From cb6843fdfdb6d9172f102762ad179413bffe0173 Mon Sep 17 00:00:00 2001 From: Vivien Nicolas Date: Mon, 25 Apr 2022 17:24:06 +0200 Subject: [PATCH 01/25] [Darwin] Crash when resolving node's IPs if it's discovered on more than one interface (#17333) --- src/platform/Darwin/BUILD.gn | 1 + src/platform/Darwin/DnssdContexts.cpp | 425 +++++++++++++++++++++ src/platform/Darwin/DnssdImpl.cpp | 513 ++++++++------------------ src/platform/Darwin/DnssdImpl.h | 149 ++++---- 4 files changed, 647 insertions(+), 441 deletions(-) create mode 100644 src/platform/Darwin/DnssdContexts.cpp diff --git a/src/platform/Darwin/BUILD.gn b/src/platform/Darwin/BUILD.gn index 5aa6668ce00460..f47ebbba4e64a1 100644 --- a/src/platform/Darwin/BUILD.gn +++ b/src/platform/Darwin/BUILD.gn @@ -51,6 +51,7 @@ static_library("Darwin") { "DeviceInfoProviderImpl.h", "DiagnosticDataProviderImpl.cpp", "DiagnosticDataProviderImpl.h", + "DnssdContexts.cpp", "DnssdImpl.cpp", "DnssdImpl.h", "InetPlatformConfig.h", diff --git a/src/platform/Darwin/DnssdContexts.cpp b/src/platform/Darwin/DnssdContexts.cpp new file mode 100644 index 00000000000000..bd68b126e004e7 --- /dev/null +++ b/src/platform/Darwin/DnssdContexts.cpp @@ -0,0 +1,425 @@ +/* + * + * Copyright (c) 2021-2022 Project CHIP Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include "DnssdImpl.h" +#include "MdnsError.h" + +#include +#include + +using namespace chip::Dnssd; + +namespace { + +constexpr uint8_t kDnssdKeyMaxSize = 32; +constexpr uint8_t kDnssdTxtRecordMaxEntries = 20; + +std::string GetHostNameWithoutDomain(const char * hostnameWithDomain) +{ + std::string hostname(hostnameWithDomain); + size_t position = hostname.find("."); + if (position != std::string::npos) + { + hostname.erase(position); + } + + return hostname; +} + +void GetTextEntries(DnssdService & service, const unsigned char * data, uint16_t len) +{ + uint16_t recordCount = TXTRecordGetCount(len, data); + service.mTextEntrySize = recordCount; + service.mTextEntries = static_cast(chip::Platform::MemoryCalloc(kDnssdTxtRecordMaxEntries, sizeof(TextEntry))); + + for (uint16_t i = 0; i < recordCount; i++) + { + char key[kDnssdKeyMaxSize]; + uint8_t valueLen; + const void * valuePtr; + + auto err = TXTRecordGetItemAtIndex(len, data, i, kDnssdKeyMaxSize, key, &valueLen, &valuePtr); + if (kDNSServiceErr_NoError != err) + { + // If there is an error with a txt record stop the parsing here. + service.mTextEntrySize = i; + break; + } + + if (valueLen >= chip::Dnssd::kDnssdTextMaxSize) + { + // Truncation, but nothing better we can do + valueLen = chip::Dnssd::kDnssdTextMaxSize - 1; + } + + char value[chip::Dnssd::kDnssdTextMaxSize]; + memcpy(value, valuePtr, valueLen); + value[valueLen] = 0; + + auto & textEntry = service.mTextEntries[i]; + textEntry.mKey = strdup(key); + textEntry.mData = reinterpret_cast(strdup(value)); + textEntry.mDataSize = valueLen; + } +} + +DNSServiceProtocol GetProtocol(const chip::Inet::IPAddressType & addressType) +{ +#if INET_CONFIG_ENABLE_IPV4 + if (addressType == chip::Inet::IPAddressType::kIPv4) + { + return kDNSServiceProtocol_IPv4; + } + + if (addressType == chip::Inet::IPAddressType::kIPv6) + { + return kDNSServiceProtocol_IPv6; + } + + return kDNSServiceProtocol_IPv4 | kDNSServiceProtocol_IPv6; +#else + // without IPv4, IPv6 is the only option + return kDNSServiceProtocol_IPv6; +#endif +} + +} // namespace + +namespace chip { +namespace Dnssd { + +CHIP_ERROR GenericContext::Finalize(DNSServiceErrorType err) +{ + if (MdnsContexts::GetInstance().Has(this) == CHIP_NO_ERROR) + { + if (kDNSServiceErr_NoError == err) + { + DispatchSuccess(); + } + else + { + DispatchFailure(err); + } + } + else + { + chip::Platform::Delete(this); + } + + return (kDNSServiceErr_NoError == err) ? CHIP_NO_ERROR : CHIP_ERROR_INTERNAL; +} + +MdnsContexts::~MdnsContexts() +{ + std::vector::const_iterator iter = mContexts.cbegin(); + while (iter != mContexts.cend()) + { + Delete(*iter); + mContexts.erase(iter); + } +} + +CHIP_ERROR MdnsContexts::Add(GenericContext * context, DNSServiceRef sdRef) +{ + VerifyOrReturnError(context != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + + if (sdRef == nullptr) + { + chip::Platform::Delete(context); + return CHIP_ERROR_INVALID_ARGUMENT; + } + + auto err = DNSServiceSetDispatchQueue(sdRef, chip::DeviceLayer::PlatformMgrImpl().GetWorkQueue()); + if (kDNSServiceErr_NoError != err) + { + chip::Platform::Delete(context); + return CHIP_ERROR_INTERNAL; + } + + context->serviceRef = sdRef; + mContexts.push_back(context); + + return CHIP_NO_ERROR; +} + +CHIP_ERROR MdnsContexts::Remove(GenericContext * context) +{ + bool found = false; + + std::vector::const_iterator iter = mContexts.cbegin(); + while (iter != mContexts.cend()) + { + if (*iter != context) + { + iter++; + continue; + } + + Delete(*iter); + mContexts.erase(iter); + found = true; + break; + } + + return found ? CHIP_NO_ERROR : CHIP_ERROR_KEY_NOT_FOUND; +} + +CHIP_ERROR MdnsContexts::RemoveAllOfType(ContextType type) +{ + bool found = false; + + std::vector::const_iterator iter = mContexts.cbegin(); + while (iter != mContexts.cend()) + { + if ((*iter)->type != type) + { + iter++; + continue; + } + + Delete(*iter); + mContexts.erase(iter); + found = true; + } + + return found ? CHIP_NO_ERROR : CHIP_ERROR_KEY_NOT_FOUND; +} + +void MdnsContexts::Delete(GenericContext * context) +{ + if (context->serviceRef != nullptr) + { + DNSServiceRefDeallocate(context->serviceRef); + } + chip::Platform::Delete(context); +} + +CHIP_ERROR MdnsContexts::Has(GenericContext * context) +{ + std::vector::iterator iter; + + for (iter = mContexts.begin(); iter != mContexts.end(); iter++) + { + if ((*iter) == context) + { + return CHIP_NO_ERROR; + } + } + + return CHIP_ERROR_KEY_NOT_FOUND; +} + +CHIP_ERROR MdnsContexts::GetRegisterContextOfType(const char * type, RegisterContext ** context) +{ + bool found = false; + std::vector::iterator iter; + + for (iter = mContexts.begin(); iter != mContexts.end(); iter++) + { + if ((*iter)->type == ContextType::Register && (static_cast(*iter))->matches(type)) + { + *context = static_cast(*iter); + found = true; + break; + } + } + + return found ? CHIP_NO_ERROR : CHIP_ERROR_KEY_NOT_FOUND; +} + +RegisterContext::RegisterContext(const char * sType, DnssdPublishCallback cb, void * cbContext) +{ + type = ContextType::Register; + context = cbContext; + callback = cb; + + Platform::CopyString(mType, sType); +} + +void RegisterContext::DispatchFailure(DNSServiceErrorType err) +{ + ChipLogError(DeviceLayer, "Register (%s)", Error::ToString(err)); + callback(context, nullptr, CHIP_ERROR_INTERNAL); + MdnsContexts::GetInstance().Remove(this); +} + +void RegisterContext::DispatchSuccess() +{ + callback(context, mType, CHIP_NO_ERROR); +} + +BrowseContext::BrowseContext(void * cbContext, DnssdBrowseCallback cb, DnssdServiceProtocol cbContextProtocol) +{ + type = ContextType::Browse; + context = cbContext; + callback = cb; + protocol = cbContextProtocol; +} + +void BrowseContext::DispatchFailure(DNSServiceErrorType err) +{ + ChipLogError(DeviceLayer, "Browse (%s)", Error::ToString(err)); + callback(context, nullptr, 0, CHIP_ERROR_INTERNAL); + MdnsContexts::GetInstance().Remove(this); +} + +void BrowseContext::DispatchSuccess() +{ + callback(context, services.data(), services.size(), CHIP_NO_ERROR); + MdnsContexts::GetInstance().Remove(this); +} + +ResolveContext::ResolveContext(void * cbContext, DnssdResolveCallback cb, chip::Inet::IPAddressType cbAddressType) +{ + type = ContextType::Resolve; + context = cbContext; + callback = cb; + protocol = GetProtocol(cbAddressType); +} + +ResolveContext::~ResolveContext() +{ + RemoveInterfaces(); +} + +void ResolveContext::DispatchFailure(DNSServiceErrorType err) +{ + ChipLogError(DeviceLayer, "Resolve (%s)", Error::ToString(err)); + callback(context, nullptr, Span(), CHIP_ERROR_INTERNAL); + MdnsContexts::GetInstance().Remove(this); +} + +void ResolveContext::DispatchSuccess() +{ + for (auto & interface : interfaces) + { + auto & ips = interface.second.addresses; + + // Some interface may not have any ips, just ignore them. + if (ips.size() == 0) + { + continue; + } + + // Use the first IP we got for the DnssdService. + interface.second.service.mAddress.SetValue(ips.front()); + ips.erase(ips.begin()); + callback(context, &interface.second.service, Span(ips.data(), ips.size()), CHIP_NO_ERROR); + break; + } + + MdnsContexts::GetInstance().Remove(this); +} + +CHIP_ERROR ResolveContext::OnNewAddress(uint32_t interfaceId, const struct sockaddr * address) +{ + chip::Inet::IPAddress ip; + ReturnErrorOnFailure(chip::Inet::IPAddress::GetIPAddressFromSockAddr(*address, ip)); + interfaces[interfaceId].addresses.push_back(ip); + +#ifdef CHIP_DETAIL_LOGGING + char addrStr[INET6_ADDRSTRLEN]; + ip.ToString(addrStr, sizeof(addrStr)); + ChipLogDetail(DeviceLayer, "Mdns: %s interface: %" PRIu32 " ip:%s", __func__, interfaceId, addrStr); +#endif // CHIP_DETAIL_LOGGING + + return CHIP_NO_ERROR; +} + +CHIP_ERROR ResolveContext::OnNewLocalOnlyAddress() +{ + sockaddr_in6 sockaddr; + memset(&sockaddr, 0, sizeof(sockaddr)); + sockaddr.sin6_len = sizeof(sockaddr); + sockaddr.sin6_family = AF_INET6; + sockaddr.sin6_addr = in6addr_loopback; + sockaddr.sin6_port = htons((unsigned short) interfaces[kDNSServiceInterfaceIndexLocalOnly].service.mPort); + + return OnNewAddress(kDNSServiceInterfaceIndexLocalOnly, reinterpret_cast(&sockaddr)); +} + +bool ResolveContext::HasAddress() +{ + for (auto & interface : interfaces) + { + if (interface.second.addresses.size()) + { + return true; + } + } + + return false; +} + +void ResolveContext::OnNewInterface(uint32_t interfaceId, const char * fullname, const char * hostnameWithDomain, uint16_t port, + uint16_t txtLen, const unsigned char * txtRecord) +{ + ChipLogDetail(DeviceLayer, "Mdns : %s hostname:%s fullname:%s interface: %" PRIu32, __func__, hostnameWithDomain, fullname, + interfaceId); + + InterfaceInfo interface; + interface.service.mPort = ntohs(port); + + if (kDNSServiceInterfaceIndexLocalOnly == interfaceId) + { + // Set interface to ANY (0) - network stack can decide how to route this. + interface.service.mInterface = Inet::InterfaceId(0); + } + else + { + interface.service.mInterface = Inet::InterfaceId(interfaceId); + } + + // The hostname parameter contains the hostname followed by the domain. But the mHostName field is sized + // to contain either a 12 bytes mac address or an extended address of at most 16 bytes, not the domain name. + auto hostname = GetHostNameWithoutDomain(hostnameWithDomain); + Platform::CopyString(interface.service.mHostName, hostname.c_str()); + Platform::CopyString(interface.service.mName, fullname); + + GetTextEntries(interface.service, txtRecord, txtLen); + + // If for some reason the hostname can not fit into the hostname field (e.g it is not a mac address) then + // DNSServiceGetAddrInfo will never return anything. So instead, copy the name as the FQDN and use it for + // resolving. + interface.fullyQualifiedDomainName = hostnameWithDomain; + + interfaces.insert(std::pair(interfaceId, interface)); +} + +bool ResolveContext::HasInterface() +{ + return interfaces.size(); +} + +void ResolveContext::RemoveInterfaces() +{ + for (auto & interface : interfaces) + { + size_t count = interface.second.service.mTextEntrySize; + for (size_t i = 0; i < count; i++) + { + const auto & textEntry = interface.second.service.mTextEntries[i]; + free(const_cast(textEntry.mKey)); + free(const_cast(textEntry.mData)); + } + Platform::MemoryFree(const_cast(interface.second.service.mTextEntries)); + } + + interfaces.clear(); +} + +} // namespace Dnssd +} // namespace chip diff --git a/src/platform/Darwin/DnssdImpl.cpp b/src/platform/Darwin/DnssdImpl.cpp index 2669fbe2693162..1358d1d124e994 100644 --- a/src/platform/Darwin/DnssdImpl.cpp +++ b/src/platform/Darwin/DnssdImpl.cpp @@ -15,7 +15,6 @@ * limitations under the License. */ #include "DnssdImpl.h" - #include "MdnsError.h" #include @@ -36,7 +35,11 @@ namespace { constexpr const char * kLocalDot = "local."; constexpr const char * kProtocolTcp = "._tcp"; constexpr const char * kProtocolUdp = "._udp"; -constexpr uint8_t kDnssdKeyMaxSize = 32; + +constexpr DNSServiceFlags kRegisterFlags = kDNSServiceFlagsNoAutoRename; +constexpr DNSServiceFlags kBrowseFlags = 0; +constexpr DNSServiceFlags kGetAddrInfoFlags = kDNSServiceFlagsTimeout | kDNSServiceFlagsShareConnection; +constexpr DNSServiceFlags kResolveFlags = kDNSServiceFlagsShareConnection; bool IsSupportedProtocol(DnssdServiceProtocol protocol) { @@ -56,6 +59,11 @@ std::string GetFullType(const char * type, DnssdServiceProtocol protocol) return typeBuilder.str(); } +std::string GetFullType(const DnssdService * service) +{ + return GetFullType(service->mType, service->mProtocol); +} + std::string GetFullTypeWithSubTypes(const char * type, DnssdServiceProtocol protocol, const char * subTypes[], size_t subTypeSize) { std::ostringstream typeBuilder; @@ -69,259 +77,134 @@ std::string GetFullTypeWithSubTypes(const char * type, DnssdServiceProtocol prot return typeBuilder.str(); } -} // namespace - -namespace chip { -namespace Dnssd { - -MdnsContexts MdnsContexts::sInstance; - -void MdnsContexts::Delete(GenericContext * context) +std::string GetFullTypeWithSubTypes(const char * type, DnssdServiceProtocol protocol) { - if (context->type == ContextType::GetAddrInfo) - { - GetAddrInfoContext * addrInfoContext = reinterpret_cast(context); - std::vector::iterator textEntry; - for (textEntry = addrInfoContext->textEntries.begin(); textEntry != addrInfoContext->textEntries.end(); textEntry++) - { - free(const_cast(textEntry->mKey)); - free(const_cast(textEntry->mData)); - } - } + auto fullType = GetFullType(type, protocol); - if (context->serviceRef != nullptr) + std::string subtypeDelimiter = "._sub."; + size_t position = fullType.find(subtypeDelimiter); + if (position != std::string::npos) { - DNSServiceRefDeallocate(context->serviceRef); + fullType = fullType.substr(position + subtypeDelimiter.size()) + "," + fullType.substr(0, position); } - chip::Platform::Delete(context); -} -MdnsContexts::~MdnsContexts() -{ - std::vector::const_iterator iter = mContexts.cbegin(); - while (iter != mContexts.cend()) - { - Delete(*iter); - mContexts.erase(iter); - } + return fullType; } -CHIP_ERROR MdnsContexts::Add(GenericContext * context, DNSServiceRef sdRef) +std::string GetFullTypeWithSubTypes(const DnssdService * service) { - VerifyOrReturnError(context != nullptr, CHIP_ERROR_INVALID_ARGUMENT); - VerifyOrReturnError(sdRef != nullptr, CHIP_ERROR_INVALID_ARGUMENT); - - context->serviceRef = sdRef; - mContexts.push_back(context); - - return CHIP_NO_ERROR; + return GetFullTypeWithSubTypes(service->mType, service->mProtocol, service->mSubTypes, service->mSubTypeSize); } -CHIP_ERROR MdnsContexts::Remove(GenericContext * context) +void LogOnFailure(const char * name, DNSServiceErrorType err) { - bool found = false; - - std::vector::const_iterator iter = mContexts.cbegin(); - while (iter != mContexts.cend()) + if (kDNSServiceErr_NoError != err) { - if (*iter != context) - { - iter++; - continue; - } - - Delete(*iter); - mContexts.erase(iter); - found = true; - break; + ChipLogError(DeviceLayer, "%s (%s)", name, Error::ToString(err)); } - - return found ? CHIP_NO_ERROR : CHIP_ERROR_KEY_NOT_FOUND; } -CHIP_ERROR MdnsContexts::Removes(ContextType type) +class ScopedTXTRecord { - bool found = false; +public: + ScopedTXTRecord() {} - std::vector::const_iterator iter = mContexts.cbegin(); - while (iter != mContexts.cend()) + ~ScopedTXTRecord() { - if ((*iter)->type != type) + if (mDataSize != 0) { - iter++; - continue; + TXTRecordDeallocate(&mRecordRef); } - - Delete(*iter); - mContexts.erase(iter); - found = true; } - return found ? CHIP_NO_ERROR : CHIP_ERROR_KEY_NOT_FOUND; -} + CHIP_ERROR Init(TextEntry * textEntries, size_t textEntrySize) + { + VerifyOrReturnError(textEntrySize <= kDnssdTextMaxSize, CHIP_ERROR_INVALID_ARGUMENT); -CHIP_ERROR MdnsContexts::Get(ContextType type, GenericContext ** context) -{ - bool found = false; - std::vector::iterator iter; + TXTRecordCreate(&mRecordRef, sizeof(mRecordBuffer), mRecordBuffer); - for (iter = mContexts.begin(); iter != mContexts.end(); iter++) - { - if ((*iter)->type == type) + for (size_t i = 0; i < textEntrySize; i++) { - *context = *iter; - found = true; - break; - } - } - - return found ? CHIP_NO_ERROR : CHIP_ERROR_KEY_NOT_FOUND; -} + TextEntry entry = textEntries[i]; + VerifyOrReturnError(chip::CanCastTo(entry.mDataSize), CHIP_ERROR_INVALID_ARGUMENT); -CHIP_ERROR MdnsContexts::GetRegisterType(const char * type, GenericContext ** context) -{ - bool found = false; - std::vector::iterator iter; + auto err = TXTRecordSetValue(&mRecordRef, entry.mKey, static_cast(entry.mDataSize), entry.mData); + VerifyOrReturnError(err == kDNSServiceErr_NoError, CHIP_ERROR_INVALID_ARGUMENT); + } - for (iter = mContexts.begin(); iter != mContexts.end(); iter++) - { - if ((*iter)->type == ContextType::Register && ((RegisterContext *) (*iter))->matches(type)) + mDataSize = TXTRecordGetLength(&mRecordRef); + if (mDataSize == 0) { - *context = *iter; - found = true; - break; + TXTRecordDeallocate(&mRecordRef); } - } - - return found ? CHIP_NO_ERROR : CHIP_ERROR_KEY_NOT_FOUND; -} - -void MdnsContexts::PrepareSelect(fd_set & readFdSet, fd_set & writeFdSet, fd_set & errorFdSet, int & maxFd, timeval & timeout) {} - -void MdnsContexts::HandleSelectResult(fd_set & readFdSet, fd_set & writeFdSet, fd_set & errorFdSet) {} -CHIP_ERROR PopulateTextRecord(TXTRecordRef * record, char * buffer, uint16_t bufferLen, TextEntry * textEntries, - size_t textEntrySize) -{ - VerifyOrReturnError(textEntrySize <= kDnssdTextMaxSize, CHIP_ERROR_INVALID_ARGUMENT); - - DNSServiceErrorType err; - TXTRecordCreate(record, bufferLen, buffer); - - for (size_t i = 0; i < textEntrySize; i++) - { - TextEntry entry = textEntries[i]; - VerifyOrReturnError(chip::CanCastTo(entry.mDataSize), CHIP_ERROR_INVALID_ARGUMENT); - - err = TXTRecordSetValue(record, entry.mKey, static_cast(entry.mDataSize), entry.mData); - VerifyOrReturnError(err == kDNSServiceErr_NoError, CHIP_ERROR_INVALID_ARGUMENT); + mData = TXTRecordGetBytesPtr(&mRecordRef); + return CHIP_NO_ERROR; } - return CHIP_NO_ERROR; -} + uint16_t size() { return mDataSize; } + const void * data() { return mData; } -bool CheckForSuccess(GenericContext * context, const char * name, DNSServiceErrorType err, bool useCallback = false) -{ - if (context == nullptr) - { - ChipLogError(DeviceLayer, "%s (%s)", name, "Mdns context is null."); - return false; - } +private: + uint16_t mDataSize = 0; + const void * mData = nullptr; - if (kDNSServiceErr_NoError != err) - { - ChipLogError(DeviceLayer, "%s (%s)", name, Error::ToString(err)); + TXTRecordRef mRecordRef; + char mRecordBuffer[kDnssdTextMaxSize]; +}; - if (useCallback) - { - switch (context->type) - { - case ContextType::Register: { - RegisterContext * registerContext = reinterpret_cast(context); - registerContext->callback(registerContext->context, nullptr, CHIP_ERROR_INTERNAL); - break; - } - case ContextType::Browse: { - BrowseContext * browseContext = reinterpret_cast(context); - browseContext->callback(browseContext->context, nullptr, 0, CHIP_ERROR_INTERNAL); - break; - } - case ContextType::Resolve: { - ResolveContext * resolveContext = reinterpret_cast(context); - resolveContext->callback(resolveContext->context, nullptr, Span(), CHIP_ERROR_INTERNAL); - break; - } - case ContextType::GetAddrInfo: { - GetAddrInfoContext * resolveContext = reinterpret_cast(context); - resolveContext->callback(resolveContext->context, nullptr, Span(), CHIP_ERROR_INTERNAL); - break; - } - } - } +} // namespace - if (CHIP_ERROR_KEY_NOT_FOUND == MdnsContexts::GetInstance().Remove(context)) - { - chip::Platform::Delete(context); - } +namespace chip { +namespace Dnssd { - return false; - } +MdnsContexts MdnsContexts::sInstance; - return true; -} +namespace { static void OnRegister(DNSServiceRef sdRef, DNSServiceFlags flags, DNSServiceErrorType err, const char * name, const char * type, const char * domain, void * context) { - RegisterContext * sdCtx = reinterpret_cast(context); - VerifyOrReturn(CheckForSuccess(sdCtx, __func__, err)); - ChipLogDetail(DeviceLayer, "Mdns: %s name: %s, type: %s, domain: %s, flags: %d", __func__, name, type, domain, flags); - sdCtx->callback(sdCtx->context, type, CHIP_NO_ERROR); + auto sdCtx = reinterpret_cast(context); + sdCtx->Finalize(err); }; CHIP_ERROR Register(void * context, DnssdPublishCallback callback, uint32_t interfaceId, const char * type, const char * name, - uint16_t port, TXTRecordRef * recordRef) + uint16_t port, ScopedTXTRecord & record) { - DNSServiceErrorType err; - DNSServiceRef sdRef; - GenericContext * sdCtx = nullptr; + ChipLogProgress(DeviceLayer, "Publishing service %s on port %u with type: %s on interface id: %" PRIu32, name, port, type, + interfaceId); - uint16_t recordLen = TXTRecordGetLength(recordRef); - const void * recordBytesPtr = TXTRecordGetBytesPtr(recordRef); - - if (CHIP_NO_ERROR == MdnsContexts::GetInstance().GetRegisterType(type, &sdCtx)) + RegisterContext * sdCtx = nullptr; + if (CHIP_NO_ERROR == MdnsContexts::GetInstance().GetRegisterContextOfType(type, &sdCtx)) { - err = DNSServiceUpdateRecord(sdCtx->serviceRef, nullptr, 0 /* flags */, recordLen, recordBytesPtr, 0 /* ttl */); - TXTRecordDeallocate(recordRef); - VerifyOrReturnError(CheckForSuccess(sdCtx, __func__, err), CHIP_ERROR_INTERNAL); + auto err = DNSServiceUpdateRecord(sdCtx->serviceRef, nullptr, kRegisterFlags, record.size(), record.data(), 0 /* ttl */); + VerifyOrReturnError(kDNSServiceErr_NoError == err, sdCtx->Finalize(err)); return CHIP_NO_ERROR; } sdCtx = chip::Platform::New(type, callback, context); - err = DNSServiceRegister(&sdRef, 0 /* flags */, interfaceId, name, type, kLocalDot, nullptr, ntohs(port), recordLen, - recordBytesPtr, OnRegister, sdCtx); - TXTRecordDeallocate(recordRef); - - VerifyOrReturnError(CheckForSuccess(sdCtx, __func__, err), CHIP_ERROR_INTERNAL); + VerifyOrReturnError(nullptr != sdCtx, CHIP_ERROR_NO_MEMORY); - err = DNSServiceSetDispatchQueue(sdRef, chip::DeviceLayer::PlatformMgrImpl().GetWorkQueue()); - VerifyOrReturnError(CheckForSuccess(sdCtx, __func__, err, true), CHIP_ERROR_INTERNAL); + DNSServiceRef sdRef; + auto err = DNSServiceRegister(&sdRef, kRegisterFlags, interfaceId, name, type, kLocalDot, nullptr, ntohs(port), record.size(), + record.data(), OnRegister, sdCtx); + VerifyOrReturnError(kDNSServiceErr_NoError == err, sdCtx->Finalize(err)); return MdnsContexts::GetInstance().Add(sdCtx, sdRef); } -void OnBrowseAdd(BrowseContext * context, const char * name, const char * type, const char * domain, - chip::Inet::InterfaceId interfaceId) +void OnBrowseAdd(BrowseContext * context, const char * name, const char * type, const char * domain, uint32_t interfaceId) { - ChipLogDetail(DeviceLayer, "Mdns: %s name: %s, type: %s, domain: %s, interface: %d", __func__, name, type, domain, - interfaceId.GetPlatformInterface()); + ChipLogDetail(DeviceLayer, "Mdns: %s name: %s, type: %s, domain: %s, interface: %" PRIu32, __func__, name, type, domain, + interfaceId); VerifyOrReturn(strcmp(kLocalDot, domain) == 0); DnssdService service = {}; - service.mInterface = interfaceId; + service.mInterface = Inet::InterfaceId(interfaceId); service.mProtocol = context->protocol; Platform::CopyString(service.mName, name); @@ -340,19 +223,17 @@ void OnBrowseAdd(BrowseContext * context, const char * name, const char * type, context->services.push_back(service); } -void OnBrowseRemove(BrowseContext * context, const char * name, const char * type, const char * domain, - chip::Inet::InterfaceId interfaceId) +void OnBrowseRemove(BrowseContext * context, const char * name, const char * type, const char * domain, uint32_t interfaceId) { - ChipLogDetail(DeviceLayer, "Mdns: %s name: %s, type: %s, domain: %s, interface: %d", __func__, name, type, domain, - interfaceId.GetPlatformInterface()); + ChipLogDetail(DeviceLayer, "Mdns: %s name: %s, type: %s, domain: %s, interface: %" PRIu32, __func__, name, type, domain, + interfaceId); VerifyOrReturn(strcmp(kLocalDot, domain) == 0); context->services.erase(std::remove_if(context->services.begin(), context->services.end(), [name, type, interfaceId](const DnssdService & service) { - return strcmp(name, service.mName) == 0 && - type == GetFullType(service.mType, service.mProtocol) && - service.mInterface == interfaceId; + return strcmp(name, service.mName) == 0 && type == GetFullType(&service) && + service.mInterface == Inet::InterfaceId(interfaceId); }), context->services.end()); } @@ -360,40 +241,28 @@ void OnBrowseRemove(BrowseContext * context, const char * name, const char * typ static void OnBrowse(DNSServiceRef sdRef, DNSServiceFlags flags, uint32_t interfaceId, DNSServiceErrorType err, const char * name, const char * type, const char * domain, void * context) { - BrowseContext * sdCtx = reinterpret_cast(context); - VerifyOrReturn(CheckForSuccess(sdCtx, __func__, err, true)); + auto sdCtx = reinterpret_cast(context); + VerifyOrReturn(kDNSServiceErr_NoError == err, sdCtx->Finalize(err)); - (flags & kDNSServiceFlagsAdd) ? OnBrowseAdd(sdCtx, name, type, domain, Inet::InterfaceId(interfaceId)) - : OnBrowseRemove(sdCtx, name, type, domain, Inet::InterfaceId(interfaceId)); + (flags & kDNSServiceFlagsAdd) ? OnBrowseAdd(sdCtx, name, type, domain, interfaceId) + : OnBrowseRemove(sdCtx, name, type, domain, interfaceId); if (!(flags & kDNSServiceFlagsMoreComing)) { - sdCtx->callback(sdCtx->context, sdCtx->services.data(), sdCtx->services.size(), CHIP_NO_ERROR); - MdnsContexts::GetInstance().Remove(sdCtx); + sdCtx->Finalize(); } } CHIP_ERROR Browse(void * context, DnssdBrowseCallback callback, uint32_t interfaceId, const char * type, DnssdServiceProtocol protocol) { - DNSServiceErrorType err; - DNSServiceRef sdRef; - BrowseContext * sdCtx; - - std::string regtype(type); - std::string subtypeDelimiter = "._sub."; - size_t position = regtype.find(subtypeDelimiter); - if (position != std::string::npos) - { - regtype = regtype.substr(position + subtypeDelimiter.size()) + "," + regtype.substr(0, position); - } + auto sdCtx = chip::Platform::New(context, callback, protocol); + VerifyOrReturnError(nullptr != sdCtx, CHIP_ERROR_NO_MEMORY); - sdCtx = chip::Platform::New(context, callback, protocol); - err = DNSServiceBrowse(&sdRef, 0 /* flags */, interfaceId, regtype.c_str(), kLocalDot, OnBrowse, sdCtx); - VerifyOrReturnError(CheckForSuccess(sdCtx, __func__, err), CHIP_ERROR_INTERNAL); - - err = DNSServiceSetDispatchQueue(sdRef, chip::DeviceLayer::PlatformMgrImpl().GetWorkQueue()); - VerifyOrReturnError(CheckForSuccess(sdCtx, __func__, err, true), CHIP_ERROR_INTERNAL); + ChipLogProgress(DeviceLayer, "Browsing for: %s", type); + DNSServiceRef sdRef; + auto err = DNSServiceBrowse(&sdRef, kBrowseFlags, interfaceId, type, kLocalDot, OnBrowse, sdCtx); + VerifyOrReturnError(kDNSServiceErr_NoError == err, sdCtx->Finalize(err)); return MdnsContexts::GetInstance().Add(sdCtx, sdRef); } @@ -401,160 +270,82 @@ CHIP_ERROR Browse(void * context, DnssdBrowseCallback callback, uint32_t interfa static void OnGetAddrInfo(DNSServiceRef sdRef, DNSServiceFlags flags, uint32_t interfaceId, DNSServiceErrorType err, const char * hostname, const struct sockaddr * address, uint32_t ttl, void * context) { - GetAddrInfoContext * sdCtx = reinterpret_cast(context); - VerifyOrReturn(CheckForSuccess(sdCtx, __func__, err, true)); - - ChipLogDetail(DeviceLayer, "Mdns: %s hostname:%s", __func__, hostname); - - chip::Inet::IPAddress ip; - CHIP_ERROR status = chip::Inet::IPAddress::GetIPAddressFromSockAddr(*address, ip); - if (status == CHIP_NO_ERROR) - { - sdCtx->addresses.push_back(ip); - } + auto sdCtx = reinterpret_cast(context); + ReturnOnFailure(MdnsContexts::GetInstance().Has(sdCtx)); + LogOnFailure(__func__, err); - if (flags & kDNSServiceFlagsMoreComing) + if (kDNSServiceErr_NoError == err) { - // Wait for that. - return; + sdCtx->OnNewAddress(interfaceId, address); } - DnssdService service = {}; - service.mPort = sdCtx->port; - service.mTextEntries = sdCtx->textEntries.empty() ? nullptr : sdCtx->textEntries.data(); - service.mTextEntrySize = sdCtx->textEntries.empty() ? 0 : sdCtx->textEntries.size(); - // Use the first IP we got for the DnssdService. - if (sdCtx->addresses.size() != 0) + if (!(flags & kDNSServiceFlagsMoreComing)) { - service.mAddress.SetValue(sdCtx->addresses.front()); - sdCtx->addresses.erase(sdCtx->addresses.begin()); + VerifyOrReturn(sdCtx->HasAddress(), sdCtx->Finalize(kDNSServiceErr_BadState)); + sdCtx->Finalize(); } - Platform::CopyString(service.mName, sdCtx->name); - Platform::CopyString(service.mHostName, hostname); - service.mInterface = Inet::InterfaceId(sdCtx->interfaceId); - - // TODO: Does it really make sense to pass in the status from our last "get the IP address" operation? - sdCtx->callback(sdCtx->context, &service, Span(sdCtx->addresses.data(), sdCtx->addresses.size()), status); - MdnsContexts::GetInstance().Remove(sdCtx); } -static CHIP_ERROR GetAddrInfo(void * context, DnssdResolveCallback callback, uint32_t interfaceId, - chip::Inet::IPAddressType addressType, const char * name, const char * hostname, uint16_t port, - uint16_t txtLen, const unsigned char * txtRecord) +static void GetAddrInfo(ResolveContext * sdCtx) { - DNSServiceErrorType err; - DNSServiceRef sdRef; - GetAddrInfoContext * sdCtx; - - sdCtx = chip::Platform::New(context, callback, name, interfaceId, port); + auto protocol = sdCtx->protocol; - char key[kDnssdKeyMaxSize]; - char value[kDnssdTextMaxSize]; - uint8_t valueLen; - const void * valuePtr; - - uint16_t recordCount = TXTRecordGetCount(txtLen, txtRecord); - for (uint16_t i = 0; i < recordCount; i++) + for (auto & interface : sdCtx->interfaces) { - err = TXTRecordGetItemAtIndex(txtLen, txtRecord, i, kDnssdKeyMaxSize, key, &valueLen, &valuePtr); - VerifyOrReturnError(CheckForSuccess(sdCtx, __func__, err, true), CHIP_ERROR_INTERNAL); - - if (valueLen >= sizeof(value)) - { - // Truncation, but nothing better we can do - valueLen = sizeof(value) - 1; - } - memcpy(value, valuePtr, valueLen); - value[valueLen] = 0; - - sdCtx->textEntries.push_back(TextEntry{ strdup(key), reinterpret_cast(strdup(value)), valueLen }); - } - - DNSServiceProtocol protocol; - -#if INET_CONFIG_ENABLE_IPV4 - if (addressType == chip::Inet::IPAddressType::kIPv4) - { - protocol = kDNSServiceProtocol_IPv4; - } - else if (addressType == chip::Inet::IPAddressType::kIPv6) - { - protocol = kDNSServiceProtocol_IPv6; - } - else - { - protocol = kDNSServiceProtocol_IPv4 | kDNSServiceProtocol_IPv6; + auto interfaceId = interface.first; + auto hostname = interface.second.fullyQualifiedDomainName.c_str(); + auto sdRefCopy = sdCtx->serviceRef; // Mandatory copy because of kDNSServiceFlagsShareConnection + auto err = DNSServiceGetAddrInfo(&sdRefCopy, kGetAddrInfoFlags, interfaceId, protocol, hostname, OnGetAddrInfo, sdCtx); + VerifyOrReturn(kDNSServiceErr_NoError == err, sdCtx->Finalize(err)); } -#else - // without IPv4, IPv6 is the only option - protocol = kDNSServiceProtocol_IPv6; -#endif - - if (interfaceId != kDNSServiceInterfaceIndexLocalOnly) - { - // -1 is the local only interface. If we're not on that interface, we need to get the address for the given hostname. - err = DNSServiceGetAddrInfo(&sdRef, 0 /* flags */, interfaceId, protocol, hostname, OnGetAddrInfo, sdCtx); - VerifyOrReturnError(CheckForSuccess(sdCtx, __func__, err, true), CHIP_ERROR_INTERNAL); - - err = DNSServiceSetDispatchQueue(sdRef, chip::DeviceLayer::PlatformMgrImpl().GetWorkQueue()); - VerifyOrReturnError(CheckForSuccess(sdCtx, __func__, err, true), CHIP_ERROR_INTERNAL); - - return MdnsContexts::GetInstance().Add(sdCtx, sdRef); - } - - sockaddr_in6 sockaddr; - memset(&sockaddr, 0, sizeof(sockaddr)); - sockaddr.sin6_len = sizeof(sockaddr); - sockaddr.sin6_family = AF_INET6; - sockaddr.sin6_addr = in6addr_loopback; - sockaddr.sin6_port = htons((unsigned short) port); - uint32_t ttl = 120; // default TTL for records with hostnames is 120 seconds - uint32_t interface = 0; // Set interface to ANY (0) - network stack can decide how to route this. - OnGetAddrInfo(nullptr, 0 /* flags */, interface, kDNSServiceErr_NoError, hostname, - reinterpret_cast(&sockaddr), ttl, sdCtx); - - // Don't leak memory. - sdCtx->serviceRef = nullptr; - MdnsContexts::GetInstance().Delete(sdCtx); - return CHIP_NO_ERROR; } static void OnResolve(DNSServiceRef sdRef, DNSServiceFlags flags, uint32_t interfaceId, DNSServiceErrorType err, const char * fullname, const char * hostname, uint16_t port, uint16_t txtLen, const unsigned char * txtRecord, void * context) { - ChipLogDetail(DeviceLayer, "Resolved interface id: %u", interfaceId); - - ResolveContext * sdCtx = reinterpret_cast(context); - VerifyOrReturn(CheckForSuccess(sdCtx, __func__, err, true)); + auto sdCtx = reinterpret_cast(context); + ReturnOnFailure(MdnsContexts::GetInstance().Has(sdCtx)); + LogOnFailure(__func__, err); - GetAddrInfo(sdCtx->context, sdCtx->callback, interfaceId, sdCtx->addressType, sdCtx->name, hostname, ntohs(port), txtLen, - txtRecord); + if (kDNSServiceErr_NoError == err) + { + sdCtx->OnNewInterface(interfaceId, fullname, hostname, port, txtLen, txtRecord); + if (kDNSServiceInterfaceIndexLocalOnly == interfaceId) + { + sdCtx->OnNewLocalOnlyAddress(); + sdCtx->Finalize(); + return; + } + } - // TODO: If flags & kDNSServiceFlagsMoreComing should we keep waiting to see - // what else we resolve instead of calling Remove() here? - MdnsContexts::GetInstance().Remove(sdCtx); + if (!(flags & kDNSServiceFlagsMoreComing)) + { + VerifyOrReturn(sdCtx->HasInterface(), sdCtx->Finalize(kDNSServiceErr_BadState)); + GetAddrInfo(sdCtx); + } } static CHIP_ERROR Resolve(void * context, DnssdResolveCallback callback, uint32_t interfaceId, chip::Inet::IPAddressType addressType, const char * type, const char * name) { - DNSServiceErrorType err; - DNSServiceRef sdRef; - ResolveContext * sdCtx; + ChipLogDetail(DeviceLayer, "Resolve type=%s name=%s interface=%" PRIu32, type, name, interfaceId); - ChipLogProgress(Controller, "Resolve type=%s name=%s", type, name); + auto sdCtx = chip::Platform::New(context, callback, addressType); + VerifyOrReturnError(nullptr != sdCtx, CHIP_ERROR_NO_MEMORY); - sdCtx = chip::Platform::New(context, callback, name, addressType); - err = DNSServiceResolve(&sdRef, 0 /* flags */, interfaceId, name, type, kLocalDot, OnResolve, sdCtx); - VerifyOrReturnError(CheckForSuccess(sdCtx, __func__, err), CHIP_ERROR_INTERNAL); + auto err = DNSServiceCreateConnection(&sdCtx->serviceRef); + VerifyOrReturnError(kDNSServiceErr_NoError == err, sdCtx->Finalize(err)); - err = DNSServiceSetDispatchQueue(sdRef, chip::DeviceLayer::PlatformMgrImpl().GetWorkQueue()); - VerifyOrReturnError(CheckForSuccess(sdCtx, __func__, err, true), CHIP_ERROR_INTERNAL); + auto sdRefCopy = sdCtx->serviceRef; // Mandatory copy because of kDNSServiceFlagsShareConnection + err = DNSServiceResolve(&sdRefCopy, kResolveFlags, interfaceId, name, type, kLocalDot, OnResolve, sdCtx); + VerifyOrReturnError(kDNSServiceErr_NoError == err, sdCtx->Finalize(err)); - return MdnsContexts::GetInstance().Add(sdCtx, sdRef); + return MdnsContexts::GetInstance().Add(sdCtx, sdCtx->serviceRef); } +} // namespace + CHIP_ERROR ChipDnssdInit(DnssdAsyncReturnCallback successCallback, DnssdAsyncReturnCallback errorCallback, void * context) { VerifyOrReturnError(successCallback != nullptr, CHIP_ERROR_INVALID_ARGUMENT); @@ -575,31 +366,23 @@ CHIP_ERROR ChipDnssdPublishService(const DnssdService * service, DnssdPublishCal VerifyOrReturnError(IsSupportedProtocol(service->mProtocol), CHIP_ERROR_INVALID_ARGUMENT); VerifyOrReturnError(callback != nullptr, CHIP_ERROR_INVALID_ARGUMENT); - if (strcmp(service->mHostName, "") != 0) - { - MdnsContexts::GetInstance().SetHostname(service->mHostName); - } - std::string regtype = GetFullTypeWithSubTypes(service->mType, service->mProtocol, service->mSubTypes, service->mSubTypeSize); - uint32_t interfaceId = GetInterfaceId(service->mInterface); - - TXTRecordRef record; - char buffer[kDnssdTextMaxSize]; - ReturnErrorOnFailure(PopulateTextRecord(&record, buffer, sizeof(buffer), service->mTextEntries, service->mTextEntrySize)); + ScopedTXTRecord record; + ReturnErrorOnFailure(record.Init(service->mTextEntries, service->mTextEntrySize)); - ChipLogProgress(DeviceLayer, "Publishing service %s on port %u with type: %s on interface id: %" PRIu32, service->mName, - service->mPort, regtype.c_str(), interfaceId); - return Register(context, callback, interfaceId, regtype.c_str(), service->mName, service->mPort, &record); + auto regtype = GetFullTypeWithSubTypes(service); + auto interfaceId = GetInterfaceId(service->mInterface); + return Register(context, callback, interfaceId, regtype.c_str(), service->mName, service->mPort, record); } CHIP_ERROR ChipDnssdRemoveServices() { - GenericContext * sdCtx = nullptr; - if (CHIP_ERROR_KEY_NOT_FOUND == MdnsContexts::GetInstance().Get(ContextType::Register, &sdCtx)) + auto err = MdnsContexts::GetInstance().RemoveAllOfType(ContextType::Register); + if (CHIP_ERROR_KEY_NOT_FOUND == err) { return CHIP_NO_ERROR; } - return MdnsContexts::GetInstance().Removes(ContextType::Register); + return err; } CHIP_ERROR ChipDnssdFinalizeServiceUpdate() @@ -614,9 +397,8 @@ CHIP_ERROR ChipDnssdBrowse(const char * type, DnssdServiceProtocol protocol, chi VerifyOrReturnError(callback != nullptr, CHIP_ERROR_INVALID_ARGUMENT); VerifyOrReturnError(IsSupportedProtocol(protocol), CHIP_ERROR_INVALID_ARGUMENT); - std::string regtype = GetFullType(type, protocol); - uint32_t interfaceId = GetInterfaceId(interface); - + auto regtype = GetFullTypeWithSubTypes(type, protocol); + auto interfaceId = GetInterfaceId(interface); return Browse(context, callback, interfaceId, regtype.c_str(), protocol); } @@ -626,9 +408,8 @@ CHIP_ERROR ChipDnssdResolve(DnssdService * service, chip::Inet::InterfaceId inte VerifyOrReturnError(service != nullptr, CHIP_ERROR_INVALID_ARGUMENT); VerifyOrReturnError(IsSupportedProtocol(service->mProtocol), CHIP_ERROR_INVALID_ARGUMENT); - std::string regtype = GetFullType(service->mType, service->mProtocol); - uint32_t interfaceId = GetInterfaceId(interface); - + auto regtype = GetFullType(service); + auto interfaceId = GetInterfaceId(interface); return Resolve(context, callback, interfaceId, service->mAddressType, regtype.c_str(), service->mName); } diff --git a/src/platform/Darwin/DnssdImpl.h b/src/platform/Darwin/DnssdImpl.h index a23470c232c638..b3934cedae1fff 100644 --- a/src/platform/Darwin/DnssdImpl.h +++ b/src/platform/Darwin/DnssdImpl.h @@ -19,9 +19,8 @@ #include #include -#include -#include +#include #include #include @@ -33,7 +32,6 @@ enum class ContextType Register, Browse, Resolve, - GetAddrInfo, }; struct GenericContext @@ -41,6 +39,53 @@ struct GenericContext ContextType type; void * context; DNSServiceRef serviceRef; + + virtual ~GenericContext() {} + + CHIP_ERROR Finalize(DNSServiceErrorType err = kDNSServiceErr_NoError); + virtual void DispatchFailure(DNSServiceErrorType err) = 0; + virtual void DispatchSuccess() = 0; +}; + +struct RegisterContext; + +class MdnsContexts +{ +public: + MdnsContexts(const MdnsContexts &) = delete; + MdnsContexts & operator=(const MdnsContexts &) = delete; + ~MdnsContexts(); + static MdnsContexts & GetInstance() { return sInstance; } + + CHIP_ERROR Add(GenericContext * context, DNSServiceRef sdRef); + CHIP_ERROR Remove(GenericContext * context); + CHIP_ERROR RemoveAllOfType(ContextType type); + CHIP_ERROR Has(GenericContext * context); + + /** + * @brief + * Returns a pointer to a RegisterContext that has previously been registered + * with a given type. + * + * @param[in] type A service type. Service type are composed of + * of the service name, the service protocol, and the PTR records. + * Example: + * _matterc._udp,_V65521,_S15,_L3840,_CM + * _matter._tcp,_I4CEEAD044CC35B63 + * @param[out] context A reference to the context previously registered + * + * @return On success, the context parameter will point to the previously + * registered context. + */ + CHIP_ERROR GetRegisterContextOfType(const char * type, RegisterContext ** context); + + void Delete(GenericContext * context); + +private: + MdnsContexts(){}; + static MdnsContexts sInstance; + + std::vector mContexts; }; struct RegisterContext : public GenericContext @@ -48,14 +93,11 @@ struct RegisterContext : public GenericContext DnssdPublishCallback callback; char mType[kDnssdTypeMaxSize + 1]; - RegisterContext(const char * sType, DnssdPublishCallback cb, void * cbContext) - { - type = ContextType::Register; - context = cbContext; - callback = cb; + RegisterContext(const char * sType, DnssdPublishCallback cb, void * cbContext); + virtual ~RegisterContext() {} - Platform::CopyString(mType, sType); - } + void DispatchFailure(DNSServiceErrorType err) override; + void DispatchSuccess() override; bool matches(const char * sType) { return (strcmp(mType, sType) == 0); } }; @@ -66,83 +108,40 @@ struct BrowseContext : public GenericContext std::vector services; DnssdServiceProtocol protocol; - BrowseContext(void * cbContext, DnssdBrowseCallback cb, DnssdServiceProtocol cbContextProtocol) - { - type = ContextType::Browse; - context = cbContext; - callback = cb; - protocol = cbContextProtocol; - } -}; - -struct ResolveContext : public GenericContext -{ - DnssdResolveCallback callback; - - char name[Common::kInstanceNameMaxLength + 1]; - chip::Inet::IPAddressType addressType; - - ResolveContext(void * cbContext, DnssdResolveCallback cb, const char * cbContextName, chip::Inet::IPAddressType cbAddressType) - { - type = ContextType::Resolve; - context = cbContext; - callback = cb; - addressType = cbAddressType; + BrowseContext(void * cbContext, DnssdBrowseCallback cb, DnssdServiceProtocol cbContextProtocol); + virtual ~BrowseContext() {} - Platform::CopyString(name, cbContextName); - } + void DispatchFailure(DNSServiceErrorType err) override; + void DispatchSuccess() override; }; -struct GetAddrInfoContext : public GenericContext +struct InterfaceInfo { - DnssdResolveCallback callback; + DnssdService service; std::vector addresses; - std::vector textEntries; - char name[Common::kInstanceNameMaxLength + 1]; - uint32_t interfaceId; - uint16_t port; - - GetAddrInfoContext(void * cbContext, DnssdResolveCallback cb, const char * cbContextName, uint32_t cbInterfaceId, - uint16_t cbContextPort) - { - type = ContextType::GetAddrInfo; - context = cbContext; - callback = cb; - interfaceId = cbInterfaceId; - port = cbContextPort; - - Platform::CopyString(name, cbContextName); - } + std::string fullyQualifiedDomainName; }; -class MdnsContexts +struct ResolveContext : public GenericContext { -public: - MdnsContexts(const MdnsContexts &) = delete; - MdnsContexts & operator=(const MdnsContexts &) = delete; - ~MdnsContexts(); - static MdnsContexts & GetInstance() { return sInstance; } - - void PrepareSelect(fd_set & readFdSet, fd_set & writeFdSet, fd_set & errorFdSet, int & maxFd, timeval & timeout); - void HandleSelectResult(fd_set & readFdSet, fd_set & writeFdSet, fd_set & errorFdSet); - - CHIP_ERROR Add(GenericContext * context, DNSServiceRef sdRef); - CHIP_ERROR Remove(GenericContext * context); - CHIP_ERROR Removes(ContextType type); - CHIP_ERROR Get(ContextType type, GenericContext ** context); - CHIP_ERROR GetRegisterType(const char * type, GenericContext ** context); + DnssdResolveCallback callback; + std::map interfaces; + DNSServiceProtocol protocol; - void SetHostname(const char * name) { mHostname = name; } - const char * GetHostname() { return mHostname.c_str(); } + ResolveContext(void * cbContext, DnssdResolveCallback cb, chip::Inet::IPAddressType cbAddressType); + virtual ~ResolveContext(); - void Delete(GenericContext * context); + void DispatchFailure(DNSServiceErrorType err) override; + void DispatchSuccess() override; -private: - MdnsContexts(){}; - static MdnsContexts sInstance; - std::string mHostname; + CHIP_ERROR OnNewAddress(uint32_t interfaceId, const struct sockaddr * address); + CHIP_ERROR OnNewLocalOnlyAddress(); + bool HasAddress(); - std::vector mContexts; + void OnNewInterface(uint32_t interfaceId, const char * fullname, const char * hostname, uint16_t port, uint16_t txtLen, + const unsigned char * txtRecord); + bool HasInterface(); + void RemoveInterfaces(); }; } // namespace Dnssd From c1cbfb0e13b0325ffc80e4013fc31c8f526a9275 Mon Sep 17 00:00:00 2001 From: Rohit Jadhav <69809379+jadhavrohit924@users.noreply.github.com> Date: Mon, 25 Apr 2022 21:54:16 +0530 Subject: [PATCH 02/25] [ESP32] Notify-update-applied command and added ota initialization to common space (#16762) * [ESP32] Notify-update-applied command and fixed initialization order * Addressed review comments * Addressed review comments * Resolved merge conflicts and addressed review comment * Some minor changes --- .../esp32/main/CMakeLists.txt | 2 + .../esp32/main/DeviceCallbacks.cpp | 23 ++++++++- examples/all-clusters-app/esp32/main/main.cpp | 27 ---------- .../lighting-app/esp32/main/CMakeLists.txt | 2 + .../esp32/main/DeviceCallbacks.cpp | 24 ++++++++- examples/lighting-app/esp32/main/main.cpp | 26 ---------- .../esp32/main/CMakeLists.txt | 6 ++- .../esp32/main/DeviceCallbacks.cpp | 22 +++++++- .../ota-requestor-app/esp32/main/main.cpp | 19 ------- examples/platform/esp32/ota/OTAHelper.cpp | 50 +++++++++++++++++++ examples/platform/esp32/ota/OTAHelper.h | 27 ++++++++++ src/platform/ESP32/OTAImageProcessorImpl.cpp | 30 +++++++++++ src/platform/ESP32/OTAImageProcessorImpl.h | 4 +- 13 files changed, 183 insertions(+), 79 deletions(-) create mode 100644 examples/platform/esp32/ota/OTAHelper.cpp create mode 100644 examples/platform/esp32/ota/OTAHelper.h diff --git a/examples/all-clusters-app/esp32/main/CMakeLists.txt b/examples/all-clusters-app/esp32/main/CMakeLists.txt index 0d6e9b0007c1b9..94c5bd15476d60 100644 --- a/examples/all-clusters-app/esp32/main/CMakeLists.txt +++ b/examples/all-clusters-app/esp32/main/CMakeLists.txt @@ -21,6 +21,7 @@ set(PRIV_INCLUDE_DIRS_LIST "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/zzz_generated/all-clusters-app" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/all-clusters-app/all-clusters-common/include" "${CMAKE_CURRENT_LIST_DIR}/include" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/platform/esp32" ) set(SRC_DIRS_LIST "${CMAKE_CURRENT_LIST_DIR}" @@ -28,6 +29,7 @@ set(SRC_DIRS_LIST "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/zzz_generated/app-common/app-common/zap-generated/attributes" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/zzz_generated/app-common/app-common/zap-generated" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/platform/esp32/route_hook" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/platform/esp32/ota" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/platform/esp32/shell_extension" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/server" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/util" diff --git a/examples/all-clusters-app/esp32/main/DeviceCallbacks.cpp b/examples/all-clusters-app/esp32/main/DeviceCallbacks.cpp index 156bb28d706af0..9d73baddc68a4a 100644 --- a/examples/all-clusters-app/esp32/main/DeviceCallbacks.cpp +++ b/examples/all-clusters-app/esp32/main/DeviceCallbacks.cpp @@ -46,6 +46,7 @@ #include #include #include +#include static const char * TAG = "app-devicecallbacks"; @@ -55,7 +56,8 @@ using namespace ::chip::System; using namespace ::chip::DeviceLayer; using namespace chip::app; -constexpr uint32_t kIdentifyTimerDelayMS = 250; +constexpr uint32_t kIdentifyTimerDelayMS = 250; +constexpr uint32_t kInitOTARequestorDelaySec = 3; void OnIdentifyTriggerEffect(Identify * identify) { @@ -200,13 +202,26 @@ void DeviceCallbacks::PostAttributeChangeCallback(EndpointId endpointId, Cluster ESP_LOGI(TAG, "Current free heap: %u\n", static_cast(heap_caps_get_free_size(MALLOC_CAP_8BIT))); } +void InitOTARequestorHandler(System::Layer * systemLayer, void * appState) +{ + OTAHelpers::Instance().InitOTARequestor(); +} + void DeviceCallbacks::OnInternetConnectivityChange(const ChipDeviceEvent * event) { + static bool isOTAInitialized = false; if (event->InternetConnectivityChange.IPv4 == kConnectivity_Established) { ESP_LOGI(TAG, "Server ready at: %s:%d", event->InternetConnectivityChange.address, CHIP_PORT); wifiLED.Set(true); chip::app::DnssdServer::Instance().StartServer(); + + if (!isOTAInitialized) + { + chip::DeviceLayer::SystemLayer().StartTimer(chip::System::Clock::Seconds32(kInitOTARequestorDelaySec), + InitOTARequestorHandler, nullptr); + isOTAInitialized = true; + } } else if (event->InternetConnectivityChange.IPv4 == kConnectivity_Lost) { @@ -217,6 +232,12 @@ void DeviceCallbacks::OnInternetConnectivityChange(const ChipDeviceEvent * event { ESP_LOGI(TAG, "IPv6 Server ready..."); chip::app::DnssdServer::Instance().StartServer(); + if (!isOTAInitialized) + { + chip::DeviceLayer::SystemLayer().StartTimer(chip::System::Clock::Seconds32(kInitOTARequestorDelaySec), + InitOTARequestorHandler, nullptr); + isOTAInitialized = true; + } } else if (event->InternetConnectivityChange.IPv6 == kConnectivity_Lost) { diff --git a/examples/all-clusters-app/esp32/main/main.cpp b/examples/all-clusters-app/esp32/main/main.cpp index 55e08b595d94fa..0638b838d77e9d 100644 --- a/examples/all-clusters-app/esp32/main/main.cpp +++ b/examples/all-clusters-app/esp32/main/main.cpp @@ -37,17 +37,12 @@ #include "shell_extension/launch.h" #include -#include -#include -#include -#include #include #include #include #include #include #include -#include #if CONFIG_HAVE_DISPLAY #include "DeviceWithDisplay.h" @@ -76,14 +71,6 @@ static DeviceCallbacks EchoCallbacks; namespace { -#if CONFIG_ENABLE_OTA_REQUESTOR -DefaultOTARequestor gRequestorCore; -DefaultOTARequestorStorage gRequestorStorage; -DefaultOTARequestorDriver gRequestorUser; -BDXDownloader gDownloader; -OTAImageProcessorImpl gImageProcessor; -#endif - app::Clusters::NetworkCommissioning::Instance sWiFiNetworkCommissioningInstance(0 /* Endpoint Id */, &(NetworkCommissioning::ESPWiFiDriver::GetInstance())); @@ -126,18 +113,6 @@ static void InitServer(intptr_t context) #endif } -static void InitOTARequestor(void) -{ -#if CONFIG_ENABLE_OTA_REQUESTOR - SetRequestorInstance(&gRequestorCore); - gRequestorStorage.Init(Server::GetInstance().GetPersistentStorage()); - gRequestorCore.Init(Server::GetInstance(), gRequestorStorage, gRequestorUser, gDownloader); - gImageProcessor.SetOTADownloader(&gDownloader); - gDownloader.SetImageProcessorDelegate(&gImageProcessor); - gRequestorUser.Init(&gRequestorCore, &gImageProcessor); -#endif -} - extern "C" void app_main() { // Initialize the ESP NVS layer. @@ -174,8 +149,6 @@ extern "C" void app_main() return; } - InitOTARequestor(); - ESP_LOGI(TAG, "------------------------Starting App Task---------------------------"); error = GetAppTask().StartAppTask(); if (error != CHIP_NO_ERROR) diff --git a/examples/lighting-app/esp32/main/CMakeLists.txt b/examples/lighting-app/esp32/main/CMakeLists.txt index 3a81faaf0f0394..efbabfd9b5f678 100644 --- a/examples/lighting-app/esp32/main/CMakeLists.txt +++ b/examples/lighting-app/esp32/main/CMakeLists.txt @@ -20,12 +20,14 @@ idf_component_register(PRIV_INCLUDE_DIRS "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/zzz_generated/lighting-app" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/lighting-app/lighting-common/color_format" "${CMAKE_CURRENT_LIST_DIR}/include" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/platform/esp32" SRC_DIRS "${CMAKE_CURRENT_LIST_DIR}" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/zzz_generated/app-common/app-common/zap-generated/attributes" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/zzz_generated/app-common/app-common/zap-generated" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/zzz_generated/lighting-app/zap-generated" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/platform/esp32/route_hook" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/platform/esp32/ota" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/platform/esp32/shell_extension" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/lighting-app/lighting-common/color_format" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/server" diff --git a/examples/lighting-app/esp32/main/DeviceCallbacks.cpp b/examples/lighting-app/esp32/main/DeviceCallbacks.cpp index 2ecbe8dcf9ea8f..1353598daa6554 100644 --- a/examples/lighting-app/esp32/main/DeviceCallbacks.cpp +++ b/examples/lighting-app/esp32/main/DeviceCallbacks.cpp @@ -38,8 +38,10 @@ #include #include #include +#include -static const char * TAG = "light-app-callbacks"; +static const char * TAG = "light-app-callbacks"; +constexpr uint32_t kInitOTARequestorDelaySec = 3; extern LEDWidget AppLED; @@ -149,12 +151,25 @@ void DeviceCallbacks::PostAttributeChangeCallback(EndpointId endpointId, Cluster ESP_LOGI(TAG, "Current free heap: %u\n", static_cast(heap_caps_get_free_size(MALLOC_CAP_8BIT))); } +void InitOTARequestorHandler(System::Layer * systemLayer, void * appState) +{ + OTAHelpers::Instance().InitOTARequestor(); +} + void DeviceCallbacks::OnInternetConnectivityChange(const ChipDeviceEvent * event) { + static bool isOTAInitialized = false; if (event->InternetConnectivityChange.IPv4 == kConnectivity_Established) { ESP_LOGI(TAG, "Server ready at: %s:%d", event->InternetConnectivityChange.address, CHIP_PORT); chip::app::DnssdServer::Instance().StartServer(); + + if (!isOTAInitialized) + { + chip::DeviceLayer::SystemLayer().StartTimer(chip::System::Clock::Seconds32(kInitOTARequestorDelaySec), + InitOTARequestorHandler, nullptr); + isOTAInitialized = true; + } } else if (event->InternetConnectivityChange.IPv4 == kConnectivity_Lost) { @@ -164,6 +179,13 @@ void DeviceCallbacks::OnInternetConnectivityChange(const ChipDeviceEvent * event { ESP_LOGI(TAG, "IPv6 Server ready..."); chip::app::DnssdServer::Instance().StartServer(); + + if (!isOTAInitialized) + { + chip::DeviceLayer::SystemLayer().StartTimer(chip::System::Clock::Seconds32(kInitOTARequestorDelaySec), + InitOTARequestorHandler, nullptr); + isOTAInitialized = true; + } } else if (event->InternetConnectivityChange.IPv6 == kConnectivity_Lost) { diff --git a/examples/lighting-app/esp32/main/main.cpp b/examples/lighting-app/esp32/main/main.cpp index 7004f6c576d7a6..838b77a1234d09 100644 --- a/examples/lighting-app/esp32/main/main.cpp +++ b/examples/lighting-app/esp32/main/main.cpp @@ -27,17 +27,12 @@ #include "nvs_flash.h" #include "shell_extension/launch.h" #include -#include -#include -#include -#include #include #include #include #include #include #include -#include #if CONFIG_ENABLE_ESP32_FACTORY_DATA_PROVIDER #include @@ -48,14 +43,6 @@ using namespace ::chip::Credentials; using namespace ::chip::DeviceManager; using namespace ::chip::DeviceLayer; -#if CONFIG_ENABLE_OTA_REQUESTOR -DefaultOTARequestor gRequestorCore; -DefaultOTARequestorStorage gRequestorStorage; -DefaultOTARequestorDriver gRequestorUser; -BDXDownloader gDownloader; -OTAImageProcessorImpl gImageProcessor; -#endif - LEDWidget AppLED; static const char * TAG = "light-app"; @@ -72,18 +59,6 @@ ESP32FactoryDataProvider sFactoryDataProvider; #endif // CONFIG_ENABLE_ESP32_FACTORY_DATA_PROVIDER } // namespace -static void InitOTARequestor(void) -{ -#if CONFIG_ENABLE_OTA_REQUESTOR - SetRequestorInstance(&gRequestorCore); - gRequestorStorage.Init(Server::GetInstance().GetPersistentStorage()); - gRequestorCore.Init(Server::GetInstance(), gRequestorStorage, gRequestorUser, gDownloader); - gImageProcessor.SetOTADownloader(&gDownloader); - gDownloader.SetImageProcessorDelegate(&gImageProcessor); - gRequestorUser.Init(&gRequestorCore, &gImageProcessor); -#endif -} - static void InitServer(intptr_t context) { // Print QR Code URL @@ -111,7 +86,6 @@ static void InitServer(intptr_t context) chip::app::DnssdServer::Instance().StartServer(); } #endif - InitOTARequestor(); } extern "C" void app_main() diff --git a/examples/ota-requestor-app/esp32/main/CMakeLists.txt b/examples/ota-requestor-app/esp32/main/CMakeLists.txt index 08f878c56b683f..f89b111d538656 100644 --- a/examples/ota-requestor-app/esp32/main/CMakeLists.txt +++ b/examples/ota-requestor-app/esp32/main/CMakeLists.txt @@ -20,7 +20,8 @@ idf_component_register(PRIV_INCLUDE_DIRS "${CMAKE_CURRENT_LIST_DIR}/include" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/zzz_generated/ota-requestor-app/" - SRC_DIRS + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/platform/esp32" + SRC_DIRS "${CMAKE_CURRENT_LIST_DIR}" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/zzz_generated/ota-requestor-app/zap-generated" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/zzz_generated/app-common/app-common/zap-generated/attributes" @@ -49,7 +50,8 @@ idf_component_register(PRIV_INCLUDE_DIRS "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/network-commissioning" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/operational-credentials-server" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/ota-requestor" - PRIV_REQUIRES chip QRCode bt console app_update) + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/platform/esp32/ota" + PRIV_REQUIRES chip QRCode bt console app_update) set_property(TARGET ${COMPONENT_LIB} PROPERTY CXX_STANDARD 14) target_compile_options(${COMPONENT_LIB} PRIVATE "-DLWIP_IPV6_SCOPES=0" "-DCHIP_HAVE_CONFIG_H") diff --git a/examples/ota-requestor-app/esp32/main/DeviceCallbacks.cpp b/examples/ota-requestor-app/esp32/main/DeviceCallbacks.cpp index 043d452011e7a4..6807e16cde0bb9 100644 --- a/examples/ota-requestor-app/esp32/main/DeviceCallbacks.cpp +++ b/examples/ota-requestor-app/esp32/main/DeviceCallbacks.cpp @@ -30,8 +30,10 @@ #include #include #include +#include -static const char * TAG = "echo-devicecallbacks"; +static const char * TAG = "echo-devicecallbacks"; +constexpr uint32_t kInitOTARequestorDelaySec = 3; using namespace ::chip; using namespace ::chip::Inet; @@ -78,12 +80,24 @@ void DeviceCallbacks::PostAttributeChangeCallback(EndpointId endpointId, Cluster ESP_LOGI(TAG, "Current free heap: %d\n", heap_caps_get_free_size(MALLOC_CAP_8BIT)); } +void InitOTARequestorHandler(System::Layer * systemLayer, void * appState) +{ + OTAHelpers::Instance().InitOTARequestor(); +} + void DeviceCallbacks::OnInternetConnectivityChange(const ChipDeviceEvent * event) { + static bool isOTAInitialized = false; if (event->InternetConnectivityChange.IPv4 == kConnectivity_Established) { ESP_LOGI(TAG, "Server ready at: %s:%d", event->InternetConnectivityChange.address, CHIP_PORT); chip::app::DnssdServer::Instance().StartServer(); + if (!isOTAInitialized) + { + chip::DeviceLayer::SystemLayer().StartTimer(chip::System::Clock::Seconds32(kInitOTARequestorDelaySec), + InitOTARequestorHandler, nullptr); + isOTAInitialized = true; + } } else if (event->InternetConnectivityChange.IPv4 == kConnectivity_Lost) { @@ -93,6 +107,12 @@ void DeviceCallbacks::OnInternetConnectivityChange(const ChipDeviceEvent * event { ESP_LOGI(TAG, "IPv6 Server ready..."); chip::app::DnssdServer::Instance().StartServer(); + if (!isOTAInitialized) + { + chip::DeviceLayer::SystemLayer().StartTimer(chip::System::Clock::Seconds32(kInitOTARequestorDelaySec), + InitOTARequestorHandler, nullptr); + isOTAInitialized = true; + } } else if (event->InternetConnectivityChange.IPv6 == kConnectivity_Lost) { diff --git a/examples/ota-requestor-app/esp32/main/main.cpp b/examples/ota-requestor-app/esp32/main/main.cpp index 5f962d712d8db1..02adf0680655ae 100644 --- a/examples/ota-requestor-app/esp32/main/main.cpp +++ b/examples/ota-requestor-app/esp32/main/main.cpp @@ -29,10 +29,6 @@ #include "freertos/task.h" #include "nvs_flash.h" #include -#include -#include -#include -#include #include #include @@ -41,8 +37,6 @@ #include -#include "OTAImageProcessorImpl.h" - using namespace ::chip; using namespace ::chip::System; using namespace ::chip::Credentials; @@ -53,12 +47,6 @@ namespace { const char * TAG = "ota-requester-app"; static DeviceCallbacks EchoCallbacks; -DefaultOTARequestor gRequestorCore; -DefaultOTARequestorStorage gRequestorStorage; -DefaultOTARequestorDriver gRequestorUser; -BDXDownloader gDownloader; -OTAImageProcessorImpl gImageProcessor; - app::Clusters::NetworkCommissioning::Instance sWiFiNetworkCommissioningInstance(0 /* Endpoint Id */, &(NetworkCommissioning::ESPWiFiDriver::GetInstance())); @@ -72,13 +60,6 @@ static void InitServer(intptr_t context) SetDeviceAttestationCredentialsProvider(Examples::GetExampleDACProvider()); sWiFiNetworkCommissioningInstance.Init(); - - SetRequestorInstance(&gRequestorCore); - gRequestorStorage.Init(Server::GetInstance().GetPersistentStorage()); - gRequestorCore.Init(Server::GetInstance(), gRequestorStorage, gRequestorUser, gDownloader); - gImageProcessor.SetOTADownloader(&gDownloader); - gDownloader.SetImageProcessorDelegate(&gImageProcessor); - gRequestorUser.Init(&gRequestorCore, &gImageProcessor); } } // namespace diff --git a/examples/platform/esp32/ota/OTAHelper.cpp b/examples/platform/esp32/ota/OTAHelper.cpp new file mode 100644 index 00000000000000..d561a09ad815e6 --- /dev/null +++ b/examples/platform/esp32/ota/OTAHelper.cpp @@ -0,0 +1,50 @@ +/* + * + * Copyright (c) 2022 Project CHIP Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "OTAHelper.h" + +#include +#include +#include +#include +#include + +using namespace chip::DeviceLayer; +using namespace chip; + +namespace { + +#if CONFIG_ENABLE_OTA_REQUESTOR +DefaultOTARequestor gRequestorCore; +DefaultOTARequestorStorage gRequestorStorage; +DefaultOTARequestorDriver gRequestorUser; +BDXDownloader gDownloader; +OTAImageProcessorImpl gImageProcessor; +#endif +} // namespace +void OTAHelpers::InitOTARequestor() +{ + +#if CONFIG_ENABLE_OTA_REQUESTOR + SetRequestorInstance(&gRequestorCore); + gRequestorStorage.Init(Server::GetInstance().GetPersistentStorage()); + gRequestorCore.Init(Server::GetInstance(), gRequestorStorage, gRequestorUser, gDownloader); + gImageProcessor.SetOTADownloader(&gDownloader); + gDownloader.SetImageProcessorDelegate(&gImageProcessor); + gRequestorUser.Init(&gRequestorCore, &gImageProcessor); +#endif +} diff --git a/examples/platform/esp32/ota/OTAHelper.h b/examples/platform/esp32/ota/OTAHelper.h new file mode 100644 index 00000000000000..521c5b39532b6d --- /dev/null +++ b/examples/platform/esp32/ota/OTAHelper.h @@ -0,0 +1,27 @@ +/* + * + * Copyright (c) 2022 Project CHIP Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +class OTAHelpers +{ +public: + static OTAHelpers & Instance(void) + { + static OTAHelpers sInitOTA; + return sInitOTA; + } + void InitOTARequestor(void); +}; diff --git a/src/platform/ESP32/OTAImageProcessorImpl.cpp b/src/platform/ESP32/OTAImageProcessorImpl.cpp index 6f8d5d07dda0d3..62fbe55410bef2 100644 --- a/src/platform/ESP32/OTAImageProcessorImpl.cpp +++ b/src/platform/ESP32/OTAImageProcessorImpl.cpp @@ -16,6 +16,7 @@ */ #include +#include #include #include "OTAImageProcessorImpl.h" @@ -38,6 +39,35 @@ void HandleRestart(Layer * systemLayer, void * appState) } } // namespace +bool OTAImageProcessorImpl::IsFirstImageRun() +{ + OTARequestorInterface * requestor = chip::GetRequestorInstance(); + if (requestor == nullptr) + { + return false; + } + + return requestor->GetCurrentUpdateState() == OTARequestorInterface::OTAUpdateStateEnum::kApplying; +} + +CHIP_ERROR OTAImageProcessorImpl::ConfirmCurrentImage() +{ + OTARequestorInterface * requestor = chip::GetRequestorInstance(); + if (requestor == nullptr) + { + return CHIP_ERROR_INTERNAL; + } + + uint32_t currentVersion; + ReturnErrorOnFailure(DeviceLayer::ConfigurationMgr().GetSoftwareVersion(currentVersion)); + if (currentVersion != requestor->GetTargetVersion()) + { + return CHIP_ERROR_INCORRECT_STATE; + } + + return CHIP_NO_ERROR; +} + CHIP_ERROR OTAImageProcessorImpl::PrepareDownload() { DeviceLayer::PlatformMgr().ScheduleWork(HandlePrepareDownload, reinterpret_cast(this)); diff --git a/src/platform/ESP32/OTAImageProcessorImpl.h b/src/platform/ESP32/OTAImageProcessorImpl.h index 64ba8e8f51f557..5d0775c4392f13 100644 --- a/src/platform/ESP32/OTAImageProcessorImpl.h +++ b/src/platform/ESP32/OTAImageProcessorImpl.h @@ -35,8 +35,8 @@ class OTAImageProcessorImpl : public OTAImageProcessorInterface CHIP_ERROR Abort() override; CHIP_ERROR ProcessBlock(ByteSpan & block) override; void SetOTADownloader(OTADownloader * downloader) { mDownloader = downloader; }; - bool IsFirstImageRun() override { return false; } - CHIP_ERROR ConfirmCurrentImage() override { return CHIP_NO_ERROR; } + bool IsFirstImageRun() override; + CHIP_ERROR ConfirmCurrentImage() override; private: static void HandlePrepareDownload(intptr_t context); From 9cd7e92a830131d1c6c2d323693ec3f2738aef92 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 25 Apr 2022 12:48:14 -0400 Subject: [PATCH 03/25] Bump third_party/pigweed/repo from `9e7d4a4` to `3d2ffee` (#17681) Bumps [third_party/pigweed/repo](https://github.com/google/pigweed) from `9e7d4a4` to `3d2ffee`. - [Release notes](https://github.com/google/pigweed/releases) - [Commits](https://github.com/google/pigweed/compare/9e7d4a4a0a1e7a341c4122d3ff473be7d23d0030...3d2ffeec739c32dc5f3071ae4227bd43eededd81) --- updated-dependencies: - dependency-name: third_party/pigweed/repo dependency-type: direct:production ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- third_party/pigweed/repo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/third_party/pigweed/repo b/third_party/pigweed/repo index 9e7d4a4a0a1e7a..3d2ffeec739c32 160000 --- a/third_party/pigweed/repo +++ b/third_party/pigweed/repo @@ -1 +1 @@ -Subproject commit 9e7d4a4a0a1e7a341c4122d3ff473be7d23d0030 +Subproject commit 3d2ffeec739c32dc5f3071ae4227bd43eededd81 From baef98a766e541beb817748f57fd891c44b9567e Mon Sep 17 00:00:00 2001 From: bluebin14 <80577827+bluebin14@users.noreply.github.com> Date: Mon, 25 Apr 2022 18:58:23 +0200 Subject: [PATCH 04/25] Darwin: add support for GetClock_RealTimeMS (#17668) --- src/platform/Darwin/BUILD.gn | 1 + src/platform/Darwin/SystemPlatformConfig.h | 2 +- src/platform/Darwin/SystemTimeSupport.cpp | 118 +++++++++++++++++++++ 3 files changed, 120 insertions(+), 1 deletion(-) create mode 100644 src/platform/Darwin/SystemTimeSupport.cpp diff --git a/src/platform/Darwin/BUILD.gn b/src/platform/Darwin/BUILD.gn index f47ebbba4e64a1..f66a1001144f89 100644 --- a/src/platform/Darwin/BUILD.gn +++ b/src/platform/Darwin/BUILD.gn @@ -65,6 +65,7 @@ static_library("Darwin") { "PosixConfig.cpp", "PosixConfig.h", "SystemPlatformConfig.h", + "SystemTimeSupport.cpp", ] deps = [ diff --git a/src/platform/Darwin/SystemPlatformConfig.h b/src/platform/Darwin/SystemPlatformConfig.h index 09ab54ee2de107..641f735999f323 100644 --- a/src/platform/Darwin/SystemPlatformConfig.h +++ b/src/platform/Darwin/SystemPlatformConfig.h @@ -37,7 +37,7 @@ struct ChipDeviceEvent; #define CHIP_SYSTEM_CONFIG_POSIX_LOCKING 0 #define CHIP_SYSTEM_CONFIG_FREERTOS_LOCKING 0 #define CHIP_SYSTEM_CONFIG_NO_LOCKING 1 -#define CHIP_SYSTEM_CONFIG_PLATFORM_PROVIDES_TIME 0 +#define CHIP_SYSTEM_CONFIG_PLATFORM_PROVIDES_TIME 1 #define CHIP_SYSTEM_CONFIG_USE_POSIX_TIME_FUNCTS 1 #define CHIP_SYSTEM_CONFIG_POOL_USE_HEAP 1 diff --git a/src/platform/Darwin/SystemTimeSupport.cpp b/src/platform/Darwin/SystemTimeSupport.cpp new file mode 100644 index 00000000000000..cfb6a2a9dcb11c --- /dev/null +++ b/src/platform/Darwin/SystemTimeSupport.cpp @@ -0,0 +1,118 @@ +/* + * + * Copyright (c) 2020 Project CHIP Authors + * Copyright (c) 2018 Nest Labs, Inc. + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @file + * Provides implementations of the CHIP System Layer platform + * time/clock functions that are suitable for use on the Darwin platform. + */ + +#include + +#include +#include + +#include +#include +#include +#include + +namespace chip { +namespace System { +namespace Clock { + +namespace Internal { +ClockImpl gClockImpl; +} // namespace Internal + +Microseconds64 ClockImpl::GetMonotonicMicroseconds64() +{ + return std::chrono::duration_cast(std::chrono::steady_clock::now().time_since_epoch()); +} + +Milliseconds64 ClockImpl::GetMonotonicMilliseconds64() +{ + return std::chrono::duration_cast(std::chrono::steady_clock::now().time_since_epoch()); +} + +CHIP_ERROR ClockImpl::GetClock_RealTime(Clock::Microseconds64 & aCurTime) +{ + struct timeval tv; + if (gettimeofday(&tv, nullptr) != 0) + { + return CHIP_ERROR_POSIX(errno); + } + if (tv.tv_sec < CHIP_SYSTEM_CONFIG_VALID_REAL_TIME_THRESHOLD) + { + return CHIP_ERROR_REAL_TIME_NOT_SYNCED; + } + if (tv.tv_usec < 0) + { + return CHIP_ERROR_REAL_TIME_NOT_SYNCED; + } + static_assert(CHIP_SYSTEM_CONFIG_VALID_REAL_TIME_THRESHOLD >= 0, "We might be letting through negative tv_sec values!"); + aCurTime = Clock::Microseconds64((static_cast(tv.tv_sec) * UINT64_C(1000000)) + static_cast(tv.tv_usec)); + return CHIP_NO_ERROR; +} + +CHIP_ERROR ClockImpl::GetClock_RealTimeMS(Clock::Milliseconds64 & aCurTime) +{ + struct timeval tv; + if (gettimeofday(&tv, nullptr) != 0) + { + return CHIP_ERROR_POSIX(errno); + } + if (tv.tv_sec < CHIP_SYSTEM_CONFIG_VALID_REAL_TIME_THRESHOLD) + { + return CHIP_ERROR_REAL_TIME_NOT_SYNCED; + } + if (tv.tv_usec < 0) + { + return CHIP_ERROR_REAL_TIME_NOT_SYNCED; + } + static_assert(CHIP_SYSTEM_CONFIG_VALID_REAL_TIME_THRESHOLD >= 0, "We might be letting through negative tv_sec values!"); + aCurTime = + Clock::Milliseconds64((static_cast(tv.tv_sec) * UINT64_C(1000)) + (static_cast(tv.tv_usec) / 1000)); + return CHIP_NO_ERROR; +} + +CHIP_ERROR ClockImpl::SetClock_RealTime(Clock::Microseconds64 aNewCurTime) +{ + struct timeval tv; + tv.tv_sec = static_cast(aNewCurTime.count() / UINT64_C(1000000)); + tv.tv_usec = static_cast(aNewCurTime.count() % UINT64_C(1000000)); + if (settimeofday(&tv, nullptr) != 0) + { + return (errno == EPERM) ? CHIP_ERROR_ACCESS_DENIED : CHIP_ERROR_POSIX(errno); + } +#if CHIP_PROGRESS_LOGGING + { + const time_t timep = tv.tv_sec; + struct tm calendar; + localtime_r(&timep, &calendar); + ChipLogProgress(DeviceLayer, "Real time clock set to %ld (%04d/%02d/%02d %02d:%02d:%02d UTC)", tv.tv_sec, calendar.tm_year, + calendar.tm_mon, calendar.tm_mday, calendar.tm_hour, calendar.tm_min, calendar.tm_sec); + } +#endif // CHIP_PROGRESS_LOGGING + return CHIP_NO_ERROR; +} + +} // namespace Clock +} // namespace System +} // namespace chip From 252314fd790c1f84e1933988494182c523fbd32d Mon Sep 17 00:00:00 2001 From: Vivien Nicolas Date: Mon, 25 Apr 2022 18:58:40 +0200 Subject: [PATCH 05/25] [YAML] Fix some discovery tests thare are using notValue improperly and add a codegen check to make sure it does not happens again (#17686) * [YAML] Fix some discovery tests thare are using notValue improperly and add a codegen check to make sure it does not happens again * Update generated test code --- src/app/tests/suites/TestDiscovery.yaml | 3 ++- .../tests/suites/certification/Test_TC_SC_4_2.yaml | 6 ++++-- .../zap-templates/common/ClusterTestGeneration.js | 13 +++++++++++++ .../chip-tool/zap-generated/test/Commands.h | 4 ++++ 4 files changed, 23 insertions(+), 3 deletions(-) diff --git a/src/app/tests/suites/TestDiscovery.yaml b/src/app/tests/suites/TestDiscovery.yaml index 2c5c3af0bbb2c6..b91785007f7c30 100644 --- a/src/app/tests/suites/TestDiscovery.yaml +++ b/src/app/tests/suites/TestDiscovery.yaml @@ -269,7 +269,8 @@ tests: response: values: - name: "pairingHint" - notValue: 0 + constraints: + notValue: 0 - label: "Optional TXT key for pairing instructions (PI)" PICS: PI_KEY diff --git a/src/app/tests/suites/certification/Test_TC_SC_4_2.yaml b/src/app/tests/suites/certification/Test_TC_SC_4_2.yaml index b8042c5b7aace6..9993999fa5db75 100644 --- a/src/app/tests/suites/certification/Test_TC_SC_4_2.yaml +++ b/src/app/tests/suites/certification/Test_TC_SC_4_2.yaml @@ -233,7 +233,8 @@ tests: response: values: - name: "pairingHint" - notValue: 0 + constraints: + notValue: 0 - label: "Optional TXT key for pairing instructions (PI)" PICS: PI_KEY @@ -457,7 +458,8 @@ tests: response: values: - name: "pairingHint" - notValue: 0 + constraints: + notValue: 0 - label: "Optional TXT key for pairing instructions (PI)" disabled: true diff --git a/src/app/zap-templates/common/ClusterTestGeneration.js b/src/app/zap-templates/common/ClusterTestGeneration.js index 4ada516a5cf9cb..fafebd0a2f8a5f 100644 --- a/src/app/zap-templates/common/ClusterTestGeneration.js +++ b/src/app/zap-templates/common/ClusterTestGeneration.js @@ -249,6 +249,19 @@ function setDefaultResponse(test) const defaultResponseValues = []; setDefault(test[kResponseName], kValuesName, defaultResponseValues); + // Ensure only valid keywords are used for response values. + const values = test[kResponseName][kValuesName]; + for (let i = 0; i < values.length; i++) { + for (let key in values[i]) { + if (key == "name" || key == "value" || key == kConstraintsName || key == kSaveAsName) { + continue; + } + + const errorStr = `Unknown key "${key}"`; + throwError(test, errorStr); + } + } + const defaultResponseConstraints = {}; setDefault(test[kResponseName], kConstraintsName, defaultResponseConstraints); diff --git a/zzz_generated/chip-tool/zap-generated/test/Commands.h b/zzz_generated/chip-tool/zap-generated/test/Commands.h index 581f8d762767ba..637c7177088709 100644 --- a/zzz_generated/chip-tool/zap-generated/test/Commands.h +++ b/zzz_generated/chip-tool/zap-generated/test/Commands.h @@ -47179,6 +47179,8 @@ class Test_TC_SC_4_2Suite : public TestCommand { chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + + VerifyOrReturn(CheckConstraintNotValue("value.pairingHint", value.pairingHint, 0U)); } shouldContinue = true; break; @@ -92215,6 +92217,8 @@ class TestDiscoverySuite : public TestCommand { chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + + VerifyOrReturn(CheckConstraintNotValue("value.pairingHint", value.pairingHint, 0U)); } shouldContinue = true; break; From 392e0df5c03c822c8c127f51fe54614af4b092e4 Mon Sep 17 00:00:00 2001 From: yunhanw-google Date: Mon, 25 Apr 2022 12:27:43 -0700 Subject: [PATCH 06/25] update GetHighestReceivedEventNumber comment (#17697) --- src/app/ReadClient.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app/ReadClient.h b/src/app/ReadClient.h index d3dd5b9b702446..57ca708dcf6277 100644 --- a/src/app/ReadClient.h +++ b/src/app/ReadClient.h @@ -186,8 +186,8 @@ class ReadClient : public Messaging::ExchangeDelegate /* * Get highest received event number. - * If application don't have this one, it clear outparam and return CHIP_NO_ERROR. - * if any returning error, it will fail the entire read client. + * If the application does not want to filter events by event number, it should call ClearValue() on aEventNumber + * and return CHIP_NO_ERROR. An error return from this function will fail the entire read client interaction. */ virtual CHIP_ERROR GetHighestReceivedEventNumber(Optional & aEventNumber) { From da634c8f18477d6f5c542be9d43c052006abf5c2 Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Mon, 25 Apr 2022 15:33:46 -0400 Subject: [PATCH 07/25] Don't lose track of the "no compatible credentials" error in commissioning. (#17662) When AutoCommissioner::GetNextCommissioningStageInternal moves out of the kSendNOC state, it can end up in one of three states: kWiFiNetworkSetup, kThreadNetworkSetup, and kCleanup. This third case happens if we don't have credentials for the network technology the commissionee supports. In that case, we set the error outparam and proceed to cleanup. Unfortunately, the caller completely ignores the outparam, except for logging. So we get situations like https://github.com/project-chip/connectedhomeip/issues/17244 where the log looks like this: CHIP:CTL: Finished commissioning step 'SendNOC' with error '../../../examples/chip-tool/third_party/connectedhomeip/src/controller/CHIPDeviceController.cpp:1390: Success' CHIP:CTL: Required network information not provided in commissioning parameters CHIP:CTL: Parameters supplied: wifi (yes) thread (no) CHIP:CTL: Device supports: wifi (no) thread(yes) CHIP:CTL: Going from commissioning step 'SendNOC' with lastErr = '../../../examples/chip-tool/third_party/connectedhomeip/src/controller/AutoCommissioner.cpp:180: CHIP Error 0x0000002F: Invalid argument' --> 'Cleanup' CHIP:CTL: Performing next commissioning step 'Cleanup' with completion status = '../../../examples/chip-tool/third_party/connectedhomeip/src/controller/CHIPDeviceController.cpp:1390: Success' CHIP:CTL: Finished commissioning step 'Cleanup' with error '../../../examples/chip-tool/third_party/connectedhomeip/src/controller/CHIPDeviceController.cpp:1497: Success' CHIP:TOO: Device commissioning completed with success and that last line shows the pairing delegate was notified that commissioning completed successfully, even though we bailed out partway through. The fix is to store the error in our completionStatus. With this change, the log ends up looking like this: CHIP: [CTL] Successfully finished commissioning step 'SendNOC' CHIP: [CTL] Required network information not provided in commissioning parameters CHIP: [CTL] Parameters supplied: wifi (no) thread (yes) CHIP: [CTL] Device supports: wifi (yes) thread(no) CHIP: [CTL] Going from commissioning step 'SendNOC' with lastErr = '../../../examples/chip-tool/third_party/connectedhomeip/src/controller/AutoCommissioner.cpp:203: CHIP Error 0x0000002F: Invalid argument' -> 'Cleanup' CHIP: [CTL] Performing next commissioning step 'Cleanup' with completion status = '../../../examples/chip-tool/third_party/connectedhomeip/src/controller/AutoCommissioner.cpp:203: CHIP Error 0x0000002F: Invalid argument' CHIP: [TOO] Device commissioning Failure: ../../../examples/chip-tool/third_party/connectedhomeip/src/controller/AutoCommissioner.cpp:203: CHIP Error 0x0000002F: Invalid argument and we see the PairingDelegate is notified with an error status, as expected. Another option would have been to add a new commissioning step for "no network credentials" and set the completion status to error from that. That would have the benefit of also setting the failedStage in the completion status, which we can't easily set right now because part of the problem is that we don't actually know what stage to proceed to and hence which stage to deem as having failed. --- src/controller/AutoCommissioner.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/controller/AutoCommissioner.cpp b/src/controller/AutoCommissioner.cpp index ee494f1b1f927d..1b7857a638ed7a 100644 --- a/src/controller/AutoCommissioner.cpp +++ b/src/controller/AutoCommissioner.cpp @@ -447,6 +447,14 @@ CHIP_ERROR AutoCommissioner::CommissioningStepFinished(CHIP_ERROR err, Commissio return CHIP_ERROR_INCORRECT_STATE; } + // If GetNextCommissioningStage indicated a failure, don't lose track of + // that. But don't overwrite any existing failures we had hanging + // around. + if (completionStatus.err == CHIP_NO_ERROR) + { + completionStatus.err = err; + } + DeviceProxy * proxy = mCommissioneeDeviceProxy; if (nextStage == CommissioningStage::kSendComplete || (nextStage == CommissioningStage::kCleanup && mOperationalDeviceProxy != nullptr)) From 6a8eedd6c2db62a120294156d959ceb19ad1aa38 Mon Sep 17 00:00:00 2001 From: Faqiang Zhu <71302147+FaqiangZhu-nxp@users.noreply.github.com> Date: Tue, 26 Apr 2022 03:38:58 +0800 Subject: [PATCH 08/25] Imx build update 0424 (#17675) * code the sysroot and compiler info instead of source the setup script Previously, before building the linux examples with the imx yocto SDK in the imxlinux_example.sh, the yocto SDK setup script is firstly executed to export many shell envs to be used. This pollutes the matter development shell env. In this patch, code the sysroot and compiler info with only one shell env named IMX_SDK_ROOT. Signed-off-by: faqiang.zhu Change-Id: Iae32c714824adbe072fdb2351a0f73df4e5a9c0f * description about building examples with python/shell script tools Remove the description about how to build the examples with gn and ninja commands, instead, describe how to build the examples with the tool build_examples.py and imxlinux_example.sh. Signed-off-by: faqiang.zhu Change-Id: Iafaca855680f373054ed593b9641924e8f5f66bc --- docs/guides/nxp_imx8m_linux_examples.md | 70 ++++++++++++++++--------- scripts/examples/imxlinux_example.sh | 21 +++----- 2 files changed, 52 insertions(+), 39 deletions(-) diff --git a/docs/guides/nxp_imx8m_linux_examples.md b/docs/guides/nxp_imx8m_linux_examples.md index bd8d47994a51cd..c1eabd3819910b 100644 --- a/docs/guides/nxp_imx8m_linux_examples.md +++ b/docs/guides/nxp_imx8m_linux_examples.md @@ -7,6 +7,8 @@ Linux Yocto SDK and then run the output executable files on the **NXP i.MX 8M** - [CHIP Linux All-clusters Example](../../examples/all-clusters-app/linux) - [CHIP Linux Lighting Example](../../examples/lighting-app/linux) - [CHIP Linux Thermostat Example](../../examples/thermostat/linux) +- [CHIP Linux CHIP-tool Example](../../examples/chip-tool) +- [CHIP Linux OTA-provider Example](../../examples/ota-provider-app/linux) This document has been tested on: @@ -120,48 +122,64 @@ to be generated. sudo tmp/deploy/sdk/fsl-imx-xwayland-glibc-x86_64-imx-image-full-cortexa53-crypto-imx8mmevk-toolchain-5.10-hardknott.sh ``` - After the Yocto SDK is installed on the host machine, an environment setup - script is also generated, and there are prompt lines telling the user to - source the script each time when using the SDK in a new shell, for example: + After the Yocto SDK is installed on the host machine, to use the SDK when + building the CHIP Linux Examples, export a shell environment variable named + `IMX_SDK_ROOT` to specify the path of the SDK, for example: ``` - . /opt/fsl-imx-xwayland/5.10-hardknott/environment-setup-cortexa53-crypto-poky-linux + export IMX_SDK_ROOT=/opt/fsl-imx-xwayland/5.10-hardknott ``` - Build the example application: - Assuming that the working directory has been changed the CHIP Linux Examples - code, all the other steps are the same. + Building those examples with the Yocto SDK specified by the `IMX_SDK_ROOT` + has been integrated into the tool `build_examples.py` and the tool + `imxlinux_example.sh`. Choose one of them to build the examples. + + Assuming that the working directory is changed to the top level directory of + this project. ``` + git submodule update --init + source scripts/activate.sh + # If the all-clusters example is to be built - cd ~/connectedhomeip/examples/all-clusters-app/linux + ./scripts/build/build_examples.py --target imx-all-clusters-app build + # or + ./scripts/examples/imxlinux_example.sh examples/all-clusters-app/linux examples/all-clusters-app/linux/out/aarch64 # If the lighting example is to be built - cd ~/connectedhomeip/examples/lighting-app/linux + ./scripts/build/build_examples.py --target imx-lighting-app build + # or + ./scripts/examples/imxlinux_example.sh examples/lighting-app/linux examples/lighting-app/linux/out/aarch64 # If the thermostat example is to be built - cd ~/connectedhomeip/examples/thermostat/linux + ./scripts/build/build_examples.py --target imx-thermostat build + # or + ./scripts/examples/imxlinux_example.sh examples/thermostat/linux examples/thermostat/linux/out/aarch64 + + # If the chip-tool example is to be built + ./scripts/build/build_examples.py --target imx-chip-tool build + # or + ./scripts/examples/imxlinux_example.sh examples/chip-tool examples/chip-tool/out/aarch64 + + # If the ota-provider example is to be built + ./scripts/build/build_examples.py --target imx-ota-provider-app build + # or + ./scripts/examples/imxlinux_example.sh examples/ota-provider-app/linux examples/ota-provider-app/linux/out/aarch64 - git submodule update --init - source third_party/connectedhomeip/scripts/activate.sh - PLATFORM_CFLAGS='-DCHIP_DEVICE_CONFIG_WIFI_STATION_IF_NAME=\"mlan0\"", "-DCHIP_DEVICE_CONFIG_LINUX_DHCPC_CMD=\"udhcpc -b -i %s \"' - PKG_CONFIG_SYSROOT_DIR=${PKG_CONFIG_SYSROOT_DIR} \ - PKG_CONFIG_LIBDIR=${PKG_CONFIG_PATH} \ - gn gen out/aarch64 --args="target_os=\"linux\" target_cpu=\"arm64\" arm_arch=\"armv8-a\" - import(\"//build_overrides/build.gni\") - target_cflags=[ \"--sysroot=${SDKTARGETSYSROOT}\", \"${PLATFORM_CFLAGS}\" ] - target_ldflags = [ \"--sysroot=${SDKTARGETSYSROOT}\" ] - custom_toolchain=\"\${build_root}/toolchain/custom\" - target_cc=\"${OECORE_NATIVE_SYSROOT}/usr/bin/aarch64-poky-linux/aarch64-poky-linux-gcc\" - target_cxx=\"${OECORE_NATIVE_SYSROOT}/usr/bin/aarch64-poky-linux/aarch64-poky-linux-g++\" - target_ar=\"${OECORE_NATIVE_SYSROOT}/usr/bin/aarch64-poky-linux/aarch64-poky-linux-ar\"" - ninja -C out/aarch64 ``` - The executable file is built under out/aarch64, it can be executed on the - **i.MX 8M Mini EVK** which running the Yocto image previously generated as - described in the sections above. + If the `build_examples.py` is used, the executable files are built in the + subdirectories under out/, the subdirectory name is the same as the argument + specified after the option `--target` when build the examples. + + If the `imxlinux_example.sh` is used, the executable files are built in the + directory specified by the second parameter when build the examples. + + The executable files can be executed on the **i.MX 8M Mini EVK** which + running the Yocto image previously generated as described in the sections + above. diff --git a/scripts/examples/imxlinux_example.sh b/scripts/examples/imxlinux_example.sh index a2c8eae43304eb..e0ac39bd13c289 100755 --- a/scripts/examples/imxlinux_example.sh +++ b/scripts/examples/imxlinux_example.sh @@ -25,25 +25,20 @@ fi source "$(dirname "$0")/../../scripts/activate.sh" if [ "$IMX_SDK_ROOT" = "" ]; then - if [ "$CROSS_COMPILE" != "aarch64-poky-linux-" ]; then - echo "i.MX SDK root not aarch64" - exit -1 - fi -else - source "$IMX_SDK_ROOT"/environment-setup-cortexa53-crypto-poky-linux + echo "the Yocto SDK path is not specified with the shell env IMX_SDK_ROOT" + exit -1 fi env PLATFORM_CFLAGS='-DCHIP_DEVICE_CONFIG_WIFI_STATION_IF_NAME=\"mlan0\"", "-DCHIP_DEVICE_CONFIG_LINUX_DHCPC_CMD=\"udhcpc -b -i %s \"' -PKG_CONFIG_SYSROOT_DIR=$PKG_CONFIG_SYSROOT_DIR \ - PKG_CONFIG_LIBDIR="$PKG_CONFIG_PATH" \ +PKG_CONFIG_PATH=$IMX_SDK_ROOT/sysroots/cortexa53-crypto-poky-linux/lib/aarch64-linux-gnu/pkgconfig \ gn gen --check --fail-on-unused-args --root="$1" "$2" --args="target_os=\"linux\" target_cpu=\"arm64\" arm_arch=\"armv8-a\" import(\"//build_overrides/build.gni\") -target_cflags=[ \"--sysroot=$SDKTARGETSYSROOT\", \"$PLATFORM_CFLAGS\" ] -target_ldflags = [ \"--sysroot=$SDKTARGETSYSROOT\" ] +sysroot=\"$IMX_SDK_ROOT/sysroots/cortexa53-crypto-poky-linux\" +target_cflags=[ \"$PLATFORM_CFLAGS\" ] custom_toolchain=\"\${build_root}/toolchain/custom\" -target_cc=\"$OECORE_NATIVE_SYSROOT/usr/bin/aarch64-poky-linux/aarch64-poky-linux-gcc\" -target_cxx=\"$OECORE_NATIVE_SYSROOT/usr/bin/aarch64-poky-linux/aarch64-poky-linux-g++\" -target_ar=\"$OECORE_NATIVE_SYSROOT/usr/bin/aarch64-poky-linux/aarch64-poky-linux-ar\"" +target_cc=\"$IMX_SDK_ROOT/sysroots/x86_64-pokysdk-linux/usr/bin/aarch64-poky-linux/aarch64-poky-linux-gcc\" +target_cxx=\"$IMX_SDK_ROOT/sysroots/x86_64-pokysdk-linux/usr/bin/aarch64-poky-linux/aarch64-poky-linux-g++\" +target_ar=\"$IMX_SDK_ROOT/sysroots/x86_64-pokysdk-linux/usr/bin/aarch64-poky-linux/aarch64-poky-linux-ar\"" ninja -C "$2" From dfc9ab636afba03809f14d52138583a0138218f1 Mon Sep 17 00:00:00 2001 From: Evgeny Margolis Date: Mon, 25 Apr 2022 12:45:18 -0700 Subject: [PATCH 09/25] Support Commissioner DUT Test Vectors Generation. (#17519) Added python script to generate test vectors: src/tools/chip-cert/gen_com_dut_test_vectors.py This script currently generates only structural errors in the DAC and PAI certificates. Next steps will be to generate structureal CD error and other validation flow errors. By default the generated test vectors will be stored here: credentials/development/commissioner_dut/ --- .../struct_dac_cert_version_v2/cd.der | Bin 0 -> 236 bytes .../struct_dac_cert_version_v2/dac-Cert.der | Bin 0 -> 466 bytes .../struct_dac_cert_version_v2/dac-Cert.pem | 12 + .../struct_dac_cert_version_v2/dac-Key.der | Bin 0 -> 121 bytes .../struct_dac_cert_version_v2/dac-Key.pem | 5 + .../struct_dac_cert_version_v2/pai-Cert.der | Bin 0 -> 450 bytes .../struct_dac_cert_version_v2/pai-Cert.pem | 12 + .../struct_dac_cert_version_v2/pai-Key.der | Bin 0 -> 121 bytes .../struct_dac_cert_version_v2/pai-Key.pem | 5 + .../test_case_vector.json | 9 + .../struct_dac_cert_version_v3/cd.der | Bin 0 -> 237 bytes .../struct_dac_cert_version_v3/dac-Cert.der | Bin 0 -> 466 bytes .../struct_dac_cert_version_v3/dac-Cert.pem | 12 + .../struct_dac_cert_version_v3/dac-Key.der | Bin 0 -> 121 bytes .../struct_dac_cert_version_v3/dac-Key.pem | 5 + .../struct_dac_cert_version_v3/pai-Cert.der | Bin 0 -> 450 bytes .../struct_dac_cert_version_v3/pai-Cert.pem | 12 + .../struct_dac_cert_version_v3/pai-Key.der | Bin 0 -> 121 bytes .../struct_dac_cert_version_v3/pai-Key.pem | 5 + .../test_case_vector.json | 9 + .../struct_dac_ext_akid_missing/cd.der | Bin 0 -> 235 bytes .../struct_dac_ext_akid_missing/dac-Cert.der | Bin 0 -> 433 bytes .../struct_dac_ext_akid_missing/dac-Cert.pem | 12 + .../struct_dac_ext_akid_missing/dac-Key.der | Bin 0 -> 121 bytes .../struct_dac_ext_akid_missing/dac-Key.pem | 5 + .../struct_dac_ext_akid_missing/pai-Cert.der | Bin 0 -> 450 bytes .../struct_dac_ext_akid_missing/pai-Cert.pem | 12 + .../struct_dac_ext_akid_missing/pai-Key.der | Bin 0 -> 121 bytes .../struct_dac_ext_akid_missing/pai-Key.pem | 5 + .../test_case_vector.json | 9 + .../cd.der | Bin 0 -> 237 bytes .../dac-Cert.der | Bin 0 -> 521 bytes .../dac-Cert.pem | 13 + .../dac-Key.der | Bin 0 -> 121 bytes .../dac-Key.pem | 5 + .../pai-Cert.der | Bin 0 -> 450 bytes .../pai-Cert.pem | 12 + .../pai-Key.der | Bin 0 -> 121 bytes .../pai-Key.pem | 5 + .../test_case_vector.json | 9 + .../struct_dac_ext_basic_ca_missing/cd.der | Bin 0 -> 237 bytes .../dac-Cert.der | Bin 0 -> 469 bytes .../dac-Cert.pem | 12 + .../dac-Key.der | Bin 0 -> 121 bytes .../dac-Key.pem | 5 + .../pai-Cert.der | Bin 0 -> 450 bytes .../pai-Cert.pem | 12 + .../pai-Key.der | Bin 0 -> 121 bytes .../pai-Key.pem | 5 + .../test_case_vector.json | 9 + .../struct_dac_ext_basic_ca_wrong/cd.der | Bin 0 -> 236 bytes .../dac-Cert.der | Bin 0 -> 469 bytes .../dac-Cert.pem | 12 + .../struct_dac_ext_basic_ca_wrong/dac-Key.der | Bin 0 -> 121 bytes .../struct_dac_ext_basic_ca_wrong/dac-Key.pem | 5 + .../pai-Cert.der | Bin 0 -> 449 bytes .../pai-Cert.pem | 12 + .../struct_dac_ext_basic_ca_wrong/pai-Key.der | Bin 0 -> 121 bytes .../struct_dac_ext_basic_ca_wrong/pai-Key.pem | 5 + .../test_case_vector.json | 9 + .../cd.der | Bin 0 -> 235 bytes .../dac-Cert.der | Bin 0 -> 462 bytes .../dac-Cert.pem | 12 + .../dac-Key.der | Bin 0 -> 121 bytes .../dac-Key.pem | 5 + .../pai-Cert.der | Bin 0 -> 451 bytes .../pai-Cert.pem | 12 + .../pai-Key.der | Bin 0 -> 121 bytes .../pai-Key.pem | 5 + .../test_case_vector.json | 9 + .../cd.der | Bin 0 -> 236 bytes .../dac-Cert.der | Bin 0 -> 462 bytes .../dac-Cert.pem | 12 + .../dac-Key.der | Bin 0 -> 121 bytes .../dac-Key.pem | 5 + .../pai-Cert.der | Bin 0 -> 451 bytes .../pai-Cert.pem | 12 + .../pai-Key.der | Bin 0 -> 121 bytes .../pai-Key.pem | 5 + .../test_case_vector.json | 9 + .../struct_dac_ext_basic_missing/cd.der | Bin 0 -> 235 bytes .../struct_dac_ext_basic_missing/dac-Cert.der | Bin 0 -> 451 bytes .../struct_dac_ext_basic_missing/dac-Cert.pem | 12 + .../struct_dac_ext_basic_missing/dac-Key.der | Bin 0 -> 121 bytes .../struct_dac_ext_basic_missing/dac-Key.pem | 5 + .../struct_dac_ext_basic_missing/pai-Cert.der | Bin 0 -> 450 bytes .../struct_dac_ext_basic_missing/pai-Cert.pem | 12 + .../struct_dac_ext_basic_missing/pai-Key.der | Bin 0 -> 121 bytes .../struct_dac_ext_basic_missing/pai-Key.pem | 5 + .../test_case_vector.json | 9 + .../struct_dac_ext_basic_pathlen0/cd.der | Bin 0 -> 237 bytes .../dac-Cert.der | Bin 0 -> 467 bytes .../dac-Cert.pem | 12 + .../struct_dac_ext_basic_pathlen0/dac-Key.der | Bin 0 -> 121 bytes .../struct_dac_ext_basic_pathlen0/dac-Key.pem | 5 + .../pai-Cert.der | Bin 0 -> 451 bytes .../pai-Cert.pem | 12 + .../struct_dac_ext_basic_pathlen0/pai-Key.der | Bin 0 -> 121 bytes .../struct_dac_ext_basic_pathlen0/pai-Key.pem | 5 + .../test_case_vector.json | 9 + .../struct_dac_ext_basic_pathlen1/cd.der | Bin 0 -> 236 bytes .../dac-Cert.der | Bin 0 -> 465 bytes .../dac-Cert.pem | 12 + .../struct_dac_ext_basic_pathlen1/dac-Key.der | Bin 0 -> 121 bytes .../struct_dac_ext_basic_pathlen1/dac-Key.pem | 5 + .../pai-Cert.der | Bin 0 -> 450 bytes .../pai-Cert.pem | 12 + .../struct_dac_ext_basic_pathlen1/pai-Key.der | Bin 0 -> 121 bytes .../struct_dac_ext_basic_pathlen1/pai-Key.pem | 5 + .../test_case_vector.json | 9 + .../struct_dac_ext_basic_pathlen2/cd.der | Bin 0 -> 236 bytes .../dac-Cert.der | Bin 0 -> 465 bytes .../dac-Cert.pem | 12 + .../struct_dac_ext_basic_pathlen2/dac-Key.der | Bin 0 -> 121 bytes .../struct_dac_ext_basic_pathlen2/dac-Key.pem | 5 + .../pai-Cert.der | Bin 0 -> 451 bytes .../pai-Cert.pem | 12 + .../struct_dac_ext_basic_pathlen2/pai-Key.der | Bin 0 -> 121 bytes .../struct_dac_ext_basic_pathlen2/pai-Key.pem | 5 + .../test_case_vector.json | 9 + .../cd.der | Bin 0 -> 236 bytes .../dac-Cert.der | Bin 0 -> 468 bytes .../dac-Cert.pem | 12 + .../dac-Key.der | Bin 0 -> 121 bytes .../dac-Key.pem | 5 + .../pai-Cert.der | Bin 0 -> 450 bytes .../pai-Cert.pem | 12 + .../pai-Key.der | Bin 0 -> 121 bytes .../pai-Key.pem | 5 + .../test_case_vector.json | 9 + .../cd.der | Bin 0 -> 237 bytes .../dac-Cert.der | Bin 0 -> 501 bytes .../dac-Cert.pem | 13 + .../dac-Key.der | Bin 0 -> 121 bytes .../dac-Key.pem | 5 + .../pai-Cert.der | Bin 0 -> 449 bytes .../pai-Cert.pem | 12 + .../pai-Key.der | Bin 0 -> 121 bytes .../pai-Key.pem | 5 + .../test_case_vector.json | 9 + .../cd.der | Bin 0 -> 235 bytes .../dac-Cert.der | Bin 0 -> 464 bytes .../dac-Cert.pem | 12 + .../dac-Key.der | Bin 0 -> 121 bytes .../dac-Key.pem | 5 + .../pai-Cert.der | Bin 0 -> 449 bytes .../pai-Cert.pem | 12 + .../pai-Key.der | Bin 0 -> 121 bytes .../pai-Key.pem | 5 + .../test_case_vector.json | 9 + .../cd.der | Bin 0 -> 236 bytes .../dac-Cert.der | Bin 0 -> 463 bytes .../dac-Cert.pem | 12 + .../dac-Key.der | Bin 0 -> 121 bytes .../dac-Key.pem | 5 + .../pai-Cert.der | Bin 0 -> 449 bytes .../pai-Cert.pem | 12 + .../pai-Key.der | Bin 0 -> 121 bytes .../pai-Key.pem | 5 + .../test_case_vector.json | 9 + .../cd.der | Bin 0 -> 236 bytes .../dac-Cert.der | Bin 0 -> 465 bytes .../dac-Cert.pem | 12 + .../dac-Key.der | Bin 0 -> 121 bytes .../dac-Key.pem | 5 + .../pai-Cert.der | Bin 0 -> 449 bytes .../pai-Cert.pem | 12 + .../pai-Key.der | Bin 0 -> 121 bytes .../pai-Key.pem | 5 + .../test_case_vector.json | 9 + .../cd.der | Bin 0 -> 236 bytes .../dac-Cert.der | Bin 0 -> 465 bytes .../dac-Cert.pem | 12 + .../dac-Key.der | Bin 0 -> 121 bytes .../dac-Key.pem | 5 + .../pai-Cert.der | Bin 0 -> 449 bytes .../pai-Cert.pem | 12 + .../pai-Key.der | Bin 0 -> 121 bytes .../pai-Key.pem | 5 + .../test_case_vector.json | 9 + .../cd.der | Bin 0 -> 237 bytes .../dac-Cert.der | Bin 0 -> 466 bytes .../dac-Cert.pem | 12 + .../dac-Key.der | Bin 0 -> 121 bytes .../dac-Key.pem | 5 + .../pai-Cert.der | Bin 0 -> 450 bytes .../pai-Cert.pem | 12 + .../pai-Key.der | Bin 0 -> 121 bytes .../pai-Key.pem | 5 + .../test_case_vector.json | 9 + .../struct_dac_ext_key_usage_missing/cd.der | Bin 0 -> 235 bytes .../dac-Cert.der | Bin 0 -> 450 bytes .../dac-Cert.pem | 12 + .../dac-Key.der | Bin 0 -> 121 bytes .../dac-Key.pem | 5 + .../pai-Cert.der | Bin 0 -> 450 bytes .../pai-Cert.pem | 12 + .../pai-Key.der | Bin 0 -> 121 bytes .../pai-Key.pem | 5 + .../test_case_vector.json | 9 + .../struct_dac_ext_skid_missing/cd.der | Bin 0 -> 236 bytes .../struct_dac_ext_skid_missing/dac-Cert.der | Bin 0 -> 434 bytes .../struct_dac_ext_skid_missing/dac-Cert.pem | 12 + .../struct_dac_ext_skid_missing/dac-Key.der | Bin 0 -> 121 bytes .../struct_dac_ext_skid_missing/dac-Key.pem | 5 + .../struct_dac_ext_skid_missing/pai-Cert.der | Bin 0 -> 449 bytes .../struct_dac_ext_skid_missing/pai-Cert.pem | 12 + .../struct_dac_ext_skid_missing/pai-Key.der | Bin 0 -> 121 bytes .../struct_dac_ext_skid_missing/pai-Key.pem | 5 + .../test_case_vector.json | 9 + .../cd.der | Bin 0 -> 236 bytes .../dac-Cert.der | Bin 0 -> 487 bytes .../dac-Cert.pem | 13 + .../dac-Key.der | Bin 0 -> 121 bytes .../dac-Key.pem | 5 + .../pai-Cert.der | Bin 0 -> 450 bytes .../pai-Cert.pem | 12 + .../pai-Key.der | Bin 0 -> 121 bytes .../pai-Key.pem | 5 + .../test_case_vector.json | 9 + .../cd.der | Bin 0 -> 235 bytes .../dac-Cert.der | Bin 0 -> 463 bytes .../dac-Cert.pem | 12 + .../dac-Key.der | Bin 0 -> 121 bytes .../dac-Key.pem | 5 + .../pai-Cert.der | Bin 0 -> 450 bytes .../pai-Cert.pem | 12 + .../pai-Key.der | Bin 0 -> 121 bytes .../pai-Key.pem | 5 + .../test_case_vector.json | 9 + .../cd.der | Bin 0 -> 236 bytes .../dac-Cert.der | Bin 0 -> 465 bytes .../dac-Cert.pem | 12 + .../dac-Key.der | Bin 0 -> 121 bytes .../dac-Key.pem | 5 + .../pai-Cert.der | Bin 0 -> 449 bytes .../pai-Cert.pem | 12 + .../pai-Key.der | Bin 0 -> 121 bytes .../pai-Key.pem | 5 + .../test_case_vector.json | 9 + .../struct_dac_sig_curve_prime256v1/cd.der | Bin 0 -> 235 bytes .../dac-Cert.der | Bin 0 -> 467 bytes .../dac-Cert.pem | 12 + .../dac-Key.der | Bin 0 -> 121 bytes .../dac-Key.pem | 5 + .../pai-Cert.der | Bin 0 -> 451 bytes .../pai-Cert.pem | 12 + .../pai-Key.der | Bin 0 -> 121 bytes .../pai-Key.pem | 5 + .../test_case_vector.json | 9 + .../struct_dac_sig_curve_secp256k1/cd.der | Bin 0 -> 236 bytes .../dac-Cert.der | Bin 0 -> 464 bytes .../dac-Cert.pem | 12 + .../dac-Key.der | Bin 0 -> 118 bytes .../dac-Key.pem | 5 + .../pai-Cert.der | Bin 0 -> 449 bytes .../pai-Cert.pem | 12 + .../pai-Key.der | Bin 0 -> 121 bytes .../pai-Key.pem | 5 + .../test_case_vector.json | 9 + .../struct_dac_subject_pid_mismatch/cd.der | Bin 0 -> 237 bytes .../dac-Cert.der | Bin 0 -> 466 bytes .../dac-Cert.pem | 12 + .../dac-Key.der | Bin 0 -> 121 bytes .../dac-Key.pem | 5 + .../pai-Cert.der | Bin 0 -> 451 bytes .../pai-Cert.pem | 12 + .../pai-Key.der | Bin 0 -> 121 bytes .../pai-Key.pem | 5 + .../test_case_vector.json | 9 + .../struct_dac_subject_vid_mismatch/cd.der | Bin 0 -> 236 bytes .../dac-Cert.der | Bin 0 -> 466 bytes .../dac-Cert.pem | 12 + .../dac-Key.der | Bin 0 -> 121 bytes .../dac-Key.pem | 5 + .../pai-Cert.der | Bin 0 -> 450 bytes .../pai-Cert.pem | 12 + .../pai-Key.der | Bin 0 -> 121 bytes .../pai-Key.pem | 5 + .../test_case_vector.json | 9 + .../struct_pai_cert_version_v2/cd.der | Bin 0 -> 236 bytes .../struct_pai_cert_version_v2/dac-Cert.der | Bin 0 -> 466 bytes .../struct_pai_cert_version_v2/dac-Cert.pem | 12 + .../struct_pai_cert_version_v2/dac-Key.der | Bin 0 -> 121 bytes .../struct_pai_cert_version_v2/dac-Key.pem | 5 + .../struct_pai_cert_version_v2/pai-Cert.der | Bin 0 -> 449 bytes .../struct_pai_cert_version_v2/pai-Cert.pem | 12 + .../struct_pai_cert_version_v2/pai-Key.der | Bin 0 -> 121 bytes .../struct_pai_cert_version_v2/pai-Key.pem | 5 + .../test_case_vector.json | 9 + .../struct_pai_cert_version_v3/cd.der | Bin 0 -> 236 bytes .../struct_pai_cert_version_v3/dac-Cert.der | Bin 0 -> 466 bytes .../struct_pai_cert_version_v3/dac-Cert.pem | 12 + .../struct_pai_cert_version_v3/dac-Key.der | Bin 0 -> 121 bytes .../struct_pai_cert_version_v3/dac-Key.pem | 5 + .../struct_pai_cert_version_v3/pai-Cert.der | Bin 0 -> 450 bytes .../struct_pai_cert_version_v3/pai-Cert.pem | 12 + .../struct_pai_cert_version_v3/pai-Key.der | Bin 0 -> 121 bytes .../struct_pai_cert_version_v3/pai-Key.pem | 5 + .../test_case_vector.json | 9 + .../struct_pai_ext_akid_missing/cd.der | Bin 0 -> 236 bytes .../struct_pai_ext_akid_missing/dac-Cert.der | Bin 0 -> 467 bytes .../struct_pai_ext_akid_missing/dac-Cert.pem | 12 + .../struct_pai_ext_akid_missing/dac-Key.der | Bin 0 -> 121 bytes .../struct_pai_ext_akid_missing/dac-Key.pem | 5 + .../struct_pai_ext_akid_missing/pai-Cert.der | Bin 0 -> 418 bytes .../struct_pai_ext_akid_missing/pai-Cert.pem | 11 + .../struct_pai_ext_akid_missing/pai-Key.der | Bin 0 -> 121 bytes .../struct_pai_ext_akid_missing/pai-Key.pem | 5 + .../test_case_vector.json | 9 + .../cd.der | Bin 0 -> 237 bytes .../dac-Cert.der | Bin 0 -> 466 bytes .../dac-Cert.pem | 12 + .../dac-Key.der | Bin 0 -> 121 bytes .../dac-Key.pem | 5 + .../pai-Cert.der | Bin 0 -> 505 bytes .../pai-Cert.pem | 13 + .../pai-Key.der | Bin 0 -> 121 bytes .../pai-Key.pem | 5 + .../test_case_vector.json | 9 + .../struct_pai_ext_basic_ca_missing/cd.der | Bin 0 -> 236 bytes .../dac-Cert.der | Bin 0 -> 466 bytes .../dac-Cert.pem | 12 + .../dac-Key.der | Bin 0 -> 121 bytes .../dac-Key.pem | 5 + .../pai-Cert.der | Bin 0 -> 446 bytes .../pai-Cert.pem | 12 + .../pai-Key.der | Bin 0 -> 121 bytes .../pai-Key.pem | 5 + .../test_case_vector.json | 9 + .../struct_pai_ext_basic_ca_wrong/cd.der | Bin 0 -> 236 bytes .../dac-Cert.der | Bin 0 -> 465 bytes .../dac-Cert.pem | 12 + .../struct_pai_ext_basic_ca_wrong/dac-Key.der | Bin 0 -> 121 bytes .../struct_pai_ext_basic_ca_wrong/dac-Key.pem | 5 + .../pai-Cert.der | Bin 0 -> 446 bytes .../pai-Cert.pem | 12 + .../struct_pai_ext_basic_ca_wrong/pai-Key.der | Bin 0 -> 121 bytes .../struct_pai_ext_basic_ca_wrong/pai-Key.pem | 5 + .../test_case_vector.json | 9 + .../cd.der | Bin 0 -> 236 bytes .../dac-Cert.der | Bin 0 -> 466 bytes .../dac-Cert.pem | 12 + .../dac-Key.der | Bin 0 -> 121 bytes .../dac-Key.pem | 5 + .../pai-Cert.der | Bin 0 -> 447 bytes .../pai-Cert.pem | 12 + .../pai-Key.der | Bin 0 -> 121 bytes .../pai-Key.pem | 5 + .../test_case_vector.json | 9 + .../cd.der | Bin 0 -> 236 bytes .../dac-Cert.der | Bin 0 -> 466 bytes .../dac-Cert.pem | 12 + .../dac-Key.der | Bin 0 -> 121 bytes .../dac-Key.pem | 5 + .../pai-Cert.der | Bin 0 -> 446 bytes .../pai-Cert.pem | 12 + .../pai-Key.der | Bin 0 -> 121 bytes .../pai-Key.pem | 5 + .../test_case_vector.json | 9 + .../struct_pai_ext_basic_missing/cd.der | Bin 0 -> 237 bytes .../struct_pai_ext_basic_missing/dac-Cert.der | Bin 0 -> 466 bytes .../struct_pai_ext_basic_missing/dac-Cert.pem | 12 + .../struct_pai_ext_basic_missing/dac-Key.der | Bin 0 -> 121 bytes .../struct_pai_ext_basic_missing/dac-Key.pem | 5 + .../struct_pai_ext_basic_missing/pai-Cert.der | Bin 0 -> 430 bytes .../struct_pai_ext_basic_missing/pai-Cert.pem | 11 + .../struct_pai_ext_basic_missing/pai-Key.der | Bin 0 -> 121 bytes .../struct_pai_ext_basic_missing/pai-Key.pem | 5 + .../test_case_vector.json | 9 + .../struct_pai_ext_basic_pathlen0/cd.der | Bin 0 -> 235 bytes .../dac-Cert.der | Bin 0 -> 465 bytes .../dac-Cert.pem | 12 + .../struct_pai_ext_basic_pathlen0/dac-Key.der | Bin 0 -> 121 bytes .../struct_pai_ext_basic_pathlen0/dac-Key.pem | 5 + .../pai-Cert.der | Bin 0 -> 450 bytes .../pai-Cert.pem | 12 + .../struct_pai_ext_basic_pathlen0/pai-Key.der | Bin 0 -> 121 bytes .../struct_pai_ext_basic_pathlen0/pai-Key.pem | 5 + .../test_case_vector.json | 9 + .../struct_pai_ext_basic_pathlen1/cd.der | Bin 0 -> 236 bytes .../dac-Cert.der | Bin 0 -> 466 bytes .../dac-Cert.pem | 12 + .../struct_pai_ext_basic_pathlen1/dac-Key.der | Bin 0 -> 121 bytes .../struct_pai_ext_basic_pathlen1/dac-Key.pem | 5 + .../pai-Cert.der | Bin 0 -> 450 bytes .../pai-Cert.pem | 12 + .../struct_pai_ext_basic_pathlen1/pai-Key.der | Bin 0 -> 121 bytes .../struct_pai_ext_basic_pathlen1/pai-Key.pem | 5 + .../test_case_vector.json | 9 + .../struct_pai_ext_basic_pathlen2/cd.der | Bin 0 -> 236 bytes .../dac-Cert.der | Bin 0 -> 466 bytes .../dac-Cert.pem | 12 + .../struct_pai_ext_basic_pathlen2/dac-Key.der | Bin 0 -> 121 bytes .../struct_pai_ext_basic_pathlen2/dac-Key.pem | 5 + .../pai-Cert.der | Bin 0 -> 450 bytes .../pai-Cert.pem | 12 + .../struct_pai_ext_basic_pathlen2/pai-Key.der | Bin 0 -> 121 bytes .../struct_pai_ext_basic_pathlen2/pai-Key.pem | 5 + .../test_case_vector.json | 9 + .../cd.der | Bin 0 -> 235 bytes .../dac-Cert.der | Bin 0 -> 466 bytes .../dac-Cert.pem | 12 + .../dac-Key.der | Bin 0 -> 121 bytes .../dac-Key.pem | 5 + .../pai-Cert.der | Bin 0 -> 448 bytes .../pai-Cert.pem | 12 + .../pai-Key.der | Bin 0 -> 121 bytes .../pai-Key.pem | 5 + .../test_case_vector.json | 9 + .../cd.der | Bin 0 -> 236 bytes .../dac-Cert.der | Bin 0 -> 466 bytes .../dac-Cert.pem | 12 + .../dac-Key.der | Bin 0 -> 121 bytes .../dac-Key.pem | 5 + .../pai-Cert.der | Bin 0 -> 486 bytes .../pai-Cert.pem | 13 + .../pai-Key.der | Bin 0 -> 121 bytes .../pai-Key.pem | 5 + .../test_case_vector.json | 9 + .../cd.der | Bin 0 -> 235 bytes .../dac-Cert.der | Bin 0 -> 467 bytes .../dac-Cert.pem | 12 + .../dac-Key.der | Bin 0 -> 121 bytes .../dac-Key.pem | 5 + .../pai-Cert.der | Bin 0 -> 446 bytes .../pai-Cert.pem | 12 + .../pai-Key.der | Bin 0 -> 121 bytes .../pai-Key.pem | 5 + .../test_case_vector.json | 9 + .../cd.der | Bin 0 -> 235 bytes .../dac-Cert.der | Bin 0 -> 466 bytes .../dac-Cert.pem | 12 + .../dac-Key.der | Bin 0 -> 121 bytes .../dac-Key.pem | 5 + .../pai-Cert.der | Bin 0 -> 447 bytes .../pai-Cert.pem | 12 + .../pai-Key.der | Bin 0 -> 121 bytes .../pai-Key.pem | 5 + .../test_case_vector.json | 9 + .../cd.der | Bin 0 -> 237 bytes .../dac-Cert.der | Bin 0 -> 467 bytes .../dac-Cert.pem | 12 + .../dac-Key.der | Bin 0 -> 121 bytes .../dac-Key.pem | 5 + .../pai-Cert.der | Bin 0 -> 450 bytes .../pai-Cert.pem | 12 + .../pai-Key.der | Bin 0 -> 121 bytes .../pai-Key.pem | 5 + .../test_case_vector.json | 9 + .../cd.der | Bin 0 -> 237 bytes .../dac-Cert.der | Bin 0 -> 466 bytes .../dac-Cert.pem | 12 + .../dac-Key.der | Bin 0 -> 121 bytes .../dac-Key.pem | 5 + .../pai-Cert.der | Bin 0 -> 449 bytes .../pai-Cert.pem | 12 + .../pai-Key.der | Bin 0 -> 121 bytes .../pai-Key.pem | 5 + .../test_case_vector.json | 9 + .../cd.der | Bin 0 -> 236 bytes .../dac-Cert.der | Bin 0 -> 466 bytes .../dac-Cert.pem | 12 + .../dac-Key.der | Bin 0 -> 121 bytes .../dac-Key.pem | 5 + .../pai-Cert.der | Bin 0 -> 450 bytes .../pai-Cert.pem | 12 + .../pai-Key.der | Bin 0 -> 121 bytes .../pai-Key.pem | 5 + .../test_case_vector.json | 9 + .../struct_pai_ext_key_usage_missing/cd.der | Bin 0 -> 236 bytes .../dac-Cert.der | Bin 0 -> 466 bytes .../dac-Cert.pem | 12 + .../dac-Key.der | Bin 0 -> 121 bytes .../dac-Key.pem | 5 + .../pai-Cert.der | Bin 0 -> 433 bytes .../pai-Cert.pem | 12 + .../pai-Key.der | Bin 0 -> 121 bytes .../pai-Key.pem | 5 + .../test_case_vector.json | 9 + .../struct_pai_ext_skid_missing/cd.der | Bin 0 -> 235 bytes .../struct_pai_ext_skid_missing/dac-Cert.der | Bin 0 -> 432 bytes .../struct_pai_ext_skid_missing/dac-Cert.pem | 11 + .../struct_pai_ext_skid_missing/dac-Key.der | Bin 0 -> 121 bytes .../struct_pai_ext_skid_missing/dac-Key.pem | 5 + .../struct_pai_ext_skid_missing/pai-Cert.der | Bin 0 -> 418 bytes .../struct_pai_ext_skid_missing/pai-Cert.pem | 11 + .../struct_pai_ext_skid_missing/pai-Key.der | Bin 0 -> 121 bytes .../struct_pai_ext_skid_missing/pai-Key.pem | 5 + .../test_case_vector.json | 9 + .../cd.der | Bin 0 -> 236 bytes .../dac-Cert.der | Bin 0 -> 465 bytes .../dac-Cert.pem | 12 + .../dac-Key.der | Bin 0 -> 121 bytes .../dac-Key.pem | 5 + .../pai-Cert.der | Bin 0 -> 470 bytes .../pai-Cert.pem | 12 + .../pai-Key.der | Bin 0 -> 121 bytes .../pai-Key.pem | 5 + .../test_case_vector.json | 9 + .../cd.der | Bin 0 -> 237 bytes .../dac-Cert.der | Bin 0 -> 466 bytes .../dac-Cert.pem | 12 + .../dac-Key.der | Bin 0 -> 121 bytes .../dac-Key.pem | 5 + .../pai-Cert.der | Bin 0 -> 447 bytes .../pai-Cert.pem | 12 + .../pai-Key.der | Bin 0 -> 121 bytes .../pai-Key.pem | 5 + .../test_case_vector.json | 9 + .../cd.der | Bin 0 -> 235 bytes .../dac-Cert.der | Bin 0 -> 465 bytes .../dac-Cert.pem | 12 + .../dac-Key.der | Bin 0 -> 121 bytes .../dac-Key.pem | 5 + .../pai-Cert.der | Bin 0 -> 450 bytes .../pai-Cert.pem | 12 + .../pai-Key.der | Bin 0 -> 121 bytes .../pai-Key.pem | 5 + .../test_case_vector.json | 9 + .../struct_pai_sig_curve_prime256v1/cd.der | Bin 0 -> 235 bytes .../dac-Cert.der | Bin 0 -> 466 bytes .../dac-Cert.pem | 12 + .../dac-Key.der | Bin 0 -> 121 bytes .../dac-Key.pem | 5 + .../pai-Cert.der | Bin 0 -> 449 bytes .../pai-Cert.pem | 12 + .../pai-Key.der | Bin 0 -> 121 bytes .../pai-Key.pem | 5 + .../test_case_vector.json | 9 + .../struct_pai_sig_curve_secp256k1/cd.der | Bin 0 -> 236 bytes .../dac-Cert.der | Bin 0 -> 466 bytes .../dac-Cert.pem | 12 + .../dac-Key.der | Bin 0 -> 121 bytes .../dac-Key.pem | 5 + .../pai-Cert.der | Bin 0 -> 446 bytes .../pai-Cert.pem | 12 + .../pai-Key.der | Bin 0 -> 118 bytes .../pai-Key.pem | 5 + .../test_case_vector.json | 9 + .../struct_pai_subject_pid_mismatch/cd.der | Bin 0 -> 237 bytes .../dac-Cert.der | Bin 0 -> 466 bytes .../dac-Cert.pem | 12 + .../dac-Key.der | Bin 0 -> 121 bytes .../dac-Key.pem | 5 + .../pai-Cert.der | Bin 0 -> 451 bytes .../pai-Cert.pem | 12 + .../pai-Key.der | Bin 0 -> 121 bytes .../pai-Key.pem | 5 + .../test_case_vector.json | 9 + .../struct_pai_subject_vid_mismatch/cd.der | Bin 0 -> 235 bytes .../dac-Cert.der | Bin 0 -> 465 bytes .../dac-Cert.pem | 12 + .../dac-Key.der | Bin 0 -> 121 bytes .../dac-Key.pem | 5 + .../pai-Cert.der | Bin 0 -> 451 bytes .../pai-Cert.pem | 12 + .../pai-Key.der | Bin 0 -> 121 bytes .../pai-Key.pem | 5 + .../test_case_vector.json | 9 + src/tools/chip-cert/CertUtils.cpp | 161 +++++-- src/tools/chip-cert/Cmd_GenAttCert.cpp | 227 +++++++++- src/tools/chip-cert/KeyUtils.cpp | 26 +- src/tools/chip-cert/chip-cert.h | 143 ++++++- .../chip-cert/gen_com_dut_test_vectors.py | 392 ++++++++++++++++++ 565 files changed, 3303 insertions(+), 55 deletions(-) create mode 100644 credentials/development/commissioner_dut/struct_dac_cert_version_v2/cd.der create mode 100644 credentials/development/commissioner_dut/struct_dac_cert_version_v2/dac-Cert.der create mode 100644 credentials/development/commissioner_dut/struct_dac_cert_version_v2/dac-Cert.pem create mode 100644 credentials/development/commissioner_dut/struct_dac_cert_version_v2/dac-Key.der create mode 100644 credentials/development/commissioner_dut/struct_dac_cert_version_v2/dac-Key.pem create mode 100644 credentials/development/commissioner_dut/struct_dac_cert_version_v2/pai-Cert.der create mode 100644 credentials/development/commissioner_dut/struct_dac_cert_version_v2/pai-Cert.pem create mode 100644 credentials/development/commissioner_dut/struct_dac_cert_version_v2/pai-Key.der create mode 100644 credentials/development/commissioner_dut/struct_dac_cert_version_v2/pai-Key.pem create mode 100644 credentials/development/commissioner_dut/struct_dac_cert_version_v2/test_case_vector.json create mode 100644 credentials/development/commissioner_dut/struct_dac_cert_version_v3/cd.der create mode 100644 credentials/development/commissioner_dut/struct_dac_cert_version_v3/dac-Cert.der create mode 100644 credentials/development/commissioner_dut/struct_dac_cert_version_v3/dac-Cert.pem create mode 100644 credentials/development/commissioner_dut/struct_dac_cert_version_v3/dac-Key.der create mode 100644 credentials/development/commissioner_dut/struct_dac_cert_version_v3/dac-Key.pem create mode 100644 credentials/development/commissioner_dut/struct_dac_cert_version_v3/pai-Cert.der create mode 100644 credentials/development/commissioner_dut/struct_dac_cert_version_v3/pai-Cert.pem create mode 100644 credentials/development/commissioner_dut/struct_dac_cert_version_v3/pai-Key.der create mode 100644 credentials/development/commissioner_dut/struct_dac_cert_version_v3/pai-Key.pem create mode 100644 credentials/development/commissioner_dut/struct_dac_cert_version_v3/test_case_vector.json create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_akid_missing/cd.der create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_akid_missing/dac-Cert.der create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_akid_missing/dac-Cert.pem create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_akid_missing/dac-Key.der create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_akid_missing/dac-Key.pem create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_akid_missing/pai-Cert.der create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_akid_missing/pai-Cert.pem create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_akid_missing/pai-Key.der create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_akid_missing/pai-Key.pem create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_akid_missing/test_case_vector.json create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_authority_info_access_present/cd.der create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_authority_info_access_present/dac-Cert.der create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_authority_info_access_present/dac-Cert.pem create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_authority_info_access_present/dac-Key.der create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_authority_info_access_present/dac-Key.pem create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_authority_info_access_present/pai-Cert.der create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_authority_info_access_present/pai-Cert.pem create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_authority_info_access_present/pai-Key.der create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_authority_info_access_present/pai-Key.pem create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_authority_info_access_present/test_case_vector.json create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_basic_ca_missing/cd.der create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_basic_ca_missing/dac-Cert.der create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_basic_ca_missing/dac-Cert.pem create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_basic_ca_missing/dac-Key.der create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_basic_ca_missing/dac-Key.pem create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_basic_ca_missing/pai-Cert.der create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_basic_ca_missing/pai-Cert.pem create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_basic_ca_missing/pai-Key.der create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_basic_ca_missing/pai-Key.pem create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_basic_ca_missing/test_case_vector.json create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_basic_ca_wrong/cd.der create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_basic_ca_wrong/dac-Cert.der create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_basic_ca_wrong/dac-Cert.pem create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_basic_ca_wrong/dac-Key.der create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_basic_ca_wrong/dac-Key.pem create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_basic_ca_wrong/pai-Cert.der create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_basic_ca_wrong/pai-Cert.pem create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_basic_ca_wrong/pai-Key.der create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_basic_ca_wrong/pai-Key.pem create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_basic_ca_wrong/test_case_vector.json create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_basic_critical_missing/cd.der create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_basic_critical_missing/dac-Cert.der create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_basic_critical_missing/dac-Cert.pem create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_basic_critical_missing/dac-Key.der create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_basic_critical_missing/dac-Key.pem create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_basic_critical_missing/pai-Cert.der create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_basic_critical_missing/pai-Cert.pem create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_basic_critical_missing/pai-Key.der create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_basic_critical_missing/pai-Key.pem create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_basic_critical_missing/test_case_vector.json create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_basic_critical_wrong/cd.der create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_basic_critical_wrong/dac-Cert.der create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_basic_critical_wrong/dac-Cert.pem create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_basic_critical_wrong/dac-Key.der create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_basic_critical_wrong/dac-Key.pem create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_basic_critical_wrong/pai-Cert.der create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_basic_critical_wrong/pai-Cert.pem create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_basic_critical_wrong/pai-Key.der create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_basic_critical_wrong/pai-Key.pem create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_basic_critical_wrong/test_case_vector.json create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_basic_missing/cd.der create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_basic_missing/dac-Cert.der create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_basic_missing/dac-Cert.pem create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_basic_missing/dac-Key.der create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_basic_missing/dac-Key.pem create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_basic_missing/pai-Cert.der create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_basic_missing/pai-Cert.pem create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_basic_missing/pai-Key.der create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_basic_missing/pai-Key.pem create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_basic_missing/test_case_vector.json create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_basic_pathlen0/cd.der create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_basic_pathlen0/dac-Cert.der create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_basic_pathlen0/dac-Cert.pem create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_basic_pathlen0/dac-Key.der create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_basic_pathlen0/dac-Key.pem create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_basic_pathlen0/pai-Cert.der create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_basic_pathlen0/pai-Cert.pem create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_basic_pathlen0/pai-Key.der create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_basic_pathlen0/pai-Key.pem create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_basic_pathlen0/test_case_vector.json create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_basic_pathlen1/cd.der create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_basic_pathlen1/dac-Cert.der create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_basic_pathlen1/dac-Cert.pem create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_basic_pathlen1/dac-Key.der create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_basic_pathlen1/dac-Key.pem create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_basic_pathlen1/pai-Cert.der create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_basic_pathlen1/pai-Cert.pem create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_basic_pathlen1/pai-Key.der create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_basic_pathlen1/pai-Key.pem create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_basic_pathlen1/test_case_vector.json create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_basic_pathlen2/cd.der create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_basic_pathlen2/dac-Cert.der create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_basic_pathlen2/dac-Cert.pem create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_basic_pathlen2/dac-Key.der create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_basic_pathlen2/dac-Key.pem create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_basic_pathlen2/pai-Cert.der create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_basic_pathlen2/pai-Cert.pem create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_basic_pathlen2/pai-Key.der create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_basic_pathlen2/pai-Key.pem create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_basic_pathlen2/test_case_vector.json create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_basic_pathlen_presence_wrong/cd.der create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_basic_pathlen_presence_wrong/dac-Cert.der create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_basic_pathlen_presence_wrong/dac-Cert.pem create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_basic_pathlen_presence_wrong/dac-Key.der create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_basic_pathlen_presence_wrong/dac-Key.pem create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_basic_pathlen_presence_wrong/pai-Cert.der create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_basic_pathlen_presence_wrong/pai-Cert.pem create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_basic_pathlen_presence_wrong/pai-Key.der create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_basic_pathlen_presence_wrong/pai-Key.pem create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_basic_pathlen_presence_wrong/test_case_vector.json create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_extended_key_usage_present/cd.der create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_extended_key_usage_present/dac-Cert.der create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_extended_key_usage_present/dac-Cert.pem create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_extended_key_usage_present/dac-Key.der create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_extended_key_usage_present/dac-Key.pem create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_extended_key_usage_present/pai-Cert.der create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_extended_key_usage_present/pai-Cert.pem create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_extended_key_usage_present/pai-Key.der create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_extended_key_usage_present/pai-Key.pem create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_extended_key_usage_present/test_case_vector.json create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_key_usage_critical_missing/cd.der create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_key_usage_critical_missing/dac-Cert.der create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_key_usage_critical_missing/dac-Cert.pem create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_key_usage_critical_missing/dac-Key.der create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_key_usage_critical_missing/dac-Key.pem create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_key_usage_critical_missing/pai-Cert.der create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_key_usage_critical_missing/pai-Cert.pem create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_key_usage_critical_missing/pai-Key.der create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_key_usage_critical_missing/pai-Key.pem create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_key_usage_critical_missing/test_case_vector.json create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_key_usage_critical_wrong/cd.der create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_key_usage_critical_wrong/dac-Cert.der create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_key_usage_critical_wrong/dac-Cert.pem create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_key_usage_critical_wrong/dac-Key.der create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_key_usage_critical_wrong/dac-Key.pem create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_key_usage_critical_wrong/pai-Cert.der create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_key_usage_critical_wrong/pai-Cert.pem create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_key_usage_critical_wrong/pai-Key.der create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_key_usage_critical_wrong/pai-Key.pem create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_key_usage_critical_wrong/test_case_vector.json create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_key_usage_crl_sign_wrong/cd.der create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_key_usage_crl_sign_wrong/dac-Cert.der create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_key_usage_crl_sign_wrong/dac-Cert.pem create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_key_usage_crl_sign_wrong/dac-Key.der create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_key_usage_crl_sign_wrong/dac-Key.pem create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_key_usage_crl_sign_wrong/pai-Cert.der create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_key_usage_crl_sign_wrong/pai-Cert.pem create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_key_usage_crl_sign_wrong/pai-Key.der create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_key_usage_crl_sign_wrong/pai-Key.pem create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_key_usage_crl_sign_wrong/test_case_vector.json create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_key_usage_dig_sig_wrong/cd.der create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_key_usage_dig_sig_wrong/dac-Cert.der create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_key_usage_dig_sig_wrong/dac-Cert.pem create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_key_usage_dig_sig_wrong/dac-Key.der create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_key_usage_dig_sig_wrong/dac-Key.pem create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_key_usage_dig_sig_wrong/pai-Cert.der create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_key_usage_dig_sig_wrong/pai-Cert.pem create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_key_usage_dig_sig_wrong/pai-Key.der create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_key_usage_dig_sig_wrong/pai-Key.pem create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_key_usage_dig_sig_wrong/test_case_vector.json create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_key_usage_key_cert_sign_wrong/cd.der create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_key_usage_key_cert_sign_wrong/dac-Cert.der create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_key_usage_key_cert_sign_wrong/dac-Cert.pem create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_key_usage_key_cert_sign_wrong/dac-Key.der create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_key_usage_key_cert_sign_wrong/dac-Key.pem create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_key_usage_key_cert_sign_wrong/pai-Cert.der create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_key_usage_key_cert_sign_wrong/pai-Cert.pem create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_key_usage_key_cert_sign_wrong/pai-Key.der create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_key_usage_key_cert_sign_wrong/pai-Key.pem create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_key_usage_key_cert_sign_wrong/test_case_vector.json create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_key_usage_missing/cd.der create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_key_usage_missing/dac-Cert.der create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_key_usage_missing/dac-Cert.pem create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_key_usage_missing/dac-Key.der create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_key_usage_missing/dac-Key.pem create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_key_usage_missing/pai-Cert.der create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_key_usage_missing/pai-Cert.pem create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_key_usage_missing/pai-Key.der create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_key_usage_missing/pai-Key.pem create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_key_usage_missing/test_case_vector.json create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_skid_missing/cd.der create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_skid_missing/dac-Cert.der create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_skid_missing/dac-Cert.pem create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_skid_missing/dac-Key.der create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_skid_missing/dac-Key.pem create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_skid_missing/pai-Cert.der create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_skid_missing/pai-Cert.pem create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_skid_missing/pai-Key.der create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_skid_missing/pai-Key.pem create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_skid_missing/test_case_vector.json create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_subject_alt_name_present/cd.der create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_subject_alt_name_present/dac-Cert.der create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_subject_alt_name_present/dac-Cert.pem create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_subject_alt_name_present/dac-Key.der create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_subject_alt_name_present/dac-Key.pem create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_subject_alt_name_present/pai-Cert.der create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_subject_alt_name_present/pai-Cert.pem create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_subject_alt_name_present/pai-Key.der create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_subject_alt_name_present/pai-Key.pem create mode 100644 credentials/development/commissioner_dut/struct_dac_ext_subject_alt_name_present/test_case_vector.json create mode 100644 credentials/development/commissioner_dut/struct_dac_sig_algo_ecdsa_with_sha1/cd.der create mode 100644 credentials/development/commissioner_dut/struct_dac_sig_algo_ecdsa_with_sha1/dac-Cert.der create mode 100644 credentials/development/commissioner_dut/struct_dac_sig_algo_ecdsa_with_sha1/dac-Cert.pem create mode 100644 credentials/development/commissioner_dut/struct_dac_sig_algo_ecdsa_with_sha1/dac-Key.der create mode 100644 credentials/development/commissioner_dut/struct_dac_sig_algo_ecdsa_with_sha1/dac-Key.pem create mode 100644 credentials/development/commissioner_dut/struct_dac_sig_algo_ecdsa_with_sha1/pai-Cert.der create mode 100644 credentials/development/commissioner_dut/struct_dac_sig_algo_ecdsa_with_sha1/pai-Cert.pem create mode 100644 credentials/development/commissioner_dut/struct_dac_sig_algo_ecdsa_with_sha1/pai-Key.der create mode 100644 credentials/development/commissioner_dut/struct_dac_sig_algo_ecdsa_with_sha1/pai-Key.pem create mode 100644 credentials/development/commissioner_dut/struct_dac_sig_algo_ecdsa_with_sha1/test_case_vector.json create mode 100644 credentials/development/commissioner_dut/struct_dac_sig_algo_ecdsa_with_sha256/cd.der create mode 100644 credentials/development/commissioner_dut/struct_dac_sig_algo_ecdsa_with_sha256/dac-Cert.der create mode 100644 credentials/development/commissioner_dut/struct_dac_sig_algo_ecdsa_with_sha256/dac-Cert.pem create mode 100644 credentials/development/commissioner_dut/struct_dac_sig_algo_ecdsa_with_sha256/dac-Key.der create mode 100644 credentials/development/commissioner_dut/struct_dac_sig_algo_ecdsa_with_sha256/dac-Key.pem create mode 100644 credentials/development/commissioner_dut/struct_dac_sig_algo_ecdsa_with_sha256/pai-Cert.der create mode 100644 credentials/development/commissioner_dut/struct_dac_sig_algo_ecdsa_with_sha256/pai-Cert.pem create mode 100644 credentials/development/commissioner_dut/struct_dac_sig_algo_ecdsa_with_sha256/pai-Key.der create mode 100644 credentials/development/commissioner_dut/struct_dac_sig_algo_ecdsa_with_sha256/pai-Key.pem create mode 100644 credentials/development/commissioner_dut/struct_dac_sig_algo_ecdsa_with_sha256/test_case_vector.json create mode 100644 credentials/development/commissioner_dut/struct_dac_sig_curve_prime256v1/cd.der create mode 100644 credentials/development/commissioner_dut/struct_dac_sig_curve_prime256v1/dac-Cert.der create mode 100644 credentials/development/commissioner_dut/struct_dac_sig_curve_prime256v1/dac-Cert.pem create mode 100644 credentials/development/commissioner_dut/struct_dac_sig_curve_prime256v1/dac-Key.der create mode 100644 credentials/development/commissioner_dut/struct_dac_sig_curve_prime256v1/dac-Key.pem create mode 100644 credentials/development/commissioner_dut/struct_dac_sig_curve_prime256v1/pai-Cert.der create mode 100644 credentials/development/commissioner_dut/struct_dac_sig_curve_prime256v1/pai-Cert.pem create mode 100644 credentials/development/commissioner_dut/struct_dac_sig_curve_prime256v1/pai-Key.der create mode 100644 credentials/development/commissioner_dut/struct_dac_sig_curve_prime256v1/pai-Key.pem create mode 100644 credentials/development/commissioner_dut/struct_dac_sig_curve_prime256v1/test_case_vector.json create mode 100644 credentials/development/commissioner_dut/struct_dac_sig_curve_secp256k1/cd.der create mode 100644 credentials/development/commissioner_dut/struct_dac_sig_curve_secp256k1/dac-Cert.der create mode 100644 credentials/development/commissioner_dut/struct_dac_sig_curve_secp256k1/dac-Cert.pem create mode 100644 credentials/development/commissioner_dut/struct_dac_sig_curve_secp256k1/dac-Key.der create mode 100644 credentials/development/commissioner_dut/struct_dac_sig_curve_secp256k1/dac-Key.pem create mode 100644 credentials/development/commissioner_dut/struct_dac_sig_curve_secp256k1/pai-Cert.der create mode 100644 credentials/development/commissioner_dut/struct_dac_sig_curve_secp256k1/pai-Cert.pem create mode 100644 credentials/development/commissioner_dut/struct_dac_sig_curve_secp256k1/pai-Key.der create mode 100644 credentials/development/commissioner_dut/struct_dac_sig_curve_secp256k1/pai-Key.pem create mode 100644 credentials/development/commissioner_dut/struct_dac_sig_curve_secp256k1/test_case_vector.json create mode 100644 credentials/development/commissioner_dut/struct_dac_subject_pid_mismatch/cd.der create mode 100644 credentials/development/commissioner_dut/struct_dac_subject_pid_mismatch/dac-Cert.der create mode 100644 credentials/development/commissioner_dut/struct_dac_subject_pid_mismatch/dac-Cert.pem create mode 100644 credentials/development/commissioner_dut/struct_dac_subject_pid_mismatch/dac-Key.der create mode 100644 credentials/development/commissioner_dut/struct_dac_subject_pid_mismatch/dac-Key.pem create mode 100644 credentials/development/commissioner_dut/struct_dac_subject_pid_mismatch/pai-Cert.der create mode 100644 credentials/development/commissioner_dut/struct_dac_subject_pid_mismatch/pai-Cert.pem create mode 100644 credentials/development/commissioner_dut/struct_dac_subject_pid_mismatch/pai-Key.der create mode 100644 credentials/development/commissioner_dut/struct_dac_subject_pid_mismatch/pai-Key.pem create mode 100644 credentials/development/commissioner_dut/struct_dac_subject_pid_mismatch/test_case_vector.json create mode 100644 credentials/development/commissioner_dut/struct_dac_subject_vid_mismatch/cd.der create mode 100644 credentials/development/commissioner_dut/struct_dac_subject_vid_mismatch/dac-Cert.der create mode 100644 credentials/development/commissioner_dut/struct_dac_subject_vid_mismatch/dac-Cert.pem create mode 100644 credentials/development/commissioner_dut/struct_dac_subject_vid_mismatch/dac-Key.der create mode 100644 credentials/development/commissioner_dut/struct_dac_subject_vid_mismatch/dac-Key.pem create mode 100644 credentials/development/commissioner_dut/struct_dac_subject_vid_mismatch/pai-Cert.der create mode 100644 credentials/development/commissioner_dut/struct_dac_subject_vid_mismatch/pai-Cert.pem create mode 100644 credentials/development/commissioner_dut/struct_dac_subject_vid_mismatch/pai-Key.der create mode 100644 credentials/development/commissioner_dut/struct_dac_subject_vid_mismatch/pai-Key.pem create mode 100644 credentials/development/commissioner_dut/struct_dac_subject_vid_mismatch/test_case_vector.json create mode 100644 credentials/development/commissioner_dut/struct_pai_cert_version_v2/cd.der create mode 100644 credentials/development/commissioner_dut/struct_pai_cert_version_v2/dac-Cert.der create mode 100644 credentials/development/commissioner_dut/struct_pai_cert_version_v2/dac-Cert.pem create mode 100644 credentials/development/commissioner_dut/struct_pai_cert_version_v2/dac-Key.der create mode 100644 credentials/development/commissioner_dut/struct_pai_cert_version_v2/dac-Key.pem create mode 100644 credentials/development/commissioner_dut/struct_pai_cert_version_v2/pai-Cert.der create mode 100644 credentials/development/commissioner_dut/struct_pai_cert_version_v2/pai-Cert.pem create mode 100644 credentials/development/commissioner_dut/struct_pai_cert_version_v2/pai-Key.der create mode 100644 credentials/development/commissioner_dut/struct_pai_cert_version_v2/pai-Key.pem create mode 100644 credentials/development/commissioner_dut/struct_pai_cert_version_v2/test_case_vector.json create mode 100644 credentials/development/commissioner_dut/struct_pai_cert_version_v3/cd.der create mode 100644 credentials/development/commissioner_dut/struct_pai_cert_version_v3/dac-Cert.der create mode 100644 credentials/development/commissioner_dut/struct_pai_cert_version_v3/dac-Cert.pem create mode 100644 credentials/development/commissioner_dut/struct_pai_cert_version_v3/dac-Key.der create mode 100644 credentials/development/commissioner_dut/struct_pai_cert_version_v3/dac-Key.pem create mode 100644 credentials/development/commissioner_dut/struct_pai_cert_version_v3/pai-Cert.der create mode 100644 credentials/development/commissioner_dut/struct_pai_cert_version_v3/pai-Cert.pem create mode 100644 credentials/development/commissioner_dut/struct_pai_cert_version_v3/pai-Key.der create mode 100644 credentials/development/commissioner_dut/struct_pai_cert_version_v3/pai-Key.pem create mode 100644 credentials/development/commissioner_dut/struct_pai_cert_version_v3/test_case_vector.json create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_akid_missing/cd.der create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_akid_missing/dac-Cert.der create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_akid_missing/dac-Cert.pem create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_akid_missing/dac-Key.der create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_akid_missing/dac-Key.pem create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_akid_missing/pai-Cert.der create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_akid_missing/pai-Cert.pem create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_akid_missing/pai-Key.der create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_akid_missing/pai-Key.pem create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_akid_missing/test_case_vector.json create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_authority_info_access_present/cd.der create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_authority_info_access_present/dac-Cert.der create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_authority_info_access_present/dac-Cert.pem create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_authority_info_access_present/dac-Key.der create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_authority_info_access_present/dac-Key.pem create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_authority_info_access_present/pai-Cert.der create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_authority_info_access_present/pai-Cert.pem create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_authority_info_access_present/pai-Key.der create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_authority_info_access_present/pai-Key.pem create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_authority_info_access_present/test_case_vector.json create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_basic_ca_missing/cd.der create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_basic_ca_missing/dac-Cert.der create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_basic_ca_missing/dac-Cert.pem create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_basic_ca_missing/dac-Key.der create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_basic_ca_missing/dac-Key.pem create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_basic_ca_missing/pai-Cert.der create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_basic_ca_missing/pai-Cert.pem create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_basic_ca_missing/pai-Key.der create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_basic_ca_missing/pai-Key.pem create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_basic_ca_missing/test_case_vector.json create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_basic_ca_wrong/cd.der create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_basic_ca_wrong/dac-Cert.der create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_basic_ca_wrong/dac-Cert.pem create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_basic_ca_wrong/dac-Key.der create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_basic_ca_wrong/dac-Key.pem create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_basic_ca_wrong/pai-Cert.der create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_basic_ca_wrong/pai-Cert.pem create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_basic_ca_wrong/pai-Key.der create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_basic_ca_wrong/pai-Key.pem create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_basic_ca_wrong/test_case_vector.json create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_basic_critical_missing/cd.der create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_basic_critical_missing/dac-Cert.der create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_basic_critical_missing/dac-Cert.pem create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_basic_critical_missing/dac-Key.der create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_basic_critical_missing/dac-Key.pem create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_basic_critical_missing/pai-Cert.der create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_basic_critical_missing/pai-Cert.pem create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_basic_critical_missing/pai-Key.der create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_basic_critical_missing/pai-Key.pem create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_basic_critical_missing/test_case_vector.json create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_basic_critical_wrong/cd.der create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_basic_critical_wrong/dac-Cert.der create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_basic_critical_wrong/dac-Cert.pem create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_basic_critical_wrong/dac-Key.der create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_basic_critical_wrong/dac-Key.pem create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_basic_critical_wrong/pai-Cert.der create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_basic_critical_wrong/pai-Cert.pem create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_basic_critical_wrong/pai-Key.der create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_basic_critical_wrong/pai-Key.pem create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_basic_critical_wrong/test_case_vector.json create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_basic_missing/cd.der create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_basic_missing/dac-Cert.der create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_basic_missing/dac-Cert.pem create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_basic_missing/dac-Key.der create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_basic_missing/dac-Key.pem create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_basic_missing/pai-Cert.der create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_basic_missing/pai-Cert.pem create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_basic_missing/pai-Key.der create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_basic_missing/pai-Key.pem create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_basic_missing/test_case_vector.json create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_basic_pathlen0/cd.der create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_basic_pathlen0/dac-Cert.der create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_basic_pathlen0/dac-Cert.pem create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_basic_pathlen0/dac-Key.der create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_basic_pathlen0/dac-Key.pem create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_basic_pathlen0/pai-Cert.der create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_basic_pathlen0/pai-Cert.pem create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_basic_pathlen0/pai-Key.der create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_basic_pathlen0/pai-Key.pem create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_basic_pathlen0/test_case_vector.json create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_basic_pathlen1/cd.der create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_basic_pathlen1/dac-Cert.der create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_basic_pathlen1/dac-Cert.pem create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_basic_pathlen1/dac-Key.der create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_basic_pathlen1/dac-Key.pem create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_basic_pathlen1/pai-Cert.der create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_basic_pathlen1/pai-Cert.pem create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_basic_pathlen1/pai-Key.der create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_basic_pathlen1/pai-Key.pem create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_basic_pathlen1/test_case_vector.json create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_basic_pathlen2/cd.der create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_basic_pathlen2/dac-Cert.der create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_basic_pathlen2/dac-Cert.pem create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_basic_pathlen2/dac-Key.der create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_basic_pathlen2/dac-Key.pem create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_basic_pathlen2/pai-Cert.der create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_basic_pathlen2/pai-Cert.pem create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_basic_pathlen2/pai-Key.der create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_basic_pathlen2/pai-Key.pem create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_basic_pathlen2/test_case_vector.json create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_basic_pathlen_presence_wrong/cd.der create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_basic_pathlen_presence_wrong/dac-Cert.der create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_basic_pathlen_presence_wrong/dac-Cert.pem create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_basic_pathlen_presence_wrong/dac-Key.der create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_basic_pathlen_presence_wrong/dac-Key.pem create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_basic_pathlen_presence_wrong/pai-Cert.der create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_basic_pathlen_presence_wrong/pai-Cert.pem create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_basic_pathlen_presence_wrong/pai-Key.der create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_basic_pathlen_presence_wrong/pai-Key.pem create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_basic_pathlen_presence_wrong/test_case_vector.json create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_extended_key_usage_present/cd.der create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_extended_key_usage_present/dac-Cert.der create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_extended_key_usage_present/dac-Cert.pem create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_extended_key_usage_present/dac-Key.der create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_extended_key_usage_present/dac-Key.pem create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_extended_key_usage_present/pai-Cert.der create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_extended_key_usage_present/pai-Cert.pem create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_extended_key_usage_present/pai-Key.der create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_extended_key_usage_present/pai-Key.pem create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_extended_key_usage_present/test_case_vector.json create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_key_usage_critical_missing/cd.der create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_key_usage_critical_missing/dac-Cert.der create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_key_usage_critical_missing/dac-Cert.pem create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_key_usage_critical_missing/dac-Key.der create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_key_usage_critical_missing/dac-Key.pem create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_key_usage_critical_missing/pai-Cert.der create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_key_usage_critical_missing/pai-Cert.pem create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_key_usage_critical_missing/pai-Key.der create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_key_usage_critical_missing/pai-Key.pem create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_key_usage_critical_missing/test_case_vector.json create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_key_usage_critical_wrong/cd.der create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_key_usage_critical_wrong/dac-Cert.der create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_key_usage_critical_wrong/dac-Cert.pem create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_key_usage_critical_wrong/dac-Key.der create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_key_usage_critical_wrong/dac-Key.pem create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_key_usage_critical_wrong/pai-Cert.der create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_key_usage_critical_wrong/pai-Cert.pem create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_key_usage_critical_wrong/pai-Key.der create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_key_usage_critical_wrong/pai-Key.pem create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_key_usage_critical_wrong/test_case_vector.json create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_key_usage_crl_sign_wrong/cd.der create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_key_usage_crl_sign_wrong/dac-Cert.der create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_key_usage_crl_sign_wrong/dac-Cert.pem create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_key_usage_crl_sign_wrong/dac-Key.der create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_key_usage_crl_sign_wrong/dac-Key.pem create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_key_usage_crl_sign_wrong/pai-Cert.der create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_key_usage_crl_sign_wrong/pai-Cert.pem create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_key_usage_crl_sign_wrong/pai-Key.der create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_key_usage_crl_sign_wrong/pai-Key.pem create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_key_usage_crl_sign_wrong/test_case_vector.json create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_key_usage_dig_sig_wrong/cd.der create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_key_usage_dig_sig_wrong/dac-Cert.der create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_key_usage_dig_sig_wrong/dac-Cert.pem create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_key_usage_dig_sig_wrong/dac-Key.der create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_key_usage_dig_sig_wrong/dac-Key.pem create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_key_usage_dig_sig_wrong/pai-Cert.der create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_key_usage_dig_sig_wrong/pai-Cert.pem create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_key_usage_dig_sig_wrong/pai-Key.der create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_key_usage_dig_sig_wrong/pai-Key.pem create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_key_usage_dig_sig_wrong/test_case_vector.json create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_key_usage_key_cert_sign_wrong/cd.der create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_key_usage_key_cert_sign_wrong/dac-Cert.der create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_key_usage_key_cert_sign_wrong/dac-Cert.pem create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_key_usage_key_cert_sign_wrong/dac-Key.der create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_key_usage_key_cert_sign_wrong/dac-Key.pem create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_key_usage_key_cert_sign_wrong/pai-Cert.der create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_key_usage_key_cert_sign_wrong/pai-Cert.pem create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_key_usage_key_cert_sign_wrong/pai-Key.der create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_key_usage_key_cert_sign_wrong/pai-Key.pem create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_key_usage_key_cert_sign_wrong/test_case_vector.json create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_key_usage_missing/cd.der create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_key_usage_missing/dac-Cert.der create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_key_usage_missing/dac-Cert.pem create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_key_usage_missing/dac-Key.der create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_key_usage_missing/dac-Key.pem create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_key_usage_missing/pai-Cert.der create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_key_usage_missing/pai-Cert.pem create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_key_usage_missing/pai-Key.der create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_key_usage_missing/pai-Key.pem create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_key_usage_missing/test_case_vector.json create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_skid_missing/cd.der create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_skid_missing/dac-Cert.der create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_skid_missing/dac-Cert.pem create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_skid_missing/dac-Key.der create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_skid_missing/dac-Key.pem create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_skid_missing/pai-Cert.der create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_skid_missing/pai-Cert.pem create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_skid_missing/pai-Key.der create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_skid_missing/pai-Key.pem create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_skid_missing/test_case_vector.json create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_subject_alt_name_present/cd.der create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_subject_alt_name_present/dac-Cert.der create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_subject_alt_name_present/dac-Cert.pem create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_subject_alt_name_present/dac-Key.der create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_subject_alt_name_present/dac-Key.pem create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_subject_alt_name_present/pai-Cert.der create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_subject_alt_name_present/pai-Cert.pem create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_subject_alt_name_present/pai-Key.der create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_subject_alt_name_present/pai-Key.pem create mode 100644 credentials/development/commissioner_dut/struct_pai_ext_subject_alt_name_present/test_case_vector.json create mode 100644 credentials/development/commissioner_dut/struct_pai_sig_algo_ecdsa_with_sha1/cd.der create mode 100644 credentials/development/commissioner_dut/struct_pai_sig_algo_ecdsa_with_sha1/dac-Cert.der create mode 100644 credentials/development/commissioner_dut/struct_pai_sig_algo_ecdsa_with_sha1/dac-Cert.pem create mode 100644 credentials/development/commissioner_dut/struct_pai_sig_algo_ecdsa_with_sha1/dac-Key.der create mode 100644 credentials/development/commissioner_dut/struct_pai_sig_algo_ecdsa_with_sha1/dac-Key.pem create mode 100644 credentials/development/commissioner_dut/struct_pai_sig_algo_ecdsa_with_sha1/pai-Cert.der create mode 100644 credentials/development/commissioner_dut/struct_pai_sig_algo_ecdsa_with_sha1/pai-Cert.pem create mode 100644 credentials/development/commissioner_dut/struct_pai_sig_algo_ecdsa_with_sha1/pai-Key.der create mode 100644 credentials/development/commissioner_dut/struct_pai_sig_algo_ecdsa_with_sha1/pai-Key.pem create mode 100644 credentials/development/commissioner_dut/struct_pai_sig_algo_ecdsa_with_sha1/test_case_vector.json create mode 100644 credentials/development/commissioner_dut/struct_pai_sig_algo_ecdsa_with_sha256/cd.der create mode 100644 credentials/development/commissioner_dut/struct_pai_sig_algo_ecdsa_with_sha256/dac-Cert.der create mode 100644 credentials/development/commissioner_dut/struct_pai_sig_algo_ecdsa_with_sha256/dac-Cert.pem create mode 100644 credentials/development/commissioner_dut/struct_pai_sig_algo_ecdsa_with_sha256/dac-Key.der create mode 100644 credentials/development/commissioner_dut/struct_pai_sig_algo_ecdsa_with_sha256/dac-Key.pem create mode 100644 credentials/development/commissioner_dut/struct_pai_sig_algo_ecdsa_with_sha256/pai-Cert.der create mode 100644 credentials/development/commissioner_dut/struct_pai_sig_algo_ecdsa_with_sha256/pai-Cert.pem create mode 100644 credentials/development/commissioner_dut/struct_pai_sig_algo_ecdsa_with_sha256/pai-Key.der create mode 100644 credentials/development/commissioner_dut/struct_pai_sig_algo_ecdsa_with_sha256/pai-Key.pem create mode 100644 credentials/development/commissioner_dut/struct_pai_sig_algo_ecdsa_with_sha256/test_case_vector.json create mode 100644 credentials/development/commissioner_dut/struct_pai_sig_curve_prime256v1/cd.der create mode 100644 credentials/development/commissioner_dut/struct_pai_sig_curve_prime256v1/dac-Cert.der create mode 100644 credentials/development/commissioner_dut/struct_pai_sig_curve_prime256v1/dac-Cert.pem create mode 100644 credentials/development/commissioner_dut/struct_pai_sig_curve_prime256v1/dac-Key.der create mode 100644 credentials/development/commissioner_dut/struct_pai_sig_curve_prime256v1/dac-Key.pem create mode 100644 credentials/development/commissioner_dut/struct_pai_sig_curve_prime256v1/pai-Cert.der create mode 100644 credentials/development/commissioner_dut/struct_pai_sig_curve_prime256v1/pai-Cert.pem create mode 100644 credentials/development/commissioner_dut/struct_pai_sig_curve_prime256v1/pai-Key.der create mode 100644 credentials/development/commissioner_dut/struct_pai_sig_curve_prime256v1/pai-Key.pem create mode 100644 credentials/development/commissioner_dut/struct_pai_sig_curve_prime256v1/test_case_vector.json create mode 100644 credentials/development/commissioner_dut/struct_pai_sig_curve_secp256k1/cd.der create mode 100644 credentials/development/commissioner_dut/struct_pai_sig_curve_secp256k1/dac-Cert.der create mode 100644 credentials/development/commissioner_dut/struct_pai_sig_curve_secp256k1/dac-Cert.pem create mode 100644 credentials/development/commissioner_dut/struct_pai_sig_curve_secp256k1/dac-Key.der create mode 100644 credentials/development/commissioner_dut/struct_pai_sig_curve_secp256k1/dac-Key.pem create mode 100644 credentials/development/commissioner_dut/struct_pai_sig_curve_secp256k1/pai-Cert.der create mode 100644 credentials/development/commissioner_dut/struct_pai_sig_curve_secp256k1/pai-Cert.pem create mode 100644 credentials/development/commissioner_dut/struct_pai_sig_curve_secp256k1/pai-Key.der create mode 100644 credentials/development/commissioner_dut/struct_pai_sig_curve_secp256k1/pai-Key.pem create mode 100644 credentials/development/commissioner_dut/struct_pai_sig_curve_secp256k1/test_case_vector.json create mode 100644 credentials/development/commissioner_dut/struct_pai_subject_pid_mismatch/cd.der create mode 100644 credentials/development/commissioner_dut/struct_pai_subject_pid_mismatch/dac-Cert.der create mode 100644 credentials/development/commissioner_dut/struct_pai_subject_pid_mismatch/dac-Cert.pem create mode 100644 credentials/development/commissioner_dut/struct_pai_subject_pid_mismatch/dac-Key.der create mode 100644 credentials/development/commissioner_dut/struct_pai_subject_pid_mismatch/dac-Key.pem create mode 100644 credentials/development/commissioner_dut/struct_pai_subject_pid_mismatch/pai-Cert.der create mode 100644 credentials/development/commissioner_dut/struct_pai_subject_pid_mismatch/pai-Cert.pem create mode 100644 credentials/development/commissioner_dut/struct_pai_subject_pid_mismatch/pai-Key.der create mode 100644 credentials/development/commissioner_dut/struct_pai_subject_pid_mismatch/pai-Key.pem create mode 100644 credentials/development/commissioner_dut/struct_pai_subject_pid_mismatch/test_case_vector.json create mode 100644 credentials/development/commissioner_dut/struct_pai_subject_vid_mismatch/cd.der create mode 100644 credentials/development/commissioner_dut/struct_pai_subject_vid_mismatch/dac-Cert.der create mode 100644 credentials/development/commissioner_dut/struct_pai_subject_vid_mismatch/dac-Cert.pem create mode 100644 credentials/development/commissioner_dut/struct_pai_subject_vid_mismatch/dac-Key.der create mode 100644 credentials/development/commissioner_dut/struct_pai_subject_vid_mismatch/dac-Key.pem create mode 100644 credentials/development/commissioner_dut/struct_pai_subject_vid_mismatch/pai-Cert.der create mode 100644 credentials/development/commissioner_dut/struct_pai_subject_vid_mismatch/pai-Cert.pem create mode 100644 credentials/development/commissioner_dut/struct_pai_subject_vid_mismatch/pai-Key.der create mode 100644 credentials/development/commissioner_dut/struct_pai_subject_vid_mismatch/pai-Key.pem create mode 100644 credentials/development/commissioner_dut/struct_pai_subject_vid_mismatch/test_case_vector.json create mode 100755 src/tools/chip-cert/gen_com_dut_test_vectors.py diff --git a/credentials/development/commissioner_dut/struct_dac_cert_version_v2/cd.der b/credentials/development/commissioner_dut/struct_dac_cert_version_v2/cd.der new file mode 100644 index 0000000000000000000000000000000000000000..d42203deaa727c650bf644f3d95505ca1ecd3a3f GIT binary patch literal 236 zcmXqLe96YC)#lOmotKfFX+h&{gT@<7jLe3-2Hb3%32h#Xsmv@)j0Uaj-G}h210CH+H8z0j7^Jbm>79j+}zv@4HU$Ajf@OTj0_+kN`l`K z2n>ykfymU-)H2Gz4TqU7j?UQ4L=$D=VX*)i9%&%V#twEV6C>2g%#7^JP7Ev&3;)km z>^L4QD&6$+n2KNJvrV}y7wQ)6UnwiT_(D8;NIjDY&$na8`Wgj2O7@0|*JbR|(76;p z;mB5jxf(<*;f}iR$8OVdAm05s+*B~OAyzl=CgC)1$J(W7SJ>c#?tGqSWkpr38 zgTcU+Ns-}DY=iC1baBQQxf>_b<10k_41OPe-@Yqb{FLw2st=p&m=yFrz0tF?jZsPu c6YKhro!xVK-;z~7)n)QI?)P_H?vVTp0G_RjXaE2J literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_dac_cert_version_v2/dac-Cert.pem b/credentials/development/commissioner_dut/struct_dac_cert_version_v2/dac-Cert.pem new file mode 100644 index 00000000000000..3b2a00789768b6 --- /dev/null +++ b/credentials/development/commissioner_dut/struct_dac_cert_version_v2/dac-Cert.pem @@ -0,0 +1,12 @@ +-----BEGIN CERTIFICATE----- +MIIBzjCCAXSgAwIBAQIII0N0uct+CD0wCgYIKoZIzj0EAwIwMDEYMBYGA1UEAwwP +TWF0dGVyIFRlc3QgUEFJMRQwEgYKKwYBBAGConwCAQwERkZGMTAgFw0yMjA0MjAw +MDAwMDBaGA85OTk5MTIzMTIzNTk1OVowRjEYMBYGA1UEAwwPTWF0dGVyIFRlc3Qg +REFDMRQwEgYKKwYBBAGConwCAQwERkZGMTEUMBIGCisGAQQBgqJ8AgIMBDgwMDAw +WTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAARYof+dIYjHUxUbgvnGJE555rJtBNB+ +or+pHRej0F8HVH8CNAz2xsaOgRFIdL1VF35ouigs0l+QxNsMRydzqfiDo2AwXjAM +BgNVHRMBAf8EAjAAMA4GA1UdDwEB/wQEAwIHgDAdBgNVHQ4EFgQUPhMhzb9IJo2+ +qUxFoLC4ZlPlLwIwHwYDVR0jBBgwFoAUFWO+/6gwpNvu5RrJt1Dd/jpurNcwCgYI +KoZIzj0EAwIDSAAwRQIhAMJdgD3ZZxcBXB7YyWdfeBWOMPvD74e6axfKTdV68LI+ +AiAu8uwuPj1cImdWForwa2uMy76kqvknHG8I34+K04gZ8w== +-----END CERTIFICATE----- diff --git a/credentials/development/commissioner_dut/struct_dac_cert_version_v2/dac-Key.der b/credentials/development/commissioner_dut/struct_dac_cert_version_v2/dac-Key.der new file mode 100644 index 0000000000000000000000000000000000000000..0712a431c139eac98917ea9ad6e433af5c9d7f2a GIT binary patch literal 121 zcmV-<0EYiCcLD(c1Rx)VBD6K7H{*)EbJJ3~5o~p&@xL!x1!30o2fO=%aF3u01_&yK zNX|V20SBQ(13~}j*f;R210CH+H8z0j7^Jbm>79j+}zv@4HU$Ajf@OTj0_+kN`l`K z2n>ykfymU-)G`W>nVvYzj5H8tV+Xs5i4p2JW=3{qCk7TdzMh3gqx8S-zP}<{-F;<( zpmvL@v;FEM@?iemCtV0e|W)B7fS0)9c zhp(PhK9l&D+`VnakIl*@dQso?g_HbOxb?Iyd~ah_%B0A!zN#kIp50QVyyj$_^Y$YJ V9?6}#bFFtRZwd65Pmo+&0RRw!iS_^h literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_dac_cert_version_v2/pai-Cert.pem b/credentials/development/commissioner_dut/struct_dac_cert_version_v2/pai-Cert.pem new file mode 100644 index 00000000000000..566be79634b389 --- /dev/null +++ b/credentials/development/commissioner_dut/struct_dac_cert_version_v2/pai-Cert.pem @@ -0,0 +1,12 @@ +-----BEGIN CERTIFICATE----- +MIIBvjCCAWSgAwIBAgIISjYJJhme3RUwCgYIKoZIzj0EAwIwMDEYMBYGA1UEAwwP +TWF0dGVyIFRlc3QgUEFBMRQwEgYKKwYBBAGConwCAQwERkZGMTAgFw0yMjA0MjAw +MDAwMDBaGA85OTk5MTIzMTIzNTk1OVowMDEYMBYGA1UEAwwPTWF0dGVyIFRlc3Qg +UEFJMRQwEgYKKwYBBAGConwCAQwERkZGMTBZMBMGByqGSM49AgEGCCqGSM49AwEH +A0IABB4OjKHFWi/1u9+oaydHqWARK4QlQflYfoV6z5bgz6qsSffaH11Wr7Dg6fJF +R+H+mX3o+4ADAGW05CIWC+4M2UWjZjBkMBIGA1UdEwEB/wQIMAYBAf8CAQEwDgYD +VR0PAQH/BAQDAgEGMB0GA1UdDgQWBBQVY77/qDCk2+7lGsm3UN3+Om6s1zAfBgNV +HSMEGDAWgBRq/SJ3H1Ef7L8WQZdnENzcMaFxfjAKBggqhkjOPQQDAgNIADBFAiAy +4ermeeYY/mOLtpj4syN0Llr3LxNiT6hGjIWh7zw6dQIhAK96fG0/Bzkkd3zJXkO3 +xHBIY4ltnTu6p4RRTx9gGa14 +-----END CERTIFICATE----- diff --git a/credentials/development/commissioner_dut/struct_dac_cert_version_v2/pai-Key.der b/credentials/development/commissioner_dut/struct_dac_cert_version_v2/pai-Key.der new file mode 100644 index 0000000000000000000000000000000000000000..b4ba5f3f14f3c3316d8e2fa8ad83e2f75eda4532 GIT binary patch literal 121 zcmV-<0EYiCcLD(c1R%`HOdIeEE%G4lGM{-?yWWlk{=BMvU7cFSa0?+tK*^vA1_&yK zNX|V20SBQ(13~}<9uAD5#ab`*yWgm5Cr7DZ5i5ixLHSsIg?i7H;Lob8N%z_xT~@EK b;OX*3N8$dNedzmu0{~^Tj-G}h210CH+H8z0j7^Jbm>79j+}zv@4HU$Ajf@OTj0_+kN`l`K z2n>ykfymU-)H2Gz4TqU7j?UQ4L=$D=VX*)i9%&%V#twEV6C>2g%#7^JP7EyBSGtXs zm+9o3S>ISBzm7-x=;Br*1=ESsgeBr%?u*$s$$$R4FI|>vcmB_vWSgIQcJlF0r}u?_ zwsTEpeEYU%#mn}^2?lWnJV0;D3NtePXJIm6FyI66_(42iu&_56$b$HMEMhDo*>T@y zUw9Zl;f>S|e}~_{@1<@JTy7u_l2&E`23~{6o5h>zSI4XnxUOQgt|D7~rq$i^?Z|=5 z?7?8*%A}C}gURUn=?R8yOoiSXULW7JPw7gJ?2+XGg>S|F?%CvXhe?s)(nX1Xai*E) e%A;C1%g@eeV`uX1+W)%v`dj0}7gF!+W(ELea*{0o literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_dac_cert_version_v3/dac-Cert.pem b/credentials/development/commissioner_dut/struct_dac_cert_version_v3/dac-Cert.pem new file mode 100644 index 00000000000000..9e408c505a5a13 --- /dev/null +++ b/credentials/development/commissioner_dut/struct_dac_cert_version_v3/dac-Cert.pem @@ -0,0 +1,12 @@ +-----BEGIN CERTIFICATE----- +MIIBzjCCAXSgAwIBAgIIDK5kwgUSAUEwCgYIKoZIzj0EAwIwMDEYMBYGA1UEAwwP +TWF0dGVyIFRlc3QgUEFJMRQwEgYKKwYBBAGConwCAQwERkZGMTAgFw0yMjA0MjAw +MDAwMDBaGA85OTk5MTIzMTIzNTk1OVowRjEYMBYGA1UEAwwPTWF0dGVyIFRlc3Qg +REFDMRQwEgYKKwYBBAGConwCAQwERkZGMTEUMBIGCisGAQQBgqJ8AgIMBDgwMDAw +WTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAARr1Isyp3YsbMyvgXIfrgwbxaOFMiA1 +kZYTGF/pvly+kk+f7vSKOa25/22SPW9lzZPH8su+V/M+RWMB7e2MqOmHo2AwXjAM +BgNVHRMBAf8EAjAAMA4GA1UdDwEB/wQEAwIHgDAdBgNVHQ4EFgQUa172m9DhX5Ds +GrhPQPv73mW3UacwHwYDVR0jBBgwFoAU7KOyf6tcqBDXJDqueGsnmTrdz4cwCgYI +KoZIzj0EAwIDSAAwRQIga/gCMtfLkDGGAnFLsOvHur4i1IwdxKdQce0W/byyTNwC +IQDS0Rj+XjVpzndahAl3zZiGBwJNir/rc9ftM8PQZdy7Aw== +-----END CERTIFICATE----- diff --git a/credentials/development/commissioner_dut/struct_dac_cert_version_v3/dac-Key.der b/credentials/development/commissioner_dut/struct_dac_cert_version_v3/dac-Key.der new file mode 100644 index 0000000000000000000000000000000000000000..e37170bf571a41c140b3bd8452d3cfd0519ba893 GIT binary patch literal 121 zcmV-<0EYiCcLD(c1Rx;Bpf)dcw3seKF_cK0FncE$OcB!9_m-zJkHs&Ff$n#7)lt3u`!3TF!S*H zCYF?>7Ab_J7MCalI64}N7znX(X|pl1Fg7i!VPfQAadUGsG*A%dH8L_VF*1OFC<%T` zATTsC1|m~SQ_CnkW_scJobofuexPAJSwytZ?`^r`ErceRYx zhV56AJIvOi*LQQ%*W(vIBxDrM-TCYBA^9E7vrb#^=`+Q~3C5V)>l zwXPyteWumj^X&%mAZcY5U|=yQJL*@MBrl}W*( zMTA&-U1_+KYRIYf#Q(~XL3f$oElY1$Lx7O8|o?4&^1_&yK zNX|V20SBQ(13~}!DI1VoYeZ(waTX5%Rb_aX+IQd>uYuz@k literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_dac_cert_version_v3/pai-Key.pem b/credentials/development/commissioner_dut/struct_dac_cert_version_v3/pai-Key.pem new file mode 100644 index 00000000000000..bab07c039ea260 --- /dev/null +++ b/credentials/development/commissioner_dut/struct_dac_cert_version_v3/pai-Key.pem @@ -0,0 +1,5 @@ +-----BEGIN EC PRIVATE KEY----- +MHcCAQEEIPby6KEXHgwmB+hUrnjDU2Kfvwrc4PCTeymHt9bVmJ5aoAoGCCqGSM49 +AwEHoUQDQgAEUsggmWHWuZ8bytcl3SoyrVa/Jh7DBoQujtmy9cfR8GBocZ25+uPC +H7hDmss4Di8CfcQsYFtw52d2B3v3OPleUg== +-----END EC PRIVATE KEY----- diff --git a/credentials/development/commissioner_dut/struct_dac_cert_version_v3/test_case_vector.json b/credentials/development/commissioner_dut/struct_dac_cert_version_v3/test_case_vector.json new file mode 100644 index 00000000000000..ed86a0962e0895 --- /dev/null +++ b/credentials/development/commissioner_dut/struct_dac_cert_version_v3/test_case_vector.json @@ -0,0 +1,9 @@ +{ + "description": "DAC Test Vector: Valid certificate version field set to v3(2)", + "is_success_case": "true", + "dac_cert": "308201ce30820174a00302010202080cae64c205120141300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313020170d3232303432303030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d030107034200046bd48b32a7762c6cccaf81721fae0c1bc5a385322035919613185fe9be5cbe924f9feef48a39adb9ff6d923d6f65cd93c7f2cbbe57f33e456301eded8ca8e987a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e041604146b5ef69bd0e15f90ec1ab84f40fbfbde65b751a7301f0603551d23041830168014eca3b27fab5ca810d7243aae786b27993addcf87300a06082a8648ce3d040302034800304502206bf80232d7cb90318602714bb0ebc7babe22d48c1dc4a75071ed16fdbcb24cdc022100d2d118fe5e3569ce775a840977cd988607024d8abfeb73d7ed33c3d065dcbb03", + "pai_cert": "308201be30820164a003020102020801a53ebdb7c77789300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303432303030303030305a180f39393939313233313233353935395a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d0301070342000452c8209961d6b99f1bcad725dd2a32ad56bf261ec306842e8ed9b2f5c7d1f06068719db9fae3c21fb8439acb380e2f027dc42c605b70e76776077bf738f95e52a366306430120603551d130101ff040830060101ff020101300e0603551d0f0101ff040403020106301d0603551d0e04160414eca3b27fab5ca810d7243aae786b27993addcf87301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d040302034800304502203874c3e128a2586f31301c15840b814136e6bc3fa9bdd023f7d9070a84ffefed022100b19bba684fc646b47e686d7bd306e73986d89ff3dd438b90e04b697c32caa684", + "certification_declaration": "3081ea06092a864886f70d010702a081dc3081d9020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317e307c020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204483046022100beee93d0de9ca5e41a7484013d7050ce439b5e92ee2c47b74399c9ea866e62ff022100b112b86226ed90d8e9136ebd94247e279dbcc6e49494c89cc27f4a8ec86a9f03", + "dac_private_key": "20c6a0362f75b4982e433194489c307b27184c11d2d8f796a7683163e2eb24a2", + "dac_public_key": "046bd48b32a7762c6cccaf81721fae0c1bc5a385322035919613185fe9be5cbe924f9feef48a39adb9ff6d923d6f65cd93c7f2cbbe57f33e456301eded8ca8e987" +} diff --git a/credentials/development/commissioner_dut/struct_dac_ext_akid_missing/cd.der b/credentials/development/commissioner_dut/struct_dac_ext_akid_missing/cd.der new file mode 100644 index 0000000000000000000000000000000000000000..918fb4d1b1675b393d77e6c2fb5c39f71aaf9eeb GIT binary patch literal 235 zcmXqLe8I-4)#lOmotKfFX+h&HgU0JjjLe3-2Hb3%32h#Xsmv@)j0UaaFgtdmCpf)=1Z>t literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_dac_ext_akid_missing/dac-Cert.der b/credentials/development/commissioner_dut/struct_dac_ext_akid_missing/dac-Cert.der new file mode 100644 index 0000000000000000000000000000000000000000..2a6e760d8ed2803301c037a404b0f95dede37c74 GIT binary patch literal 433 zcmXqLVq9y`#2CDQnTe5!iNok7cS))L&8-GpY#dr`9_MUXn3)U=3?&T2*qB3En0fep z6H7``ixfgqi%S#&96b$1420OYwAmP07@HQ=FfsD5xVgC*8YqbK8W|aw7#To7lmx#e z5EvR61Cgnvsb!Rb8xAvF9G$V7i6+X#!(st4JkmgzjUDV#CPt`}nHkxcofufczMOjy zC$IHXxpa+ZvWq$kV=6PAM z6A!7C#97@wQZ;e0y@9O(5767P!i#?`rpT?i=ne y_2f9Xal6t6-zFvnN12a_W)=!dKdcelT=`U>Xr)@o=Y>q$r!O^K@iqHS_DTSUBZL|N literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_dac_ext_akid_missing/dac-Cert.pem b/credentials/development/commissioner_dut/struct_dac_ext_akid_missing/dac-Cert.pem new file mode 100644 index 00000000000000..e3819352af3d61 --- /dev/null +++ b/credentials/development/commissioner_dut/struct_dac_ext_akid_missing/dac-Cert.pem @@ -0,0 +1,12 @@ +-----BEGIN CERTIFICATE----- +MIIBrTCCAVOgAwIBAgIIMtkLdHVP2bUwCgYIKoZIzj0EAwIwMDEYMBYGA1UEAwwP +TWF0dGVyIFRlc3QgUEFJMRQwEgYKKwYBBAGConwCAQwERkZGMTAgFw0yMjA0MjAw +MDAwMDBaGA85OTk5MTIzMTIzNTk1OVowRjEYMBYGA1UEAwwPTWF0dGVyIFRlc3Qg +REFDMRQwEgYKKwYBBAGConwCAQwERkZGMTEUMBIGCisGAQQBgqJ8AgIMBDgwMDAw +WTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAARW9M7gXh8q5SN1rEmB4uTs4ulidrVa +AVF1Fcz3k2RdHZDrXyePPPTkK05dBozXGjfb5bOeal2RwiZ0XjrbxHqRoz8wPTAM +BgNVHRMBAf8EAjAAMA4GA1UdDwEB/wQEAwIHgDAdBgNVHQ4EFgQUpVLxDDvTkOli +pRjcmb5XFaTeXm8wCgYIKoZIzj0EAwIDSAAwRQIhAJYBm4Pay1B/56mq27F+oPcm +3yzfMb91SQjBsbcisE2CAiBBHPFhNjggpfCsEbN55RByqSZ086ECt5elNaj1a9xr +qQ== +-----END CERTIFICATE----- diff --git a/credentials/development/commissioner_dut/struct_dac_ext_akid_missing/dac-Key.der b/credentials/development/commissioner_dut/struct_dac_ext_akid_missing/dac-Key.der new file mode 100644 index 0000000000000000000000000000000000000000..c79fdbd9d9f3251a530e9cf5f99c734763f0ccbc GIT binary patch literal 121 zcmV-<0EYiCcLD(c1R&3#GgvVRH-bD6TKRKvM<1qz+WUUx#`P~|Zly=IX4;?%1_&yK zNX|V20SBQ(13~}JkHs&Ff$n#7)lt3u`!3TF!S*H zCYF?>7Ab_J7MCalI64}N7znX(X|pl1Fg7i!VPfQAadUGsG*A%dH8L_VF*1OFC<%T` zATTsC1|m~SQ_CnkW_scJobofudWbF$y?_Ad$Ul; z%tOnnj-GuGx1zT*WvhniF(Ju`KiXO+NHCf67@In33^63x@$4kYZwFG~fe?@q@&G!NAC7APeI2v52vVG`#EL^$B5`@NKP` zfRn_!-ujIz91Y|_(#kBrz-kc5`m0nfA1ME3znJ6nbb&i}3>OyGAqOh62ZMntlOn^B zKl{%$-#&1~Yq?uh`RtH7PMudz-?B-u1pFydG2P=9z@%W6>Ek~;CD=242Pea=gi{M{ V^K@-Lw0F;%y2iyP-gjIu1povqhwcCX literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_dac_ext_akid_missing/pai-Cert.pem b/credentials/development/commissioner_dut/struct_dac_ext_akid_missing/pai-Cert.pem new file mode 100644 index 00000000000000..292df21eb5699f --- /dev/null +++ b/credentials/development/commissioner_dut/struct_dac_ext_akid_missing/pai-Cert.pem @@ -0,0 +1,12 @@ +-----BEGIN CERTIFICATE----- +MIIBvjCCAWSgAwIBAgIIGD6qjPnNUJMwCgYIKoZIzj0EAwIwMDEYMBYGA1UEAwwP +TWF0dGVyIFRlc3QgUEFBMRQwEgYKKwYBBAGConwCAQwERkZGMTAgFw0yMjA0MjAw +MDAwMDBaGA85OTk5MTIzMTIzNTk1OVowMDEYMBYGA1UEAwwPTWF0dGVyIFRlc3Qg +UEFJMRQwEgYKKwYBBAGConwCAQwERkZGMTBZMBMGByqGSM49AgEGCCqGSM49AwEH +A0IABGFta88lFn2iFG6mS/uzElSZwqZ6xc3gXqiNiWS1KDXGEhmR+IaFkBgCNwwy +i27QZvQ6eV1kosBplvG9pYqKBxujZjBkMBIGA1UdEwEB/wQIMAYBAf8CAQEwDgYD +VR0PAQH/BAQDAgEGMB0GA1UdDgQWBBSA7ooNTFQCkPatNhBCGK6Nf7GoQTAfBgNV +HSMEGDAWgBRq/SJ3H1Ef7L8WQZdnENzcMaFxfjAKBggqhkjOPQQDAgNIADBFAiEA +xPy/zoPbwNRKp0Z6d5tUfgks6uXtBhoEUPxyJDW8RlACIDppTE+bZFNJZ7gJANpg +yqDbDIq3wr28rH6Bo8jviNA1 +-----END CERTIFICATE----- diff --git a/credentials/development/commissioner_dut/struct_dac_ext_akid_missing/pai-Key.der b/credentials/development/commissioner_dut/struct_dac_ext_akid_missing/pai-Key.der new file mode 100644 index 0000000000000000000000000000000000000000..97ce4e98b33c20c0af588fea060413dabc550007 GIT binary patch literal 121 zcmV-<0EYiCcLD(c1RxBe=8`}c_*5<6Nj-G}h210CH+H8z0j7^Jbm>79j+}zv@4HU$Ajf@OTj0_+kN`l`K z2n>ykfymU-)H2Gz4TqU7j?UQ4L=$D=VX*)i9%&%V#twEV6C>2g%#7^JP7EwdXFp`S zU+eDsdCdbsIPBGvCdR$hRk?}tZlL3PPABe{f;sFDOy}>{h#OGrXV-cCn zTYLX*ZPS@|Px2G2Z3UF;(l@^~kOxUCvjBsyL4+edw#Rtw@5vkXCdu~Lhx}6$P!};U zVdDS>9xE$5BO{B3ftrB|jBmi$CXrE6QedU8pPyV@pqE;am|KvOs+XLftB)Kx%Z zE=&p`hwnIUV`z3aJR#m{Zlj}N{Qgm-|AglX(MR?zS*%&Nf=R*na+dPcROL3=@AqCl ZtH_(U-{3U=`+M?k7dq=SSM8G%1^@%inF;^^ literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_dac_ext_authority_info_access_present/dac-Cert.pem b/credentials/development/commissioner_dut/struct_dac_ext_authority_info_access_present/dac-Cert.pem new file mode 100644 index 00000000000000..af31cdf4136dfb --- /dev/null +++ b/credentials/development/commissioner_dut/struct_dac_ext_authority_info_access_present/dac-Cert.pem @@ -0,0 +1,13 @@ +-----BEGIN CERTIFICATE----- +MIICBTCCAaygAwIBAgIIe5d63TeEWm8wCgYIKoZIzj0EAwIwMDEYMBYGA1UEAwwP +TWF0dGVyIFRlc3QgUEFJMRQwEgYKKwYBBAGConwCAQwERkZGMTAgFw0yMjA0MjAw +MDAwMDBaGA85OTk5MTIzMTIzNTk1OVowRjEYMBYGA1UEAwwPTWF0dGVyIFRlc3Qg +REFDMRQwEgYKKwYBBAGConwCAQwERkZGMTEUMBIGCisGAQQBgqJ8AgIMBDgwMDAw +WTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAASlm+EG331HTfOs+EgVxwuHX0MQ+DvR +fkajrFew2M4cGNlPQrnYP8ynbNLIdPdukR3zUxw2T55/Tqk/5fX/LsjWo4GXMIGU +MAwGA1UdEwEB/wQCMAAwDgYDVR0PAQH/BAQDAgeAMB0GA1UdDgQWBBSbDX3f3X2C +zO7kb2A7PRAjfmez7TAfBgNVHSMEGDAWgBQIX12MM637k7C9Yh2MP1T+JhAnFDA0 +BggrBgEFBQcBAQQoMCYwJAYIKwYBBQUHMAGGGGh0dHA6Ly9vY3NwLmV4YW1wbGUu +Y29tLzAKBggqhkjOPQQDAgNHADBEAiBUw9xBtgCDRzHIF4U3PCwoM+/iWU+Q5yBb +xL6koyl+qAIgM9NqI5VlI4Yd997p5nhukb8wyw/v3h9G0Il+Kaq+HhM= +-----END CERTIFICATE----- diff --git a/credentials/development/commissioner_dut/struct_dac_ext_authority_info_access_present/dac-Key.der b/credentials/development/commissioner_dut/struct_dac_ext_authority_info_access_present/dac-Key.der new file mode 100644 index 0000000000000000000000000000000000000000..9eb30bc36bf88def60e195e802590bb180e4d6eb GIT binary patch literal 121 zcmV-<0EYiCcLD(c1R%mTcpT*w_-+x+qT#XTIVo6m1d%#7^JP7Ey9=x`=^1NLrZ%7+4J=S$~zv=$#Ko-T0bj^V<>I^;lQ_Fyn@Wm06A z!LxHuQrES;=J~CMZ~o=tT^+GyPV(u5lRm49Wb>u`9x*B82!&LpSY9`(YMfm$b;;It V@fl$}Z|@y_uexXFmeV^eI042%h^hbp literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_dac_ext_authority_info_access_present/pai-Cert.pem b/credentials/development/commissioner_dut/struct_dac_ext_authority_info_access_present/pai-Cert.pem new file mode 100644 index 00000000000000..71ad2c6c786870 --- /dev/null +++ b/credentials/development/commissioner_dut/struct_dac_ext_authority_info_access_present/pai-Cert.pem @@ -0,0 +1,12 @@ +-----BEGIN CERTIFICATE----- +MIIBvjCCAWSgAwIBAgIId+Ifj7WiBh4wCgYIKoZIzj0EAwIwMDEYMBYGA1UEAwwP +TWF0dGVyIFRlc3QgUEFBMRQwEgYKKwYBBAGConwCAQwERkZGMTAgFw0yMjA0MjAw +MDAwMDBaGA85OTk5MTIzMTIzNTk1OVowMDEYMBYGA1UEAwwPTWF0dGVyIFRlc3Qg +UEFJMRQwEgYKKwYBBAGConwCAQwERkZGMTBZMBMGByqGSM49AgEGCCqGSM49AwEH +A0IABNdf9CWhXgi2u8loLJu99vaKhkUOc+2s8J8ZOuE2iJwtO8hbNvhLsroBuHhq +2rEaqS6TlXx5tIkgdg0bxJDNr6ijZjBkMBIGA1UdEwEB/wQIMAYBAf8CAQEwDgYD +VR0PAQH/BAQDAgEGMB0GA1UdDgQWBBQIX12MM637k7C9Yh2MP1T+JhAnFDAfBgNV +HSMEGDAWgBRq/SJ3H1Ef7L8WQZdnENzcMaFxfjAKBggqhkjOPQQDAgNIADBFAiEA +mAy5vGKK1r03b4XD2f0KDatYtJxjy2DJTKtyHW8aTuICIGwSVHlkOdcyeoGbeJWk +tYcXmFYM7d7F7yW8ubTLuTgJ +-----END CERTIFICATE----- diff --git a/credentials/development/commissioner_dut/struct_dac_ext_authority_info_access_present/pai-Key.der b/credentials/development/commissioner_dut/struct_dac_ext_authority_info_access_present/pai-Key.der new file mode 100644 index 0000000000000000000000000000000000000000..d2ed939a8f8e7c014640d97e658b7c1bd2a6986b GIT binary patch literal 121 zcmV-<0EYiCcLD(c1RzO#0$-(%8gQW+TrPk0;Xo)c(X0@8CCHEJOqchqv>Tub1_&yK zNX|V20SBQ(13~}<*I)D{paOZ%~$dmVM_v~vIT8}S>tKRgb*dvZb&P|3EB9l29)T5tTtwlag`!u_|O UvbxHTtjN9lEB3Q`py literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_dac_ext_basic_ca_missing/dac-Cert.der b/credentials/development/commissioner_dut/struct_dac_ext_basic_ca_missing/dac-Cert.der new file mode 100644 index 0000000000000000000000000000000000000000..282617dd4ad6435bae628816d2f97e2f8ea3dcec GIT binary patch literal 469 zcmXqLV!UY3#8|$7nTe5!iNoTmP5?XKaRmb|HV&;ek8`#x%uEIbh7ty1Y|No7%sl+Q zi6teeMG7IQ#U%;>j-G}h210CH+H8z0j7^Jbm>79j+}zv@4HU$Ajf@OTj0_+kN`l`K z2n>ykfymU-)H2Gz4TqU7j?UQ4L=$D=VX*)i9%&%V#twEV6C>2g%#7^JP7ExnN~v!D zxr+sU-8YlY4LBt-b&*tU)V2L*1>X0+-Ew;IzyI@0->%d#mD;d%&3TOwiB(%}SoP*F zb`Xwd*gb9Q4BO1b$p(oA{6KHZ3NtePXJIt}h7f}RA4q^7BmfK<_67r45TB1lj78*x zAh*9Pqk#R@-RqAp+w^%)j@_P92J#?jWfoxgHHcVf?s4%jSk8VVAl&#;ee>_A)w?~A z!v`rkGiZBWV-m7*GbTGqeK5buxew9BLZ|DHANsVp@b bu(hnuC{!4#wAeb0Z=*mHUjVz7wU|9=FJLwp literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_dac_ext_basic_ca_missing/dac-Key.pem b/credentials/development/commissioner_dut/struct_dac_ext_basic_ca_missing/dac-Key.pem new file mode 100644 index 00000000000000..5c7c2cfc33dfe5 --- /dev/null +++ b/credentials/development/commissioner_dut/struct_dac_ext_basic_ca_missing/dac-Key.pem @@ -0,0 +1,5 @@ +-----BEGIN EC PRIVATE KEY----- +MHcCAQEEINon4iaBLXpKixJa21lQvei2dvg8dOD1ZJFYBenvYvrFoAoGCCqGSM49 +AwEHoUQDQgAEJSJlRv8LcxD63zYbbVDKFJWiGn1a1r/NEO+P7bTLo/7/njXtqSw1 +GrC1rM8oVBiqtNg6jW+jQBNfALuWtZg9aQ== +-----END EC PRIVATE KEY----- diff --git a/credentials/development/commissioner_dut/struct_dac_ext_basic_ca_missing/pai-Cert.der b/credentials/development/commissioner_dut/struct_dac_ext_basic_ca_missing/pai-Cert.der new file mode 100644 index 0000000000000000000000000000000000000000..670a3fba99d0077ed8e3228558602619d70f7d2b GIT binary patch literal 450 zcmXqLV%%rY#F(;xnTe5!iG%59kZHg8y)*+ZHV&;ek8`#x%uEIbh7ty1Y|No7%sl+Q zi6teeMG7IQ#U%;>j*f;R210CH+H8z0j7^Jbm>79j+}zv@4HU$Ajf@OTj0_+kN`l`K z2n>ykfymU-)G`W>nVvYzj5H8tV+Xs5i4p2JW=3{qCkB>lzw?}<4Hsw@aNg~z3(vcI z?uy16rvt2srT33~WmudUxXbs$F|q$HTcUohUXwJ#Wb^)_TdTOHboBnRSln0s=Xd1d zG=mhNH<&|Zg&7(Dvv3%&0VyU%Mgu;O7(Yl17z~VT2C^VNABz}^h=t}J7Y~Ew>_-B^ zjW5+V|BhO{+rvN}B(2N>46Fu`tiMX-@`3Vi_KP`APZzjz$8cd`9de*DdoUQdGAS}# z;qME2>~B=8v#LcoeZsvnX__pt+S7!!Vzh+6AI@DY!KA=zx~1N&S$2Uqk72}>8K%*v U<_o15%XHerwM=ZQ`>j&~0KYPX=>Px# literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_dac_ext_basic_ca_missing/pai-Cert.pem b/credentials/development/commissioner_dut/struct_dac_ext_basic_ca_missing/pai-Cert.pem new file mode 100644 index 00000000000000..ac10d8b7b18bd1 --- /dev/null +++ b/credentials/development/commissioner_dut/struct_dac_ext_basic_ca_missing/pai-Cert.pem @@ -0,0 +1,12 @@ +-----BEGIN CERTIFICATE----- +MIIBvjCCAWSgAwIBAgIIAvlSNY8X3mYwCgYIKoZIzj0EAwIwMDEYMBYGA1UEAwwP +TWF0dGVyIFRlc3QgUEFBMRQwEgYKKwYBBAGConwCAQwERkZGMTAgFw0yMjA0MjAw +MDAwMDBaGA85OTk5MTIzMTIzNTk1OVowMDEYMBYGA1UEAwwPTWF0dGVyIFRlc3Qg +UEFJMRQwEgYKKwYBBAGConwCAQwERkZGMTBZMBMGByqGSM49AgEGCCqGSM49AwEH +A0IABNb7bkNbMaApcAndin5Xbt3O1CjsQsAFYXXfxPUAo2lRuk3wxhb/RLRa+aus +Ypg0s79y2qoKlIiN+jijjnf8+1mjZjBkMBIGA1UdEwEB/wQIMAYBAf8CAQEwDgYD +VR0PAQH/BAQDAgEGMB0GA1UdDgQWBBQ4KbxESDCnB8RQVzPSf4P7Wqu7SDAfBgNV +HSMEGDAWgBRq/SJ3H1Ef7L8WQZdnENzcMaFxfjAKBggqhkjOPQQDAgNIADBFAiEA +1A+OUuNPMnMsqoQjZ5DezGYpBF0rlhMqXCoT98NtoxgCIA01tH9Ggx2gFwwxWNSY +NVvKnxJkMxyJPF6EkYZ++yx0 +-----END CERTIFICATE----- diff --git a/credentials/development/commissioner_dut/struct_dac_ext_basic_ca_missing/pai-Key.der b/credentials/development/commissioner_dut/struct_dac_ext_basic_ca_missing/pai-Key.der new file mode 100644 index 0000000000000000000000000000000000000000..00aa7b80539d0ccd65ad57cc69bae44e16a79d2b GIT binary patch literal 121 zcmV-<0EYiCcLD(c1Rw-Rp&%Nf33!VLjc%WbG+#{wpKsMJegqD<*@rPlaulEn1_&yK zNX|V20SBQ(13~}<*86TlTQQ(1a0%UtephbY&eSOELcj%Kb>GDG0HbM9x=rxL7XL)F bTKTK2Vwg0uzjE5D3Y3VA`Z%MGcl`TVNcS_P literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_dac_ext_basic_ca_missing/pai-Key.pem b/credentials/development/commissioner_dut/struct_dac_ext_basic_ca_missing/pai-Key.pem new file mode 100644 index 00000000000000..50acc0f4b9d86d --- /dev/null +++ b/credentials/development/commissioner_dut/struct_dac_ext_basic_ca_missing/pai-Key.pem @@ -0,0 +1,5 @@ +-----BEGIN EC PRIVATE KEY----- +MHcCAQEEIARIoSAaogl4iwiNbp+JNF9NBJ9v1S5+BA642YcxR3IUoAoGCCqGSM49 +AwEHoUQDQgAE1vtuQ1sxoClwCd2Kfldu3c7UKOxCwAVhdd/E9QCjaVG6TfDGFv9E +tFr5q6ximDSzv3LaqgqUiI36OKOOd/z7WQ== +-----END EC PRIVATE KEY----- diff --git a/credentials/development/commissioner_dut/struct_dac_ext_basic_ca_missing/test_case_vector.json b/credentials/development/commissioner_dut/struct_dac_ext_basic_ca_missing/test_case_vector.json new file mode 100644 index 00000000000000..d79752ad019002 --- /dev/null +++ b/credentials/development/commissioner_dut/struct_dac_ext_basic_ca_missing/test_case_vector.json @@ -0,0 +1,9 @@ +{ + "description": "DAC Test Vector: Certificate Basic Constraint extension CA field is missing", + "is_success_case": "false", + "dac_cert": "308201d130820177a003020102020838d52c50070ec720300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313020170d3232303432303030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d0301070342000425226546ff0b7310fadf361b6d50ca1495a21a7d5ad6bfcd10ef8fedb4cba3feff9e35eda92c351ab0b5accf285418aab4d83a8d6fa340135f00bb96b5983d69a3633061300f0603551d130101ff04053003020100300e0603551d0f0101ff040403020780301d0603551d0e04160414c8110b4f1d01103fd5bbafc7a6b2f3bc6c3ebcca301f0603551d230418301680143829bc444830a707c4505733d27f83fb5aabbb48300a06082a8648ce3d040302034800304502203068efbf4261c69e39583f154b01b8fbfa067668703efe9a486835229b70fcc7022100b7352405e78cdd7ae7287554bee9d549793e8b512f4974ed976de93074f81e9f", + "pai_cert": "308201be30820164a003020102020802f952358f17de66300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303432303030303030305a180f39393939313233313233353935395a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d03010703420004d6fb6e435b31a0297009dd8a7e576eddced428ec42c0056175dfc4f500a36951ba4df0c616ff44b45af9abac629834b3bf72daaa0a94888dfa38a38e77fcfb59a366306430120603551d130101ff040830060101ff020101300e0603551d0f0101ff040403020106301d0603551d0e041604143829bc444830a707c4505733d27f83fb5aabbb48301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020348003045022100d40f8e52e34f32732caa84236790decc6629045d2b96132a5c2a13f7c36da31802200d35b47f46831da0170c3158d498355bca9f1264331c893c5e8491867efb2c74", + "certification_declaration": "3081ea06092a864886f70d010702a081dc3081d9020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317e307c020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204483046022100a8c5f3b1a71919dd80ff1b4e04ceeb5adacb238fd7d85fb10bf0e356ddc99062022100b6f1886d95d93bb1fa06a96808d0dfedf26a8a77c4a86dddfa5df3275115f9ec", + "dac_private_key": "da27e226812d7a4a8b125adb5950bde8b676f83c74e0f564915805e9ef62fac5", + "dac_public_key": "0425226546ff0b7310fadf361b6d50ca1495a21a7d5ad6bfcd10ef8fedb4cba3feff9e35eda92c351ab0b5accf285418aab4d83a8d6fa340135f00bb96b5983d69" +} diff --git a/credentials/development/commissioner_dut/struct_dac_ext_basic_ca_wrong/cd.der b/credentials/development/commissioner_dut/struct_dac_ext_basic_ca_wrong/cd.der new file mode 100644 index 0000000000000000000000000000000000000000..01ab18641b69f19168684b7cf3cb058b2471a1e0 GIT binary patch literal 236 zcmXqLe96YC)#lOmotKfFX+h&{gT@<7jLe3-2Hb3%32h#Xsmv@)j0Uarii)(3GV;1Rb8>`efm3{ Tt|JDYHb<%Ho%!s_rFb6zjnzl- literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_dac_ext_basic_ca_wrong/dac-Cert.der b/credentials/development/commissioner_dut/struct_dac_ext_basic_ca_wrong/dac-Cert.der new file mode 100644 index 0000000000000000000000000000000000000000..07f213437d8eed256f94bc97c694d91af3922d98 GIT binary patch literal 469 zcmXqLV!UY3#8|$7nTe5!iG%;tre_8VrGgE(*f_M>JkHs&Ff$n#7)lt3u`!3TF!S*H zCYF?>7Ab_J7MCalIC>h27znX(X|pl1Fg7i!VPfQAadUGsG*A%dH8L_VF*1OFC<%T` zATTsC1|m~SQ_Cm=HymcVI67lD6HSzfhs6S9c%*?a8#~ygOpH(`Gc&R?J29{nM#S)6 z*nQ!EU86eF$I6BNW(8~1&lY}LJKu&=e5YT{os5{$XDi!tix-tFj5b<2U0(g>p{7qd zDT{UaY-IA5>nko!Hb^w!2YOppn33^63#$P$kTT!{3GjmifFZ-)U?2mdzSf-#+Z|ueKdd~#T%x4DjAZcY5VE8qN^tosYui0n2FkQyNlQpC(@1=A#19CVs zdoUQdGAS~gmxy)Q{#QZ&=knEFGRA6$)DlbDzg!DV5cU<%keG3O0h5B){ED^K`J2Rh d_UbL!Idv`feuiY{;*9c^$jD30fx1T@0svV{gg^iQ literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_dac_ext_basic_ca_wrong/dac-Cert.pem b/credentials/development/commissioner_dut/struct_dac_ext_basic_ca_wrong/dac-Cert.pem new file mode 100644 index 00000000000000..73ffcfead222f3 --- /dev/null +++ b/credentials/development/commissioner_dut/struct_dac_ext_basic_ca_wrong/dac-Cert.pem @@ -0,0 +1,12 @@ +-----BEGIN CERTIFICATE----- +MIIB0TCCAXegAwIBAgIID8qy5jChGlMwCgYIKoZIzj0EAwIwMDEYMBYGA1UEAwwP +TWF0dGVyIFRlc3QgUEFJMRQwEgYKKwYBBAGConwCAQwERkZGMTAgFw0yMjA0MjAw +MDAwMDBaGA85OTk5MTIzMTIzNTk1OVowRjEYMBYGA1UEAwwPTWF0dGVyIFRlc3Qg +REFDMRQwEgYKKwYBBAGConwCAQwERkZGMTEUMBIGCisGAQQBgqJ8AgIMBDgwMDAw +WTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAARxWFwP0LvQwD6BJwLxeaFPNnCsJ81x +9q2fPAkXuU583Ghcdeaph21zonShWzKllx8n2cKC8ixkoy0OPBxupy8ho2MwYTAP +BgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIHgDAdBgNVHQ4EFgQUz1YrlnhY +QXYgKH8zSgjrvJAJaeYwHwYDVR0jBBgwFoAUjkQrE6y+PaFnHDhJBVSKbukbewAw +CgYIKoZIzj0EAwIDSAAwRQIhAM8YXUS3/SAv+aerShwzJsImYXSH9NZVYBNNF2gY +mNegAiBKn3itO2+yF4y9LqS5la0LvwBjQ3Nod4RZWdKDUS3F4Q== +-----END CERTIFICATE----- diff --git a/credentials/development/commissioner_dut/struct_dac_ext_basic_ca_wrong/dac-Key.der b/credentials/development/commissioner_dut/struct_dac_ext_basic_ca_wrong/dac-Key.der new file mode 100644 index 0000000000000000000000000000000000000000..9af1514d4cc89fa9b9586f95c6dd72b6f768cce9 GIT binary patch literal 121 zcmV-<0EYiCcLD(c1R%CAsKTtv32lsW;oM!Zl^CHN`Wyx literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_dac_ext_basic_ca_wrong/dac-Key.pem b/credentials/development/commissioner_dut/struct_dac_ext_basic_ca_wrong/dac-Key.pem new file mode 100644 index 00000000000000..a455be20e35208 --- /dev/null +++ b/credentials/development/commissioner_dut/struct_dac_ext_basic_ca_wrong/dac-Key.pem @@ -0,0 +1,5 @@ +-----BEGIN EC PRIVATE KEY----- +MHcCAQEEILYvqMKsywltjHLh3GFbRTY/vNCyPzHCJYpU0BVsKgyfoAoGCCqGSM49 +AwEHoUQDQgAEcVhcD9C70MA+gScC8XmhTzZwrCfNcfatnzwJF7lOfNxoXHXmqYdt +c6J0oVsypZcfJ9nCgvIsZKMtDjwcbqcvIQ== +-----END EC PRIVATE KEY----- diff --git a/credentials/development/commissioner_dut/struct_dac_ext_basic_ca_wrong/pai-Cert.der b/credentials/development/commissioner_dut/struct_dac_ext_basic_ca_wrong/pai-Cert.der new file mode 100644 index 0000000000000000000000000000000000000000..de3b317c3c8dba570b85c4964a87fc0197c940f8 GIT binary patch literal 449 zcmXqLV%%%c#F(;xnTe5!iKG5ykY2udg^U3g8;4e#$2nUTW+npzLkR;hHs(+kW*&au z#FCQKB88CD;u3`bM@K^u10gmpZ8k<0#->FzOpH7%Zfj#0Yg9Gb1~*69dbZLhtF9eBK1w`aUg8nKh~R z$nWMUzwele&$(_=wCv82Q!~s29?eWEd2{STbM0amG3MlhLT?`FrS1EgxkR;V&UL=U zX$C1kZ!m|-3NtePXW=kl15!+kj0SulF@BI3Fc=uw3}iukJ{B<+kv#tI|e4zZB{bG*O(*^F_FAU}XdcVpyvP|1mb}}nh?CWRa!y9?}V#}0{)LO-O}zV6mm-V-^B^j T1ruFP{GT~ZCO5Tu(_Ku% literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_dac_ext_basic_critical_missing/dac-Cert.der b/credentials/development/commissioner_dut/struct_dac_ext_basic_critical_missing/dac-Cert.der new file mode 100644 index 0000000000000000000000000000000000000000..e215ca2a3098b314811616bbb10f293313b131d5 GIT binary patch literal 462 zcmXqLVmxKg#8|k1nTe5!iNoiXz|{UQ}nHZr?W@cn(c4A<8^KC_L z?&3biM_cm+1Waf5t;_-pxdxG?_3y59x1QZ}uJ_b!&Xw99<8}&9Lk?kP zcLoC&CIyL-?r(ioE|ZtC?U&iGv+9qcc&VuLUxDwUygOzJ)Xzv~QYcID==sjF{>^0n bYacb7cYhb>sOaQwxxl{8++|aP!*o#qteuTY literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_dac_ext_basic_critical_missing/dac-Cert.pem b/credentials/development/commissioner_dut/struct_dac_ext_basic_critical_missing/dac-Cert.pem new file mode 100644 index 00000000000000..f937cbb6f42bb6 --- /dev/null +++ b/credentials/development/commissioner_dut/struct_dac_ext_basic_critical_missing/dac-Cert.pem @@ -0,0 +1,12 @@ +-----BEGIN CERTIFICATE----- +MIIByjCCAXGgAwIBAgIITNoQlY/6u6IwCgYIKoZIzj0EAwIwMDEYMBYGA1UEAwwP +TWF0dGVyIFRlc3QgUEFJMRQwEgYKKwYBBAGConwCAQwERkZGMTAgFw0yMjA0MjAw +MDAwMDBaGA85OTk5MTIzMTIzNTk1OVowRjEYMBYGA1UEAwwPTWF0dGVyIFRlc3Qg +REFDMRQwEgYKKwYBBAGConwCAQwERkZGMTEUMBIGCisGAQQBgqJ8AgIMBDgwMDAw +WTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAATs9qhtbaOOAeK1bxAQNZuMbAwN1F3S +pDaJ1iCj3LDHPBqVdW54+XJn3L4oaMtCTH/6rmyV2p2x8QZxzcjr6rXSo10wWzAJ +BgNVHRMEAjAAMA4GA1UdDwEB/wQEAwIHgDAdBgNVHQ4EFgQUWySeBlIvflK2gPLf +DG8zYaLiAHIwHwYDVR0jBBgwFoAUpX/u1IuFzbLOjcrbCakr8V65E5YwCgYIKoZI +zj0EAwIDRwAwRAIgGHSL9o46RJOlBr8csLl6/CEXdRUb/RD3FQ24mRB/mGcCIHZk +SIz3BK/sk0/W8ShDu/cXCHiJC4TQB643RLKAQJcV +-----END CERTIFICATE----- diff --git a/credentials/development/commissioner_dut/struct_dac_ext_basic_critical_missing/dac-Key.der b/credentials/development/commissioner_dut/struct_dac_ext_basic_critical_missing/dac-Key.der new file mode 100644 index 0000000000000000000000000000000000000000..233f617598ab92e962100557c2f6a98e09da873a GIT binary patch literal 121 zcmV-<0EYiCcLD(c1Rzg6Lo&qw+-r+YuA)^K<~Aw4SCB;W? b+`cGi%R)?l`mSu1+MTiS264^E>*}@AlqEMf literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_dac_ext_basic_critical_missing/dac-Key.pem b/credentials/development/commissioner_dut/struct_dac_ext_basic_critical_missing/dac-Key.pem new file mode 100644 index 00000000000000..1e0fa09c4ddb55 --- /dev/null +++ b/credentials/development/commissioner_dut/struct_dac_ext_basic_critical_missing/dac-Key.pem @@ -0,0 +1,5 @@ +-----BEGIN EC PRIVATE KEY----- +MHcCAQEEIE89QzLE/9xri06uolUY5jYpvVeQRT+yJHvgRgXGleF7oAoGCCqGSM49 +AwEHoUQDQgAE7PaobW2jjgHitW8QEDWbjGwMDdRd0qQ2idYgo9ywxzwalXVuePly +Z9y+KGjLQkx/+q5sldqdsfEGcc3I6+q10g== +-----END EC PRIVATE KEY----- diff --git a/credentials/development/commissioner_dut/struct_dac_ext_basic_critical_missing/pai-Cert.der b/credentials/development/commissioner_dut/struct_dac_ext_basic_critical_missing/pai-Cert.der new file mode 100644 index 0000000000000000000000000000000000000000..f12a1147dda3e911d4d525e41da2a87f4bbe8ef5 GIT binary patch literal 451 zcmXqLV%%@g#F(;xnTe5!iNocrcI=hx9ZUvXY#dr`9_MUXn3)U=3?&T2*qB3En0fep z6H7``ixfgqi%S#&932fs420OYwAmP07@HQ=FfsD5xVgC*8YqbK8W|aw7#To7lmx#e z5EvR61Cgnvsbv%%Gd*#b8EGKQ#twE96C>1d%#7^JP7EyH_O|t{<9X13SM7fE)R|2J z1qT=FzWido-f&^kw$;aF`?EgjmOpekS3RTqr|L}J-r3Lhu>E8CRkLHw1Rl9a_UEyS z(+pC8-e3-u6=r1o&%$BA2Ber684dVAV*DU6U@$PU8OVb8d@N!tB1`MvUFmK;yXjo- zsoR_@wLiw~6rN@v50X}90R~osNY-Daa``~{H~YmLr>6_txnsDnunsv;nLQZ{+?W&@ zTBBI*irz|p^rN;7@5(_#e{zHaGf?H3{H7=kE1_&yK zNX|V20SBQ(13~}<_PvIVt_GU_RF`;6%tH&LWYVs|2;Y7}R bn2Y%(nGKDb=e!2~1p0iqtdI;ISqJA`s4p_# literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_dac_ext_basic_critical_missing/pai-Key.pem b/credentials/development/commissioner_dut/struct_dac_ext_basic_critical_missing/pai-Key.pem new file mode 100644 index 00000000000000..8d57cc3bf512f1 --- /dev/null +++ b/credentials/development/commissioner_dut/struct_dac_ext_basic_critical_missing/pai-Key.pem @@ -0,0 +1,5 @@ +-----BEGIN EC PRIVATE KEY----- +MHcCAQEEIBbJDakrXac0BXhggy5J6jpZzhILOib+Q4ZHgltPzjUuoAoGCCqGSM49 +AwEHoUQDQgAE9r2Gjq4M4I/dJt9blZmCEHDBoy3p9DevMaFitqvHHY9q8i134UTO +e5iL+SWZDY2b57wG/gT6fLiskAweWQfnXQ== +-----END EC PRIVATE KEY----- diff --git a/credentials/development/commissioner_dut/struct_dac_ext_basic_critical_missing/test_case_vector.json b/credentials/development/commissioner_dut/struct_dac_ext_basic_critical_missing/test_case_vector.json new file mode 100644 index 00000000000000..964ef3fc524d16 --- /dev/null +++ b/credentials/development/commissioner_dut/struct_dac_ext_basic_critical_missing/test_case_vector.json @@ -0,0 +1,9 @@ +{ + "description": "DAC Test Vector: Certificate Basic Constraint extension critical field is missing", + "is_success_case": "false", + "dac_cert": "308201ca30820171a00302010202084cda10958ffabba2300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313020170d3232303432303030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004ecf6a86d6da38e01e2b56f1010359b8c6c0c0dd45dd2a43689d620a3dcb0c73c1a95756e78f97267dcbe2868cb424c7ffaae6c95da9db1f10671cdc8ebeab5d2a35d305b30090603551d1304023000300e0603551d0f0101ff040403020780301d0603551d0e041604145b249e06522f7e52b680f2df0c6f3361a2e20072301f0603551d23041830168014a57feed48b85cdb2ce8dcadb09a92bf15eb91396300a06082a8648ce3d0403020347003044022018748bf68e3a4493a506bf1cb0b97afc211775151bfd10f7150db899107f986702207664488cf704afec934fd6f12843bbf7170878890b84d007ae3744b280409715", + "pai_cert": "308201bf30820164a003020102020844cd2b5dd46bb802300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303432303030303030305a180f39393939313233313233353935395a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d03010703420004f6bd868eae0ce08fdd26df5b9599821070c1a32de9f437af31a162b6abc71d8f6af22d77e144ce7b988bf925990d8d9be7bc06fe04fa7cb8ac900c1e5907e75da366306430120603551d130101ff040830060101ff020101300e0603551d0f0101ff040403020106301d0603551d0e04160414a57feed48b85cdb2ce8dcadb09a92bf15eb91396301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020349003046022100855a04dd15da67e2f2796bc74df2fd2cb55e2448551e324d362a5bf71e9366ea022100d0edf0942410b6a5f63a9637874e2b990944556604305e460000708300c40958", + "certification_declaration": "3081e806092a864886f70d010702a081da3081d7020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317c307a020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d040302044630440220261e5642187ef1644369b4d0ed9921f005864feda1a899a7a3705fac5b50d15b02205ad7c145af31c4957cae83e7dcd27cb4b6ced9ba77e9a6fa348766059dc219eb", + "dac_private_key": "4f3d4332c4ffdc6b8b4eaea25518e63629bd5790453fb2247be04605c695e17b", + "dac_public_key": "04ecf6a86d6da38e01e2b56f1010359b8c6c0c0dd45dd2a43689d620a3dcb0c73c1a95756e78f97267dcbe2868cb424c7ffaae6c95da9db1f10671cdc8ebeab5d2" +} diff --git a/credentials/development/commissioner_dut/struct_dac_ext_basic_critical_wrong/cd.der b/credentials/development/commissioner_dut/struct_dac_ext_basic_critical_wrong/cd.der new file mode 100644 index 0000000000000000000000000000000000000000..93a353b7c6687b0df3412762821428c6cb03294e GIT binary patch literal 236 zcmXqLe96YC)#lOmotKfFX+h&{gT@<7jLe3-2Hb3%32h#Xsmv@)j0UaZyq1nW)TZ%NHd6EV9l$zG85vB#ZBf$fBizqf_DOF~S6kFzOpH7%ZfC?t&DSrG^m1R;xt2L6w_IlbRNve;F;w51_M42lb@0CKMOES*c%LFL3}G!G6KprHm%mNI#29eP8NA32r3Oi(#LrgSoZU~AiXRSmIVPAq^tgq+E=(+Bc@ bgN~6^FG%A%(1d%#7^JP7Evxe(_Rk5B+h{u|Dy0lBM3X zZ6OwF%MMuo+we6k@j&jys4D)tY5y*Cyq@YH-+6bLifU<^u8c_V)T=%}RFw9;o^xz* znn4QC8_c1y!iOyGAqOh6Cxd|-lOjXQ ztBGF)lI(9xs$$&`=70ayvLnV9U+j&m$5ZO91#|iy#01 literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_dac_ext_basic_critical_wrong/pai-Cert.pem b/credentials/development/commissioner_dut/struct_dac_ext_basic_critical_wrong/pai-Cert.pem new file mode 100644 index 00000000000000..5eb0bc26a2bc28 --- /dev/null +++ b/credentials/development/commissioner_dut/struct_dac_ext_basic_critical_wrong/pai-Cert.pem @@ -0,0 +1,12 @@ +-----BEGIN CERTIFICATE----- +MIIBvzCCAWSgAwIBAgIID+GOMm3R0RwwCgYIKoZIzj0EAwIwMDEYMBYGA1UEAwwP +TWF0dGVyIFRlc3QgUEFBMRQwEgYKKwYBBAGConwCAQwERkZGMTAgFw0yMjA0MjAw +MDAwMDBaGA85OTk5MTIzMTIzNTk1OVowMDEYMBYGA1UEAwwPTWF0dGVyIFRlc3Qg +UEFJMRQwEgYKKwYBBAGConwCAQwERkZGMTBZMBMGByqGSM49AgEGCCqGSM49AwEH +A0IABCBOXxqtwvxCLDvI+ZI5Lpa2VDgmpsA7/rD1VmHAbdFaeg9+lv7QiOuVQB+J +3aYkJXVmLRwUU5XVTPgkIr7rnMajZjBkMBIGA1UdEwEB/wQIMAYBAf8CAQEwDgYD +VR0PAQH/BAQDAgEGMB0GA1UdDgQWBBRVZ+KHP5pxiB0jVDQo2bBSXncFeTAfBgNV +HSMEGDAWgBRq/SJ3H1Ef7L8WQZdnENzcMaFxfjAKBggqhkjOPQQDAgNJADBGAiEA +hOqR9RBiP9iSegWwVk/f6qbEM9HovV58bCrv+mYoerUCIQC7+nKd49BL0dteYLG/ +0bkpN62YMpeBShz4ZcxSuCiG0g== +-----END CERTIFICATE----- diff --git a/credentials/development/commissioner_dut/struct_dac_ext_basic_critical_wrong/pai-Key.der b/credentials/development/commissioner_dut/struct_dac_ext_basic_critical_wrong/pai-Key.der new file mode 100644 index 0000000000000000000000000000000000000000..37d0988b3712a6a064fb5a807aa7e6c413877699 GIT binary patch literal 121 zcmV-<0EYiCcLD(c1R!CCDx_tPFu_Pe8n!mV=gCA$kTa57vc6S+Tk1~@L!Qr4)8E+SWNeVOcy72-*q2EmSSNbM&7N&XmX}34{yMs(VcK@l SHIE%#_Wrp$+f=5Vvl{>=(nnj-G}h210CH+H8z0j7^Jbm>79j+}zv@4HU$Ajf@OTj0_+kN`l`K z2n>ykfymU-)H2Gz4TqU7j?UQ4L=$D=VX*)i9%&%V#twEV6C>2g%#7^JP7ExOOv$Sm ztd_5ju)KADp3s^754ja=bW-^0yo&;-oU{L*X;Xji)0V2lg+~vqQ+sa2s6F{jdGw#j zpC+pNUH_<^wmfKYkU@X}AJE&f{EUqMS%3k--e4dL;`6bHv53SvF-D)vP1gUK71;9q zv!&#s`ZZe&YF)FJwlkN{s5m S^0wK>UM`$F@qXDYZ!rLE42lN; literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_dac_ext_basic_missing/dac-Cert.pem b/credentials/development/commissioner_dut/struct_dac_ext_basic_missing/dac-Cert.pem new file mode 100644 index 00000000000000..3ae9e540f9e37d --- /dev/null +++ b/credentials/development/commissioner_dut/struct_dac_ext_basic_missing/dac-Cert.pem @@ -0,0 +1,12 @@ +-----BEGIN CERTIFICATE----- +MIIBvzCCAWagAwIBAgIIdWQZZ/hRmSMwCgYIKoZIzj0EAwIwMDEYMBYGA1UEAwwP +TWF0dGVyIFRlc3QgUEFJMRQwEgYKKwYBBAGConwCAQwERkZGMTAgFw0yMjA0MjAw +MDAwMDBaGA85OTk5MTIzMTIzNTk1OVowRjEYMBYGA1UEAwwPTWF0dGVyIFRlc3Qg +REFDMRQwEgYKKwYBBAGConwCAQwERkZGMTEUMBIGCisGAQQBgqJ8AgIMBDgwMDAw +WTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAARZAmOrADqnr1g52t+eEsy/4QsgPCxk +Dn5LclGUzj//aTx/3vK0emGhxcKuJucyASuT7Hdb/JPykSdO1/ErZqdSo1IwUDAO +BgNVHQ8BAf8EBAMCB4AwHQYDVR0OBBYEFF1CAVvJbWMv9WpRhPfzORmif6y0MB8G +A1UdIwQYMBaAFESUBKTSsI5oejdmvN3p3DEHtQblMAoGCCqGSM49BAMCA0cAMEQC +IE/Du5ZitPyojUXhCHPlF511CY9T0ZVO7lsXNBi4LzN9AiAxYJCXJS7vz7zB5k5U +mHUkXCXhd4abxumhnZHfdtpLFg== +-----END CERTIFICATE----- diff --git a/credentials/development/commissioner_dut/struct_dac_ext_basic_missing/dac-Key.der b/credentials/development/commissioner_dut/struct_dac_ext_basic_missing/dac-Key.der new file mode 100644 index 0000000000000000000000000000000000000000..e3a7661d6f24aa6482acf31ba5fdb73b4bea4619 GIT binary patch literal 121 zcmV-<0EYiCcLD(c1RwytK`~^|KoGrDrXJc8qUJu07p#>qKrx-mTY+{(7Tcf-1_&yK zNX|V20SBQ(13~}e2>WY#dr`9_MUXn3)U=3?&T2*qB3En0fep z6H7``ixfgqi%S#&932fs420OYwAmP07@HQ=FfsD5xVgC*8YqbK8W|aw7#To7lmx#e z5EvR61Cgnvsbv%%Gd*#b8EGKQ#twE96C>1d%#7^JP7Ew+>D*;j;tS@!-dAitWB#na zfpb5I9y?q(>E@%WCxvD@l+0OL=^3|d(i{8t4KB;=b^c1__#RF2{d4!+<>w(~J{9td z(+pC8-e3-u6=r1o&%$BA2Ber684dVAV*DU6U@$PU8OVb8d@N!tA}&){mR#DFEM@?iemCtV0e|W)B7fS0+V< z|4Ul<*1mSh$z7?tT=non@dS4+RS(WXH&P5ej3k(AW0@4>8^Y9UB{J4~FPy3H@~l+q V%*l2}b=x98wadr7kc;F#3;^7Wg_i&T literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_dac_ext_basic_missing/pai-Cert.pem b/credentials/development/commissioner_dut/struct_dac_ext_basic_missing/pai-Cert.pem new file mode 100644 index 00000000000000..79052c615b6647 --- /dev/null +++ b/credentials/development/commissioner_dut/struct_dac_ext_basic_missing/pai-Cert.pem @@ -0,0 +1,12 @@ +-----BEGIN CERTIFICATE----- +MIIBvjCCAWSgAwIBAgIIB71uNqm8JxswCgYIKoZIzj0EAwIwMDEYMBYGA1UEAwwP +TWF0dGVyIFRlc3QgUEFBMRQwEgYKKwYBBAGConwCAQwERkZGMTAgFw0yMjA0MjAw +MDAwMDBaGA85OTk5MTIzMTIzNTk1OVowMDEYMBYGA1UEAwwPTWF0dGVyIFRlc3Qg +UEFJMRQwEgYKKwYBBAGConwCAQwERkZGMTBZMBMGByqGSM49AgEGCCqGSM49AwEH +A0IABCZnC3Y6F6Cd675zP5ifmv1RnfAVxsNxktni1ckSmUB0nKV5SV6mkuw/74BE +pz8s/RpsTcViTfzdztPnVHZMeB+jZjBkMBIGA1UdEwEB/wQIMAYBAf8CAQEwDgYD +VR0PAQH/BAQDAgEGMB0GA1UdDgQWBBRElASk0rCOaHo3Zrzd6dwxB7UG5TAfBgNV +HSMEGDAWgBRq/SJ3H1Ef7L8WQZdnENzcMaFxfjAKBggqhkjOPQQDAgNIADBFAiEA +/6SEDq3rRGxtqS2nJcPhF2BHCiVICcLYZDFIMhgDfV0CIB+AVid9GGivS6GZIOnN +GmWZkz4yfrZZ8ocfXugeWQvD +-----END CERTIFICATE----- diff --git a/credentials/development/commissioner_dut/struct_dac_ext_basic_missing/pai-Key.der b/credentials/development/commissioner_dut/struct_dac_ext_basic_missing/pai-Key.der new file mode 100644 index 0000000000000000000000000000000000000000..5bd09a77b395d72d51d19dcc7ad3ae7b7229a69b GIT binary patch literal 121 zcmV-<0EYiCcLD(c1R!2EP7dWNv7O(($}SCZGAsxO04lHwLq)aN<-Egv59go?1_&yK zNX|V20SBQ(13~}%Mb8n4g;cQJwG=#=~)v+2Ym75}81BoTYh5UZ#@l bKktA;d-VLbF%eAe3b6~`|DmF!!$TF=kZ^Xu8Osr!V|jE?WI UaNH0(zgytqgm-%xyG&0300;U>p#T5? literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_dac_ext_basic_pathlen0/dac-Cert.der b/credentials/development/commissioner_dut/struct_dac_ext_basic_pathlen0/dac-Cert.der new file mode 100644 index 0000000000000000000000000000000000000000..eec9f7e9db8379a2ae5357392470da20fde53d95 GIT binary patch literal 467 zcmXqLVmxoq#8|R`nTe5!i9@cnKy2~E*jNKDHV&;ek8`#x%uEIbh7ty1Y|No7%sl+Q zi6teeMG7IQ#U%;>j-G}h210CH+H8z0j7^Jbm>79j+}zv@4HU$Ajf@OTj0_+kN`l`K z2n>ykfymU-)H2Gz4TqU7j?UQ4L=$D=VX*)i9%&%V#twEV6C>2g%#7^JP7EyUeqB6y zN)B^1XJ?mezxTDGIQ@Iv!u<^fC+`>pq>KFuni|08slQ#_t~(`I{I}ZcDSNCL7n?Ia zPxxZkbj(9h`_1A6gE#{optog(85#exFc~ly@PT;zARaJS*c%LFL3}r4CF!5$}GUZYY+)b{#1I_G2c7c)M@u-61DV;A z!N844kzr9nKKGUo1!lpguAg>U-^hO}*|hoLLaRdO8^3>)ae6!iD!F4VWN9~Tjpy4b c_8fD*YacLJJkHs&Ff$n#7)lt3u`!3TF!S*H zCYF?>7Ab_J7MCalI64}N7znX(X|pl1Fg7i!VPfQAadUGsG*A%dH8L_VF*1OFC<%T` zATTsC1|m~SQ_CnkW_scJobofuf;{!Qq$p0QgsAhx~h{*oE% zMCx3lpVl9Jzp?ON%$wb-p1*0Fv;M|+ajt)hHGFfVzltvSJl$SHG&`mLv|f3<;V0w8 zX$C1kZ!m|-3NtePXW=kl15!+kj0SulF@BI3Fc=uw3}iukJ{B<+k+9@Xr3al@Z=5b= zYP5IIIUjJegu_4{B(2N>46Fu`tiMX-@`3Vi_KP`APZzjz$8cd`9de*DdomcfF)1<} zJ>@=S`u6ivGTP@lTFdM&575mmu-Vsnt4!;&(219M%0MMwme^OP%XBPLGjjc9F!{y93pZeduyic{KnBLMhHi2DEl literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_dac_ext_basic_pathlen0/pai-Cert.pem b/credentials/development/commissioner_dut/struct_dac_ext_basic_pathlen0/pai-Cert.pem new file mode 100644 index 00000000000000..fc5b7392117d38 --- /dev/null +++ b/credentials/development/commissioner_dut/struct_dac_ext_basic_pathlen0/pai-Cert.pem @@ -0,0 +1,12 @@ +-----BEGIN CERTIFICATE----- +MIIBvzCCAWSgAwIBAgIIV5Mnr0rRnWswCgYIKoZIzj0EAwIwMDEYMBYGA1UEAwwP +TWF0dGVyIFRlc3QgUEFBMRQwEgYKKwYBBAGConwCAQwERkZGMTAgFw0yMjA0MjAw +MDAwMDBaGA85OTk5MTIzMTIzNTk1OVowMDEYMBYGA1UEAwwPTWF0dGVyIFRlc3Qg +UEFJMRQwEgYKKwYBBAGConwCAQwERkZGMTBZMBMGByqGSM49AgEGCCqGSM49AwEH +A0IABB7+kI07mLslUF2Hit+kmK4UfkVb5X/F77Fx/lzsu6rn7IGcr9j3Fwr+oyhN +bBv1FaDzlz8oFWtkj8sud18x8jOjZjBkMBIGA1UdEwEB/wQIMAYBAf8CAQEwDgYD +VR0PAQH/BAQDAgEGMB0GA1UdDgQWBBRWY/J1wUIF2Mt1AoE/QCzPUMV0CDAfBgNV +HSMEGDAWgBRq/SJ3H1Ef7L8WQZdnENzcMaFxfjAKBggqhkjOPQQDAgNJADBGAiEA +xcpHlJe3z5Roh51BOxy/d1AtbXA8vonadirzEsjpbiMCIQD0pD97ZxyIpiYyRfow +k9TeJ1fQHa7Fwpc4MXeqCRszsQ== +-----END CERTIFICATE----- diff --git a/credentials/development/commissioner_dut/struct_dac_ext_basic_pathlen0/pai-Key.der b/credentials/development/commissioner_dut/struct_dac_ext_basic_pathlen0/pai-Key.der new file mode 100644 index 0000000000000000000000000000000000000000..9baffb174c981e1db0bfba2854956ce34fb434fe GIT binary patch literal 121 zcmV-<0EYiCcLD(c1R$BRM;*$TptcPFZI7W<4kqt&iKLn|LberUY*XRe-qoNA1_&yK zNX|V20SBQ(13~}<9{!MxJD9sAP+fOY#a3zp!1hMC>3jDkIOE1UorAC@i;a_ literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_dac_ext_basic_pathlen0/pai-Key.pem b/credentials/development/commissioner_dut/struct_dac_ext_basic_pathlen0/pai-Key.pem new file mode 100644 index 00000000000000..97d49675220882 --- /dev/null +++ b/credentials/development/commissioner_dut/struct_dac_ext_basic_pathlen0/pai-Key.pem @@ -0,0 +1,5 @@ +-----BEGIN EC PRIVATE KEY----- +MHcCAQEEIJmyRx3KmKC2DQBtj6FVDibvc4mkmjRCthVlbFPh297VoAoGCCqGSM49 +AwEHoUQDQgAEHv6QjTuYuyVQXYeK36SYrhR+RVvlf8XvsXH+XOy7qufsgZyv2PcX +Cv6jKE1sG/UVoPOXPygVa2SPyy53XzHyMw== +-----END EC PRIVATE KEY----- diff --git a/credentials/development/commissioner_dut/struct_dac_ext_basic_pathlen0/test_case_vector.json b/credentials/development/commissioner_dut/struct_dac_ext_basic_pathlen0/test_case_vector.json new file mode 100644 index 00000000000000..3f50c4352dc51f --- /dev/null +++ b/credentials/development/commissioner_dut/struct_dac_ext_basic_pathlen0/test_case_vector.json @@ -0,0 +1,9 @@ +{ + "description": "DAC Test Vector: Certificate Basic Constraint extension PathLen field set to 0", + "is_success_case": "false", + "dac_cert": "308201cf30820174a00302010202081e857016a3915d5d300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313020170d3232303432303030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004074e8a0c6e22409d299b6b74b7def5787367f75ea1bf8030c9dc30506716fa5295500e492fb7273e8b645317fb26eb94bc3b01a33701e760f43182c648212beca360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e0416041431326841ebbab31837c9731f9b9b8f9b96e32b98301f0603551d230418301680145663f275c14205d8cb7502813f402ccf50c57408300a06082a8648ce3d0403020349003046022100a2606f0bb454200311e545f2ba3bd86fed1982b3e1a13a7143d8fbf8760948e1022100dc3b12393e96ac49ed943f089cf72bc030ac4a2866f1e130d726a59da58405d9", + "pai_cert": "308201bf30820164a0030201020208579327af4ad19d6b300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303432303030303030305a180f39393939313233313233353935395a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d030107034200041efe908d3b98bb25505d878adfa498ae147e455be57fc5efb171fe5cecbbaae7ec819cafd8f7170afea3284d6c1bf515a0f3973f28156b648fcb2e775f31f233a366306430120603551d130101ff040830060101ff020101300e0603551d0f0101ff040403020106301d0603551d0e041604145663f275c14205d8cb7502813f402ccf50c57408301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020349003046022100c5ca479497b7cf9468879d413b1cbf77502d6d703cbe89da762af312c8e96e23022100f4a43f7b671c88a6263245fa3093d4de2757d01daec5c297383177aa091b33b1", + "certification_declaration": "3081ea06092a864886f70d010702a081dc3081d9020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317e307c020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204483046022100adf3c31a4e27816c20544450934b8fc148be00c6b05c01c2f3179aad87a8c7d2022100beaeab2e4e4949f5cdcd65be126632c7bc3841b05d9f8b10d190eebd018a35ca", + "dac_private_key": "e01bf335ceff445d3a1c16e87d8185e62e58cb94715ac67364fc705fa69bffa7", + "dac_public_key": "04074e8a0c6e22409d299b6b74b7def5787367f75ea1bf8030c9dc30506716fa5295500e492fb7273e8b645317fb26eb94bc3b01a33701e760f43182c648212bec" +} diff --git a/credentials/development/commissioner_dut/struct_dac_ext_basic_pathlen1/cd.der b/credentials/development/commissioner_dut/struct_dac_ext_basic_pathlen1/cd.der new file mode 100644 index 0000000000000000000000000000000000000000..4e1216e9fdb893a5b4ab7e2dfffb4fc2db7ace73 GIT binary patch literal 236 zcmXqLe96YC)#lOmotKfFX+h&{gT@<7jLe3-2Hb3%32h#Xsmv@)j0Ua+&6 Tg>w}QkBNOPQ`au|b#isZ&d;>_Au?`xS(gf`^Z7XW7&7amKlgLXIyypz3PtF)iAb2Tejq;?~VE7!7=Hf zPgyUQ+Of^@lPt;>Cm6&T@BqCnE6m9FpM}YQ!GI6M;|KA8!NT5PAPeI2v52vVY+JvY z#menn-FBndGD&Sy^V_dZJ7XXZl2&E`23~{6UCSmL^=BWgyIPN|3bwfV+e7D-EOH<- zyE7QLFe%udd@PgBxwGI>dg34X>6)rOmIZqybPuO0iTyaJC6#@RNg<#K9rPYupy5Fckx6(B}7g+)C9} b2BNgIZD+k)@<<4h;Y@ao3MR(0ACfqBCAu=) literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_dac_ext_basic_pathlen1/dac-Key.pem b/credentials/development/commissioner_dut/struct_dac_ext_basic_pathlen1/dac-Key.pem new file mode 100644 index 00000000000000..96d6c9258083ec --- /dev/null +++ b/credentials/development/commissioner_dut/struct_dac_ext_basic_pathlen1/dac-Key.pem @@ -0,0 +1,5 @@ +-----BEGIN EC PRIVATE KEY----- +MHcCAQEEIHJbSL/6EzbHP6Vv59AZFoyfKxUwVi7s+Rc0UFcsWe8NoAoGCCqGSM49 +AwEHoUQDQgAEx3Or4GulpZH2ehDovAK9CNAuO7vEwSHGa9wWpjAVA2jQ5vd63ErV +VgaitLRtZ71c8kgIkuFMdo0KJsazH5I4dg== +-----END EC PRIVATE KEY----- diff --git a/credentials/development/commissioner_dut/struct_dac_ext_basic_pathlen1/pai-Cert.der b/credentials/development/commissioner_dut/struct_dac_ext_basic_pathlen1/pai-Cert.der new file mode 100644 index 0000000000000000000000000000000000000000..4163a7a6d953e8007a6bebbc2e2feb7b5e62cc7f GIT binary patch literal 450 zcmXqLV%%rY#F(;xnTe5!i6iTPd%3wlQjY-_8;4e#$2nUTW+npzLkR;hHs(+kW*&au z#FCQKB88CD;u3`bM@K^u10gmpZ8k<0#->FzOpH7%Zfj#0Yg9Gb1~*69Y@DoArf4ccz>j24Zi&*mK|2 zO8jlKrZ>~{Rm1NKC6}}Iervj6*FVco-fVH_^wRSV|JS#_wiMeiY2LxMFVp69OgXwZ z%^(Hn4dzf;VMfOPEF1=GK#GZx(SQ#m#t#w$1_L9Tfh>s6$0Eiea@VrSM*Z1G>#o)# ztAZ`A{`Sy$C2JrLl2&E`23CVe)?cM^`9S$M`^6lmrwiPFXv4bWKz(29Wi@)YUqQWGw)aM#D?$P Vw4(Ba1$W|UebrsuGv}+!1OR!mh)4hc literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_dac_ext_basic_pathlen1/pai-Cert.pem b/credentials/development/commissioner_dut/struct_dac_ext_basic_pathlen1/pai-Cert.pem new file mode 100644 index 00000000000000..939b18938fba74 --- /dev/null +++ b/credentials/development/commissioner_dut/struct_dac_ext_basic_pathlen1/pai-Cert.pem @@ -0,0 +1,12 @@ +-----BEGIN CERTIFICATE----- +MIIBvjCCAWSgAwIBAgIIasBHdzcQYowwCgYIKoZIzj0EAwIwMDEYMBYGA1UEAwwP +TWF0dGVyIFRlc3QgUEFBMRQwEgYKKwYBBAGConwCAQwERkZGMTAgFw0yMjA0MjAw +MDAwMDBaGA85OTk5MTIzMTIzNTk1OVowMDEYMBYGA1UEAwwPTWF0dGVyIFRlc3Qg +UEFJMRQwEgYKKwYBBAGConwCAQwERkZGMTBZMBMGByqGSM49AgEGCCqGSM49AwEH +A0IABIVGO9BxRwJsuDAW7fQ/C90qYfsyrI1pNeqA+9B002q99oLYPo+aTh82o4mX +dc9A/6+H6zkWsJKewYb0lpyIlMWjZjBkMBIGA1UdEwEB/wQIMAYBAf8CAQEwDgYD +VR0PAQH/BAQDAgEGMB0GA1UdDgQWBBTdOYI8J+bxO4qFxKpTONX7SCzqHTAfBgNV +HSMEGDAWgBRq/SJ3H1Ef7L8WQZdnENzcMaFxfjAKBggqhkjOPQQDAgNIADBFAiEA +ze9WdCVUO2Berd0XA1epFncdS3QbblrhtFwDI+mekxECICrrWJuXZVXgjMzvqAxd +V72yqHnIOAthyy8luguZnySZ +-----END CERTIFICATE----- diff --git a/credentials/development/commissioner_dut/struct_dac_ext_basic_pathlen1/pai-Key.der b/credentials/development/commissioner_dut/struct_dac_ext_basic_pathlen1/pai-Key.der new file mode 100644 index 0000000000000000000000000000000000000000..645a79675660e79952c1f7d4317f2172bc464aed GIT binary patch literal 121 zcmV-<0EYiCcLD(c1R!tr_;?|U>BY9;lri{hVx`dbzzmVW&ubkl0R_JY_xkD5*& bHlvA`b&SO*A3`tPJrY*(R6`vAo$g6c literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_dac_ext_basic_pathlen2/dac-Cert.der b/credentials/development/commissioner_dut/struct_dac_ext_basic_pathlen2/dac-Cert.der new file mode 100644 index 0000000000000000000000000000000000000000..94e0d9b034d83613b55d26e70fc03ab68c78b02c GIT binary patch literal 465 zcmXqLVmxcm#8|R`nTe5!iNoJ_#iuXRD(@R`v2kd%d7QIlVP-NgFqAM5V`C0wVdmlY zO)M!%Em8Q}nHZr?W@cn(c4A<8 zZ1zzRo4VDRj8!)MHM?(k+dv*9t;_-pyati<#-gcilN(M5EEo2VJ-Fg(Vb&%aUE bka)S~vE~b|!!_Y%%VZBPKlQj+`cxDETgi;{ literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_dac_ext_basic_pathlen2/dac-Cert.pem b/credentials/development/commissioner_dut/struct_dac_ext_basic_pathlen2/dac-Cert.pem new file mode 100644 index 00000000000000..2c1a0d787217a8 --- /dev/null +++ b/credentials/development/commissioner_dut/struct_dac_ext_basic_pathlen2/dac-Cert.pem @@ -0,0 +1,12 @@ +-----BEGIN CERTIFICATE----- +MIIBzTCCAXSgAwIBAgIIT02o8vSWed8wCgYIKoZIzj0EAwIwMDEYMBYGA1UEAwwP +TWF0dGVyIFRlc3QgUEFJMRQwEgYKKwYBBAGConwCAQwERkZGMTAgFw0yMjA0MjAw +MDAwMDBaGA85OTk5MTIzMTIzNTk1OVowRjEYMBYGA1UEAwwPTWF0dGVyIFRlc3Qg +REFDMRQwEgYKKwYBBAGConwCAQwERkZGMTEUMBIGCisGAQQBgqJ8AgIMBDgwMDAw +WTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAATsRQA/7Ff6+o4F4lZotstSZPf35jfi +ZCUb8mmIgM5wv2ngNUjM7mriQsWqxVSKzEBbPzI4VmqOCZq9b54jXNqmo2AwXjAM +BgNVHRMBAf8EAjAAMA4GA1UdDwEB/wQEAwIHgDAdBgNVHQ4EFgQUAiPZQgY/Wliy +iycCMySy/TbfMdswHwYDVR0jBBgwFoAUZ4FylUaTgMgQpxNPXcGo1XFqsjwwCgYI +KoZIzj0EAwIDRwAwRAIgU2muwp5prELkbKZ6RDTDMgqRgleAMG9MjuOxUNquuioC +IHRF8lecKDEratxQGOms4ynoCsN8VzamHcOnyuNzG8pa +-----END CERTIFICATE----- diff --git a/credentials/development/commissioner_dut/struct_dac_ext_basic_pathlen2/dac-Key.der b/credentials/development/commissioner_dut/struct_dac_ext_basic_pathlen2/dac-Key.der new file mode 100644 index 0000000000000000000000000000000000000000..e2ed387e30a79afd6c047ec3be315dae0b996aaa GIT binary patch literal 121 zcmV-<0EYiCcLD(c1Ryv?>^#L8IF`s#JixKQa=F55x$1P=-6zvQv$CoZ#y6k}1_&yK zNX|V20SBQ(13~}<>_q@S>{t5wjs@aYXtv8zWcT;xH{xU^8}ez0fX;BgY2Y5R%(t3n!RtHBV5|1qTVGYjv2kd%d7QIlVP-NgFqAM5V`C0wVdmlY zO)M!%Em8?e-rSqD-|e)~;ZK*V zGjDF!Q#~1RhQdpWbL7EVZJ!c zAO+|R=1^H-M#ldv90qJaiiwfYfDa_b4-x|g10$P(EQrs?BE}+;-dHr%ZF0j2f#t&f zu?JUNEzH_vV;~QbR%QVPR)a{^U!`*SK>0WO#T=)n3*5P5xUjGeIZ&BB84TQ*6d5)P zdu>b4&dPnv@z3+%qC@W>u3v_f^~-vg^&(<&=b2|g%fltbSdIy%`Id{j%a@lw$t b0pX2XHw756dId#Fcxj4$ZG|#BNG~`y@DVPc literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_dac_ext_basic_pathlen2/pai-Key.pem b/credentials/development/commissioner_dut/struct_dac_ext_basic_pathlen2/pai-Key.pem new file mode 100644 index 00000000000000..2f927fea7c324a --- /dev/null +++ b/credentials/development/commissioner_dut/struct_dac_ext_basic_pathlen2/pai-Key.pem @@ -0,0 +1,5 @@ +-----BEGIN EC PRIVATE KEY----- +MHcCAQEEINUvCfFwivDIHiu0QnXn3wOrXtMqK1EJPisBwmXrC7tQoAoGCCqGSM49 +AwEHoUQDQgAERG5CjinZvWq/Rssyw/LTe2nZtykKicYklEPfGjo62Rl8VEuy8VLR +IQHhjVs3BRixegVFSnhpin5thTI7SC84Nw== +-----END EC PRIVATE KEY----- diff --git a/credentials/development/commissioner_dut/struct_dac_ext_basic_pathlen2/test_case_vector.json b/credentials/development/commissioner_dut/struct_dac_ext_basic_pathlen2/test_case_vector.json new file mode 100644 index 00000000000000..c6662ac7dc73b9 --- /dev/null +++ b/credentials/development/commissioner_dut/struct_dac_ext_basic_pathlen2/test_case_vector.json @@ -0,0 +1,9 @@ +{ + "description": "DAC Test Vector: Certificate Basic Constraint extension PathLen field set to 2", + "is_success_case": "false", + "dac_cert": "308201cd30820174a00302010202084f4da8f2f49679df300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313020170d3232303432303030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004ec45003fec57fafa8e05e25668b6cb5264f7f7e637e264251bf2698880ce70bf69e03548ccee6ae242c5aac5548acc405b3f3238566a8e099abd6f9e235cdaa6a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e041604140223d942063f5a58b28b27023324b2fd36df31db301f0603551d2304183016801467817295469380c810a7134f5dc1a8d5716ab23c300a06082a8648ce3d040302034700304402205369aec29e69ac42e46ca67a4434c3320a91825780306f4c8ee3b150daaeba2a02207445f2579c28312b6adc5018e9ace329e80ac37c5736a61dc3a7cae3731bca5a", + "pai_cert": "308201bf30820164a003020102020842c19370b69f6494300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303432303030303030305a180f39393939313233313233353935395a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d03010703420004446e428e29d9bd6abf46cb32c3f2d37b69d9b7290a89c6249443df1a3a3ad9197c544bb2f152d12101e18d5b370518b17a05454a78698a7e6d85323b482f3837a366306430120603551d130101ff040830060101ff020101300e0603551d0f0101ff040403020106301d0603551d0e0416041467817295469380c810a7134f5dc1a8d5716ab23c301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020349003046022100b3134ab6676b6a6de308fe49c1a2c23184ef1219c55d7f7288ba8d698e5eb8d6022100b4caa581571508ec59eae4644f99ab5789bf71c0caa6e754c97e7495dd4752b7", + "certification_declaration": "3081e906092a864886f70d010702a081db3081d8020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204473045022100ac6765617a5c02188bc6bf6b44117e95757c39abd16d7a792cd56751d6bc72970220109f0698347f89a673a2a321f4f9aaba113ceb59ee46f055d2ddc45674e52827", + "dac_private_key": "3845ec3cc5193896c8523cc0b1c072b9c26bb9ea74dbdd27d341b3b2aa12c637", + "dac_public_key": "04ec45003fec57fafa8e05e25668b6cb5264f7f7e637e264251bf2698880ce70bf69e03548ccee6ae242c5aac5548acc405b3f3238566a8e099abd6f9e235cdaa6" +} diff --git a/credentials/development/commissioner_dut/struct_dac_ext_basic_pathlen_presence_wrong/cd.der b/credentials/development/commissioner_dut/struct_dac_ext_basic_pathlen_presence_wrong/cd.der new file mode 100644 index 0000000000000000000000000000000000000000..2151772c8dbe238283089bdd1a5154ec7ca40a6b GIT binary patch literal 236 zcmXqLe96YC)#lOmotKfFX+h&{gT@<7jLe3-2Hb3%32h#Xsmv@)j0Ua!Q_v6Y+ik_q#~& literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_dac_ext_basic_pathlen_presence_wrong/dac-Cert.der b/credentials/development/commissioner_dut/struct_dac_ext_basic_pathlen_presence_wrong/dac-Cert.der new file mode 100644 index 0000000000000000000000000000000000000000..ccdd6e80c59b62ccfe547fed3c24907e6e811b21 GIT binary patch literal 468 zcmXqLV!U9`#8|$7nTe5!i9_B;t?G)84Zi^w8;4e#$2nUTW+npzLkR;hHs(+kW*&au z#FCQKB88CD;u3`bM^8f$10gmpZ8k<0#->FzOpH7%Zf{ z4(pwm^gK>H?A*2GY+QQI2l+o`^(4mgIBu%f+A6TVbkFiz=a0|5_uE0lLwf)HzfT0N zE>f9c6E&r^-PL7rvO%H&KhWE?Tey}>{h#OGrXV-eY- zaH`U6+dtW{^QRwj zI5WF57`QMg7=>Ns+!&sA_(yc2NaXf)b8=dqOHN(;rYp(F>={E$MF^8ZK3DJ}zN8ry evZ=Fg-8=GalK+RBPG=27eu>@w5>f9V{}%w~rHmN> literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_dac_ext_basic_pathlen_presence_wrong/dac-Cert.pem b/credentials/development/commissioner_dut/struct_dac_ext_basic_pathlen_presence_wrong/dac-Cert.pem new file mode 100644 index 00000000000000..00145c1c7c91d3 --- /dev/null +++ b/credentials/development/commissioner_dut/struct_dac_ext_basic_pathlen_presence_wrong/dac-Cert.pem @@ -0,0 +1,12 @@ +-----BEGIN CERTIFICATE----- +MIIB0DCCAXegAwIBAgIIH0wmetRMPA8wCgYIKoZIzj0EAwIwMDEYMBYGA1UEAwwP +TWF0dGVyIFRlc3QgUEFJMRQwEgYKKwYBBAGConwCAQwERkZGMTAgFw0yMjA0MjAw +MDAwMDBaGA85OTk5MTIzMTIzNTk1OVowRjEYMBYGA1UEAwwPTWF0dGVyIFRlc3Qg +REFDMRQwEgYKKwYBBAGConwCAQwERkZGMTEUMBIGCisGAQQBgqJ8AgIMBDgwMDAw +WTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAAQ19mhK+sMuyJLnXhdWztanBgouQ8EP +8mqMYV8MQbJ/KrUQr3W8p9rPx53e+0AUSBu/3/3kENWiJJg8WpSFh0VEo2MwYTAP +BgNVHRMBAf8EBTADAgEAMA4GA1UdDwEB/wQEAwIHgDAdBgNVHQ4EFgQUvCDKcND4 +4uFZZpG5Oba7iOrGV1wwHwYDVR0jBBgwFoAUFpIgbP+hhXkolUUJAYtPY0GJ+U4w +CgYIKoZIzj0EAwIDRwAwRAIgMlbVCbFXZsP4W2EUWbeunGyE5xmVreyKYjI25gBc +eFQCIG8KU6IOYph4HWWb2t7E9pJP8NlCzTAU+hbb9Fh/SB/9 +-----END CERTIFICATE----- diff --git a/credentials/development/commissioner_dut/struct_dac_ext_basic_pathlen_presence_wrong/dac-Key.der b/credentials/development/commissioner_dut/struct_dac_ext_basic_pathlen_presence_wrong/dac-Key.der new file mode 100644 index 0000000000000000000000000000000000000000..28c9fd3dce4c045cda860f612308c1cbadb198f4 GIT binary patch literal 121 zcmV-<0EYiCcLD(c1R$0lmORIC%j(3UVgyCq*q*mMPtKmZqK%iQud@FT@Ufr@1_&yK zNX|V20SBQ(13~}j*f;R210CH+H8z0j7^Jbm>79j+}zv@4HU$Ajf@OTj0_+kN`l`K z2n>ykfymU-)G`W>nVvYzj5H8tV+Xs5i4p2JW=3{qCkB>Kcbf^33n$m+xE$1+KT)qd z(5P*p<4JHrQb1FnZkx8Zap~eT zgA|}Qm_ucS85#exa2T)wDJDin13r)#KS&H142*0BvLHSmix`WD*d&FV{|j3yHKw|9 zGIskXJ9hr`Gmr;KE3*Itt3f2|uTr^up!}QtVvf_(1@7E2Tv%9#9H`753%EebVY9uM}cZ)%QrLsvhz%e3~$zX1sy)-yd*NF-}un!+1G8; T`7@{W3UVJxb-By2b#W#DU4nnj literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_dac_ext_basic_pathlen_presence_wrong/pai-Cert.pem b/credentials/development/commissioner_dut/struct_dac_ext_basic_pathlen_presence_wrong/pai-Cert.pem new file mode 100644 index 00000000000000..41db9014fdbc69 --- /dev/null +++ b/credentials/development/commissioner_dut/struct_dac_ext_basic_pathlen_presence_wrong/pai-Cert.pem @@ -0,0 +1,12 @@ +-----BEGIN CERTIFICATE----- +MIIBvjCCAWSgAwIBAgIIB2Rlxt9fJ1swCgYIKoZIzj0EAwIwMDEYMBYGA1UEAwwP +TWF0dGVyIFRlc3QgUEFBMRQwEgYKKwYBBAGConwCAQwERkZGMTAgFw0yMjA0MjAw +MDAwMDBaGA85OTk5MTIzMTIzNTk1OVowMDEYMBYGA1UEAwwPTWF0dGVyIFRlc3Qg +UEFJMRQwEgYKKwYBBAGConwCAQwERkZGMTBZMBMGByqGSM49AgEGCCqGSM49AwEH +A0IABFVHPJBZoZN9bETBKZ+RLndRMoahQfkLDpJBXo3LaNn2Dq8RWMMPWJfppkJU +L5bR7akJp0YFWtJQglEthitLM3WjZjBkMBIGA1UdEwEB/wQIMAYBAf8CAQEwDgYD +VR0PAQH/BAQDAgEGMB0GA1UdDgQWBBQWkiBs/6GFeSiVRQkBi09jQYn5TjAfBgNV +HSMEGDAWgBRq/SJ3H1Ef7L8WQZdnENzcMaFxfjAKBggqhkjOPQQDAgNIADBFAiAF +yEg4IkkuYibce6mHMQ3MTomC1C68CHAlaYT2Nk92zwIhAOyuSlLDxkOkWVyPM8LL +m9c9Zw9plo0RC8JlRN0ItaNp +-----END CERTIFICATE----- diff --git a/credentials/development/commissioner_dut/struct_dac_ext_basic_pathlen_presence_wrong/pai-Key.der b/credentials/development/commissioner_dut/struct_dac_ext_basic_pathlen_presence_wrong/pai-Key.der new file mode 100644 index 0000000000000000000000000000000000000000..00414b0eab0c97d65496e763b507ff1b676f41fa GIT binary patch literal 121 zcmV-<0EYiCcLD(c1R&0K_2gUag;Oh$A~N>QdgP-;L>`RAWT&78APq_`)c>Fg1_&yK zNX|V20SBQ(13~}~l0jaL%V^p54zCed!w*=O b>83(dFP72msR^e>1zOTjf>AAoD@!wVaBDE= literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_dac_ext_basic_pathlen_presence_wrong/pai-Key.pem b/credentials/development/commissioner_dut/struct_dac_ext_basic_pathlen_presence_wrong/pai-Key.pem new file mode 100644 index 00000000000000..857632dade5e9e --- /dev/null +++ b/credentials/development/commissioner_dut/struct_dac_ext_basic_pathlen_presence_wrong/pai-Key.pem @@ -0,0 +1,5 @@ +-----BEGIN EC PRIVATE KEY----- +MHcCAQEEIM529eRb7YVTK5EiMvbOeuSjRUQejMVkp6AGIA1KLtT/oAoGCCqGSM49 +AwEHoUQDQgAEVUc8kFmhk31sRMEpn5Eud1EyhqFB+QsOkkFejcto2fYOrxFYww9Y +l+mmQlQvltHtqQmnRgVa0lCCUS2GK0szdQ== +-----END EC PRIVATE KEY----- diff --git a/credentials/development/commissioner_dut/struct_dac_ext_basic_pathlen_presence_wrong/test_case_vector.json b/credentials/development/commissioner_dut/struct_dac_ext_basic_pathlen_presence_wrong/test_case_vector.json new file mode 100644 index 00000000000000..227f98ccba1451 --- /dev/null +++ b/credentials/development/commissioner_dut/struct_dac_ext_basic_pathlen_presence_wrong/test_case_vector.json @@ -0,0 +1,9 @@ +{ + "description": "DAC Test Vector: Certificate Basic Constraint extension PathLen field presence is wrong (present for DAC not present for PAI)", + "is_success_case": "false", + "dac_cert": "308201d030820177a00302010202081f4c267ad44c3c0f300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313020170d3232303432303030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d0301070342000435f6684afac32ec892e75e1756ced6a7060a2e43c10ff26a8c615f0c41b27f2ab510af75bca7dacfc79ddefb4014481bbfdffde410d5a224983c5a9485874544a3633061300f0603551d130101ff04053003020100300e0603551d0f0101ff040403020780301d0603551d0e04160414bc20ca70d0f8e2e1596691b939b6bb88eac6575c301f0603551d230418301680141692206cffa1857928954509018b4f634189f94e300a06082a8648ce3d040302034700304402203256d509b15766c3f85b611459b7ae9c6c84e71995adec8a623236e6005c785402206f0a53a20e6298781d659bdadec4f6924ff0d942cd3014fa16dbf4587f481ffd", + "pai_cert": "308201be30820164a0030201020208076465c6df5f275b300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303432303030303030305a180f39393939313233313233353935395a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d0301070342000455473c9059a1937d6c44c1299f912e77513286a141f90b0e92415e8dcb68d9f60eaf1158c30f5897e9a642542f96d1eda909a746055ad25082512d862b4b3375a366306430120603551d130101ff040830060101ff020101300e0603551d0f0101ff040403020106301d0603551d0e041604141692206cffa1857928954509018b4f634189f94e301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020348003045022005c8483822492e6226dc7ba987310dcc4e8982d42ebc0870256984f6364f76cf022100ecae4a52c3c643a4595c8f33c2cb9bd73d670f69968d110bc26544dd08b5a369", + "certification_declaration": "3081e906092a864886f70d010702a081db3081d8020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204473045022100992be60da945dca9ef5b485bdfdc23e86e5d2ec9b72f606a78a1b6a81d01d09602205636e879c3eaa6d3617d369a2ac2743535f94626bbbe4c66072ad13aff34178f", + "dac_private_key": "961f963cc771cbeac4a2620445ddd89eb73c4fce9ebba28d97a7afb2ff10f0b1", + "dac_public_key": "0435f6684afac32ec892e75e1756ced6a7060a2e43c10ff26a8c615f0c41b27f2ab510af75bca7dacfc79ddefb4014481bbfdffde410d5a224983c5a9485874544" +} diff --git a/credentials/development/commissioner_dut/struct_dac_ext_extended_key_usage_present/cd.der b/credentials/development/commissioner_dut/struct_dac_ext_extended_key_usage_present/cd.der new file mode 100644 index 0000000000000000000000000000000000000000..26ec086a15c6ba1b7d23cb2fb0feec21057453d1 GIT binary patch literal 237 zcmXqLe8tA8)#lOmotKfFX+h&1gT|XojLe3-2Hb3%32h#Xsmv@)j0UaNWbUVKGvsq2oG$l5% TOM#2}ejnJkHs&Ff$n#7)lt3u`!3TF!S*H zCYF?>7Ab_J7MCalIC>h27znX(X|pl1Fg7i!VPfQAadUGsG*A%dH8L_VF*1OFC<%T` zATTsC1|m~SQ_Cm=HymcVI67lD6HSzfhs6S9c%*?a8#~ygOpH(`Gc&R?J29{v=(~D+ z+qdBSWfyO^Jf35+M$O^%rN9+jSs&{bo_}2VmT?}>d0qZZQkRdIU3qi$_zn(hhhP=o zkXx$vK7SN+-mvBD;>Ko!#s&i(pvPr}85#exFc~ly@PT;zARaJa*c%LFL3}(it4dg-6$}GU(YY>^7FMQ=_dHur8Zx3wbD%;AEaZHHE zKmnvc6=a^6fe0H1Fd$i3*_oN(EJoyrV0LFPaA8t#dgxhjOe#U;^ZBIYJ#U2Hb1t7W zw}0j1`=`t91QhK1=*XlH>#+II%H0)T?;kJnn6OGLb5CmXscF@%XSw@$yi0>Rt^xqu C!I=L5 literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_dac_ext_extended_key_usage_present/dac-Cert.pem b/credentials/development/commissioner_dut/struct_dac_ext_extended_key_usage_present/dac-Cert.pem new file mode 100644 index 00000000000000..7c9fbd3669a477 --- /dev/null +++ b/credentials/development/commissioner_dut/struct_dac_ext_extended_key_usage_present/dac-Cert.pem @@ -0,0 +1,13 @@ +-----BEGIN CERTIFICATE----- +MIIB8TCCAZigAwIBAgIIY4D6+Tc+qmwwCgYIKoZIzj0EAwIwMDEYMBYGA1UEAwwP +TWF0dGVyIFRlc3QgUEFJMRQwEgYKKwYBBAGConwCAQwERkZGMTAgFw0yMjA0MjAw +MDAwMDBaGA85OTk5MTIzMTIzNTk1OVowRjEYMBYGA1UEAwwPTWF0dGVyIFRlc3Qg +REFDMRQwEgYKKwYBBAGConwCAQwERkZGMTEUMBIGCisGAQQBgqJ8AgIMBDgwMDAw +WTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAATAjtXHtvZTb6bR24TjnDSsJkDr0lGo +CmrxfqHP43ntAZ4Mzy0PshrTxDbU7NXHuAg7QFMkTVTaJd7z8RFDsLTNo4GDMIGA +MAwGA1UdEwEB/wQCMAAwDgYDVR0PAQH/BAQDAgeAMB0GA1UdDgQWBBQnw5Z+K4VU +dv2r3jfOlUW8X8mYNzAfBgNVHSMEGDAWgBSTbxPUxXd/obPtwLEKdrUEaMYSDDAg +BgNVHSUBAf8EFjAUBggrBgEFBQcDAgYIKwYBBQUHAwEwCgYIKoZIzj0EAwIDRwAw +RAIgQuFJcMYaYCTzz2JjvOwT7wmnkp2PqePfy3bcUHC+8UECIF1As8Kpu3j138dy +SJCqFmm8ZYPKlnuFzQuODEt1UojV +-----END CERTIFICATE----- diff --git a/credentials/development/commissioner_dut/struct_dac_ext_extended_key_usage_present/dac-Key.der b/credentials/development/commissioner_dut/struct_dac_ext_extended_key_usage_present/dac-Key.der new file mode 100644 index 0000000000000000000000000000000000000000..4a7e0676cdd8bb1a2f001ee761b09dc36ae659dc GIT binary patch literal 121 zcmV-<0EYiCcLD(c1R!w0sd|&w)RtRrqSDkkb`wRmvHV&;ek8`#x%uEIbh7ty1Y|No7%sl+Q zi6teeMG7IQ#U%;>j*f;R210CH+H8z0j7^Jbm>79j+}zv@4HU$Ajf@OTj0_+kN`l`K z2n>ykfymU-)G`W>nVvYzj5H8tV+Xs5i4p2JW=3{qCkB?BYuQ^8qXVrZFRgee?00SV zode?BE-6b|Uk0_87(K}jdVZRbH)-4Mt6R?7AIe}z?2ytt)i|woUYm2y=G=Aps|yyV z8KeNc!5k_p%*gnkg~NaiNHH-o8t{R{_(5X8U|?i3kOlGiSj1RFCg%%ZIa*%7aP!*( z8@bB1vSb_+;xUj1Nh`Ae1FJzK>#tI|e4zZB{bG*O(*^F_F2>!O7zbVyKDw{C U?ZV;y=*9EyyPaP??~_e405c+rPyhe` literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_dac_ext_extended_key_usage_present/pai-Cert.pem b/credentials/development/commissioner_dut/struct_dac_ext_extended_key_usage_present/pai-Cert.pem new file mode 100644 index 00000000000000..d5fa1613b084f1 --- /dev/null +++ b/credentials/development/commissioner_dut/struct_dac_ext_extended_key_usage_present/pai-Cert.pem @@ -0,0 +1,12 @@ +-----BEGIN CERTIFICATE----- +MIIBvTCCAWSgAwIBAgIIfSojSm7W72gwCgYIKoZIzj0EAwIwMDEYMBYGA1UEAwwP +TWF0dGVyIFRlc3QgUEFBMRQwEgYKKwYBBAGConwCAQwERkZGMTAgFw0yMjA0MjAw +MDAwMDBaGA85OTk5MTIzMTIzNTk1OVowMDEYMBYGA1UEAwwPTWF0dGVyIFRlc3Qg +UEFJMRQwEgYKKwYBBAGConwCAQwERkZGMTBZMBMGByqGSM49AgEGCCqGSM49AwEH +A0IABGzWa7RhW1E6GdKo4RNO1rvcwBcLRGSkhelSh3Qy5GtS58sBDWK2u9W0zz/C +aABhiBopyoGWfZ6GQ2yzba5vq3CjZjBkMBIGA1UdEwEB/wQIMAYBAf8CAQEwDgYD +VR0PAQH/BAQDAgEGMB0GA1UdDgQWBBSTbxPUxXd/obPtwLEKdrUEaMYSDDAfBgNV +HSMEGDAWgBRq/SJ3H1Ef7L8WQZdnENzcMaFxfjAKBggqhkjOPQQDAgNHADBEAiBx +/S/zpLWYCIfnXBJ7euUqHNy0soJkUNBMFwTzcjADFAIgWjrxj0Pvy67eoDNR0RPF +vnOG0MOPW6Oe30bPp57yPIM= +-----END CERTIFICATE----- diff --git a/credentials/development/commissioner_dut/struct_dac_ext_extended_key_usage_present/pai-Key.der b/credentials/development/commissioner_dut/struct_dac_ext_extended_key_usage_present/pai-Key.der new file mode 100644 index 0000000000000000000000000000000000000000..25239e90ef3535f59ec8a9a3b1d42c7a55a8dde0 GIT binary patch literal 121 zcmV-<0EYiCcLD(c1R(ofHrCLX!dK{IOaj&6cMuONiK+1Hd6PeK`P_a=Qre&j1_&yK zNX|V20SBQ(13~}NVz#^0 bw9h}nXaHe|8Y#+wmVKUvLu|8cu5YVwPh~a! literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_dac_ext_extended_key_usage_present/pai-Key.pem b/credentials/development/commissioner_dut/struct_dac_ext_extended_key_usage_present/pai-Key.pem new file mode 100644 index 00000000000000..b8d13298169471 --- /dev/null +++ b/credentials/development/commissioner_dut/struct_dac_ext_extended_key_usage_present/pai-Key.pem @@ -0,0 +1,5 @@ +-----BEGIN EC PRIVATE KEY----- +MHcCAQEEIPteNtbQmMJX6GRMAtXhdxAPK4mp8Ox5kz9y+dx+SlLaoAoGCCqGSM49 +AwEHoUQDQgAEbNZrtGFbUToZ0qjhE07Wu9zAFwtEZKSF6VKHdDLka1LnywENYra7 +1bTPP8JoAGGIGinKgZZ9noZDbLNtrm+rcA== +-----END EC PRIVATE KEY----- diff --git a/credentials/development/commissioner_dut/struct_dac_ext_extended_key_usage_present/test_case_vector.json b/credentials/development/commissioner_dut/struct_dac_ext_extended_key_usage_present/test_case_vector.json new file mode 100644 index 00000000000000..0ee5f9f7cfde21 --- /dev/null +++ b/credentials/development/commissioner_dut/struct_dac_ext_extended_key_usage_present/test_case_vector.json @@ -0,0 +1,9 @@ +{ + "description": "DAC Test Vector: Certificate includes optional Extended Key Usage extension", + "is_success_case": "true", + "dac_cert": "308201f130820198a00302010202086380faf9373eaa6c300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313020170d3232303432303030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004c08ed5c7b6f6536fa6d1db84e39c34ac2640ebd251a80a6af17ea1cfe379ed019e0ccf2d0fb21ad3c436d4ecd5c7b8083b4053244d54da25def3f11143b0b4cda38183308180300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e0416041427c3967e2b855476fdabde37ce9545bc5fc99837301f0603551d23041830168014936f13d4c5777fa1b3edc0b10a76b50468c6120c30200603551d250101ff0416301406082b0601050507030206082b06010505070301300a06082a8648ce3d0403020347003044022042e14970c61a6024f3cf6263bcec13ef09a7929d8fa9e3dfcb76dc5070bef14102205d40b3c2a9bb78f5dfc7724890aa1669bc6583ca967b85cd0b8e0c4b755288d5", + "pai_cert": "308201bd30820164a00302010202087d2a234a6ed6ef68300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303432303030303030305a180f39393939313233313233353935395a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d030107034200046cd66bb4615b513a19d2a8e1134ed6bbdcc0170b4464a485e952877432e46b52e7cb010d62b6bbd5b4cf3fc2680061881a29ca81967d9e86436cb36dae6fab70a366306430120603551d130101ff040830060101ff020101300e0603551d0f0101ff040403020106301d0603551d0e04160414936f13d4c5777fa1b3edc0b10a76b50468c6120c301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020347003044022071fd2ff3a4b5980887e75c127b7ae52a1cdcb4b2826450d04c1704f37230031402205a3af18f43efcbaedea03351d113c5be7386d0c38f5ba39edf46cfa79ef23c83", + "certification_declaration": "3081ea06092a864886f70d010702a081dc3081d9020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317e307c020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204483046022100e042680e0971ccf3d7b623cdcdf3a22809357816693fdf0ad937bacb2689855b022100828be304ddfb7146c7adf3367c8a96220616d251a28efbc28f9719380e66de6f", + "dac_private_key": "70c0aab5b8a38efd0bcb269f18ef7cdd6e689867a0a14a2e74cdeffc79ffa97c", + "dac_public_key": "04c08ed5c7b6f6536fa6d1db84e39c34ac2640ebd251a80a6af17ea1cfe379ed019e0ccf2d0fb21ad3c436d4ecd5c7b8083b4053244d54da25def3f11143b0b4cd" +} diff --git a/credentials/development/commissioner_dut/struct_dac_ext_key_usage_critical_missing/cd.der b/credentials/development/commissioner_dut/struct_dac_ext_key_usage_critical_missing/cd.der new file mode 100644 index 0000000000000000000000000000000000000000..5528b5bb0f6d5b1de1dd71c29a42ca40571a2e3a GIT binary patch literal 235 zcmXqLe8I-4)#lOmotKfFX+h&HgU0JjjLe3-2Hb3%32h#Xsmv@)j0UaV;cat_(>=L literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_dac_ext_key_usage_critical_missing/dac-Cert.der b/credentials/development/commissioner_dut/struct_dac_ext_key_usage_critical_missing/dac-Cert.der new file mode 100644 index 0000000000000000000000000000000000000000..78fbc0971d3a9e728fceb510d9838ee47ad83c1e GIT binary patch literal 464 zcmXqLVmxEe#8|k1nTe5!i6fTd%e&K2Sz8Ra*f_M>JkHs&Ff$n#7)lt3u`!3TF!S*H zCYF?>7Ab_J7MCalIC>h27znX(X|pl1Fg7i!VPfQAadUGsG*A%dH8L_VF*1OFC<%T` zATTsC1|m~SQ_Cm=HymcVI67lD6HSzfhs6S9c%*?a8#~ygOpH(`Gc&R?J29~QzB(^# zVgBxj(xA^X7=mXjGKC+w<2Yes^vdjx$tpLtJbxUnIVif4hEZajZeK0T0mIvcimv|5=y}7!0^UJbo5nn6Nh($bvY0EMhDo_jey( zx4&m@?Q4I2Yn6dKNLrZ%7;+6FkDa{^@A%aq9C+^GW09L|A2RJOd_)dm zW={qKHzq}fYd0NFe_gDm)y^qgw3B@U4VrUV_4+-Phq=-0(M-)dfNO3k1O1_&yK zNX|V20SBQ(13~}<`_-OSp>MlbbyD+~08^VG0$0G?L6EUqscVRnB-pg)N*zS^6mBgN--eF54hV&TpclOuPaAY{Y literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_dac_ext_key_usage_critical_missing/dac-Key.pem b/credentials/development/commissioner_dut/struct_dac_ext_key_usage_critical_missing/dac-Key.pem new file mode 100644 index 00000000000000..df3e17b4986257 --- /dev/null +++ b/credentials/development/commissioner_dut/struct_dac_ext_key_usage_critical_missing/dac-Key.pem @@ -0,0 +1,5 @@ +-----BEGIN EC PRIVATE KEY----- +MHcCAQEEIM5yrjTYtYLByDvsL71FpgQdkdxobC3o18U632pebkrNoAoGCCqGSM49 +AwEHoUQDQgAE+9WeVqFvu1h1UvOYAFObIQJXwNxBkLFbqWuIkyTYtOflFkkClPQJ +bb9NknfY7pJWlcSeo95hSyOG9Bj0d/bX0g== +-----END EC PRIVATE KEY----- diff --git a/credentials/development/commissioner_dut/struct_dac_ext_key_usage_critical_missing/pai-Cert.der b/credentials/development/commissioner_dut/struct_dac_ext_key_usage_critical_missing/pai-Cert.der new file mode 100644 index 0000000000000000000000000000000000000000..e7572880af3e73cd2e2a1a2eb88bbcd94e1b72ff GIT binary patch literal 449 zcmXqLV%%%c#F(;xnTe5!i9@5WW4}R@kCXuy8;4e#$2nUTW+npzLkR;hHs(+kW*&au z#FCQKB88CD;u3`bM@K^u10gmpZ8k<0#->FzOpH7%Zfj#0Yg9Gb1~*69Y?v|L=##XR+?d7hiWpASQX$ zG%ahV4u*Rw#`_uWW%8}GRXkCYyKtvy!_p0U9lw|DcIwU9^5*a1*oj9s{_w3?%DH@T znn4QC8_c1y!iyQJL*`2|_g-Ib@ z^+9y$D@FN_8jKlM7O6S6d9Rwu%>7f&-^=oO9_N|8ObYdn9x~5Vs6APbkbP;z9iE@Z Uw|q2w^UY{Vwn=5RzDws}01KIk`~Uy| literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_dac_ext_key_usage_critical_missing/pai-Cert.pem b/credentials/development/commissioner_dut/struct_dac_ext_key_usage_critical_missing/pai-Cert.pem new file mode 100644 index 00000000000000..43a415eb460ce6 --- /dev/null +++ b/credentials/development/commissioner_dut/struct_dac_ext_key_usage_critical_missing/pai-Cert.pem @@ -0,0 +1,12 @@ +-----BEGIN CERTIFICATE----- +MIIBvTCCAWSgAwIBAgIIKI6IvzCCTBowCgYIKoZIzj0EAwIwMDEYMBYGA1UEAwwP +TWF0dGVyIFRlc3QgUEFBMRQwEgYKKwYBBAGConwCAQwERkZGMTAgFw0yMjA0MjAw +MDAwMDBaGA85OTk5MTIzMTIzNTk1OVowMDEYMBYGA1UEAwwPTWF0dGVyIFRlc3Qg +UEFJMRQwEgYKKwYBBAGConwCAQwERkZGMTBZMBMGByqGSM49AgEGCCqGSM49AwEH +A0IABGBP++HHmgW8bxeu1BBcY6qWKjtCiADeJDO/AN5pDqk9IchybaG5FYClsC6I ++6a7Qo1stOz9w12RxbH4TXylCaejZjBkMBIGA1UdEwEB/wQIMAYBAf8CAQEwDgYD +VR0PAQH/BAQDAgEGMB0GA1UdDgQWBBTjQ0rDuPqAE1HO4eMU2QbwaT7Q8TAfBgNV +HSMEGDAWgBRq/SJ3H1Ef7L8WQZdnENzcMaFxfjAKBggqhkjOPQQDAgNHADBEAiBn +JeBbdeohH/EoAWg6OGVs2w3VNhyd/HcPjQTzngnMvQIgf+LhA5kgfclwYGvSqNwM ++ce08THs9jKUazR5ey9EicM= +-----END CERTIFICATE----- diff --git a/credentials/development/commissioner_dut/struct_dac_ext_key_usage_critical_missing/pai-Key.der b/credentials/development/commissioner_dut/struct_dac_ext_key_usage_critical_missing/pai-Key.der new file mode 100644 index 0000000000000000000000000000000000000000..e1ed68bfafa0d377d50a75ae6fd3f3178c9943d0 GIT binary patch literal 121 zcmV-<0EYiCcLD(c1R$)pj7&WrR+PF2YGORC9Dl@HF?eHJxT?Cq=evmCn=qgX1_&yK zNX|V20SBQ(13~}jcl~+{li_6#j*HJe5DDeYcDk6 literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_dac_ext_key_usage_critical_missing/pai-Key.pem b/credentials/development/commissioner_dut/struct_dac_ext_key_usage_critical_missing/pai-Key.pem new file mode 100644 index 00000000000000..08beb3ae399792 --- /dev/null +++ b/credentials/development/commissioner_dut/struct_dac_ext_key_usage_critical_missing/pai-Key.pem @@ -0,0 +1,5 @@ +-----BEGIN EC PRIVATE KEY----- +MHcCAQEEIKy3jEw9H1aUugdqYjytHH/EWzF4Y1u4qrrA57uI35swoAoGCCqGSM49 +AwEHoUQDQgAEYE/74ceaBbxvF67UEFxjqpYqO0KIAN4kM78A3mkOqT0hyHJtobkV +gKWwLoj7prtCjWy07P3DXZHFsfhNfKUJpw== +-----END EC PRIVATE KEY----- diff --git a/credentials/development/commissioner_dut/struct_dac_ext_key_usage_critical_missing/test_case_vector.json b/credentials/development/commissioner_dut/struct_dac_ext_key_usage_critical_missing/test_case_vector.json new file mode 100644 index 00000000000000..123052d1ba83b0 --- /dev/null +++ b/credentials/development/commissioner_dut/struct_dac_ext_key_usage_critical_missing/test_case_vector.json @@ -0,0 +1,9 @@ +{ + "description": "DAC Test Vector: Certificate Key Usage extension critical field is missing", + "is_success_case": "false", + "dac_cert": "308201cc30820171a00302010202085d08f4eecb5a6ab4300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313020170d3232303432303030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004fbd59e56a16fbb587552f39800539b210257c0dc4190b15ba96b889324d8b4e7e516490294f4096dbf4d9277d8ee925695c49ea3de614b2386f418f477f6d7d2a35d305b300c0603551d130101ff04023000300b0603551d0f040403020780301d0603551d0e04160414dfbbc7a240765ab7fbc01aedfb99b58e87e7daaa301f0603551d23041830168014e3434ac3b8fa801351cee1e314d906f0693ed0f1300a06082a8648ce3d0403020349003046022100d6d941cbf5a3262a87091372b90bbca2bf8a8b464f299d4dc686966a6f31fafc022100d8a57ebfbe76ba0c5334fad0ea27a58d98b1f182ab5196777389d7448cd01b48", + "pai_cert": "308201bd30820164a0030201020208288e88bf30824c1a300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303432303030303030305a180f39393939313233313233353935395a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d03010703420004604ffbe1c79a05bc6f17aed4105c63aa962a3b428800de2433bf00de690ea93d21c8726da1b91580a5b02e88fba6bb428d6cb4ecfdc35d91c5b1f84d7ca509a7a366306430120603551d130101ff040830060101ff020101300e0603551d0f0101ff040403020106301d0603551d0e04160414e3434ac3b8fa801351cee1e314d906f0693ed0f1301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d040302034700304402206725e05b75ea211ff12801683a38656cdb0dd5361c9dfc770f8d04f39e09ccbd02207fe2e10399207dc970606bd2a8dc0cf9c7b4f131ecf632946b34797b2f4489c3", + "certification_declaration": "3081e806092a864886f70d010702a081da3081d7020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317c307a020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204463044022038c1d56482bc7fe79458357e2916a1d426cbd96b9a5fc6775e404545d6b931fc022003e6796cb5320ef83437b58893469152edc51f11da6fc99c3878fd643b8908b6", + "dac_private_key": "ce72ae34d8b582c1c83bec2fbd45a6041d91dc686c2de8d7c53adf6a5e6e4acd", + "dac_public_key": "04fbd59e56a16fbb587552f39800539b210257c0dc4190b15ba96b889324d8b4e7e516490294f4096dbf4d9277d8ee925695c49ea3de614b2386f418f477f6d7d2" +} diff --git a/credentials/development/commissioner_dut/struct_dac_ext_key_usage_critical_wrong/cd.der b/credentials/development/commissioner_dut/struct_dac_ext_key_usage_critical_wrong/cd.der new file mode 100644 index 0000000000000000000000000000000000000000..a851109ca5aede98ceb54ef5c8d4e48cd1d7150f GIT binary patch literal 236 zcmXqLe96YC)#lOmotKfFX+h&{gT@<7jLe3-2Hb3%32h#Xsmv@)j0UaO@@P8y5yzs63zU@qk44>bwES7pJ={#>&)6*>*cmC|t UywQ`N^*MJ?yDGZv2kd%d7QIlVP-NgFqAM5V`C0wVdmlY zO)M!%Em8Q}nHZr?W@cn(c4A;rtB9S> zwk+`S`CU3EdPVpCOk5QceY&m0pq#6-clLdo4bx`X2->dOFXEbhNac=m;`dYUOO~%K zx|DP%gMG&GC8qZm#~MT%@BqCnE6m9FpM}YQ!GIgY<7WYe344QqEQrI$BE}+8w1d%#7^JP7Ey8*P8XO>lIw^-!cF9hJ-br zSee_`798pgnk^%w6E*d}__1|&qGp%P2)r(mr|xQEJ(GD&aXUv*aFy24(miLzn-mwP z8KeNc!5k_p%*gnkg~NaiNHH-o8t{R{_(5X8U|?i3kOlGiSj1RFe#=}vv-D2cb)UXd z0tG++pVzikJ!K#dl2&E`23CVe)?cM^`9S$M`^6lmrwiP-qL0hxk?J=N#L!n@OQcWYsSR$M_99`k72u?#u9$ VnrX1`jZ{hUorQ5f5T9yA7#;)92n|7E{ b*A#9iMKn8^1FUn02y#<;D#dlY%@=|pV+}EV literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_dac_ext_key_usage_critical_wrong/pai-Key.pem b/credentials/development/commissioner_dut/struct_dac_ext_key_usage_critical_wrong/pai-Key.pem new file mode 100644 index 00000000000000..e34b4e5baf34f0 --- /dev/null +++ b/credentials/development/commissioner_dut/struct_dac_ext_key_usage_critical_wrong/pai-Key.pem @@ -0,0 +1,5 @@ +-----BEGIN EC PRIVATE KEY----- +MHcCAQEEIHDmjilk5Dn5BMzuOdm7/wbcMgs0M7QJVRAAzK0rZcOOoAoGCCqGSM49 +AwEHoUQDQgAEO9aDL9cucNBPuJ/7sGCs8gUDh61wwo1SmxwSLFqV/xfGrtxam3aY +UdcUbidFNDuZA6xzhwhyU3oqxXW8zReCIQ== +-----END EC PRIVATE KEY----- diff --git a/credentials/development/commissioner_dut/struct_dac_ext_key_usage_critical_wrong/test_case_vector.json b/credentials/development/commissioner_dut/struct_dac_ext_key_usage_critical_wrong/test_case_vector.json new file mode 100644 index 00000000000000..95bf0a84c95ff5 --- /dev/null +++ b/credentials/development/commissioner_dut/struct_dac_ext_key_usage_critical_wrong/test_case_vector.json @@ -0,0 +1,9 @@ +{ + "description": "DAC Test Vector: Certificate Key Usage extension critical field is set as 'non-critical'", + "is_success_case": "false", + "dac_cert": "308201cb30820171a003020102020856f040baa9a0df24300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313020170d3232303432303030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d0301070342000426785d9706a651d3cfba2cc88d15bdf961aa5c5bcb867430770a898d9bdf3cb0969a3c113daebf144567c224dc4361f7caef74a7ad72d262c2680798a7a435dfa35d305b300c0603551d130101ff04023000300b0603551d0f040403020780301d0603551d0e041604147ebc60ac01452ad2f080db0f59b7a87ba868bd05301f0603551d23041830168014fb1cd5cca5dc76d74c8eca1070f9ffcf2b3d25ca300a06082a8648ce3d04030203480030450220745a8c366d849f301c0e15466a053ccbf63778ab9d567720b798412694cfc6dd022100fa1931716f4b07ffd1163164726b451f11a87818132235439bbaa650bdc7ccf1", + "pai_cert": "308201bd30820164a0030201020208015cdb55a001bd13300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303432303030303030305a180f39393939313233313233353935395a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d030107034200043bd6832fd72e70d04fb89ffbb060acf2050387ad70c28d529b1c122c5a95ff17c6aedc5a9b769851d7146e2745343b9903ac73870872537a2ac575bccd178221a366306430120603551d130101ff040830060101ff020101300e0603551d0f0101ff040403020106301d0603551d0e04160414fb1cd5cca5dc76d74c8eca1070f9ffcf2b3d25ca301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020347003044022037e820a1eadf1a56e4aea7f7654194f6aa7c4d2cbae7b7c4c20f259f6cc6bcbb02207a14aafa40415fb0b88f0235a9be68491a9930a1ec1a7463dca15ef860f0034c", + "certification_declaration": "3081e906092a864886f70d010702a081db3081d8020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204473045022021f858a256c52c1b80ee1aa02b2be2c92a8b8623e62b004fe21d53a1ed1fbeb7022100f3eda9731aed19439eba82e5b4b1b9f98e29d88c6f6ae893e39117d1e4ac0a4f", + "dac_private_key": "19221a3c878fa199998e34d5c38c4f83664e945ea36cdc476f2ea7bb4c7a4491", + "dac_public_key": "0426785d9706a651d3cfba2cc88d15bdf961aa5c5bcb867430770a898d9bdf3cb0969a3c113daebf144567c224dc4361f7caef74a7ad72d262c2680798a7a435df" +} diff --git a/credentials/development/commissioner_dut/struct_dac_ext_key_usage_crl_sign_wrong/cd.der b/credentials/development/commissioner_dut/struct_dac_ext_key_usage_crl_sign_wrong/cd.der new file mode 100644 index 0000000000000000000000000000000000000000..d2652374f4c554996f6cb6eed6cc7e1016e2bfdb GIT binary patch literal 236 zcmXqLe96YC)#lOmotKfFX+h&{gT@<7jLe3-2Hb3%32h#Xsmv@)j0Ua`K_(zjqMD$*f_M>JkHs&Ff$n#7)lt3u`!3TF!S*H zCYF?>7Ab_J7MCalIC>h27znX(X|pl1Fg7i!VPfQAadUGsG*A%dH8L_VF*1OFC<%T` zATTsC1|m~SQ_Cm=HymcVI67lD6HSzfhs6S9c%*?a8#~ygOpH(`Gc&R?J29|46yRbr z5uATR+Gt-=OZ%0~MYpoV7OtP6x%GmS=>6g~Lfil4oylD+tp9my_o_4QSvRMMH5Dp8 zn0X^X>|2zEh2)pT2?lWnJV0;D3NtePXJIm6FyI66_(42iurM|m$b$HMEMhDog1+|_ z_{=$U!}ynQn(U;*Tlg(&O$_8g(#kBrz-tg;>r5)YynKN;&zH!>Uh_-4mYZ!ng&fGt z?hFPlObV>E0$G`EJ7)g*^f{uWEx2vjDz(~p%gtMEeG-a@T)toflR|>WRgS%9{q*Cu cC8o!&@-%<9)BkIx#SuN**q+=)3ldiW09M0_y8r+H literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_dac_ext_key_usage_crl_sign_wrong/dac-Cert.pem b/credentials/development/commissioner_dut/struct_dac_ext_key_usage_crl_sign_wrong/dac-Cert.pem new file mode 100644 index 00000000000000..4e7af76892807c --- /dev/null +++ b/credentials/development/commissioner_dut/struct_dac_ext_key_usage_crl_sign_wrong/dac-Cert.pem @@ -0,0 +1,12 @@ +-----BEGIN CERTIFICATE----- +MIIBzTCCAXSgAwIBAgIIEBLn2rXPMz4wCgYIKoZIzj0EAwIwMDEYMBYGA1UEAwwP +TWF0dGVyIFRlc3QgUEFJMRQwEgYKKwYBBAGConwCAQwERkZGMTAgFw0yMjA0MjAw +MDAwMDBaGA85OTk5MTIzMTIzNTk1OVowRjEYMBYGA1UEAwwPTWF0dGVyIFRlc3Qg +REFDMRQwEgYKKwYBBAGConwCAQwERkZGMTEUMBIGCisGAQQBgqJ8AgIMBDgwMDAw +WTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAAThEAoGNBGf2BsyvmKEh9RpotpqFqGv +mCm10BoV33OsErf+bsxtoxMv87WLqsxHatmUFoJxIeCZ2GAW9looOBn0o2AwXjAM +BgNVHRMBAf8EAjAAMA4GA1UdDwEB/wQEAwIBgjAdBgNVHQ4EFgQUEU3eoEycwtgz ++hNmHZLDtA85fTQwHwYDVR0jBBgwFoAUBolid9OnoBcM9FmjSp91iqc2scowCgYI +KoZIzj0EAwIDRwAwRAIgBX0QamlGuJn88vNYdIZThqaqJn1fObO02vISWFmnoLAC +IGBI1Qi9zU4vXrZhZ12qSTfuuU/1aTjELj1djG2ioGGq +-----END CERTIFICATE----- diff --git a/credentials/development/commissioner_dut/struct_dac_ext_key_usage_crl_sign_wrong/dac-Key.der b/credentials/development/commissioner_dut/struct_dac_ext_key_usage_crl_sign_wrong/dac-Key.der new file mode 100644 index 0000000000000000000000000000000000000000..5f7cff5a7c4402e7283c125ebdd5dd3559013fea GIT binary patch literal 121 zcmV-<0EYiCcLD(c1R(I`3(A1VMq}6$si-O1c2C-&BnOohct@e9mv26%-C3Xt1_&yK zNX|V20SBQ(13~}<;SdT2G!dWJ8#2CPgoo5=qS|T}p|6-Jwa^+B-*c=IxBhO-ZKD$} b^Rf(VU>5dTC^#APl8ZCb literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_dac_ext_key_usage_crl_sign_wrong/dac-Key.pem b/credentials/development/commissioner_dut/struct_dac_ext_key_usage_crl_sign_wrong/dac-Key.pem new file mode 100644 index 00000000000000..50916dbeeddfc1 --- /dev/null +++ b/credentials/development/commissioner_dut/struct_dac_ext_key_usage_crl_sign_wrong/dac-Key.pem @@ -0,0 +1,5 @@ +-----BEGIN EC PRIVATE KEY----- +MHcCAQEEIPDlC8qAyEZj2BOpqCnadk/aoSQHlRV4R6Gnl28+pt1ZoAoGCCqGSM49 +AwEHoUQDQgAE4RAKBjQRn9gbMr5ihIfUaaLaahahr5gptdAaFd9zrBK3/m7MbaMT +L/O1i6rMR2rZlBaCcSHgmdhgFvZaKDgZ9A== +-----END EC PRIVATE KEY----- diff --git a/credentials/development/commissioner_dut/struct_dac_ext_key_usage_crl_sign_wrong/pai-Cert.der b/credentials/development/commissioner_dut/struct_dac_ext_key_usage_crl_sign_wrong/pai-Cert.der new file mode 100644 index 0000000000000000000000000000000000000000..6a0e5a13eea7e27a886dfd134ea488f4b034c4c7 GIT binary patch literal 449 zcmXqLV%%%c#F(;xnTe5!i9_>>*6NSGJqrxD*f_M>JkHs&Ff$n#7)lt3u`!3TF!S*H zCYF?>7Ab_J7MCalI64}N7znX(X|pl1Fg7i!VPfQAadUGsG*A%dH8L_VF*1OFC<%T` zATTsC1|m~SQ_CnkW_scJobofueD6>CcN9B|W@za;r5)co+* z0u}8FC&Apf`)4ffzbtWXf9P?riNCF?H?A{s_SJjwUT^Pm&5in!$9MNdju_9>iKiE* z8KeNc!5k_p%*gnkg~NaiNHH-o8t{R{_(5X8U|?i3kOlGiSj1RF*gBKSFE3vp&hsU5 zvDf_4uH|MMPZ`LAq?K8Kfz=?A^;fA}K2ZM6elf@C=>m7|7%nWVLk?7CcLoC&CIy?j z*SaSx^7z5)XYy*_`D_#Gi)-3vM`mZeni@M>@c)+$ObTqP9Mk8XmAbxc&HV)@Tv}Sz UFqB#L9C*K>f9gehl`CP#0rc&Q*8l(j literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_dac_ext_key_usage_crl_sign_wrong/pai-Cert.pem b/credentials/development/commissioner_dut/struct_dac_ext_key_usage_crl_sign_wrong/pai-Cert.pem new file mode 100644 index 00000000000000..69d907d8336e30 --- /dev/null +++ b/credentials/development/commissioner_dut/struct_dac_ext_key_usage_crl_sign_wrong/pai-Cert.pem @@ -0,0 +1,12 @@ +-----BEGIN CERTIFICATE----- +MIIBvTCCAWSgAwIBAgIIKdQqq/FNjKAwCgYIKoZIzj0EAwIwMDEYMBYGA1UEAwwP +TWF0dGVyIFRlc3QgUEFBMRQwEgYKKwYBBAGConwCAQwERkZGMTAgFw0yMjA0MjAw +MDAwMDBaGA85OTk5MTIzMTIzNTk1OVowMDEYMBYGA1UEAwwPTWF0dGVyIFRlc3Qg +UEFJMRQwEgYKKwYBBAGConwCAQwERkZGMTBZMBMGByqGSM49AgEGCCqGSM49AwEH +A0IABCUhfHS8wEYvH9IZ/FU3w/VwJCt4QhFtXt/MON/pdEOH4UjBgg+Geo1eiVmb +1d5fSu3dCp1a9G4O3ehsFgyVkcujZjBkMBIGA1UdEwEB/wQIMAYBAf8CAQEwDgYD +VR0PAQH/BAQDAgEGMB0GA1UdDgQWBBQGiWJ306egFwz0WaNKn3WKpzaxyjAfBgNV +HSMEGDAWgBRq/SJ3H1Ef7L8WQZdnENzcMaFxfjAKBggqhkjOPQQDAgNHADBEAiA8 +3daLkKJI+A1ONOq+z2s0O9Gsh5tZa2rqlV2bEf/0sAIgBqpBZ53NGtemrN+gyESE +hKwAdjmMwO+wj5XRPyTUVsc= +-----END CERTIFICATE----- diff --git a/credentials/development/commissioner_dut/struct_dac_ext_key_usage_crl_sign_wrong/pai-Key.der b/credentials/development/commissioner_dut/struct_dac_ext_key_usage_crl_sign_wrong/pai-Key.der new file mode 100644 index 0000000000000000000000000000000000000000..580a86fd5b4cff005b24252bb235f97ff725c009 GIT binary patch literal 121 zcmV-<0EYiCcLD(c1Ry$IYs+Guq#c#wiAt97pv|IgZD#0X!+a~H5O&`W^U$CQ1_&yK zNX|V20SBQ(13~}2yPf;Yh)P4~BY; bUWr+o)!tu9?cEBUTJ&xX-RNu<43&|~^*c3l literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_dac_ext_key_usage_crl_sign_wrong/pai-Key.pem b/credentials/development/commissioner_dut/struct_dac_ext_key_usage_crl_sign_wrong/pai-Key.pem new file mode 100644 index 00000000000000..79f4f41404d6e4 --- /dev/null +++ b/credentials/development/commissioner_dut/struct_dac_ext_key_usage_crl_sign_wrong/pai-Key.pem @@ -0,0 +1,5 @@ +-----BEGIN EC PRIVATE KEY----- +MHcCAQEEIDpea8tinqQdleKJSpbxoM2ibm1m6GTDfCulEHbfD/PQoAoGCCqGSM49 +AwEHoUQDQgAEJSF8dLzARi8f0hn8VTfD9XAkK3hCEW1e38w43+l0Q4fhSMGCD4Z6 +jV6JWZvV3l9K7d0KnVr0bg7d6GwWDJWRyw== +-----END EC PRIVATE KEY----- diff --git a/credentials/development/commissioner_dut/struct_dac_ext_key_usage_crl_sign_wrong/test_case_vector.json b/credentials/development/commissioner_dut/struct_dac_ext_key_usage_crl_sign_wrong/test_case_vector.json new file mode 100644 index 00000000000000..bc099f8f07a60b --- /dev/null +++ b/credentials/development/commissioner_dut/struct_dac_ext_key_usage_crl_sign_wrong/test_case_vector.json @@ -0,0 +1,9 @@ +{ + "description": "DAC Test Vector: Certificate Key Usage extension cRLSign field is wrong (present for DAC and not present for PAI", + "is_success_case": "false", + "dac_cert": "308201cd30820174a00302010202081012e7dab5cf333e300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313020170d3232303432303030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004e1100a0634119fd81b32be628487d469a2da6a16a1af9829b5d01a15df73ac12b7fe6ecc6da3132ff3b58baacc476ad99416827121e099d86016f65a283819f4a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020182301d0603551d0e04160414114ddea04c9cc2d833fa13661d92c3b40f397d34301f0603551d2304183016801406896277d3a7a0170cf459a34a9f758aa736b1ca300a06082a8648ce3d04030203470030440220057d106a6946b899fcf2f35874865386a6aa267d5f39b3b4daf2125859a7a0b002206048d508bdcd4e2f5eb661675daa4937eeb94ff56938c42e3d5d8c6da2a061aa", + "pai_cert": "308201bd30820164a003020102020829d42aabf14d8ca0300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303432303030303030305a180f39393939313233313233353935395a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d0301070342000425217c74bcc0462f1fd219fc5537c3f570242b7842116d5edfcc38dfe9744387e148c1820f867a8d5e89599bd5de5f4aeddd0a9d5af46e0edde86c160c9591cba366306430120603551d130101ff040830060101ff020101300e0603551d0f0101ff040403020106301d0603551d0e0416041406896277d3a7a0170cf459a34a9f758aa736b1ca301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d040302034700304402203cddd68b90a248f80d4e34eabecf6b343bd1ac879b596b6aea955d9b11fff4b0022006aa41679dcd1ad7a6acdfa0c8448484ac0076398cc0efb08f95d13f24d456c7", + "certification_declaration": "3081e906092a864886f70d010702a081db3081d8020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204473045022100937523b1acc3cd829e4b13074b49a9a42ddcfe5f9b3829e4605e5b44e3344e85022023d74801d3bfe19a7824950a2d2e657933ba955636888c9dc112f2a8530f1cc9", + "dac_private_key": "f0e50bca80c84663d813a9a829da764fdaa1240795157847a1a7976f3ea6dd59", + "dac_public_key": "04e1100a0634119fd81b32be628487d469a2da6a16a1af9829b5d01a15df73ac12b7fe6ecc6da3132ff3b58baacc476ad99416827121e099d86016f65a283819f4" +} diff --git a/credentials/development/commissioner_dut/struct_dac_ext_key_usage_dig_sig_wrong/cd.der b/credentials/development/commissioner_dut/struct_dac_ext_key_usage_dig_sig_wrong/cd.der new file mode 100644 index 0000000000000000000000000000000000000000..d7f99324e18d2240265b3c3258e3ce0f76ce0c5e GIT binary patch literal 236 zcmXqLe96YC)#lOmotKfFX+h&{gT@<7jLe3-2Hb3%32h#Xsmv@)j0Uab1+SJkHs&Ff$n#7)lt3u`!3TF!S*H zCYF?>7Ab_J7MCalIC>h27znX(X|pl1Fg7i!VPfQAadUGsG*A%dH8L_VF*1OFC<%T` zATTsC1|m~SQ_Cm=HymcVI67lD6HSzfhs6S9c%*?a8#~ygOpH(`Gc&R?J29|0cs7(x zoAxs@aLrn!Rr<36C8uSu`KsJCe)zXj&%^wI#s{0oS64Lo9BO_yv@ZI7-Ymc8`%kgj zpd~h?C)g%0JukmF!643n2k32CVMfOPEKCLr27DkMKZpkm7FGoVSrDI(MT|wn@s6*~ zF8O0Ef(qBz6oR;)RDHN0XCM!fR%QVPUV{ji$ky!>Qa>1GJbeE+FK9vRoy^WuTp&5x}jt}9vJX!Lbad@1_&yK zNX|V20SBQ(13~}ZsxO*R8J1`UO(fkj;r)p&NH^dp@H|=S)F}=? beEWcfqW8}>Z;bc(7JX8rJaxzhlcmoeSXnjv literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_dac_ext_key_usage_dig_sig_wrong/dac-Key.pem b/credentials/development/commissioner_dut/struct_dac_ext_key_usage_dig_sig_wrong/dac-Key.pem new file mode 100644 index 00000000000000..5e0281d6d46c8f --- /dev/null +++ b/credentials/development/commissioner_dut/struct_dac_ext_key_usage_dig_sig_wrong/dac-Key.pem @@ -0,0 +1,5 @@ +-----BEGIN EC PRIVATE KEY----- +MHcCAQEEIPZjRK3jx2EvkG82y0WAxvPv4epwVf66oWQ9HhjwbEK1oAoGCCqGSM49 +AwEHoUQDQgAEQEmAdpaW+VlRrK0iqi+aURmWaAZNJN0z4f2JLkg34CjwPFnq1CkO +QHz7gIWi9882b4z3+RZ9UqQ8dcgGk6XPHw== +-----END EC PRIVATE KEY----- diff --git a/credentials/development/commissioner_dut/struct_dac_ext_key_usage_dig_sig_wrong/pai-Cert.der b/credentials/development/commissioner_dut/struct_dac_ext_key_usage_dig_sig_wrong/pai-Cert.der new file mode 100644 index 0000000000000000000000000000000000000000..9e1369e35703debb7e27bec991db319e22475d17 GIT binary patch literal 449 zcmXqLV%%%c#F(;xnTe5!iNoUA;rD4TqBk3Gv2kd%d7QIlVP-NgFqAM5V`C0wVdmlY zO)M!%Em8SE>Db&t8q&8*O5@ zIL#mh=ndvjSz$)T|12B^Y(R>MkI0t~DMk*vQ;epDDSY_^exL8{6!kSz0K8Ly<0RsNAWoC literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_dac_ext_key_usage_dig_sig_wrong/pai-Key.pem b/credentials/development/commissioner_dut/struct_dac_ext_key_usage_dig_sig_wrong/pai-Key.pem new file mode 100644 index 00000000000000..1d8b58390affef --- /dev/null +++ b/credentials/development/commissioner_dut/struct_dac_ext_key_usage_dig_sig_wrong/pai-Key.pem @@ -0,0 +1,5 @@ +-----BEGIN EC PRIVATE KEY----- +MHcCAQEEIOEgvo4uae/RUnOWFuPlK6lJLJLKORr6FPVacfvT1jo5oAoGCCqGSM49 +AwEHoUQDQgAEiTLSaEUeWF4D+30zfb/3PK9XI+/q11icWc+EIkrAC/apqrao1Ncz +rcvLvLT6Vd7K9C3LGvxFGr+9zdVevVs0Pg== +-----END EC PRIVATE KEY----- diff --git a/credentials/development/commissioner_dut/struct_dac_ext_key_usage_dig_sig_wrong/test_case_vector.json b/credentials/development/commissioner_dut/struct_dac_ext_key_usage_dig_sig_wrong/test_case_vector.json new file mode 100644 index 00000000000000..dae7c1dceeb80b --- /dev/null +++ b/credentials/development/commissioner_dut/struct_dac_ext_key_usage_dig_sig_wrong/test_case_vector.json @@ -0,0 +1,9 @@ +{ + "description": "DAC Test Vector: Certificate Key Usage extension diginalSignature field is wrong (not present for DAC and present for PAI", + "is_success_case": "false", + "dac_cert": "308201cd30820174a0030201020208513af27cdcf1c358300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313020170d3232303432303030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004404980769696f95951acad22aa2f9a51199668064d24dd33e1fd892e4837e028f03c59ead4290e407cfb8085a2f7cf366f8cf7f9167d52a43c75c80693a5cf1fa360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020520301d0603551d0e0416041441dc4d2cba1fc6841120d60620520be47af0d01e301f0603551d230418301680140a14b5b79065f03168e1efe36e52a05ddc698965300a06082a8648ce3d04030203470030440220646dd1b6464247825e86a637bf87ae91fc367d34017dfc0ea00f1ea20ec971a502205c192fe0f0bf72b03ce9e1b4b3a6f40296ced3fa67693d4c5a12cecc985cce36", + "pai_cert": "308201bd30820164a003020102020838e6c3ef66e85bb3300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303432303030303030305a180f39393939313233313233353935395a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d030107034200048932d268451e585e03fb7d337dbff73caf5723efead7589c59cf84224ac00bf6a9aab6a8d4d733adcbcbbcb4fa55decaf42dcb1afc451abfbdcdd55ebd5b343ea366306430120603551d130101ff040830060101ff020101300e0603551d0f0101ff040403020106301d0603551d0e041604140a14b5b79065f03168e1efe36e52a05ddc698965301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020347003044022046124d18a397a3576b6f9a766d7e87dd2cc4554dffd95dd458cdff32050918d00220330a57ad23e5c13d136e304f0a30d4cc8e39a712c63ecc280846ce4b8bdd9934", + "certification_declaration": "3081e906092a864886f70d010702a081db3081d8020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204473045022100b1d85dfdff236be1dbd390eb8731977dcb0c83abfee9aad4da806ee67cc14d8c022019e4f0621388c03bb0c82b86e98e019b9f348c6743ff8e2e6bb9a1308111d427", + "dac_private_key": "f66344ade3c7612f906f36cb4580c6f3efe1ea7055febaa1643d1e18f06c42b5", + "dac_public_key": "04404980769696f95951acad22aa2f9a51199668064d24dd33e1fd892e4837e028f03c59ead4290e407cfb8085a2f7cf366f8cf7f9167d52a43c75c80693a5cf1f" +} diff --git a/credentials/development/commissioner_dut/struct_dac_ext_key_usage_key_cert_sign_wrong/cd.der b/credentials/development/commissioner_dut/struct_dac_ext_key_usage_key_cert_sign_wrong/cd.der new file mode 100644 index 0000000000000000000000000000000000000000..8e1382796469f3a4c7910ef17f77e65fec055048 GIT binary patch literal 237 zcmXqLe8tA8)#lOmotKfFX+h&1gT|XojLe3-2Hb3%32h#Xsmv@)j0Ua9e2JGvmin|)0%B&UeWc60@fEmB@2#jx)lG_duG#>d-M8}EuS_E TB|P}0ztE*cs@%vq#Q7-zMSn^l literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_dac_ext_key_usage_key_cert_sign_wrong/dac-Cert.der b/credentials/development/commissioner_dut/struct_dac_ext_key_usage_key_cert_sign_wrong/dac-Cert.der new file mode 100644 index 0000000000000000000000000000000000000000..5fbd5c10efa5fdfa12ca0886b9e92461811b0e6c GIT binary patch literal 466 zcmXqLVmxQi#8|R`nTe5!iGxuu%&Gc2ZFzOpH7%ZfS+&~^At;_-pyatgIWp|VIB-r0%NfN5~vbi%P?}D2rav(E% zFc`QpDKf09SsSq8=GUcnr>XeOdAe}TsV{B!jy{>2w)dIz!gt46e({V{W3!Wy(ypy1_&yK zNX|V20SBQ(13~}Z3F?L{`nP bQMAt#r-lH9T5-E!MFC9d)OeBdi>t9wgPSpx literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_dac_ext_key_usage_key_cert_sign_wrong/dac-Key.pem b/credentials/development/commissioner_dut/struct_dac_ext_key_usage_key_cert_sign_wrong/dac-Key.pem new file mode 100644 index 00000000000000..6d4a751d7e3244 --- /dev/null +++ b/credentials/development/commissioner_dut/struct_dac_ext_key_usage_key_cert_sign_wrong/dac-Key.pem @@ -0,0 +1,5 @@ +-----BEGIN EC PRIVATE KEY----- +MHcCAQEEIPSORMEWfjBnpST1D5SxCGAXPcAVTzQUKW8d/TJDAr0poAoGCCqGSM49 +AwEHoUQDQgAEIsaL+a2n5H/mWAToXp7R3Jox+ZnFRBcvbwvYJxlkbcLqozQ0RFbN +sFG0zxSnhgCFWnG7YUUBTOnUeJHyi6uxUQ== +-----END EC PRIVATE KEY----- diff --git a/credentials/development/commissioner_dut/struct_dac_ext_key_usage_key_cert_sign_wrong/pai-Cert.der b/credentials/development/commissioner_dut/struct_dac_ext_key_usage_key_cert_sign_wrong/pai-Cert.der new file mode 100644 index 0000000000000000000000000000000000000000..2f6fd46323a320438c90d09ac8c8f5265f5467e6 GIT binary patch literal 450 zcmXqLV%%rY#F(;xnTe5!iNmDUF8aOZaa98@HV&;ek8`#x%uEIbh7ty1Y|No7%sl+Q zi6teeMG7IQ#U%;>j*f;R210CH+H8z0j7^Jbm>79j+}zv@4HU$Ajf@OTj0_+kN`l`K z2n>ykfymU-)G`W>nVvYzj5H8tV+Xs5i4p2JW=3{qCkB>--Q`*-{JP$4XQo6HSmo65 zo}8Jp<5l&E4~FK}br;_#Ut{_-Q>m()iG#1@&ZCL8*IuU=YS;xFVm`_${ruG1GtP_C z3{rsJU=EcPW@P-&!ePJ$q?i~P4fsG}{2(!4Ffg(i$b$HMEMhDoC(7<7?Mbk|$&w^g z@nv&oNZtiEPXl?7v@#1Yuo^_N{wkHr2g<+MFXlKsUEt0g!-a))$bri2!C>IZq>yJ@ z^K%>fVoR&L*S_q3!p&bN=T}%z{^73ckAxLJIWMs>DKfNVe(nvND>V1E?%}B-+OJ(F U)jxloVl$srY}&Vw2BoK+03M}>+yDRo literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_dac_ext_key_usage_key_cert_sign_wrong/pai-Cert.pem b/credentials/development/commissioner_dut/struct_dac_ext_key_usage_key_cert_sign_wrong/pai-Cert.pem new file mode 100644 index 00000000000000..a3d73ddca2a8f9 --- /dev/null +++ b/credentials/development/commissioner_dut/struct_dac_ext_key_usage_key_cert_sign_wrong/pai-Cert.pem @@ -0,0 +1,12 @@ +-----BEGIN CERTIFICATE----- +MIIBvjCCAWSgAwIBAgIINH0+W+8pxyUwCgYIKoZIzj0EAwIwMDEYMBYGA1UEAwwP +TWF0dGVyIFRlc3QgUEFBMRQwEgYKKwYBBAGConwCAQwERkZGMTAgFw0yMjA0MjAw +MDAwMDBaGA85OTk5MTIzMTIzNTk1OVowMDEYMBYGA1UEAwwPTWF0dGVyIFRlc3Qg +UEFJMRQwEgYKKwYBBAGConwCAQwERkZGMTBZMBMGByqGSM49AgEGCCqGSM49AwEH +A0IABMGLdypkDy1LhsyUWHA6bH4NyZlsuOp7yPAxNzt+0ewj1gLymSJ6dwIIDoTc +4pE91utncSg+UMIDxQUb58rtzEOjZjBkMBIGA1UdEwEB/wQIMAYBAf8CAQEwDgYD +VR0PAQH/BAQDAgEGMB0GA1UdDgQWBBTIdt1ivGA/2QRiEnj0s4lUbtBGSTAfBgNV +HSMEGDAWgBRq/SJ3H1Ef7L8WQZdnENzcMaFxfjAKBggqhkjOPQQDAgNIADBFAiBu +PXz5tgejOTrd1vS/5AsPfh5OcXB38N1F+GCo+QnSBgIhAIRp841RnRKd2y3DlRQr +60WSf+frZDyfBRaW9lSAIuWJ +-----END CERTIFICATE----- diff --git a/credentials/development/commissioner_dut/struct_dac_ext_key_usage_key_cert_sign_wrong/pai-Key.der b/credentials/development/commissioner_dut/struct_dac_ext_key_usage_key_cert_sign_wrong/pai-Key.der new file mode 100644 index 0000000000000000000000000000000000000000..50168a6fa1d89b0faf20fddaceb46d279500fff9 GIT binary patch literal 121 zcmV-<0EYiCcLD(c1Ry$a5`*$4au2oxaxbz@G&<#e$nhB)&laGB6@cM b2o8kY;*mYp>t}H&K2X8~#RVJZ%I(ZU>CrLr literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_dac_ext_key_usage_key_cert_sign_wrong/pai-Key.pem b/credentials/development/commissioner_dut/struct_dac_ext_key_usage_key_cert_sign_wrong/pai-Key.pem new file mode 100644 index 00000000000000..fc18452c49e097 --- /dev/null +++ b/credentials/development/commissioner_dut/struct_dac_ext_key_usage_key_cert_sign_wrong/pai-Key.pem @@ -0,0 +1,5 @@ +-----BEGIN EC PRIVATE KEY----- +MHcCAQEEID1/Hl9vwslfio4i3E8mehG2MnBSUZL52e0gqZcHNN0joAoGCCqGSM49 +AwEHoUQDQgAEwYt3KmQPLUuGzJRYcDpsfg3JmWy46nvI8DE3O37R7CPWAvKZInp3 +AggOhNzikT3W62dxKD5QwgPFBRvnyu3MQw== +-----END EC PRIVATE KEY----- diff --git a/credentials/development/commissioner_dut/struct_dac_ext_key_usage_key_cert_sign_wrong/test_case_vector.json b/credentials/development/commissioner_dut/struct_dac_ext_key_usage_key_cert_sign_wrong/test_case_vector.json new file mode 100644 index 00000000000000..4412d5ec9b68c0 --- /dev/null +++ b/credentials/development/commissioner_dut/struct_dac_ext_key_usage_key_cert_sign_wrong/test_case_vector.json @@ -0,0 +1,9 @@ +{ + "description": "DAC Test Vector: Certificate Key Usage extension keyCertSign field is wrong (present for DAC and not present for PAI", + "is_success_case": "false", + "dac_cert": "308201ce30820174a0030201020208012e56427bf70d56300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313020170d3232303432303030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d0301070342000422c68bf9ada7e47fe65804e85e9ed1dc9a31f999c544172f6f0bd82719646dc2eaa334344456cdb051b4cf14a78600855a71bb6145014ce9d47891f28babb151a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020284301d0603551d0e041604140c5509076a71ef3f2e43dd05902897e625f6c517301f0603551d23041830168014c876dd62bc603fd904621278f4b389546ed04649300a06082a8648ce3d0403020348003045022100ae7cad50a8d9f5a5dd96244e9ce5a1accaf486dec5e49445affe80a0e4858aff0220109c495dfdfb3888028ba7055e832a4d579a240d4f7f2990a2f19be47eb5503b", + "pai_cert": "308201be30820164a0030201020208347d3e5bef29c725300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303432303030303030305a180f39393939313233313233353935395a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d03010703420004c18b772a640f2d4b86cc9458703a6c7e0dc9996cb8ea7bc8f031373b7ed1ec23d602f299227a7702080e84dce2913dd6eb6771283e50c203c5051be7caedcc43a366306430120603551d130101ff040830060101ff020101300e0603551d0f0101ff040403020106301d0603551d0e04160414c876dd62bc603fd904621278f4b389546ed04649301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d040302034800304502206e3d7cf9b607a3393addd6f4bfe40b0f7e1e4e717077f0dd45f860a8f909d2060221008469f38d519d129ddb2dc395142beb45927fe7eb643c9f051696f6548022e589", + "certification_declaration": "3081ea06092a864886f70d010702a081dc3081d9020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317e307c020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d040302044830460221009bfed41235cb42557a06dd76efc6c743d45ca05817693b06996e72d7787005e8022100a0c5b2d25ff54b9982d4de9e8f6339e5831260e0fa2fa144841a7732435443e5", + "dac_private_key": "f48e44c1167e3067a524f50f94b10860173dc0154f3414296f1dfd324302bd29", + "dac_public_key": "0422c68bf9ada7e47fe65804e85e9ed1dc9a31f999c544172f6f0bd82719646dc2eaa334344456cdb051b4cf14a78600855a71bb6145014ce9d47891f28babb151" +} diff --git a/credentials/development/commissioner_dut/struct_dac_ext_key_usage_missing/cd.der b/credentials/development/commissioner_dut/struct_dac_ext_key_usage_missing/cd.der new file mode 100644 index 0000000000000000000000000000000000000000..1a961872ed43ed800b2778a70c04022d5df034e4 GIT binary patch literal 235 zcmXqLe8I-4)#lOmotKfFX+h&HgU0JjjLe3-2Hb3%32h#Xsmv@)j0UaJkHs&Ff$n#7)lt3u`!3TF!S*H zCYF?>7Ab_J7MCalIC>h27znX(X|pl1Fg7i!VPfQAadUGsG*A%dH8L_VF*1OFC<%T` zATTsC1|m~SQ_Cm=HymcVI67lD6HSzfhs6S9c%*?a8#~ygOpH(`Gc&R?J29|)5_mhY z!sET$$z^tjGcqHX6X#F&kIU>|&nsT>%Go1x&YWw@^|U8W_DVH1Zt;z{v47?&p^t0r zXSB`~yAbfc>Tc%Z00Tb*9-y~ng&7(DvoIMj7|4Qnd@N!tB86wae>-r)uC%D-fP8+) zgXjg1R!%XH2T3cl00XN*$qI+;z}?bdFZVIs4(it0s6zeEmHW)B7fS0;t5;$kUX zO}SN*CgkikF)HE^iQN2AbkDw{A7mcbpLXR?W>RFhmh^k+uUmE9N0;(W{VV%#{)KHD S)St?DJI8Gk>{Lx!RSWzUTKf74HtOoLr7_yoYtoN|O<35!nW_@;tv{HBnHJDc?|R*7={Ypx literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_dac_ext_key_usage_missing/dac-Key.pem b/credentials/development/commissioner_dut/struct_dac_ext_key_usage_missing/dac-Key.pem new file mode 100644 index 00000000000000..30ac1b879ba158 --- /dev/null +++ b/credentials/development/commissioner_dut/struct_dac_ext_key_usage_missing/dac-Key.pem @@ -0,0 +1,5 @@ +-----BEGIN EC PRIVATE KEY----- +MHcCAQEEICKJxV25Dgh9+t9qyyoBi7/jy+645R/B0mYaOZiMXKxnoAoGCCqGSM49 +AwEHoUQDQgAE8hDtkXhI70bJpj7DaGlYA2Gfl09eaY+vDRd46kNIaZyc1qcuK5GT +SmU1M4RNWNi/maoS8a0/mIWZFtBQ73rdaQ== +-----END EC PRIVATE KEY----- diff --git a/credentials/development/commissioner_dut/struct_dac_ext_key_usage_missing/pai-Cert.der b/credentials/development/commissioner_dut/struct_dac_ext_key_usage_missing/pai-Cert.der new file mode 100644 index 0000000000000000000000000000000000000000..7751df99b85a5c704ea0a2e7e93574d646933d1c GIT binary patch literal 450 zcmXqLV%%rY#F(;xnTe5!i9?yCw)MDhdaMB#8;4e#$2nUTW+npzLkR;hHs(+kW*&au z#FCQKB88CD;u3`bM@K^u10gmpZ8k<0#->FzOpH7%Zfj#0Yg9Gb1~*69db~S@WDi0xK4q9|?)d+5Ow# zUr{`J%^~&RK>p>jr{_lS{Cpk$SGW3wXKcN-yqaUHkH`tVCo=_>J-Ht8EB)BH5C0dZ z8KeNc!5k_p%*gnkg~NaiNHH-o8t{R{_(5X8U|?i3kOlGiSj1RFPKX|^li9@GZtbQS zCNgWQs9v=6O9Oe3v@#1Yuo^_N{wkHr2g<+MFXlKsUEt0g!-a))$bri2!C>IZq#$zT zoL9)ks_lF>cO}0)(P2K4mfjkcSQs{cmhrM6zb%zaiVXLfs{=~iYjmQVmz~O1V!py_( zn^;nkTBHz?T3n(K;OJ>6Vj#rErOn33!q~K^hKZ4f#m&vl&_F?)*T~4g#K-^wq9ph& zfxytn7>GUsOf*p@9u^Cb;gJTyZ0ul{GBHA(%*@En?8LwlWe{Kc zI&KLM_xkl~k1t|f;dSzCSF+{oEM~TDp9xAo>v}m8&uCsb#q}h>%$)C(VBm~3GY@dB zbmZH6uu@?+^S*?|jt2GyJV0;D3NtePXJIm6FyI66_(42iu&_56$bZj(TzjZmFyj+)C^EY<7`QMg_?X6I*;?)nJL{;o<=Jd!_t$O}GlLo# y*Lc0`*j5>swT(%kV#dyyKWlGZjc2{TVB6coz+Id77i*UmU5cof&wjW&z6bzu!-5_F literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_dac_ext_skid_missing/dac-Cert.pem b/credentials/development/commissioner_dut/struct_dac_ext_skid_missing/dac-Cert.pem new file mode 100644 index 00000000000000..1dc2e6c9836d0b --- /dev/null +++ b/credentials/development/commissioner_dut/struct_dac_ext_skid_missing/dac-Cert.pem @@ -0,0 +1,12 @@ +-----BEGIN CERTIFICATE----- +MIIBrjCCAVWgAwIBAgIIeZ66Jfr6yckwCgYIKoZIzj0EAwIwMDEYMBYGA1UEAwwP +TWF0dGVyIFRlc3QgUEFJMRQwEgYKKwYBBAGConwCAQwERkZGMTAgFw0yMjA0MjAw +MDAwMDBaGA85OTk5MTIzMTIzNTk1OVowRjEYMBYGA1UEAwwPTWF0dGVyIFRlc3Qg +REFDMRQwEgYKKwYBBAGConwCAQwERkZGMTEUMBIGCisGAQQBgqJ8AgIMBDgwMDAw +WTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAARaMF99616kDAuvr63HogWoSsnNimM5 +m2oDBotMkCL5fo0JYcwp1MoK5FA2Nw7KEVGYrJnACqlBDr3BeSC7A75go0EwPzAM +BgNVHRMBAf8EAjAAMA4GA1UdDwEB/wQEAwIHgDAfBgNVHSMEGDAWgBT8LwenSXt/ +UaDF7Mpz0NbhJXCY8jAKBggqhkjOPQQDAgNHADBEAiBMNVxqPTm7Vs1BLrTmm0NH +60Z4mVKBAaxK6Yi2eVFqtgIgeJi5mfl92dVfBd+gtu1hUbqzv3MrdXLSWHifB8OL +X3I= +-----END CERTIFICATE----- diff --git a/credentials/development/commissioner_dut/struct_dac_ext_skid_missing/dac-Key.der b/credentials/development/commissioner_dut/struct_dac_ext_skid_missing/dac-Key.der new file mode 100644 index 0000000000000000000000000000000000000000..a161af1e8c5d89a1e33bcf0651ea46492a5ca35e GIT binary patch literal 121 zcmV-<0EYiCcLD(c1RyX_r&^*pp#{-7eOcPRYGD01JH*WQBvk3^Oc6Xu9h0C61_&yK zNX|V20SBQ(13~}t3V`3$L%O$D#$OO3BTNV>z2@0|tvskRthhjR|4QDb&ge bz=3aLR3y}@}Py92&p1a~lf literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_dac_ext_skid_missing/dac-Key.pem b/credentials/development/commissioner_dut/struct_dac_ext_skid_missing/dac-Key.pem new file mode 100644 index 00000000000000..983b9d4150b51a --- /dev/null +++ b/credentials/development/commissioner_dut/struct_dac_ext_skid_missing/dac-Key.pem @@ -0,0 +1,5 @@ +-----BEGIN EC PRIVATE KEY----- +MHcCAQEEIDBQp1qiOaEF0Tl9Wdq+amD9ODvEzPckVOnrTBE8SR2ToAoGCCqGSM49 +AwEHoUQDQgAEWjBffetepAwLr6+tx6IFqErJzYpjOZtqAwaLTJAi+X6NCWHMKdTK +CuRQNjcOyhFRmKyZwAqpQQ69wXkguwO+YA== +-----END EC PRIVATE KEY----- diff --git a/credentials/development/commissioner_dut/struct_dac_ext_skid_missing/pai-Cert.der b/credentials/development/commissioner_dut/struct_dac_ext_skid_missing/pai-Cert.der new file mode 100644 index 0000000000000000000000000000000000000000..8215f09fa7b19732e4756194689084d5e6aac84e GIT binary patch literal 449 zcmXqLV%%%c#F(;xnTe5!iG!7S^X1oTQqLK1v2kd%d7QIlVP-NgFqAM5V`C0wVdmlY zO)M!%Em8?V)PHj86vgAZcY5U|=yQJL*`2|_g-N0M z@a7e%BEKD{UHj8(8v#lv8PRmK_hT bO06eU(cAfIm_>bp@`T39;y=4cG}RqO(=Ig% literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_dac_ext_skid_missing/pai-Key.pem b/credentials/development/commissioner_dut/struct_dac_ext_skid_missing/pai-Key.pem new file mode 100644 index 00000000000000..b1d417b4d41f94 --- /dev/null +++ b/credentials/development/commissioner_dut/struct_dac_ext_skid_missing/pai-Key.pem @@ -0,0 +1,5 @@ +-----BEGIN EC PRIVATE KEY----- +MHcCAQEEII4wA4W5EbBT5ukkUj/z4g3LrR5h9NTZ0CbtVvU65TDooAoGCCqGSM49 +AwEHoUQDQgAEF7i3rgc/GSQHUnZvW2tfbTfxy/owG/8MGpa5OevPrNaUU2l0lh0P +r0qtJ1TR2/lqmEV9gvKExsriP7tINNUdRg== +-----END EC PRIVATE KEY----- diff --git a/credentials/development/commissioner_dut/struct_dac_ext_skid_missing/test_case_vector.json b/credentials/development/commissioner_dut/struct_dac_ext_skid_missing/test_case_vector.json new file mode 100644 index 00000000000000..103085cbbd4a11 --- /dev/null +++ b/credentials/development/commissioner_dut/struct_dac_ext_skid_missing/test_case_vector.json @@ -0,0 +1,9 @@ +{ + "description": "DAC Test Vector: Certificate doesn't include Subject Key ID (SKID) extension", + "is_success_case": "false", + "dac_cert": "308201ae30820155a0030201020208799eba25fafac9c9300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313020170d3232303432303030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d030107034200045a305f7deb5ea40c0bafafadc7a205a84ac9cd8a63399b6a03068b4c9022f97e8d0961cc29d4ca0ae45036370eca115198ac99c00aa9410ebdc17920bb03be60a341303f300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301f0603551d23041830168014fc2f07a7497b7f51a0c5ecca73d0d6e1257098f2300a06082a8648ce3d040302034700304402204c355c6a3d39bb56cd412eb4e69b4347eb467899528101ac4ae988b679516ab602207898b999f97dd9d55f05dfa0b6ed6151bab3bf732b7572d258789f07c38b5f72", + "pai_cert": "308201bd30820164a00302010202080503b3d3ebac65ce300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303432303030303030305a180f39393939313233313233353935395a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d0301070342000417b8b7ae073f19240752766f5b6b5f6d37f1cbfa301bff0c1a96b939ebcfacd694536974961d0faf4aad2754d1dbf96a98457d82f284c6cae23fbb4834d51d46a366306430120603551d130101ff040830060101ff020101300e0603551d0f0101ff040403020106301d0603551d0e04160414fc2f07a7497b7f51a0c5ecca73d0d6e1257098f2301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d040302034700304402207bc3b3a86514fb4196d6fc88c501eaf31a066732bf02c27a5dc934deee80924302207fafc732c943cdd5cb77c617ccf359565d562f12d8bb5a4d9ace6aa505e2c49e", + "certification_declaration": "3081e906092a864886f70d010702a081db3081d8020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204473045022041f14cbf2ec70d10970853d9017663d79f14f7470cb4d133238032f1cf3dd48102210080f2f24b889f0d9cdcdcf70950ad25fa7339fd5ec436fbb8e16b925723edbf9c", + "dac_private_key": "3050a75aa239a105d1397d59dabe6a60fd383bc4ccf72454e9eb4c113c491d93", + "dac_public_key": "045a305f7deb5ea40c0bafafadc7a205a84ac9cd8a63399b6a03068b4c9022f97e8d0961cc29d4ca0ae45036370eca115198ac99c00aa9410ebdc17920bb03be60" +} diff --git a/credentials/development/commissioner_dut/struct_dac_ext_subject_alt_name_present/cd.der b/credentials/development/commissioner_dut/struct_dac_ext_subject_alt_name_present/cd.der new file mode 100644 index 0000000000000000000000000000000000000000..d9293cb64030e4d06d94173141b0d115edbbc7d0 GIT binary patch literal 236 zcmXqLe96YC)#lOmotKfFX+h&{gT@<7jLe3-2Hb3%32h#Xsmv@)j0Ua z6>Iog{!8y;cgOGUI+HnW TP4^-WKiIY1$}vZ(VQL@%*Um{R literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_dac_ext_subject_alt_name_present/dac-Cert.der b/credentials/development/commissioner_dut/struct_dac_ext_subject_alt_name_present/dac-Cert.der new file mode 100644 index 0000000000000000000000000000000000000000..4c946ca849269c7a51072bff1110d7be4afbb9a4 GIT binary patch literal 487 zcmXqLVtj1S#MrrjnTe5!iNp9!&cecNtLhE7*f_M>JkHs&Ff$n#7)lt3u`!3TF!S*H zCYF?>7Ab_J7MCalIC>h27znX(X|pl1Fg7i!VPfQAadUGsG*A%dH8L_VF*1OFC<%T` zATTsC1|m~SQ_Cm=HymcVI67lD6HSzfhs6S9c%*?a8#~ygOpH(`Gc&R?J29~QU0C{A zh2g=D1y|3fX*28GS6ECpr_a)wUd+VxsBZ+A1P)DVuGxl;KTFhZ|9s z?3+OAU$*c!1uP6=r1o&%$KDV893B@q>84U}0}CkOlGiSj1RFY`wQU zOca|{!vAiu_o?{}zy6if`y0rEq?K8Kf!83iEFxyl+_$dlLl>Tw|65e1vsJo_5$JTF z0znoY1Fj~H5@3kxCFkcNhdi?fgMllPf_1a{ncVtc?TyElY`v*2%@*_ch4{DPo#$Kj v9SNJiz}b;WkzsbKT=kQ#L+-2v{0`69PudoLiYn#Rd$IgQQ>Cl-cLNmwpW&0* literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_dac_ext_subject_alt_name_present/dac-Cert.pem b/credentials/development/commissioner_dut/struct_dac_ext_subject_alt_name_present/dac-Cert.pem new file mode 100644 index 00000000000000..81a67ce9250fed --- /dev/null +++ b/credentials/development/commissioner_dut/struct_dac_ext_subject_alt_name_present/dac-Cert.pem @@ -0,0 +1,13 @@ +-----BEGIN CERTIFICATE----- +MIIB4zCCAYmgAwIBAgIIM+xsoXG2qn8wCgYIKoZIzj0EAwIwMDEYMBYGA1UEAwwP +TWF0dGVyIFRlc3QgUEFJMRQwEgYKKwYBBAGConwCAQwERkZGMTAgFw0yMjA0MjAw +MDAwMDBaGA85OTk5MTIzMTIzNTk1OVowRjEYMBYGA1UEAwwPTWF0dGVyIFRlc3Qg +REFDMRQwEgYKKwYBBAGConwCAQwERkZGMTEUMBIGCisGAQQBgqJ8AgIMBDgwMDAw +WTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAAT9oXXzJADguKDVz2YrAyzfI6SCuUIt +TODUcZLIiWHWfYTFlDQpR4WFFBTSawazGjHZOUDYWtPdYwr87xrxkrXdo3UwczAM +BgNVHRMBAf8EAjAAMA4GA1UdDwEB/wQEAwIHgDAdBgNVHQ4EFgQUPUu04WEWmnQP +7qNLyp+A+v50f08wHwYDVR0jBBgwFoAUplhcvJ3tRa9Vocsf/XJ2LLUbigEwEwYD +VR0RBAwwCoIIdGVzdC5jb20wCgYIKoZIzj0EAwIDSAAwRQIgO4MnzG1/+oeBxqS1 +2ScbBlzj6Bf2c7nPhL7EVp+gQ0ECIQCbZR575IrCRwVwD0DmB8k9c/JadQ0u6Kfo +gnlFS/cwJA== +-----END CERTIFICATE----- diff --git a/credentials/development/commissioner_dut/struct_dac_ext_subject_alt_name_present/dac-Key.der b/credentials/development/commissioner_dut/struct_dac_ext_subject_alt_name_present/dac-Key.der new file mode 100644 index 0000000000000000000000000000000000000000..e23808824f9b3228beb50e39ff179de41c49df83 GIT binary patch literal 121 zcmV-<0EYiCcLD(c1R#?N+hXM@9{|XT4T;nb!)zUxE!1d%#7^JP7Ex$5svCFink|}yp+h=E)=_9 z3V*%Wt=sFbPj}Dbh$<2ns8OAA{HO39$<|Zz4zugbJz)4nZT_{@yu#_C?YU15oRnCc zW{?8(26L#aFeBrC77hb8AjQPUXut;&;|GZWgMpFFKo-R3V-aH!Sr!qqXYO0q^`Q$- z%l|DZ)7dKB#b_W8l2&E`23CVe)?cM^`9S$M`^6lmrwiP2LSF^_2ZY&eDwL-LBbpu3Pc{y0cX3{R`u1Oo|L!OMm$vm@Qf9#LL8(rn+DC VI^(LZ*I#@oir_jbox$eI3;=lah7kY& literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_dac_ext_subject_alt_name_present/pai-Cert.pem b/credentials/development/commissioner_dut/struct_dac_ext_subject_alt_name_present/pai-Cert.pem new file mode 100644 index 00000000000000..768032784b9271 --- /dev/null +++ b/credentials/development/commissioner_dut/struct_dac_ext_subject_alt_name_present/pai-Cert.pem @@ -0,0 +1,12 @@ +-----BEGIN CERTIFICATE----- +MIIBvjCCAWSgAwIBAgIIAR/N/IEcfv4wCgYIKoZIzj0EAwIwMDEYMBYGA1UEAwwP +TWF0dGVyIFRlc3QgUEFBMRQwEgYKKwYBBAGConwCAQwERkZGMTAgFw0yMjA0MjAw +MDAwMDBaGA85OTk5MTIzMTIzNTk1OVowMDEYMBYGA1UEAwwPTWF0dGVyIFRlc3Qg +UEFJMRQwEgYKKwYBBAGConwCAQwERkZGMTBZMBMGByqGSM49AgEGCCqGSM49AwEH +A0IABG1YQSfoc7dgdOkYarcSXaCUD38W2tuv15dHbghachcQfCWUx/kTvBmFyp7D +ByydwDH0Jp/Wqw0TZxWHbeTAyRijZjBkMBIGA1UdEwEB/wQIMAYBAf8CAQEwDgYD +VR0PAQH/BAQDAgEGMB0GA1UdDgQWBBSmWFy8ne1Fr1Whyx/9cnYstRuKATAfBgNV +HSMEGDAWgBRq/SJ3H1Ef7L8WQZdnENzcMaFxfjAKBggqhkjOPQQDAgNIADBFAiBc +Sp5CYvSPh03a5QfIbKVog7tFa9zXOg/63KUa7+gzlgIhALV1+k/Amxl5Qg0CAWYl +vyXXAar11+j0clgKxRtoBk0D +-----END CERTIFICATE----- diff --git a/credentials/development/commissioner_dut/struct_dac_ext_subject_alt_name_present/pai-Key.der b/credentials/development/commissioner_dut/struct_dac_ext_subject_alt_name_present/pai-Key.der new file mode 100644 index 0000000000000000000000000000000000000000..7dae7039a45c4deaa34d38f12a9656cf0e6b1b60 GIT binary patch literal 121 zcmV-<0EYiCcLD(c1R#b^;8de1zLE$;pR^N78l8cfY)Rls@wv$wuYm=$$D*JL1_&yK zNX|V20SBQ(13~}|Vj7ZvfgYcHzB@D#am_u2ZdH8)3 zOG;9U6hcyqOB4beJq<++gxI*W*%(J*fSMg5>Ov2J#?jWfoxIHHfgx%A2+CG}D(ytlTMASo|v1&0;S?3S(w> z1_Ku+g)G%9>%7o_tf~c0T(~%boVlDyLI2JQN!QMj%e5Dl aa3}okh?IHlTi_X%wJlu!=AR17+iL)5QHQ|* literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_dac_sig_algo_ecdsa_with_sha1/dac-Cert.pem b/credentials/development/commissioner_dut/struct_dac_sig_algo_ecdsa_with_sha1/dac-Cert.pem new file mode 100644 index 00000000000000..eb2bd5ef87ae0a --- /dev/null +++ b/credentials/development/commissioner_dut/struct_dac_sig_algo_ecdsa_with_sha1/dac-Cert.pem @@ -0,0 +1,12 @@ +-----BEGIN CERTIFICATE----- +MIIByzCCAXOgAwIBAgIIM5gk1idb9GAwCQYHKoZIzj0EATAwMRgwFgYDVQQDDA9N +YXR0ZXIgVGVzdCBQQUkxFDASBgorBgEEAYKifAIBDARGRkYxMCAXDTIyMDQyMDAw +MDAwMFoYDzk5OTkxMjMxMjM1OTU5WjBGMRgwFgYDVQQDDA9NYXR0ZXIgVGVzdCBE +QUMxFDASBgorBgEEAYKifAIBDARGRkYxMRQwEgYKKwYBBAGConwCAgwEODAwMDBZ +MBMGByqGSM49AgEGCCqGSM49AwEHA0IABJqpN9xIz/t2V0aVOzvjBGlTcEKhKVGN +Ro222SoB91tGOm6fe5Vty1FtcAokUzc9xmF1LYtIGSY+25Rek5irn7WjYDBeMAwG +A1UdEwEB/wQCMAAwDgYDVR0PAQH/BAQDAgeAMB0GA1UdDgQWBBTEG8rXyBGxKw2p +oiD3Uof4IBmb8TAfBgNVHSMEGDAWgBQEmm6avssC9OIFC2TUBE54rpoHcjAJBgcq +hkjOPQQBA0cAMEQCIGolajtuVVBqeqBCCj0Pp6v+pmCmcskonGS4XJzc4ZmnAiAv +3KgZRYl0033QpAtg+4hZHOtNcElWarZXH9n8eDnbrA== +-----END CERTIFICATE----- diff --git a/credentials/development/commissioner_dut/struct_dac_sig_algo_ecdsa_with_sha1/dac-Key.der b/credentials/development/commissioner_dut/struct_dac_sig_algo_ecdsa_with_sha1/dac-Key.der new file mode 100644 index 0000000000000000000000000000000000000000..1db8e9eac5d2fb749d963ad33574cd5588b8351f GIT binary patch literal 121 zcmV-<0EYiCcLD(c1R%%Jg?ewqvWO|*8#X6i{qJ@2HnN!Z|JV+|4Muy%X@;N*1_&yK zNX|V20SBQ(13~}j*f;R210CH+H8z0j7^Jbm>79j+}zv@4HU$Ajf@OTj0_+kN`l`K z2n>ykfymU-)G`W>nVvYzj5H8tV+Xs5i4p2JW=3{qCkB?c)_t5EyEb0`q%9j(e=kns zUaw%sI{B{t@^m_0O9gb>qOFSJo{~ zGe`k?gE>@In33^63x@$4kYZwFG~fe?@q@&G!NAC7APeI2v52vVu*}MvweK|3mq)DJ zDOXthD%Q#tI|e4zZB{bG*O(*^F_FoQN}qKkoUVVK6rOeE5R-!Ms)r_1?``nbd9-McoiP)~ V8_gNr^Y*8`vi`Ajv1ad-4*(+HiI@NY literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_dac_sig_algo_ecdsa_with_sha1/pai-Cert.pem b/credentials/development/commissioner_dut/struct_dac_sig_algo_ecdsa_with_sha1/pai-Cert.pem new file mode 100644 index 00000000000000..a5de7f2fe50825 --- /dev/null +++ b/credentials/development/commissioner_dut/struct_dac_sig_algo_ecdsa_with_sha1/pai-Cert.pem @@ -0,0 +1,12 @@ +-----BEGIN CERTIFICATE----- +MIIBvjCCAWSgAwIBAgIIJKpVuBhNEYUwCgYIKoZIzj0EAwIwMDEYMBYGA1UEAwwP +TWF0dGVyIFRlc3QgUEFBMRQwEgYKKwYBBAGConwCAQwERkZGMTAgFw0yMjA0MjAw +MDAwMDBaGA85OTk5MTIzMTIzNTk1OVowMDEYMBYGA1UEAwwPTWF0dGVyIFRlc3Qg +UEFJMRQwEgYKKwYBBAGConwCAQwERkZGMTBZMBMGByqGSM49AgEGCCqGSM49AwEH +A0IABO07jgmIurHX8isdVn/eXijejRGIrhbY2zWwNSTI3itqZxmxtz4ToFAkT3pJ +bAqymLk40/hR/GX87IwnM1H51K6jZjBkMBIGA1UdEwEB/wQIMAYBAf8CAQEwDgYD +VR0PAQH/BAQDAgEGMB0GA1UdDgQWBBQEmm6avssC9OIFC2TUBE54rpoHcjAfBgNV +HSMEGDAWgBRq/SJ3H1Ef7L8WQZdnENzcMaFxfjAKBggqhkjOPQQDAgNIADBFAiEA +vBOJV9xWVZf6vLD1XXNeY5GbPhR15ohgy3/nYldq1MICIE2q4TSV3rBLLOKivD4z +AgjsKZiLnr9m6jv4paMpjZTw +-----END CERTIFICATE----- diff --git a/credentials/development/commissioner_dut/struct_dac_sig_algo_ecdsa_with_sha1/pai-Key.der b/credentials/development/commissioner_dut/struct_dac_sig_algo_ecdsa_with_sha1/pai-Key.der new file mode 100644 index 0000000000000000000000000000000000000000..8a313c4aecdfc4bae692d557d9286bdbb6e5affd GIT binary patch literal 121 zcmV-<0EYiCcLD(c1RyoAwald(oz;qfdBK+i*w5^(t$RV~#zBb@k`b#5**2gG1_&yK zNX|V20SBQ(13~}FzOpH7%ZfjA>*xW;jg^srtCm6&T@BqCnE6m9FpM}YQ!GI6M;|KA8!NT5PAPeI2v52vV1fROg z(B3(F>Yv-L5@Byd-%Yj;Z!nMtNh`Ae1Fu1(Eq{f@L_rqLNiVKmRBFzBSJ82b9XXJh z-5CsAm=x4rdD>?Doo;-u?~;X%&j*$s>-9<%zk&o!R<7h0wobpvq>$Xjxag_s76und cp4}&R-JK%8@Z|jLum_uF$nSrAYWnGA0E@egL;wH) literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_dac_sig_algo_ecdsa_with_sha256/dac-Cert.pem b/credentials/development/commissioner_dut/struct_dac_sig_algo_ecdsa_with_sha256/dac-Cert.pem new file mode 100644 index 00000000000000..fc5cc45fb3e9eb --- /dev/null +++ b/credentials/development/commissioner_dut/struct_dac_sig_algo_ecdsa_with_sha256/dac-Cert.pem @@ -0,0 +1,12 @@ +-----BEGIN CERTIFICATE----- +MIIBzTCCAXSgAwIBAgIIPWAiOWrKUWIwCgYIKoZIzj0EAwIwMDEYMBYGA1UEAwwP +TWF0dGVyIFRlc3QgUEFJMRQwEgYKKwYBBAGConwCAQwERkZGMTAgFw0yMjA0MjAw +MDAwMDBaGA85OTk5MTIzMTIzNTk1OVowRjEYMBYGA1UEAwwPTWF0dGVyIFRlc3Qg +REFDMRQwEgYKKwYBBAGConwCAQwERkZGMTEUMBIGCisGAQQBgqJ8AgIMBDgwMDAw +WTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAAQFZ+vEXJHU0iQ4vq9InW77s1a6ONcz +9SBF07RLN5aY4RNmGQWT+EXnR6Kuebb+tgbFV12sjoXUyOwWncJhcUHao2AwXjAM +BgNVHRMBAf8EAjAAMA4GA1UdDwEB/wQEAwIHgDAdBgNVHQ4EFgQUU8rdAIeJm5X8 +20UYVuwV7pM/V4AwHwYDVR0jBBgwFoAUhm+oOJERBAmS6NXRIoNt7niIygcwCgYI +KoZIzj0EAwIDRwAwRAIgJupJPWj9lzPejtI4LEzwBIw7ryJ4+lIRNKmpCxM7Z9kC +IGOKAaLlJbQARBkMu8m63ZQfocmfa1bgspgfv+PKl8um +-----END CERTIFICATE----- diff --git a/credentials/development/commissioner_dut/struct_dac_sig_algo_ecdsa_with_sha256/dac-Key.der b/credentials/development/commissioner_dut/struct_dac_sig_algo_ecdsa_with_sha256/dac-Key.der new file mode 100644 index 0000000000000000000000000000000000000000..dff6da6b07749ee3cc53215daa1dc23dc961a451 GIT binary patch literal 121 zcmV-<0EYiCcLD(c1R#@e%=pO=vEEVR1p)By2Z5 literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_dac_sig_algo_ecdsa_with_sha256/dac-Key.pem b/credentials/development/commissioner_dut/struct_dac_sig_algo_ecdsa_with_sha256/dac-Key.pem new file mode 100644 index 00000000000000..df5f005244d266 --- /dev/null +++ b/credentials/development/commissioner_dut/struct_dac_sig_algo_ecdsa_with_sha256/dac-Key.pem @@ -0,0 +1,5 @@ +-----BEGIN EC PRIVATE KEY----- +MHcCAQEEIJNwzPjJD0JDQ6Kq+OzaeBzorQ2u2iJQOWYMuwEMYd/5oAoGCCqGSM49 +AwEHoUQDQgAEBWfrxFyR1NIkOL6vSJ1u+7NWujjXM/UgRdO0SzeWmOETZhkFk/hF +50eirnm2/rYGxVddrI6F1MjsFp3CYXFB2g== +-----END EC PRIVATE KEY----- diff --git a/credentials/development/commissioner_dut/struct_dac_sig_algo_ecdsa_with_sha256/pai-Cert.der b/credentials/development/commissioner_dut/struct_dac_sig_algo_ecdsa_with_sha256/pai-Cert.der new file mode 100644 index 0000000000000000000000000000000000000000..4ac04099c28a7bafafaaea40a37a1021ccbe5ebe GIT binary patch literal 449 zcmXqLV%%%c#F(;xnTe5!i6hHOJlvRf{W$|JHV&;ek8`#x%uEIbh7ty1Y|No7%sl+Q zi6teeMG7IQ#U%;>j*f;R210CH+H8z0j7^Jbm>79j+}zv@4HU$Ajf@OTj0_+kN`l`K z2n>ykfymU-)G`W>nVvYzj5H8tV+Xs5i4p2JW=3{qCk7VnXNh^HHk*?!+`GJ|f5Ya6 zLMOZMWj80ySZQp$XL0kc9k~ZwqgOpLk5M%1Jfg97{+yQJL*`2|_g-M~P z$?nLn#`aVN!OJ&NpT?M86KXlQ|DuuH@|#7zU0%Aom=x-oVq*2fughPsIhmx?vV6xq Up{)_&ORS4Jzf7*|E1mKh0K967R{#J2 literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_dac_sig_algo_ecdsa_with_sha256/pai-Cert.pem b/credentials/development/commissioner_dut/struct_dac_sig_algo_ecdsa_with_sha256/pai-Cert.pem new file mode 100644 index 00000000000000..6cb86f62cd72a7 --- /dev/null +++ b/credentials/development/commissioner_dut/struct_dac_sig_algo_ecdsa_with_sha256/pai-Cert.pem @@ -0,0 +1,12 @@ +-----BEGIN CERTIFICATE----- +MIIBvTCCAWSgAwIBAgIIajoXVzMNr84wCgYIKoZIzj0EAwIwMDEYMBYGA1UEAwwP +TWF0dGVyIFRlc3QgUEFBMRQwEgYKKwYBBAGConwCAQwERkZGMTAgFw0yMjA0MjAw +MDAwMDBaGA85OTk5MTIzMTIzNTk1OVowMDEYMBYGA1UEAwwPTWF0dGVyIFRlc3Qg +UEFJMRQwEgYKKwYBBAGConwCAQwERkZGMTBZMBMGByqGSM49AgEGCCqGSM49AwEH +A0IABCvmYW41PLNi0N7TvI+ws4BxQj5XptmSmKkzM7yjg7q4bcBFW6riN1whNonE +KK2fvKDY9vg1yPrNZLAHJwt61XqjZjBkMBIGA1UdEwEB/wQIMAYBAf8CAQEwDgYD +VR0PAQH/BAQDAgEGMB0GA1UdDgQWBBSGb6g4kREECZLo1dEig23ueIjKBzAfBgNV +HSMEGDAWgBRq/SJ3H1Ef7L8WQZdnENzcMaFxfjAKBggqhkjOPQQDAgNHADBEAiBy +gj7E+oGHZSAR09hl5Vw11hKEwb/RMh6n2XJNikotugIgfoJcXS9X1x/QPMliIoSn +uN4StVhXpDtyifSTeY51lOs= +-----END CERTIFICATE----- diff --git a/credentials/development/commissioner_dut/struct_dac_sig_algo_ecdsa_with_sha256/pai-Key.der b/credentials/development/commissioner_dut/struct_dac_sig_algo_ecdsa_with_sha256/pai-Key.der new file mode 100644 index 0000000000000000000000000000000000000000..17451d2168625f94c1697dbcc422b249d9bb24f0 GIT binary patch literal 121 zcmV-<0EYiCcLD(c1R%0W{Hmg|ws3bFK&bZf)NiUExHVwR8BqcT83>JxrpTZQ1_&yK zNX|V20SBQ(13~}{46IeTq4ss#W*dPUj* literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_dac_sig_curve_prime256v1/dac-Cert.der b/credentials/development/commissioner_dut/struct_dac_sig_curve_prime256v1/dac-Cert.der new file mode 100644 index 0000000000000000000000000000000000000000..5deb3a6b8ba09bdefb7a9fc25a532d2bce847d49 GIT binary patch literal 467 zcmXqLVmxoq#8|R`nTe5!iK9M}y+Jp1+7<&YHV&;ek8`#x%uEIbh7ty1Y|No7%sl+Q zi6teeMG7IQ#U%;>j-G}h210CH+H8z0j7^Jbm>79j+}zv@4HU$Ajf@OTj0_+kN`l`K z2n>ykfymU-)H2Gz4TqU7j?UQ4L=$D=VX*)i9%&%V#twEV6C>2g%#7^JP7ExOzXJp! zLYCb3ePW$I=gR{V%a$_JU+t|)=OX`JthgY3?aX067PJ3*)h1kDW%reN+0QhWA8Ji^ z;}p)9eB2?vcCN+Z1cNvO9-y~ng&7(DvoIMj81R93{2(4MSlAm3WI=pB7BLo)wGWn_ zkKeKDWO99;VlIehUN4)&ScR(e-`9jXNi|(wG cVU88gbDOQqJq@Ss69L@51^{;&k0cRDB>i_@% literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_dac_sig_curve_prime256v1/dac-Cert.pem b/credentials/development/commissioner_dut/struct_dac_sig_curve_prime256v1/dac-Cert.pem new file mode 100644 index 00000000000000..5a115999dd5045 --- /dev/null +++ b/credentials/development/commissioner_dut/struct_dac_sig_curve_prime256v1/dac-Cert.pem @@ -0,0 +1,12 @@ +-----BEGIN CERTIFICATE----- +MIIBzzCCAXSgAwIBAgIIf1kHgC1llrQwCgYIKoZIzj0EAwIwMDEYMBYGA1UEAwwP +TWF0dGVyIFRlc3QgUEFJMRQwEgYKKwYBBAGConwCAQwERkZGMTAgFw0yMjA0MjAw +MDAwMDBaGA85OTk5MTIzMTIzNTk1OVowRjEYMBYGA1UEAwwPTWF0dGVyIFRlc3Qg +REFDMRQwEgYKKwYBBAGConwCAQwERkZGMTEUMBIGCisGAQQBgqJ8AgIMBDgwMDAw +WTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAARZ+1AQWFSk303kO2+c9OA0OYR2NfqH +hWLOWf3ReNAb1szDTgQ2/70mkNeqPvUDpvlmRPgmgt1eIM908bgXrZ04o2AwXjAM +BgNVHRMBAf8EAjAAMA4GA1UdDwEB/wQEAwIHgDAdBgNVHQ4EFgQUreClz1+4usl3 +bBMEb8+oxb5aRwUwHwYDVR0jBBgwFoAUMfnptlpML8tOY/G26Nt3URYqXFUwCgYI +KoZIzj0EAwIDSQAwRgIhAI9BXqn9YL+Cmh5aw/bm9vDQ9oWZQKYTWQLAK4hfH9Hu +AiEA+w5UzYcVuX4cA10XbkabKEMYWTgCL2krM1sE86v6vqE= +-----END CERTIFICATE----- diff --git a/credentials/development/commissioner_dut/struct_dac_sig_curve_prime256v1/dac-Key.der b/credentials/development/commissioner_dut/struct_dac_sig_curve_prime256v1/dac-Key.der new file mode 100644 index 0000000000000000000000000000000000000000..c2114651bdd7f0c0b4938a5760e83f2ba7854a42 GIT binary patch literal 121 zcmV-<0EYiCcLD(c1Rzb>!^-Z6J}$(i!?rtv+j8~$4S1WNarq5|L}gPaiR7RP1_&yK zNX|V20SBQ(13~}ZVg56#q&vfy)7pJkHs&Ff$n#7)lt3u`!3TF!S*H zCYF?>7Ab_J7MCalI64}N7znX(X|pl1Fg7i!VPfQAadUGsG*A%dH8L_VF*1OFC<%T` zATTsC1|m~SQ_CnkW_scJobofue7dA)Y9s+#=G#tI|e4zZB{bG*O(*^F_FRpds^1In UJDhWsL-n{>^xGS66;+hv0YL+X>;M1& literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_dac_sig_curve_prime256v1/pai-Cert.pem b/credentials/development/commissioner_dut/struct_dac_sig_curve_prime256v1/pai-Cert.pem new file mode 100644 index 00000000000000..18415e99ce8b12 --- /dev/null +++ b/credentials/development/commissioner_dut/struct_dac_sig_curve_prime256v1/pai-Cert.pem @@ -0,0 +1,12 @@ +-----BEGIN CERTIFICATE----- +MIIBvzCCAWSgAwIBAgIINu3nG2Jn6v0wCgYIKoZIzj0EAwIwMDEYMBYGA1UEAwwP +TWF0dGVyIFRlc3QgUEFBMRQwEgYKKwYBBAGConwCAQwERkZGMTAgFw0yMjA0MjAw +MDAwMDBaGA85OTk5MTIzMTIzNTk1OVowMDEYMBYGA1UEAwwPTWF0dGVyIFRlc3Qg +UEFJMRQwEgYKKwYBBAGConwCAQwERkZGMTBZMBMGByqGSM49AgEGCCqGSM49AwEH +A0IABMpK60A6epP2SNO7Nn8gPbLKrXgWVpJcTZkHPaj+IlekE+qJKvt001GjeM7U +CQnOToKrud9NfYN2R4IHfd8IoxejZjBkMBIGA1UdEwEB/wQIMAYBAf8CAQEwDgYD +VR0PAQH/BAQDAgEGMB0GA1UdDgQWBBQx+em2Wkwvy05j8bbo23dRFipcVTAfBgNV +HSMEGDAWgBRq/SJ3H1Ef7L8WQZdnENzcMaFxfjAKBggqhkjOPQQDAgNJADBGAiEA +nZncRQVCvzWDgIgVAyx1utqviy8uJtWgFCyH91Gi7Q4CIQDRq28M9VcXfkLGfK+9 +J95QTsNs1QglxzZb7djtISQiHw== +-----END CERTIFICATE----- diff --git a/credentials/development/commissioner_dut/struct_dac_sig_curve_prime256v1/pai-Key.der b/credentials/development/commissioner_dut/struct_dac_sig_curve_prime256v1/pai-Key.der new file mode 100644 index 0000000000000000000000000000000000000000..302a6b124c01d61c82707ad46ff564de1078f15e GIT binary patch literal 121 zcmV-<0EYiCcLD(c1R#;BbM+UKJFLfOQ}_tZjLFQ;ytY%ZhY$Bza2q|%zYU-Y1_&yK zNX|V20SBQ(13~}<%1Y}%I(n1#NYlGEe;_@w%B^@7R+3yznFl?n{vubT6Y7a7`*hP$ bqj=8L2?@?lf~&dTO?`uQM}h}^-w2}@HSaX# literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_dac_sig_curve_prime256v1/pai-Key.pem b/credentials/development/commissioner_dut/struct_dac_sig_curve_prime256v1/pai-Key.pem new file mode 100644 index 00000000000000..59f544240edabb --- /dev/null +++ b/credentials/development/commissioner_dut/struct_dac_sig_curve_prime256v1/pai-Key.pem @@ -0,0 +1,5 @@ +-----BEGIN EC PRIVATE KEY----- +MHcCAQEEIJGqc/UXkzusx2hT+AjOjMnMz7y2U7GHD/dZcBs9zb8NoAoGCCqGSM49 +AwEHoUQDQgAEykrrQDp6k/ZI07s2fyA9ssqteBZWklxNmQc9qP4iV6QT6okq+3TT +UaN4ztQJCc5Ogqu53019g3ZHggd93wijFw== +-----END EC PRIVATE KEY----- diff --git a/credentials/development/commissioner_dut/struct_dac_sig_curve_prime256v1/test_case_vector.json b/credentials/development/commissioner_dut/struct_dac_sig_curve_prime256v1/test_case_vector.json new file mode 100644 index 00000000000000..98b305cbaddb8d --- /dev/null +++ b/credentials/development/commissioner_dut/struct_dac_sig_curve_prime256v1/test_case_vector.json @@ -0,0 +1,9 @@ +{ + "description": "DAC Test Vector: Valid certificate public key curve prime256v1", + "is_success_case": "true", + "dac_cert": "308201cf30820174a00302010202087f5907802d6596b4300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313020170d3232303432303030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d0301070342000459fb50105854a4df4de43b6f9cf4e03439847635fa878562ce59fdd178d01bd6ccc34e0436ffbd2690d7aa3ef503a6f96644f82682dd5e20cf74f1b817ad9d38a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414ade0a5cf5fb8bac9776c13046fcfa8c5be5a4705301f0603551d2304183016801431f9e9b65a4c2fcb4e63f1b6e8db7751162a5c55300a06082a8648ce3d04030203490030460221008f415ea9fd60bf829a1e5ac3f6e6f6f0d0f6859940a6135902c02b885f1fd1ee022100fb0e54cd8715b97e1c035d176e469b2843185938022f692b335b04f3abfabea1", + "pai_cert": "308201bf30820164a003020102020836ede71b6267eafd300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303432303030303030305a180f39393939313233313233353935395a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d03010703420004ca4aeb403a7a93f648d3bb367f203db2caad781656925c4d99073da8fe2257a413ea892afb74d351a378ced40909ce4e82abb9df4d7d83764782077ddf08a317a366306430120603551d130101ff040830060101ff020101300e0603551d0f0101ff040403020106301d0603551d0e0416041431f9e9b65a4c2fcb4e63f1b6e8db7751162a5c55301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d04030203490030460221009d99dc450542bf3583808815032c75badaaf8b2f2e26d5a0142c87f751a2ed0e022100d1ab6f0cf557177e42c67cafbd27de504ec36cd50825c7365bedd8ed2124221f", + "certification_declaration": "3081e806092a864886f70d010702a081da3081d7020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317c307a020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d040302044630440220620a83eed8a527c0972862bc9c784a02c114280e4573ec370f9ccf1a56d92dfb02206e8bdb0790366e11ec9f184d5a52c44efb6c575b17a09dc5889012434ab7327d", + "dac_private_key": "4dd9c3caee883e2ec4a5c3b63b83db72f5fb0d789ba071f90d844465532789e4", + "dac_public_key": "0459fb50105854a4df4de43b6f9cf4e03439847635fa878562ce59fdd178d01bd6ccc34e0436ffbd2690d7aa3ef503a6f96644f82682dd5e20cf74f1b817ad9d38" +} diff --git a/credentials/development/commissioner_dut/struct_dac_sig_curve_secp256k1/cd.der b/credentials/development/commissioner_dut/struct_dac_sig_curve_secp256k1/cd.der new file mode 100644 index 0000000000000000000000000000000000000000..d8dd4154cd8c5770167e102875373e6c3de1bec4 GIT binary patch literal 236 zcmXqLe96YC)#lOmotKfFX+h&{gT@<7jLe3-2Hb3%32h#Xsmv@)j0Uay?(6y(IjPJNTKjWlUX`fr{nJ}nMRqeOG93QA<1hKlHV&;ek8`#x%uEIbh7ty1Y|No7%sl+Q zi6teeMG7IQ#U%;>j-G}h210CH+H8z0j7^Jbm>79j+}zv@4HU$Ajf@OTj0_+kN`l`K z2n>ykfymU-)H2Gz4TqU7j?UQ4L=$D=VX*)i9%dlG#twEV6C)d|b|VV|7qb%sOSsZJ zZdR6!z0ZVO%Iq~KBszaiP3T|$#wbA8G~MAj-^<;>QylAzBHp{}eN^rL@w)9-=e1K0 zoqlvgTTbvwI{cGwae_gd0T0m6vcimv|5=y}7!3G8Jbn-l7$)ou2C^VNABz}^h~rb= zr@QLaW-U8)E#TVvgI06DtiEF)50X}90ftP_fVTr;|S&p0MH$5xQeU{+EY+K#Ns?GeX@cZ3`cb;G2NxlqJa$(|JKepwQ fne)FrmFNykS5{Vk_vZPN_qI+IQZ9zZb1wh@v7?SG literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_dac_sig_curve_secp256k1/dac-Cert.pem b/credentials/development/commissioner_dut/struct_dac_sig_curve_secp256k1/dac-Cert.pem new file mode 100644 index 00000000000000..b59b5c1f89ae9e --- /dev/null +++ b/credentials/development/commissioner_dut/struct_dac_sig_curve_secp256k1/dac-Cert.pem @@ -0,0 +1,12 @@ +-----BEGIN CERTIFICATE----- +MIIBzDCCAXGgAwIBAgIII3geiE8t5cswCgYIKoZIzj0EAwIwMDEYMBYGA1UEAwwP +TWF0dGVyIFRlc3QgUEFJMRQwEgYKKwYBBAGConwCAQwERkZGMTAgFw0yMjA0MjAw +MDAwMDBaGA85OTk5MTIzMTIzNTk1OVowRjEYMBYGA1UEAwwPTWF0dGVyIFRlc3Qg +REFDMRQwEgYKKwYBBAGConwCAQwERkZGMTEUMBIGCisGAQQBgqJ8AgIMBDgwMDAw +VjAQBgcqhkjOPQIBBgUrgQQACgNCAARXIp4LBQSxjeYThHY/KZBhQ/NlYI+v7DJQ +EzVnQOcO6btTlEF+MljvRy7xJY/464b6idbK4UL4iFs5kEpiw/kOo2AwXjAMBgNV +HRMBAf8EAjAAMA4GA1UdDwEB/wQEAwIHgDAdBgNVHQ4EFgQUQeVN5bp/JpqmytZQ +1q/BOp30q9wwHwYDVR0jBBgwFoAUMq3Sj+eICOBjVatB8oGXmLLyW5AwCgYIKoZI +zj0EAwIDSQAwRgIhAKQg+R0I2c+y5ndt5mBMAz17hgUrA/px992h3OfUDGPTAiEA +0JGdTgankwNv9uUYi1FnIyMn7uzn5O89QngaRDEzndA= +-----END CERTIFICATE----- diff --git a/credentials/development/commissioner_dut/struct_dac_sig_curve_secp256k1/dac-Key.der b/credentials/development/commissioner_dut/struct_dac_sig_curve_secp256k1/dac-Key.der new file mode 100644 index 0000000000000000000000000000000000000000..005705cdcafb03c049a2d7dc169343cad23b6724 GIT binary patch literal 118 zcmV-+0Ez!FbOHeZ1R#b?J%m!A0|?uXn2#k&VGm+>@pTg|gi&|7IAO>uL4Gn=??*22 YC6D;)hWd%t%Hcxzh+8?3N@BzL4t^IeP5=M^ literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_dac_sig_curve_secp256k1/dac-Key.pem b/credentials/development/commissioner_dut/struct_dac_sig_curve_secp256k1/dac-Key.pem new file mode 100644 index 00000000000000..060c6d43c38616 --- /dev/null +++ b/credentials/development/commissioner_dut/struct_dac_sig_curve_secp256k1/dac-Key.pem @@ -0,0 +1,5 @@ +-----BEGIN EC PRIVATE KEY----- +MHQCAQEEIIZMPYRSoAMI24+YjyVKYQ9iePF1Ey2EUXe5OrE7WxXmoAcGBSuBBAAK +oUQDQgAEVyKeCwUEsY3mE4R2PymQYUPzZWCPr+wyUBM1Z0DnDum7U5RBfjJY70cu +8SWP+OuG+onWyuFC+IhbOZBKYsP5Dg== +-----END EC PRIVATE KEY----- diff --git a/credentials/development/commissioner_dut/struct_dac_sig_curve_secp256k1/pai-Cert.der b/credentials/development/commissioner_dut/struct_dac_sig_curve_secp256k1/pai-Cert.der new file mode 100644 index 0000000000000000000000000000000000000000..f79a2182e84fa2fdcb3d7b14b802a5abf3b8458a GIT binary patch literal 449 zcmXqLV%%%c#F(;xnTe5!i6dKxUGHgh=>h{THV&;ek8`#x%uEIbh7ty1Y|No7%sl+Q zi6teeMG7IQ#U%;>j*f;R210CH+H8z0j7^Jbm>79j+}zv@4HU$Ajf@OTj0_+kN`l`K z2n>ykfymU-)G`W>nVvYzj5H8tV+Xs5i4p2JW=3{qCk7UMu|;`>&MvZcGHw|kEEpx9 z{XE;Nb^kX1?PKqQ8UwU1Mp$ATz1RM{_*0CEP4MLmCIy|A4Oez#g}mum9m4vo;Yd!; Uxs#`-MjVTE_gw#|U17Qr0I9-@761SM literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_dac_sig_curve_secp256k1/pai-Cert.pem b/credentials/development/commissioner_dut/struct_dac_sig_curve_secp256k1/pai-Cert.pem new file mode 100644 index 00000000000000..03125aff2c1265 --- /dev/null +++ b/credentials/development/commissioner_dut/struct_dac_sig_curve_secp256k1/pai-Cert.pem @@ -0,0 +1,12 @@ +-----BEGIN CERTIFICATE----- +MIIBvTCCAWSgAwIBAgIIaxIHLuVbdaAwCgYIKoZIzj0EAwIwMDEYMBYGA1UEAwwP +TWF0dGVyIFRlc3QgUEFBMRQwEgYKKwYBBAGConwCAQwERkZGMTAgFw0yMjA0MjAw +MDAwMDBaGA85OTk5MTIzMTIzNTk1OVowMDEYMBYGA1UEAwwPTWF0dGVyIFRlc3Qg +UEFJMRQwEgYKKwYBBAGConwCAQwERkZGMTBZMBMGByqGSM49AgEGCCqGSM49AwEH +A0IABC8Wom5xQ0QdPhxGaPA4ARnm+c2NKt/bD9vG71KBUCvRWDuJctqOBQDWJkiq +pz7ftO7EVoP+yvuZzyJPXf44cqmjZjBkMBIGA1UdEwEB/wQIMAYBAf8CAQEwDgYD +VR0PAQH/BAQDAgEGMB0GA1UdDgQWBBQyrdKP54gI4GNVq0HygZeYsvJbkDAfBgNV +HSMEGDAWgBRq/SJ3H1Ef7L8WQZdnENzcMaFxfjAKBggqhkjOPQQDAgNHADBEAiAr +NMvv4qqBwZdQGqfDMyt4uIoYjSrvK/Oj8lwkPFPTaAIgLISw1LhqVOyMq1QF5oDE +bIzOycuVWMZdR0mv4ocglzI= +-----END CERTIFICATE----- diff --git a/credentials/development/commissioner_dut/struct_dac_sig_curve_secp256k1/pai-Key.der b/credentials/development/commissioner_dut/struct_dac_sig_curve_secp256k1/pai-Key.der new file mode 100644 index 0000000000000000000000000000000000000000..91b21aa1d218b5f01d7885c85702d7a270775221 GIT binary patch literal 121 zcmV-<0EYiCcLD(c1RyE+Ttk;i;AT#(Yl0BpWMIvPe;PeJpGh#*Hb8VaSUZVw+KvSP b)+R`*r#|1b?!;Du{>uBA&mvD<{y1`}qMI^^ literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_dac_sig_curve_secp256k1/pai-Key.pem b/credentials/development/commissioner_dut/struct_dac_sig_curve_secp256k1/pai-Key.pem new file mode 100644 index 00000000000000..776e2c07d4ee34 --- /dev/null +++ b/credentials/development/commissioner_dut/struct_dac_sig_curve_secp256k1/pai-Key.pem @@ -0,0 +1,5 @@ +-----BEGIN EC PRIVATE KEY----- +MHcCAQEEICn4XEOXSuBmTq1rghDfZGDNhn8aPTyfSTDWNkB0XjasoAoGCCqGSM49 +AwEHoUQDQgAELxaibnFDRB0+HEZo8DgBGeb5zY0q39sP28bvUoFQK9FYO4ly2o4F +ANYmSKqnPt+07sRWg/7K+5nPIk9d/jhyqQ== +-----END EC PRIVATE KEY----- diff --git a/credentials/development/commissioner_dut/struct_dac_sig_curve_secp256k1/test_case_vector.json b/credentials/development/commissioner_dut/struct_dac_sig_curve_secp256k1/test_case_vector.json new file mode 100644 index 00000000000000..c458dac01e50f3 --- /dev/null +++ b/credentials/development/commissioner_dut/struct_dac_sig_curve_secp256k1/test_case_vector.json @@ -0,0 +1,9 @@ +{ + "description": "DAC Test Vector: Invalid certificate public key curve secp256k1", + "is_success_case": "false", + "dac_cert": "308201cc30820171a003020102020823781e884f2de5cb300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313020170d3232303432303030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303056301006072a8648ce3d020106052b8104000a0342000457229e0b0504b18de61384763f29906143f365608fafec325013356740e70ee9bb5394417e3258ef472ef1258ff8eb86fa89d6cae142f8885b39904a62c3f90ea360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e0416041441e54de5ba7f269aa6cad650d6afc13a9df4abdc301f0603551d2304183016801432add28fe78808e06355ab41f2819798b2f25b90300a06082a8648ce3d0403020349003046022100a420f91d08d9cfb2e6776de6604c033d7b86052b03fa71f7dda1dce7d40c63d3022100d0919d4e06a793036ff6e5188b5167232327eeece7e4ef3d42781a4431339dd0", + "pai_cert": "308201bd30820164a00302010202086b12072ee55b75a0300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303432303030303030305a180f39393939313233313233353935395a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d030107034200042f16a26e7143441d3e1c4668f0380119e6f9cd8d2adfdb0fdbc6ef5281502bd1583b8972da8e0500d62648aaa73edfb4eec45683fecafb99cf224f5dfe3872a9a366306430120603551d130101ff040830060101ff020101300e0603551d0f0101ff040403020106301d0603551d0e0416041432add28fe78808e06355ab41f2819798b2f25b90301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d040302034700304402202b34cbefe2aa81c197501aa7c3332b78b88a188d2aef2bf3a3f25c243c53d36802202c84b0d4b86a54ec8cab5405e680c46c8ccec9cb9558c65d4749afe287209732", + "certification_declaration": "3081e906092a864886f70d010702a081db3081d8020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d0403020447304502207e3b4477a2e4e088d2f8eadf2d4c3242249a12adf9a96e7a153ddfcbb50514bb022100c3f3b4c2f2825e0a45da13a94dac4cdfc882e04eab6866fb7e9b5d5d9c98ecc6", + "dac_private_key": "864c3d8452a00308db8f988f254a610f6278f175132d845177b93ab13b5b15e6", + "dac_public_key": "0457229e0b0504b18de61384763f29906143f365608fafec325013356740e70ee9bb5394417e3258ef472ef1258ff8eb86fa89d6cae142f8885b39904a62c3f90e" +} diff --git a/credentials/development/commissioner_dut/struct_dac_subject_pid_mismatch/cd.der b/credentials/development/commissioner_dut/struct_dac_subject_pid_mismatch/cd.der new file mode 100644 index 0000000000000000000000000000000000000000..d62a4c29240228f1343a6ac85a49bf289593640c GIT binary patch literal 237 zcmXqLe8tA8)#lOmotKfFX+h&1gT|XojLe3-2Hb3%32h#Xsmv@)j0Ua022l-UYT7Po$p$D*5{Nnmmty^peH}@o&Yww&yUP Ud@ODJNZ|Fajf)TN-?{K906~XK=l}o! literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_dac_subject_pid_mismatch/dac-Cert.der b/credentials/development/commissioner_dut/struct_dac_subject_pid_mismatch/dac-Cert.der new file mode 100644 index 0000000000000000000000000000000000000000..778edb359d072fa23a43bf6e839581308263c6b0 GIT binary patch literal 466 zcmXqLVmxQi#8|R`nTe5!i6dDxao2Ynv1tZeY#dr`9_MUXn3)U=3?&T2*qB3En0fep z6H7``ixfgqi%S#&96b$1420OYwAmP07@HQ=FfsD5xVgC*8YqbK8W|aw7#To7lmx#e z5EvR61Cgnvsb!Rb8xAvF9G$V7i6+X#!(st+m_ek0FdIAArA&-aCo?m$GdnS`9QiY= z`mVOdmy?Unh5CCl)oq&oxBHkpUzo+ka~mdI``NE0(ILlrU(LdM>RHWcc3T;lLpDo3 zt6XHbGCpp()}+hfixUju40wRvmKA1X{LjKj2J#~?mcH950X}90R~=!$n4w+L5<&+9X~qh>f7l~2T$*kt-XaD z$jlxL2Chts40F$F-PuFtrB&@*a=? literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_dac_subject_pid_mismatch/dac-Cert.pem b/credentials/development/commissioner_dut/struct_dac_subject_pid_mismatch/dac-Cert.pem new file mode 100644 index 00000000000000..16f7c7c0f8a1f3 --- /dev/null +++ b/credentials/development/commissioner_dut/struct_dac_subject_pid_mismatch/dac-Cert.pem @@ -0,0 +1,12 @@ +-----BEGIN CERTIFICATE----- +MIIBzjCCAXSgAwIBAgIIYyVhuvc8FpYwCgYIKoZIzj0EAwIwMDEYMBYGA1UEAwwP +TWF0dGVyIFRlc3QgUEFJMRQwEgYKKwYBBAGConwCAQwERkZGMTAgFw0yMjA0MjAw +MDAwMDBaGA85OTk5MTIzMTIzNTk1OVowRjEYMBYGA1UEAwwPTWF0dGVyIFRlc3Qg +REFDMRQwEgYKKwYBBAGConwCAQwERkZGMTEUMBIGCisGAQQBgqJ8AgIMBDgwMDEw +WTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAATE/Jp73Sso9MmjzlVPSwJ+spf9i8Yf +DlY40c6wktb5jyoYiB4F3yY4S5XNKZY+tQEDVLMZ5nmiMalfXqcqktNXo2AwXjAM +BgNVHRMBAf8EAjAAMA4GA1UdDwEB/wQEAwIHgDAdBgNVHQ4EFgQUksnOi9WJgFbl +8g/ZS8gyAPIJvc4wHwYDVR0jBBgwFoAUm22QUoH3psfFktXtl0LBy7odfdowCgYI +KoZIzj0EAwIDSAAwRQIhAJ3NKty+dRXX2clrR0ozjfXnkQHBq2blSWRLm4ZeOvl/ +AiASOjPUNJL9QJo8DY0HZK6mUDLtsyF3ReRrI8eX/rCVjA== +-----END CERTIFICATE----- diff --git a/credentials/development/commissioner_dut/struct_dac_subject_pid_mismatch/dac-Key.der b/credentials/development/commissioner_dut/struct_dac_subject_pid_mismatch/dac-Key.der new file mode 100644 index 0000000000000000000000000000000000000000..f7cec17297de125479f7e676abc2dfb0ff019d8a GIT binary patch literal 121 zcmV-<0EYiCcLD(c1R%|Yt( bOO?$jmOixs15~pa=6Rwqsb5~FDw5MzQe83l literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_dac_subject_pid_mismatch/dac-Key.pem b/credentials/development/commissioner_dut/struct_dac_subject_pid_mismatch/dac-Key.pem new file mode 100644 index 00000000000000..155a704febdc35 --- /dev/null +++ b/credentials/development/commissioner_dut/struct_dac_subject_pid_mismatch/dac-Key.pem @@ -0,0 +1,5 @@ +-----BEGIN EC PRIVATE KEY----- +MHcCAQEEIM2swOQYQ/2jsNUhg1U0tTdNQ+2BMQclGD7yTEBxPjNooAoGCCqGSM49 +AwEHoUQDQgAExPyae90rKPTJo85VT0sCfrKX/YvGHw5WONHOsJLW+Y8qGIgeBd8m +OEuVzSmWPrUBA1SzGeZ5ojGpX16nKpLTVw== +-----END EC PRIVATE KEY----- diff --git a/credentials/development/commissioner_dut/struct_dac_subject_pid_mismatch/pai-Cert.der b/credentials/development/commissioner_dut/struct_dac_subject_pid_mismatch/pai-Cert.der new file mode 100644 index 0000000000000000000000000000000000000000..b17c34934ce4a9c124ed8795f7211229d60b3052 GIT binary patch literal 451 zcmXqLV%%@g#F(;xnTe5!iG#J^k-CFzOpH7%Zfj#0Yg9Gb1~*69dbHRr~KrZThpIaMeNa>#q+7 zTlE&*R{j>6^WkRL{~OPK-(`tqKJejX^r6dTZ=Fh?*349>?AvgE%G~w`%TL$+T6)}X zahgF2&>PI5vcimv|5-Q;*nkuhBclNyNQ@sO1`Gy9HUn7@pN~b1MPzpFgrLUn%Z?wN zboK3Yr-P?=$=2R7kOxUCvj79DK_u(1Qn`Gf{G0t^j?>cx?%Xk4SXhS~sLY-W25wA> z3{Af~L~nlk#4ciS#^mUy)Ar5b-8)Mk3UYYdaoRG){G$#~NvEm8F226v?bd9JpMJl1 X%=6^j#D*pE*EP4U3JzcNv9k;SY-5ug literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_dac_subject_pid_mismatch/pai-Cert.pem b/credentials/development/commissioner_dut/struct_dac_subject_pid_mismatch/pai-Cert.pem new file mode 100644 index 00000000000000..041b310ec86919 --- /dev/null +++ b/credentials/development/commissioner_dut/struct_dac_subject_pid_mismatch/pai-Cert.pem @@ -0,0 +1,12 @@ +-----BEGIN CERTIFICATE----- +MIIBvzCCAWSgAwIBAgIIBXDiJyo/giAwCgYIKoZIzj0EAwIwMDEYMBYGA1UEAwwP +TWF0dGVyIFRlc3QgUEFBMRQwEgYKKwYBBAGConwCAQwERkZGMTAgFw0yMjA0MjAw +MDAwMDBaGA85OTk5MTIzMTIzNTk1OVowMDEYMBYGA1UEAwwPTWF0dGVyIFRlc3Qg +UEFJMRQwEgYKKwYBBAGConwCAQwERkZGMTBZMBMGByqGSM49AgEGCCqGSM49AwEH +A0IABJCqv94asvygcarBF9frw1M6jXLbI/ZVbPDZVv/Y5vvdBF0DwPDpW8LTdu1C +deV8mSB5jrDflJ2H4KfLfvqlx06jZjBkMBIGA1UdEwEB/wQIMAYBAf8CAQEwDgYD +VR0PAQH/BAQDAgEGMB0GA1UdDgQWBBSbbZBSgfemx8WS1e2XQsHLuh192jAfBgNV +HSMEGDAWgBRq/SJ3H1Ef7L8WQZdnENzcMaFxfjAKBggqhkjOPQQDAgNJADBGAiEA +gvuIFdn28gcUOMw0xfLLP4NXi7l14REISNxCtJQ38SwCIQCJNSC6Do5ztzsGAfL7 +6OMM5M6RgKQf1ym1qlNXovGJdg== +-----END CERTIFICATE----- diff --git a/credentials/development/commissioner_dut/struct_dac_subject_pid_mismatch/pai-Key.der b/credentials/development/commissioner_dut/struct_dac_subject_pid_mismatch/pai-Key.der new file mode 100644 index 0000000000000000000000000000000000000000..57d1e35108f0aa94abd20b05e58f3da7dc6b164e GIT binary patch literal 121 zcmV-<0EYiCcLD(c1R$U|?;-!yH0Ool&QI_R>GohSE~1~o)1SAbF0k-;|w);HS%e`lZKCn1nu_ literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_dac_subject_pid_mismatch/pai-Key.pem b/credentials/development/commissioner_dut/struct_dac_subject_pid_mismatch/pai-Key.pem new file mode 100644 index 00000000000000..5ee1f9608fe222 --- /dev/null +++ b/credentials/development/commissioner_dut/struct_dac_subject_pid_mismatch/pai-Key.pem @@ -0,0 +1,5 @@ +-----BEGIN EC PRIVATE KEY----- +MHcCAQEEIKA47yH/1TTnheLOT/AM6fZgMC6in8HlLdm5cmZMFcOloAoGCCqGSM49 +AwEHoUQDQgAEkKq/3hqy/KBxqsEX1+vDUzqNctsj9lVs8NlW/9jm+90EXQPA8Olb +wtN27UJ15XyZIHmOsN+UnYfgp8t++qXHTg== +-----END EC PRIVATE KEY----- diff --git a/credentials/development/commissioner_dut/struct_dac_subject_pid_mismatch/test_case_vector.json b/credentials/development/commissioner_dut/struct_dac_subject_pid_mismatch/test_case_vector.json new file mode 100644 index 00000000000000..809193398371cf --- /dev/null +++ b/credentials/development/commissioner_dut/struct_dac_subject_pid_mismatch/test_case_vector.json @@ -0,0 +1,9 @@ +{ + "description": "DAC Test Vector: PID in Subject field doesn't match PID in Issuer field", + "is_success_case": "false", + "dac_cert": "308201ce30820174a0030201020208632561baf73c1696300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313020170d3232303432303030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030313059301306072a8648ce3d020106082a8648ce3d03010703420004c4fc9a7bdd2b28f4c9a3ce554f4b027eb297fd8bc61f0e5638d1ceb092d6f98f2a18881e05df26384b95cd29963eb5010354b319e679a231a95f5ea72a92d357a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e0416041492c9ce8bd5898056e5f20fd94bc83200f209bdce301f0603551d230418301680149b6d905281f7a6c7c592d5ed9742c1cbba1d7dda300a06082a8648ce3d04030203480030450221009dcd2adcbe7515d7d9c96b474a338df5e79101c1ab66e549644b9b865e3af97f0220123a33d43492fd409a3c0d8d0764aea65032edb3217745e46b23c797feb0958c", + "pai_cert": "308201bf30820164a00302010202080570e2272a3f8220300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303432303030303030305a180f39393939313233313233353935395a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d0301070342000490aabfde1ab2fca071aac117d7ebc3533a8d72db23f6556cf0d956ffd8e6fbdd045d03c0f0e95bc2d376ed4275e57c9920798eb0df949d87e0a7cb7efaa5c74ea366306430120603551d130101ff040830060101ff020101300e0603551d0f0101ff040403020106301d0603551d0e041604149b6d905281f7a6c7c592d5ed9742c1cbba1d7dda301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d040302034900304602210082fb8815d9f6f2071438cc34c5f2cb3f83578bb975e1110848dc42b49437f12c022100893520ba0e8e73b73b0601f2fbe8e30ce4ce9180a41fd729b5aa5357a2f18976", + "certification_declaration": "3081ea06092a864886f70d010702a081dc3081d9020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317e307c020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d0403020448304602210091d00b7a0a27f30bdb3b4ff6b6ffbb7c27c5ffce8775ed1c020da03dd1c867ca022100f5fdd61f0c101ba481a05fed174ab76c03c9e31b33e210ebfab1a3c1bfb9a1e5", + "dac_private_key": "cdacc0e41843fda3b0d521835534b5374d43ed81310725183ef24c40713e3368", + "dac_public_key": "04c4fc9a7bdd2b28f4c9a3ce554f4b027eb297fd8bc61f0e5638d1ceb092d6f98f2a18881e05df26384b95cd29963eb5010354b319e679a231a95f5ea72a92d357" +} diff --git a/credentials/development/commissioner_dut/struct_dac_subject_vid_mismatch/cd.der b/credentials/development/commissioner_dut/struct_dac_subject_vid_mismatch/cd.der new file mode 100644 index 0000000000000000000000000000000000000000..98aeace7f48cd35c1c04a712b6dd55b6c21b3c58 GIT binary patch literal 236 zcmXqLe96YC)#lOmotKfFX+h&{gT@<7jLe3-2Hb3%32h#Xsmv@)j0Ua#tMdU%n&LJa_VPv28(`R&`8@3=5|${Zf+^SHM#|FzOpH7%Zfje%!o12;tj+qD_Q#aZ zEb}EN*X{c^hkNqF#R&#+20TD-%L+3x{%2t_U@+hV@%TYJV6d<^7|4S7d@N!tA`$5lOn^jbHdA5gR)hm d%MCvk{5aj9Xtu56n|z4Rd#TO54~vg41_1e_iMId% literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_dac_subject_vid_mismatch/dac-Cert.pem b/credentials/development/commissioner_dut/struct_dac_subject_vid_mismatch/dac-Cert.pem new file mode 100644 index 00000000000000..db23faf1e61a05 --- /dev/null +++ b/credentials/development/commissioner_dut/struct_dac_subject_vid_mismatch/dac-Cert.pem @@ -0,0 +1,12 @@ +-----BEGIN CERTIFICATE----- +MIIBzjCCAXSgAwIBAgIIGC0sZXdJdd0wCgYIKoZIzj0EAwIwMDEYMBYGA1UEAwwP +TWF0dGVyIFRlc3QgUEFJMRQwEgYKKwYBBAGConwCAQwERkZGMTAgFw0yMjA0MjAw +MDAwMDBaGA85OTk5MTIzMTIzNTk1OVowRjEYMBYGA1UEAwwPTWF0dGVyIFRlc3Qg +REFDMRQwEgYKKwYBBAGConwCAQwERkZGMjEUMBIGCisGAQQBgqJ8AgIMBDgwMDAw +WTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAATV4LyDUYxmE+mUrwx8wNvPo32VufUj +6VLXyuvG6aQiJlaogwJN7SRBMng3ekkWhjv6K/Fk8wSfGZN+vv6cC5Pho2AwXjAM +BgNVHRMBAf8EAjAAMA4GA1UdDwEB/wQEAwIHgDAdBgNVHQ4EFgQUWP4y9aAsNCMn +gslWYYHIH2p8UtQwHwYDVR0jBBgwFoAUQwpuurKnWy4kLDtmO7INTT6YKoswCgYI +KoZIzj0EAwIDSAAwRQIgGAup276bZJ2IBUhYui7FOnGO3+BQcHW4i32URKm8jS8C +IQDmzhOmBVJrJBt3MfFw+MuAITa2iPYfVEzvGrMN4XPHow== +-----END CERTIFICATE----- diff --git a/credentials/development/commissioner_dut/struct_dac_subject_vid_mismatch/dac-Key.der b/credentials/development/commissioner_dut/struct_dac_subject_vid_mismatch/dac-Key.der new file mode 100644 index 0000000000000000000000000000000000000000..459e8c91f14c874f8cba113702f3414d8ca265ab GIT binary patch literal 121 zcmV-<0EYiCcLD(c1RzejQ5dKJ+-M}=KfbIlgjUkt)}e)g6EVwe8Ah!qkWaR^&{z0*UIb0>7*hiR;YslP3 bGI%$7Nfw4X`YZ8d^8}w6lYYMboC}lTl65!e literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_dac_subject_vid_mismatch/dac-Key.pem b/credentials/development/commissioner_dut/struct_dac_subject_vid_mismatch/dac-Key.pem new file mode 100644 index 00000000000000..8702b4b9be0655 --- /dev/null +++ b/credentials/development/commissioner_dut/struct_dac_subject_vid_mismatch/dac-Key.pem @@ -0,0 +1,5 @@ +-----BEGIN EC PRIVATE KEY----- +MHcCAQEEIE66URioAdxoJOA/vqwvhFbS3tahhYHkfDGU++vlBegIoAoGCCqGSM49 +AwEHoUQDQgAE1eC8g1GMZhPplK8MfMDbz6N9lbn1I+lS18rrxumkIiZWqIMCTe0k +QTJ4N3pJFoY7+ivxZPMEnxmTfr7+nAuT4Q== +-----END EC PRIVATE KEY----- diff --git a/credentials/development/commissioner_dut/struct_dac_subject_vid_mismatch/pai-Cert.der b/credentials/development/commissioner_dut/struct_dac_subject_vid_mismatch/pai-Cert.der new file mode 100644 index 0000000000000000000000000000000000000000..28b123b7f94b589b5bd960bd3065d94ec34cda62 GIT binary patch literal 450 zcmXqLV%%rY#F(;xnTe5!iNpNN;V}7-2Lc9MY#dr`9_MUXn3)U=3?&T2*qB3En0fep z6H7``ixfgqi%S#&932fs420OYwAmP07@HQ=FfsD5xVgC*8YqbK8W|aw7#To7lmx#e z5EvR61Cgnvsbv%%Gd*#b8EGKQ#twE96C>1d%#7^JP7ExM_$Rj?P$x{XQ%he8I;{>G`5J1&xnqWk{DT zPBTaWdV@JsR+y3TKMRKe8<1jRWHjIdiSdKPfWg4XW*`gV^RbArh&XfQ?b@_FT2DpC zI?Z|$udm$TS%LmH8*)QfeJze0=9m9o%b;yCr?7?8*%A}xP zSe@DVc!$rU^k4}I?zW4CQg0?E3b!^IedsQ+50>j>Qe;?gxMcOZv-|V!E%j)*&8Jjz VBj{<~;iDhZgQlLiQQbXB8~~t{iIV^T literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_dac_subject_vid_mismatch/pai-Cert.pem b/credentials/development/commissioner_dut/struct_dac_subject_vid_mismatch/pai-Cert.pem new file mode 100644 index 00000000000000..0e16d878598610 --- /dev/null +++ b/credentials/development/commissioner_dut/struct_dac_subject_vid_mismatch/pai-Cert.pem @@ -0,0 +1,12 @@ +-----BEGIN CERTIFICATE----- +MIIBvjCCAWSgAwIBAgIIN8zDVh9U4BAwCgYIKoZIzj0EAwIwMDEYMBYGA1UEAwwP +TWF0dGVyIFRlc3QgUEFBMRQwEgYKKwYBBAGConwCAQwERkZGMTAgFw0yMjA0MjAw +MDAwMDBaGA85OTk5MTIzMTIzNTk1OVowMDEYMBYGA1UEAwwPTWF0dGVyIFRlc3Qg +UEFJMRQwEgYKKwYBBAGConwCAQwERkZGMTBZMBMGByqGSM49AgEGCCqGSM49AwEH +A0IABOIPk4fAJuHA1+0dKwe68qNt0SLeDHCgod/6M19UV+BSmFjdssS2vYYpVvXo +lxL7wxFT0ExKIuei7HCB45poG3ajZjBkMBIGA1UdEwEB/wQIMAYBAf8CAQEwDgYD +VR0PAQH/BAQDAgEGMB0GA1UdDgQWBBRDCm66sqdbLiQsO2Y7sg1NPpgqizAfBgNV +HSMEGDAWgBRq/SJ3H1Ef7L8WQZdnENzcMaFxfjAKBggqhkjOPQQDAgNIADBFAiAn +cXtpieO4TOJnUxgYC4bRcRrskWEThYEy8It0P1MeiQIhAKDDdKuuzb9v3qVIhNsO +InzYUuVuw8XxZ1KVyNh7i5IX +-----END CERTIFICATE----- diff --git a/credentials/development/commissioner_dut/struct_dac_subject_vid_mismatch/pai-Key.der b/credentials/development/commissioner_dut/struct_dac_subject_vid_mismatch/pai-Key.der new file mode 100644 index 0000000000000000000000000000000000000000..209bd28cb525ee4831d7191bacac79e330b09cc1 GIT binary patch literal 121 zcmV-<0EYiCcLD(c1RxXu2YyqWAqHaA?-%H2G~RuvuC~h&z2tJvWGj2I#~+{y1_&yK zNX|V20SBQ(13~}<;t!LDz$W3q*XK-}*COR9E0qm{{Gi#J0VL bDOUC9mlFHK5mV4iN+Rc?>~MkOnrIt#!In1m literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_dac_subject_vid_mismatch/pai-Key.pem b/credentials/development/commissioner_dut/struct_dac_subject_vid_mismatch/pai-Key.pem new file mode 100644 index 00000000000000..90e7351d48c60b --- /dev/null +++ b/credentials/development/commissioner_dut/struct_dac_subject_vid_mismatch/pai-Key.pem @@ -0,0 +1,5 @@ +-----BEGIN EC PRIVATE KEY----- +MHcCAQEEIBQAB35TnCEGYtXvF+hnNN59qK62yxG95HLOZCt7sccfoAoGCCqGSM49 +AwEHoUQDQgAE4g+Th8Am4cDX7R0rB7ryo23RIt4McKCh3/ozX1RX4FKYWN2yxLa9 +hilW9eiXEvvDEVPQTEoi56LscIHjmmgbdg== +-----END EC PRIVATE KEY----- diff --git a/credentials/development/commissioner_dut/struct_dac_subject_vid_mismatch/test_case_vector.json b/credentials/development/commissioner_dut/struct_dac_subject_vid_mismatch/test_case_vector.json new file mode 100644 index 00000000000000..ec920a4e0b5146 --- /dev/null +++ b/credentials/development/commissioner_dut/struct_dac_subject_vid_mismatch/test_case_vector.json @@ -0,0 +1,9 @@ +{ + "description": "DAC Test Vector: VID in Subject field doesn't match VID in Issuer field", + "is_success_case": "false", + "dac_cert": "308201ce30820174a0030201020208182d2c65774975dd300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313020170d3232303432303030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463231143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004d5e0bc83518c6613e994af0c7cc0dbcfa37d95b9f523e952d7caebc6e9a4222656a883024ded24413278377a4916863bfa2bf164f3049f19937ebefe9c0b93e1a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e0416041458fe32f5a02c34232782c9566181c81f6a7c52d4301f0603551d23041830168014430a6ebab2a75b2e242c3b663bb20d4d3e982a8b300a06082a8648ce3d04030203480030450220180ba9dbbe9b649d88054858ba2ec53a718edfe0507075b88b7d9444a9bc8d2f022100e6ce13a605526b241b7731f170f8cb802136b688f61f544cef1ab30de173c7a3", + "pai_cert": "308201be30820164a003020102020837ccc3561f54e010300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303432303030303030305a180f39393939313233313233353935395a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d03010703420004e20f9387c026e1c0d7ed1d2b07baf2a36dd122de0c70a0a1dffa335f5457e0529858ddb2c4b6bd862956f5e89712fbc31153d04c4a22e7a2ec7081e39a681b76a366306430120603551d130101ff040830060101ff020101300e0603551d0f0101ff040403020106301d0603551d0e04160414430a6ebab2a75b2e242c3b663bb20d4d3e982a8b301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020348003045022027717b6989e3b84ce2675318180b86d1711aec916113858132f08b743f531e89022100a0c374abaecdbf6fdea54884db0e227cd852e56ec3c5f1675295c8d87b8b9217", + "certification_declaration": "3081e906092a864886f70d010702a081db3081d8020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204473045022050e897792b88f626d2d23f766eacef2fae220fa7b869376d93a716b652293a7e022100a194a5f47c6a5e700c7398f5df07dbfdcff2aec25e70c488796b6bd4b813763b", + "dac_private_key": "4eba5118a801dc6824e03fbeac2f8456d2ded6a18581e47c3194fbebe505e808", + "dac_public_key": "04d5e0bc83518c6613e994af0c7cc0dbcfa37d95b9f523e952d7caebc6e9a4222656a883024ded24413278377a4916863bfa2bf164f3049f19937ebefe9c0b93e1" +} diff --git a/credentials/development/commissioner_dut/struct_pai_cert_version_v2/cd.der b/credentials/development/commissioner_dut/struct_pai_cert_version_v2/cd.der new file mode 100644 index 0000000000000000000000000000000000000000..d778884e3d30058b743f508db2f093194fb7cce0 GIT binary patch literal 236 zcmXqLe96YC)#lOmotKfFX+h&{gT@<7jLe3-2Hb3%32h#Xsmv@)j0Uaj-G}h210CH+H8z0j7^Jbm>79j+}zv@4HU$Ajf@OTj0_+kN`l`K z2n>ykfymU-)H2Gz4TqU7j?UQ4L=$D=VX*)i9%&%V#twEV6C>2g%#7^JP7EyJ(|>Zf zXJ5S%5T@<4sByuR`bx2zXKyUp68K1uaoIwn${Pt)+IZq>yxIXJ8gjc;qu{m6|&>Y%ibHRyW=;zk71y^etkE{7(d#6dAV1q|S+7SMp-x co!!QZndgcu;HYi%4by*_zu#2*#g5eJ0Mx*XWdHyG literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_pai_cert_version_v2/dac-Cert.pem b/credentials/development/commissioner_dut/struct_pai_cert_version_v2/dac-Cert.pem new file mode 100644 index 00000000000000..d19bbbc85d7586 --- /dev/null +++ b/credentials/development/commissioner_dut/struct_pai_cert_version_v2/dac-Cert.pem @@ -0,0 +1,12 @@ +-----BEGIN CERTIFICATE----- +MIIBzjCCAXSgAwIBAgIICAlLtkhCW7AwCgYIKoZIzj0EAwIwMDEYMBYGA1UEAwwP +TWF0dGVyIFRlc3QgUEFJMRQwEgYKKwYBBAGConwCAQwERkZGMTAgFw0yMjA0MjAw +MDAwMDBaGA85OTk5MTIzMTIzNTk1OVowRjEYMBYGA1UEAwwPTWF0dGVyIFRlc3Qg +REFDMRQwEgYKKwYBBAGConwCAQwERkZGMTEUMBIGCisGAQQBgqJ8AgIMBDgwMDAw +WTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAARXl/kIR2vV1FBWK0KigaCUf3kW2c3Y +orRR4i4BpqEyedhgegtOwGy+P+MU14rR+UYsBIShAM5GPWAaQqsw2krwo2AwXjAM +BgNVHRMBAf8EAjAAMA4GA1UdDwEB/wQEAwIHgDAdBgNVHQ4EFgQUg63TjfAbkMiV +dobJKDIpb49cTPAwHwYDVR0jBBgwFoAUKJbJZKBWst3K0Wz0RToQ3eZiQi4wCgYI +KoZIzj0EAwIDSAAwRQIgYsK5UWoMV1nmOyR83HwG6eZ9e4HcN93JsZe0FmEP5BEC +IQC3XGWcX6506LHcuzOjA50UoAh9gU1WL+lvvzUr6Lhllw== +-----END CERTIFICATE----- diff --git a/credentials/development/commissioner_dut/struct_pai_cert_version_v2/dac-Key.der b/credentials/development/commissioner_dut/struct_pai_cert_version_v2/dac-Key.der new file mode 100644 index 0000000000000000000000000000000000000000..b1d69f662c40329aceb7b27f61fc41af6c9a4695 GIT binary patch literal 121 zcmV-<0EYiCcLD(c1Rz}9A&BeDbf-T#gn?`>1(j@9~w9M>Fgd742qx%1_&yK zNX|V20SBQ(13~}ZWJFxpD+f`Kz3 literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_pai_cert_version_v2/dac-Key.pem b/credentials/development/commissioner_dut/struct_pai_cert_version_v2/dac-Key.pem new file mode 100644 index 00000000000000..5c0db1110e15b2 --- /dev/null +++ b/credentials/development/commissioner_dut/struct_pai_cert_version_v2/dac-Key.pem @@ -0,0 +1,5 @@ +-----BEGIN EC PRIVATE KEY----- +MHcCAQEEIFzdIcrGZ0c5gSYp0hIPxZO65ulrsPEfGjf66eweEgyKoAoGCCqGSM49 +AwEHoUQDQgAEV5f5CEdr1dRQVitCooGglH95FtnN2KK0UeIuAaahMnnYYHoLTsBs +vj/jFNeK0flGLASEoQDORj1gGkKrMNpK8A== +-----END EC PRIVATE KEY----- diff --git a/credentials/development/commissioner_dut/struct_pai_cert_version_v2/pai-Cert.der b/credentials/development/commissioner_dut/struct_pai_cert_version_v2/pai-Cert.der new file mode 100644 index 0000000000000000000000000000000000000000..a65a6aa75202dce69ef237f74d345545d546a0a3 GIT binary patch literal 449 zcmXqLV%%%c#F(;xnTe5+i6ddnZ{>NboZ}6+*f_M>JkHs&Ff$n#7)lt3u`!3TF!S*H zCYF?>7Ab_J7MCalI64}N7znX(X|pl1Fg7i!VPfQAadUGsG*A%dH8L_VF*1OFC<%T` zATTsC1|m~SQ_CnkW_scJobofufWZV4USe&>Xc>?5UB-*acO zv^{w@kJBkC`*M-p!dMks);~AdCmBfm{7}8wbDgs17cqH7xi7c;k_v8?TRE@yc(Gw| znn4QC8_c1y!im7|7%nWVLk?7CcLoC&CWRVl z!R0?3pP26Xn>F)LLg?AWzg*vETolwVTR*{#vp>IwNr69O+x_a0XQpCD3+BxF$f@m} T%IIdtJD2yf<>a+uiCY-~nmmT7 literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_pai_cert_version_v2/pai-Cert.pem b/credentials/development/commissioner_dut/struct_pai_cert_version_v2/pai-Cert.pem new file mode 100644 index 00000000000000..972d760ce2045b --- /dev/null +++ b/credentials/development/commissioner_dut/struct_pai_cert_version_v2/pai-Cert.pem @@ -0,0 +1,12 @@ +-----BEGIN CERTIFICATE----- +MIIBvTCCAWSgAwIBAQIIYKz7I56qQ18wCgYIKoZIzj0EAwIwMDEYMBYGA1UEAwwP +TWF0dGVyIFRlc3QgUEFBMRQwEgYKKwYBBAGConwCAQwERkZGMTAgFw0yMjA0MjAw +MDAwMDBaGA85OTk5MTIzMTIzNTk1OVowMDEYMBYGA1UEAwwPTWF0dGVyIFRlc3Qg +UEFJMRQwEgYKKwYBBAGConwCAQwERkZGMTBZMBMGByqGSM49AgEGCCqGSM49AwEH +A0IABEraEsG33MgSHeIiqvdtmQSG5O6eCUJaa9NyPqFdJD0F/NkHkjAY+fB7s0mu +I0n0Fh8hHvTaTmJw2Xc6Q69I6LCjZjBkMBIGA1UdEwEB/wQIMAYBAf8CAQEwDgYD +VR0PAQH/BAQDAgEGMB0GA1UdDgQWBBQolslkoFay3crRbPRFOhDd5mJCLjAfBgNV +HSMEGDAWgBRq/SJ3H1Ef7L8WQZdnENzcMaFxfjAKBggqhkjOPQQDAgNHADBEAiB8 +GxGn+EHkNbz9apnCYFXNo/pF72jRES92r5BGCY9vjAIgD2i233tU5jUWxXCcmvEJ +K0tlAUY+DZ0N8zmTrRZhtQE= +-----END CERTIFICATE----- diff --git a/credentials/development/commissioner_dut/struct_pai_cert_version_v2/pai-Key.der b/credentials/development/commissioner_dut/struct_pai_cert_version_v2/pai-Key.der new file mode 100644 index 0000000000000000000000000000000000000000..fd1cfd8385346d3c64c505871021a60c1613d9b8 GIT binary patch literal 121 zcmV-<0EYiCcLD(c1Rz;b-TQ9-9oL9{*>^fauSn>y&zdvc literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_pai_cert_version_v2/pai-Key.pem b/credentials/development/commissioner_dut/struct_pai_cert_version_v2/pai-Key.pem new file mode 100644 index 00000000000000..492f422a4c5fcf --- /dev/null +++ b/credentials/development/commissioner_dut/struct_pai_cert_version_v2/pai-Key.pem @@ -0,0 +1,5 @@ +-----BEGIN EC PRIVATE KEY----- +MHcCAQEEIFlS3ftu/h3XnZV3IdOtaL3vCK1g438DNxART9CDvm45oAoGCCqGSM49 +AwEHoUQDQgAEStoSwbfcyBId4iKq922ZBIbk7p4JQlpr03I+oV0kPQX82QeSMBj5 +8HuzSa4jSfQWHyEe9NpOYnDZdzpDr0josA== +-----END EC PRIVATE KEY----- diff --git a/credentials/development/commissioner_dut/struct_pai_cert_version_v2/test_case_vector.json b/credentials/development/commissioner_dut/struct_pai_cert_version_v2/test_case_vector.json new file mode 100644 index 00000000000000..4bf9fa0697b35b --- /dev/null +++ b/credentials/development/commissioner_dut/struct_pai_cert_version_v2/test_case_vector.json @@ -0,0 +1,9 @@ +{ + "description": "PAI Test Vector: Invalid certificate version field set to v2(1)", + "is_success_case": "false", + "dac_cert": "308201ce30820174a003020102020808094bb648425bb0300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313020170d3232303432303030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d030107034200045797f908476bd5d450562b42a281a0947f7916d9cdd8a2b451e22e01a6a13279d8607a0b4ec06cbe3fe314d78ad1f9462c0484a100ce463d601a42ab30da4af0a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e0416041483add38df01b90c8957686c92832296f8f5c4cf0301f0603551d230418301680142896c964a056b2ddcad16cf4453a10dde662422e300a06082a8648ce3d0403020348003045022062c2b9516a0c5759e63b247cdc7c06e9e67d7b81dc37ddc9b197b416610fe411022100b75c659c5fae74e8b1dcbb33a3039d14a0087d814d562fe96fbf352be8b86597", + "pai_cert": "308201bd30820164a003020101020860acfb239eaa435f300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303432303030303030305a180f39393939313233313233353935395a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d030107034200044ada12c1b7dcc8121de222aaf76d990486e4ee9e09425a6bd3723ea15d243d05fcd907923018f9f07bb349ae2349f4161f211ef4da4e6270d9773a43af48e8b0a366306430120603551d130101ff040830060101ff020101300e0603551d0f0101ff040403020106301d0603551d0e041604142896c964a056b2ddcad16cf4453a10dde662422e301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d040302034700304402207c1b11a7f841e435bcfd6a99c26055cda3fa45ef68d1112f76af9046098f6f8c02200f68b6df7b54e63516c5709c9af1092b4b6501463e0d9d0df33993ad1661b501", + "certification_declaration": "3081e906092a864886f70d010702a081db3081d8020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204473045022100c30e031e12d3d890b9619084f2085b6e1d90116536e5f76738d41fa51fb53619022042738ca2e1e4418427417e49b1eb716db6eff97bd2d9a800f5404e33ba365387", + "dac_private_key": "5cdd21cac6674739812629d2120fc593bae6e96bb0f11f1a37fae9ec1e120c8a", + "dac_public_key": "045797f908476bd5d450562b42a281a0947f7916d9cdd8a2b451e22e01a6a13279d8607a0b4ec06cbe3fe314d78ad1f9462c0484a100ce463d601a42ab30da4af0" +} diff --git a/credentials/development/commissioner_dut/struct_pai_cert_version_v3/cd.der b/credentials/development/commissioner_dut/struct_pai_cert_version_v3/cd.der new file mode 100644 index 0000000000000000000000000000000000000000..6510d758d6e1a22183f3380f04c614ba17e7effb GIT binary patch literal 236 zcmXqLe96YC)#lOmotKfFX+h&{gT@<7jLe3-2Hb3%32h#Xsmv@)j0UaJkHs&Ff$n#7)lt3u`!3TF!S*H zCYF?>7Ab_J7MCalIC>h27znX(X|pl1Fg7i!VPfQAadUGsG*A%dH8L_VF*1OFC<%T` zATTsC1|m~SQ_Cm=HymcVI67lD6HSzfhs6S9c%*?a8#~ygOpH(`Gc&R?J29|Cn^n06 z8s3?3T%s>)S8<%_c_Eir&t>B0ivJsIzFy0d+shl_{HWSY?^m}=USDp|4EL=pERyvM zDO$davHE8}*ey;lh%?{;dRtbQk?}tZlL3PPABe{f;sJw&y}>{h#OGrXV-d-H7FZr; zRu~W~eE#CDclz6R-!UyVkOxUCvj79HL4?_x;Y8$K^J4pjZga9FuB+LEW-dbxWM&Tr z16L+RhHuOM?{;2$GXB}xUy=)Tq*788dt&=PM4jDzY`f~*j*HWn6lArwwtW)nJ3VL4 boR=|s^UXzO-fW)x=bwsTLrr&A(X(y<)nAFK literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_pai_cert_version_v3/dac-Cert.pem b/credentials/development/commissioner_dut/struct_pai_cert_version_v3/dac-Cert.pem new file mode 100644 index 00000000000000..ac2b0964ce8867 --- /dev/null +++ b/credentials/development/commissioner_dut/struct_pai_cert_version_v3/dac-Cert.pem @@ -0,0 +1,12 @@ +-----BEGIN CERTIFICATE----- +MIIBzjCCAXSgAwIBAgIISFfX5j7PwncwCgYIKoZIzj0EAwIwMDEYMBYGA1UEAwwP +TWF0dGVyIFRlc3QgUEFJMRQwEgYKKwYBBAGConwCAQwERkZGMTAgFw0yMjA0MjAw +MDAwMDBaGA85OTk5MTIzMTIzNTk1OVowRjEYMBYGA1UEAwwPTWF0dGVyIFRlc3Qg +REFDMRQwEgYKKwYBBAGConwCAQwERkZGMTEUMBIGCisGAQQBgqJ8AgIMBDgwMDAw +WTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAARbNnpFUTHckMcYjmq6c141zxJEXUmm +F85z/zCz130MbY0NWEPiezYu+otEbo5tUphHtQQEGX8AZCpNAV0vzfA+o2AwXjAM +BgNVHRMBAf8EAjAAMA4GA1UdDwEB/wQEAwIHgDAdBgNVHQ4EFgQUbeZRd1Y2cVBd +E8/Ruu4vt7vcNXMwHwYDVR0jBBgwFoAUA0sAyFm9N3M/oUacaxjXJjxVaaYwCgYI +KoZIzj0EAwIDSAAwRQIhAPam/7tDrclf5q36GaEsGmRkIYxdj/BazbvGtyWdiNGW +AiAdKrWG8hKOy5ycnOlcvW83FJnZg538/iQRgHyLinLmiw== +-----END CERTIFICATE----- diff --git a/credentials/development/commissioner_dut/struct_pai_cert_version_v3/dac-Key.der b/credentials/development/commissioner_dut/struct_pai_cert_version_v3/dac-Key.der new file mode 100644 index 0000000000000000000000000000000000000000..0e6ed2251293276932e0132d234d1b16c521e67b GIT binary patch literal 121 zcmV-<0EYiCcLD(c1Ry?VgX|=`lp1+Ra7CveG46J^`jCq@dzw(VsMT2WJ>{SZ1_&yK zNX|V20SBQ(13~}1d%#7^JP7Ewrp+Ek|>R!3w-mehEe5S?J ztT(K@N+hn1VWp+B`kUG*wFUD`ZFRRj>Y6rT-iIT1YFl3Smz-XwHIaMfv7#BfmTg^} zW{?8(26L#aFeBrC77hb8AjQPUXut;&;|GZWgMpFFKo-R3V-aH!VfJP?5xLjA*nXkg zoNS5fYBr&n%M9c}(#kBrz-kc5`m0nfA1ME3znJ6nbb&i}3>OyGAqOh62ZMntlR|uK zH)BYt>6xu%-;FJ1?K5bM?Oak_X<+`-^?K&*@K{48MTYy{o6cqzru_S?z`*u#@87SF UPRmdCdHSQHDq`>AcX@@+0iivL6aWAK literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_pai_cert_version_v3/pai-Cert.pem b/credentials/development/commissioner_dut/struct_pai_cert_version_v3/pai-Cert.pem new file mode 100644 index 00000000000000..d1b515e7cbbade --- /dev/null +++ b/credentials/development/commissioner_dut/struct_pai_cert_version_v3/pai-Cert.pem @@ -0,0 +1,12 @@ +-----BEGIN CERTIFICATE----- +MIIBvjCCAWSgAwIBAgIIW/tsGvPlBoAwCgYIKoZIzj0EAwIwMDEYMBYGA1UEAwwP +TWF0dGVyIFRlc3QgUEFBMRQwEgYKKwYBBAGConwCAQwERkZGMTAgFw0yMjA0MjAw +MDAwMDBaGA85OTk5MTIzMTIzNTk1OVowMDEYMBYGA1UEAwwPTWF0dGVyIFRlc3Qg +UEFJMRQwEgYKKwYBBAGConwCAQwERkZGMTBZMBMGByqGSM49AgEGCCqGSM49AwEH +A0IABGpV+P9dLdTYR48gUgPMhDU2jVZ3ehRefgCpOUMn7H2UfXCeNT0ttuKKlpCe +8MTcfYTrj3TLriqRC5nGcpi6prWjZjBkMBIGA1UdEwEB/wQIMAYBAf8CAQEwDgYD +VR0PAQH/BAQDAgEGMB0GA1UdDgQWBBQDSwDIWb03cz+hRpxrGNcmPFVppjAfBgNV +HSMEGDAWgBRq/SJ3H1Ef7L8WQZdnENzcMaFxfjAKBggqhkjOPQQDAgNIADBFAiBf +XYsBVHU1zLV29zM4mr4wgV2JpHt5MDf5Rddp21ddMQIhAN9Lss1rcWT+8yAABvG9 +/fXiyx+XTOX4iHpYvaPubnHn +-----END CERTIFICATE----- diff --git a/credentials/development/commissioner_dut/struct_pai_cert_version_v3/pai-Key.der b/credentials/development/commissioner_dut/struct_pai_cert_version_v3/pai-Key.der new file mode 100644 index 0000000000000000000000000000000000000000..8304a0243bd8b9e1886cbd25ef72594c58847895 GIT binary patch literal 121 zcmV-<0EYiCcLD(c1Ry}mG?tB{*H+NNM%PzX)zm2UvlBX{c3066auNB`@nfJ01_&yK zNX|V20SBQ(13~}-%UX1>Kzv8ZGW&%@(E8zQ%A=*;w)l T?5KF7K6B6ANoSfD+A#nCquEEP literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_pai_ext_akid_missing/dac-Cert.der b/credentials/development/commissioner_dut/struct_pai_ext_akid_missing/dac-Cert.der new file mode 100644 index 0000000000000000000000000000000000000000..651eba7f8f629b089062e5687099437cabbfce0a GIT binary patch literal 467 zcmXqLVmxoq#8|R`nTe5!iKEQNuj-G}h210CH+H8z0j7^Jbm>79j+}zv@4HU$Ajf@OTj0_+kN`l`K z2n>ykfymU-)H2Gz4TqU7j?UQ4L=$D=VX*)i9%&%V#twEV6C>2g%#7^JP7EwFzgMU1 z{IIb4{n`Ud(skH5(yZ8u^%=w%48wP7oH=r!+0SCTn9v;7ZMRI?J6DL8`JBC;yw>&N zF5!07JawV4mnn-A4B`xUfZmoBW@P-&!eqc;zz5>-gLuGTVQ(;y1@ZY<#8^a1xQ-;p zsJ&l4kx}ZwcAfqkA4E#G8OVdAm05s+*B~;5?dh*o1@)e4Yu&!4h$l#{_o~~59LUU` z3l$eD(tXcN&EX literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_pai_ext_akid_missing/dac-Cert.pem b/credentials/development/commissioner_dut/struct_pai_ext_akid_missing/dac-Cert.pem new file mode 100644 index 00000000000000..c5fb322462e6c0 --- /dev/null +++ b/credentials/development/commissioner_dut/struct_pai_ext_akid_missing/dac-Cert.pem @@ -0,0 +1,12 @@ +-----BEGIN CERTIFICATE----- +MIIBzzCCAXSgAwIBAgIIdkwxeuEn4yswCgYIKoZIzj0EAwIwMDEYMBYGA1UEAwwP +TWF0dGVyIFRlc3QgUEFJMRQwEgYKKwYBBAGConwCAQwERkZGMTAgFw0yMjA0MjAw +MDAwMDBaGA85OTk5MTIzMTIzNTk1OVowRjEYMBYGA1UEAwwPTWF0dGVyIFRlc3Qg +REFDMRQwEgYKKwYBBAGConwCAQwERkZGMTEUMBIGCisGAQQBgqJ8AgIMBDgwMDAw +WTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAASZ93tkufChe++twKRnLAcIZjoGcy8A +FgAxV7kozMTAg044txYSnAW22jSHiagXdkzN12OtRdG6E4clbicSVulko2AwXjAM +BgNVHRMBAf8EAjAAMA4GA1UdDwEB/wQEAwIHgDAdBgNVHQ4EFgQUdArEY1wm76eR +ARrgtyyP2PAUdbYwHwYDVR0jBBgwFoAUlAbl+qpwf0kmrUb1ZBdgGa9KfrYwCgYI +KoZIzj0EAwIDSQAwRgIhAMaffE54k6NM/zFfDTPJLzuB1V2xPXatqgQNfyUIIHzI +AiEAmHUzJq6cUo38Kqrke22tBwt2eKk8PE/GTScN0n3Pa+A= +-----END CERTIFICATE----- diff --git a/credentials/development/commissioner_dut/struct_pai_ext_akid_missing/dac-Key.der b/credentials/development/commissioner_dut/struct_pai_ext_akid_missing/dac-Key.der new file mode 100644 index 0000000000000000000000000000000000000000..1316331b2a7456d03c585a0578de0482beeba7f0 GIT binary patch literal 121 zcmV-<0EYiCcLD(c1RxFjlE6ra5bSJGh|Y61vBy4CDzkOsr$U0RL;_g-AlIM@1_&yK zNX|V20SBQ(13~}1d%#7^JP7EyP%x)~sZV=;PTergDqJQm! zjJw&71a2&-Q?KEY5y@_Jm0VF%%QTvjEw(TI1Jc;6cZz(0Ut<=A0!4021YgmSrDI(MT|vc3ft3Ps|xBp)z-Rw zO%YF!T<=x44LQu1JsAw#m=qb-2XlS7Dl7MNR$#0r3haSJW?9`!IhF`vXyvnM( qR2itG`$W^~v#%a)lr3FyHfPU&c|X~{nW5KM#Fm}oKf0WK&RPK0&3%&q literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_pai_ext_akid_missing/pai-Cert.pem b/credentials/development/commissioner_dut/struct_pai_ext_akid_missing/pai-Cert.pem new file mode 100644 index 00000000000000..1fd8f39749ef05 --- /dev/null +++ b/credentials/development/commissioner_dut/struct_pai_ext_akid_missing/pai-Cert.pem @@ -0,0 +1,11 @@ +-----BEGIN CERTIFICATE----- +MIIBnjCCAUOgAwIBAgIIAozSuBetLHAwCgYIKoZIzj0EAwIwMDEYMBYGA1UEAwwP +TWF0dGVyIFRlc3QgUEFBMRQwEgYKKwYBBAGConwCAQwERkZGMTAgFw0yMjA0MjAw +MDAwMDBaGA85OTk5MTIzMTIzNTk1OVowMDEYMBYGA1UEAwwPTWF0dGVyIFRlc3Qg +UEFJMRQwEgYKKwYBBAGConwCAQwERkZGMTBZMBMGByqGSM49AgEGCCqGSM49AwEH +A0IABM422KNrgBYMBq6oQNFPfeBo3WviENigfid8ChwUa4FFGah9cB2eZHzn2LT/ +LMJHZW3wXR9GUCUg9ERjhPpZRg2jRTBDMBIGA1UdEwEB/wQIMAYBAf8CAQEwDgYD +VR0PAQH/BAQDAgEGMB0GA1UdDgQWBBSUBuX6qnB/SSatRvVkF2AZr0p+tjAKBggq +hkjOPQQDAgNJADBGAiEAr1MK9NUcnBWlvGt/k+yD01XH1abKwpox9PTx1QUtpSMC +IQCLyIKrzerisR11pM1svP8fTh2OmVXWBBamzg/FpwecrQ== +-----END CERTIFICATE----- diff --git a/credentials/development/commissioner_dut/struct_pai_ext_akid_missing/pai-Key.der b/credentials/development/commissioner_dut/struct_pai_ext_akid_missing/pai-Key.der new file mode 100644 index 0000000000000000000000000000000000000000..448aa9ef838c801274c6ffb9121a3fb29ded3107 GIT binary patch literal 121 zcmV-<0EYiCcLD(c1Rw%bn@=5)D_}j)+6&RQa|P)06MRyZAKPfTPHuz8Unrmo1_&yK zNX|V20SBQ(13~}<&NkSiYk(FE2Ck?;(NBHgXx(e#5ZIu8CwvMV6l;M+8K`}59iC)- b=h(FWEW$@+ZSY+mMo=Xn^h9HX`dLN|%)u~1 literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_pai_ext_akid_missing/pai-Key.pem b/credentials/development/commissioner_dut/struct_pai_ext_akid_missing/pai-Key.pem new file mode 100644 index 00000000000000..04d143ad195197 --- /dev/null +++ b/credentials/development/commissioner_dut/struct_pai_ext_akid_missing/pai-Key.pem @@ -0,0 +1,5 @@ +-----BEGIN EC PRIVATE KEY----- +MHcCAQEEIAJUm08dkStgPdDaC9G3cwXo8xN8UpYf22i5Tm6Dx18ooAoGCCqGSM49 +AwEHoUQDQgAEzjbYo2uAFgwGrqhA0U994Gjda+IQ2KB+J3wKHBRrgUUZqH1wHZ5k +fOfYtP8swkdlbfBdH0ZQJSD0RGOE+llGDQ== +-----END EC PRIVATE KEY----- diff --git a/credentials/development/commissioner_dut/struct_pai_ext_akid_missing/test_case_vector.json b/credentials/development/commissioner_dut/struct_pai_ext_akid_missing/test_case_vector.json new file mode 100644 index 00000000000000..2f8e249136f52b --- /dev/null +++ b/credentials/development/commissioner_dut/struct_pai_ext_akid_missing/test_case_vector.json @@ -0,0 +1,9 @@ +{ + "description": "PAI Test Vector: Certificate doesn't include Authority Key ID (AKID) extension", + "is_success_case": "false", + "dac_cert": "308201cf30820174a0030201020208764c317ae127e32b300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313020170d3232303432303030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d0301070342000499f77b64b9f0a17befadc0a4672c0708663a06732f0016003157b928ccc4c0834e38b716129c05b6da348789a817764ccdd763ad45d1ba1387256e271256e964a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414740ac4635c26efa791011ae0b72c8fd8f01475b6301f0603551d230418301680149406e5faaa707f4926ad46f564176019af4a7eb6300a06082a8648ce3d0403020349003046022100c69f7c4e7893a34cff315f0d33c92f3b81d55db13d76adaa040d7f2508207cc802210098753326ae9c528dfc2aaae47b6dad070b7678a93c3c4fc64d270dd27dcf6be0", + "pai_cert": "3082019e30820143a0030201020208028cd2b817ad2c70300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303432303030303030305a180f39393939313233313233353935395a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d03010703420004ce36d8a36b80160c06aea840d14f7de068dd6be210d8a07e277c0a1c146b814519a87d701d9e647ce7d8b4ff2cc247656df05d1f46502520f4446384fa59460da345304330120603551d130101ff040830060101ff020101300e0603551d0f0101ff040403020106301d0603551d0e041604149406e5faaa707f4926ad46f564176019af4a7eb6300a06082a8648ce3d0403020349003046022100af530af4d51c9c15a5bc6b7f93ec83d355c7d5a6cac29a31f4f4f1d5052da5230221008bc882abcdeae2b11d75a4cd6cbcff1f4e1d8e9955d60416a6ce0fc5a7079cad", + "certification_declaration": "3081e906092a864886f70d010702a081db3081d8020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204473045022100b57e12767312397c8207dcd64a626ae6568fc3892f6a9a33b1e86aa2bdf5ef5b02202db9402884475683387596f55c087a3c390d10b878ec2799bcdd92cc83a13e00", + "dac_private_key": "0dfb92c0488810ec6c5188ce7336b1c73e542ab375e2a74282ae440258fd20d7", + "dac_public_key": "0499f77b64b9f0a17befadc0a4672c0708663a06732f0016003157b928ccc4c0834e38b716129c05b6da348789a817764ccdd763ad45d1ba1387256e271256e964" +} diff --git a/credentials/development/commissioner_dut/struct_pai_ext_authority_info_access_present/cd.der b/credentials/development/commissioner_dut/struct_pai_ext_authority_info_access_present/cd.der new file mode 100644 index 0000000000000000000000000000000000000000..0480d913456df1bdd3c0e764a1ec575f8abb7210 GIT binary patch literal 237 zcmXqLe8tA8)#lOmotKfFX+h&1gT|XojLe3-2Hb3%32h#Xsmv@)j0UaZnmAq)=o`2(^pvFNaj-G}h210CH+H8z0j7^Jbm>79j+}zv@4HU$Ajf@OTj0_+kN`l`K z2n>ykfymU-)H2Gz4TqU7j?UQ4L=$D=VX*)i9%&%V#twEV6C>2g%#7^JP7Ew^(l$E} zyo-GC=7YyfhI9S1E`15wE*E#}!|g8(<`yc+?CT5?-9I1x&95pr$Gk=D!Wz>#61us3 zdw=eFvi5E9$4=hG2?lWnJV0;D3NtePXJIm6FyI66_(42iu&_56$b$HMEMhDoJTqT$ z+}_~g6=7d-VgAb78~)9(wlR)_@7CkbVE|)b@YBT=$`+$w;mLp2KlN^N*z#2>^|al0yIh literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_pai_ext_authority_info_access_present/dac-Cert.pem b/credentials/development/commissioner_dut/struct_pai_ext_authority_info_access_present/dac-Cert.pem new file mode 100644 index 00000000000000..22f61c4ff8f2de --- /dev/null +++ b/credentials/development/commissioner_dut/struct_pai_ext_authority_info_access_present/dac-Cert.pem @@ -0,0 +1,12 @@ +-----BEGIN CERTIFICATE----- +MIIBzjCCAXSgAwIBAgIIdoiBXJZMeZwwCgYIKoZIzj0EAwIwMDEYMBYGA1UEAwwP +TWF0dGVyIFRlc3QgUEFJMRQwEgYKKwYBBAGConwCAQwERkZGMTAgFw0yMjA0MjAw +MDAwMDBaGA85OTk5MTIzMTIzNTk1OVowRjEYMBYGA1UEAwwPTWF0dGVyIFRlc3Qg +REFDMRQwEgYKKwYBBAGConwCAQwERkZGMTEUMBIGCisGAQQBgqJ8AgIMBDgwMDAw +WTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAAQeGzy5wO5Z6OzwSJkAzo+a0vRStx5e +2vDb9IA3OCRjB64wYUfzw/sPJRGcN4Qm0Kw1nBgtbQ69+brkre1z8YkNo2AwXjAM +BgNVHRMBAf8EAjAAMA4GA1UdDwEB/wQEAwIHgDAdBgNVHQ4EFgQUDJnqCNuwREpY +P3jQn6nbsP6YOzwwHwYDVR0jBBgwFoAUh6pW/4U+apckvO3m85LRl445w8YwCgYI +KoZIzj0EAwIDSAAwRQIhAKxPXg+v0fFA+rqciPtgmAao1Dc2MsoUWMaQAmR+fPH/ +AiB04ohDxSJt7SdtwY4mv/fTfvCEgjImj95AxzE38XU4YA== +-----END CERTIFICATE----- diff --git a/credentials/development/commissioner_dut/struct_pai_ext_authority_info_access_present/dac-Key.der b/credentials/development/commissioner_dut/struct_pai_ext_authority_info_access_present/dac-Key.der new file mode 100644 index 0000000000000000000000000000000000000000..97244c4785c141aaff9df417cf9336385a1300b2 GIT binary patch literal 121 zcmV-<0EYiCcLD(c1R#SdWy0f^IsZ>-=a3u+^VKyp2Pl_uG(^Lf7bE^G!~viR1_&yK zNX|V20SBQ(13~}<9veKl!0uV-?C?mL0M3t^()3cd9$wn;+w_1pI3!~St}tOo^TYcO bB@vuAgeK6eHJlhNZ4SNpy5z0xbMc7{SK>4u literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_pai_ext_authority_info_access_present/dac-Key.pem b/credentials/development/commissioner_dut/struct_pai_ext_authority_info_access_present/dac-Key.pem new file mode 100644 index 00000000000000..17e323eb162810 --- /dev/null +++ b/credentials/development/commissioner_dut/struct_pai_ext_authority_info_access_present/dac-Key.pem @@ -0,0 +1,5 @@ +-----BEGIN EC PRIVATE KEY----- +MHcCAQEEIIMqZcLjlzn/T2nnkBwH89U1NAcol3E0RMOXFyP+LMQBoAoGCCqGSM49 +AwEHoUQDQgAEHhs8ucDuWejs8EiZAM6PmtL0UrceXtrw2/SANzgkYweuMGFH88P7 +DyURnDeEJtCsNZwYLW0Ovfm65K3tc/GJDQ== +-----END EC PRIVATE KEY----- diff --git a/credentials/development/commissioner_dut/struct_pai_ext_authority_info_access_present/pai-Cert.der b/credentials/development/commissioner_dut/struct_pai_ext_authority_info_access_present/pai-Cert.der new file mode 100644 index 0000000000000000000000000000000000000000..005fae73ac37ea17358050b27548c6567e6257a3 GIT binary patch literal 505 zcmXqLV*F~*#5iXGGZP~d6Nh(}k-)DTO~(zm*f_M>JkHs&Ff$n#7)lt3u`!3TF!S*H zCYF?>7Ab_J7MCalI64}N7znX(X|pl1Fg7i!VPfQAadUGsG*A%dH8L_VF*1OFC<%T` zATTsC1|m~SQ_CnkW_scJobofue>r=B%A=Ct+=P5*4ef7Yd!dl;2}?CA*k?jpo%)$uX-crw6}ydv`~{!I>6| z8|NA{&H{RbIaF4dk?}tZhXEUqVq#=8-~);AgT#OV!N_JH3*z&!h_Q&YuL}F$YL_)# zWzXAZpC?_M-e-CEn1MVwf0fGR1LfcB7jvARE^z0L;ljc?0~0n5U|_Mb zvNJNWXc(v&sKEFJjBOGbB_#z``uh3F#RYn)6^Xe8IjMTd`MLVYk-_ZFVBo@}!1eZ& zS);FoNcP%emfJo&GOQE*@K2#=hpw3HwuhJMv-dG61j+Qzp0};eVf7lN0PeY0FRe(L TKWFEvjDx&7yML+N(zp%)=SrIP literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_pai_ext_authority_info_access_present/pai-Cert.pem b/credentials/development/commissioner_dut/struct_pai_ext_authority_info_access_present/pai-Cert.pem new file mode 100644 index 00000000000000..055063109423c6 --- /dev/null +++ b/credentials/development/commissioner_dut/struct_pai_ext_authority_info_access_present/pai-Cert.pem @@ -0,0 +1,13 @@ +-----BEGIN CERTIFICATE----- +MIIB9TCCAZygAwIBAgIIS2oyEPrYgscwCgYIKoZIzj0EAwIwMDEYMBYGA1UEAwwP +TWF0dGVyIFRlc3QgUEFBMRQwEgYKKwYBBAGConwCAQwERkZGMTAgFw0yMjA0MjAw +MDAwMDBaGA85OTk5MTIzMTIzNTk1OVowMDEYMBYGA1UEAwwPTWF0dGVyIFRlc3Qg +UEFJMRQwEgYKKwYBBAGConwCAQwERkZGMTBZMBMGByqGSM49AgEGCCqGSM49AwEH +A0IABGOVzTTGRrL7cFqpKCcflQ/wgHijtukOrZKvLNc2eMBhIXt7oRLN0m+MMtRr +cwesKdXyY1yqeZdT6O3duHDBmTijgZ0wgZowEgYDVR0TAQH/BAgwBgEB/wIBATAO +BgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFIeqVv+FPmqXJLzt5vOS0ZeOOcPGMB8G +A1UdIwQYMBaAFGr9IncfUR/svxZBl2cQ3NwxoXF+MDQGCCsGAQUFBwEBBCgwJjAk +BggrBgEFBQcwAYYYaHR0cDovL29jc3AuZXhhbXBsZS5jb20vMAoGCCqGSM49BAMC +A0cAMEQCIArtyjaBTTgUa63GObbw4jF+FfD+IHK4LRYdtuHSf2u+AiBSHI+bnrZ+ +QKusIlALndXSqGKfnLmqaMENLLv6JNoo1w== +-----END CERTIFICATE----- diff --git a/credentials/development/commissioner_dut/struct_pai_ext_authority_info_access_present/pai-Key.der b/credentials/development/commissioner_dut/struct_pai_ext_authority_info_access_present/pai-Key.der new file mode 100644 index 0000000000000000000000000000000000000000..d8706df3b27bce191939405ef73ac7b02972ef14 GIT binary patch literal 121 zcmV-<0EYiCcLD(c1R#i3RX=qn1${MKB#Rg81h*&{c0wYLV@eyn8_RZE=_0uHG5Xg<^49V Tk^`6jyJ-2>Ytx>6fgbGu!ADAe literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_pai_ext_basic_ca_missing/dac-Cert.der b/credentials/development/commissioner_dut/struct_pai_ext_basic_ca_missing/dac-Cert.der new file mode 100644 index 0000000000000000000000000000000000000000..51277d4d186a06e983b24d7dc24d9ffaefe0b001 GIT binary patch literal 466 zcmXqLVmxQi#8|R`nTe5!iKFWAkN=)+1Y;UT2{F&PB4fw-~oDDR+y3TKMRuqg8?6i#}DEGgN41pKo-R3V-aH!vGI1h z`@f#?^nAV}ncA#edzv4svKq*Pq?K8Kf!83CZ1n1Z#tN^!=O)QDPCM85ljn2dbmTy0 z_Fyn@Wm07LWwK@iU;3|a+z%SoyB)c|`NvK79C5d;Y&-w`p5)}{p39^l{czRO^#wI+ eKNRG?d%0KQv?|9VozS~GtZNHPehT<+m<9lB@sOSX literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_pai_ext_basic_ca_missing/dac-Cert.pem b/credentials/development/commissioner_dut/struct_pai_ext_basic_ca_missing/dac-Cert.pem new file mode 100644 index 00000000000000..0e3015b7ee40e5 --- /dev/null +++ b/credentials/development/commissioner_dut/struct_pai_ext_basic_ca_missing/dac-Cert.pem @@ -0,0 +1,12 @@ +-----BEGIN CERTIFICATE----- +MIIBzjCCAXSgAwIBAgIIeuP4/0mGcIMwCgYIKoZIzj0EAwIwMDEYMBYGA1UEAwwP +TWF0dGVyIFRlc3QgUEFJMRQwEgYKKwYBBAGConwCAQwERkZGMTAgFw0yMjA0MjAw +MDAwMDBaGA85OTk5MTIzMTIzNTk1OVowRjEYMBYGA1UEAwwPTWF0dGVyIFRlc3Qg +REFDMRQwEgYKKwYBBAGConwCAQwERkZGMTEUMBIGCisGAQQBgqJ8AgIMBDgwMDAw +WTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAAQNMrEtPRNE5KY5/6vzVx7Jvd6wxRHk +HVCUBDvFqc0SfXSdgaCxv6/GnS32U+bqTznE1a8XB136pC8SLqIEhKpGo2AwXjAM +BgNVHRMBAf8EAjAAMA4GA1UdDwEB/wQEAwIHgDAdBgNVHQ4EFgQUPEtG3f9/Acuf +DsRpKwUKvIPjJQUwHwYDVR0jBBgwFoAUYzLq4CioSr3Okh6Bls6B+QzzYZcwCgYI +KoZIzj0EAwIDSAAwRQIhAPo0rLAOZ/r2C+CAr0bE37P42UdsF0a1Brn++5JCQUdt +AiAb4arlr3B8rfBwbe7pvRjLJQjiLFXduDt9cXT5EE+wlg== +-----END CERTIFICATE----- diff --git a/credentials/development/commissioner_dut/struct_pai_ext_basic_ca_missing/dac-Key.der b/credentials/development/commissioner_dut/struct_pai_ext_basic_ca_missing/dac-Key.der new file mode 100644 index 0000000000000000000000000000000000000000..2c327e265e0f382a8118609709427452958f9fb1 GIT binary patch literal 121 zcmV-<0EYiCcLD(c1R&3k__dg6=DoP^Tf$i)JU#D2JByina@uY@YSQ`0ZH1r;1_&yK zNX|V20SBQ(13~}<4KlGUJrhLaraAws^H(0pz230J5#$|Elmt7)sm&67be(~qvA?gz boh|lL=IT#5#MQ4C2VMH4FA^@I1ca(aust^C literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_pai_ext_basic_ca_missing/dac-Key.pem b/credentials/development/commissioner_dut/struct_pai_ext_basic_ca_missing/dac-Key.pem new file mode 100644 index 00000000000000..de0777015f9cae --- /dev/null +++ b/credentials/development/commissioner_dut/struct_pai_ext_basic_ca_missing/dac-Key.pem @@ -0,0 +1,5 @@ +-----BEGIN EC PRIVATE KEY----- +MHcCAQEEIM+P+LWYaea9uPBbwlkiPD3vQzuLmXty2m48atL5yG2FoAoGCCqGSM49 +AwEHoUQDQgAEDTKxLT0TROSmOf+r81ceyb3esMUR5B1QlAQ7xanNEn10nYGgsb+v +xp0t9lPm6k85xNWvFwdd+qQvEi6iBISqRg== +-----END EC PRIVATE KEY----- diff --git a/credentials/development/commissioner_dut/struct_pai_ext_basic_ca_missing/pai-Cert.der b/credentials/development/commissioner_dut/struct_pai_ext_basic_ca_missing/pai-Cert.der new file mode 100644 index 0000000000000000000000000000000000000000..6f2180832bdc2e5b95a5cfc1bc25b5cabc8f92f3 GIT binary patch literal 446 zcmXqLV%%lW#F)5%nTe5!i9^kF=KNglG64fFHV&;ek8`#x%uEIbh7ty1Y|No7%sl+Q zi6teeMG7IQ#U%;>j*f;R210CH+H8z0j7^Jbm>79j+}zv@4HU$Ajf@OTj0_+kN`l`K z2n>ykfymU-)G`W>nVvYzj5H8tV+Xs5i4p2JW=3{qCkB>Vk6xFR9+_2lL%NUm+JT+7 zms*8;dY4Z=>F8VR{(wO>B)9APH2MCuU$;I`j=vXisKQd2MWUxg%!Jd6eM7-Bq2G&> z4H6CbfgY3}dw%IwZy;KHOJVQpl? zY2YE2J>$^co literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_pai_ext_basic_ca_missing/pai-Cert.pem b/credentials/development/commissioner_dut/struct_pai_ext_basic_ca_missing/pai-Cert.pem new file mode 100644 index 00000000000000..6ea1d58e279ba6 --- /dev/null +++ b/credentials/development/commissioner_dut/struct_pai_ext_basic_ca_missing/pai-Cert.pem @@ -0,0 +1,12 @@ +-----BEGIN CERTIFICATE----- +MIIBujCCAWGgAwIBAgIIJjWZn20LdhAwCgYIKoZIzj0EAwIwMDEYMBYGA1UEAwwP +TWF0dGVyIFRlc3QgUEFBMRQwEgYKKwYBBAGConwCAQwERkZGMTAgFw0yMjA0MjAw +MDAwMDBaGA85OTk5MTIzMTIzNTk1OVowMDEYMBYGA1UEAwwPTWF0dGVyIFRlc3Qg +UEFJMRQwEgYKKwYBBAGConwCAQwERkZGMTBZMBMGByqGSM49AgEGCCqGSM49AwEH +A0IABNri63Z1xJp+2BuODdbAudulOldJS3eTyUFNc0fgACVUbYr3lh+PrfW14CNf +3ljCeDkjBBiMhBY0CUoHsHDmEvujYzBhMA8GA1UdEwEB/wQFMAMCAQEwDgYDVR0P +AQH/BAQDAgEGMB0GA1UdDgQWBBRjMurgKKhKvc6SHoGWzoH5DPNhlzAfBgNVHSME +GDAWgBRq/SJ3H1Ef7L8WQZdnENzcMaFxfjAKBggqhkjOPQQDAgNHADBEAiAYOzI8 +CTBIFmuYwr2nbNkULJvpiMOkWnNq43O9TYjbNgIge5n7CtHZ0adwbCjMoqeQ4yAY +kMzjtGW/DysJtd2RUy8= +-----END CERTIFICATE----- diff --git a/credentials/development/commissioner_dut/struct_pai_ext_basic_ca_missing/pai-Key.der b/credentials/development/commissioner_dut/struct_pai_ext_basic_ca_missing/pai-Key.der new file mode 100644 index 0000000000000000000000000000000000000000..b069345373d563a67224df4c2286d223cef14283 GIT binary patch literal 121 zcmV-<0EYiCcLD(c1Rzsz!(2MCF^8l622fZkbKVM25U31KQyz`(Oa(|%_BNmj1_&yK zNX|V20SBQ(13~}<+T!bWb;O!}*c*-w*1);jr8-whOLvpWK}~Z<-~c65ZHo7nACIl| bwcsOP-dMtTIU@uZjD!|62}%dBaOM*Gzr!$r literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_pai_ext_basic_ca_missing/pai-Key.pem b/credentials/development/commissioner_dut/struct_pai_ext_basic_ca_missing/pai-Key.pem new file mode 100644 index 00000000000000..4b454d1337c22c --- /dev/null +++ b/credentials/development/commissioner_dut/struct_pai_ext_basic_ca_missing/pai-Key.pem @@ -0,0 +1,5 @@ +-----BEGIN EC PRIVATE KEY----- +MHcCAQEEIFNww1w6sTGHo/4GUFgqc94KUBCoDE9THo3uTAVIUvY2oAoGCCqGSM49 +AwEHoUQDQgAE2uLrdnXEmn7YG44N1sC526U6V0lLd5PJQU1zR+AAJVRtiveWH4+t +9bXgI1/eWMJ4OSMEGIyEFjQJSgewcOYS+w== +-----END EC PRIVATE KEY----- diff --git a/credentials/development/commissioner_dut/struct_pai_ext_basic_ca_missing/test_case_vector.json b/credentials/development/commissioner_dut/struct_pai_ext_basic_ca_missing/test_case_vector.json new file mode 100644 index 00000000000000..23b0f7f6fa56d2 --- /dev/null +++ b/credentials/development/commissioner_dut/struct_pai_ext_basic_ca_missing/test_case_vector.json @@ -0,0 +1,9 @@ +{ + "description": "PAI Test Vector: Certificate Basic Constraint extension CA field is missing", + "is_success_case": "false", + "dac_cert": "308201ce30820174a00302010202087ae3f8ff49867083300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313020170d3232303432303030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d030107034200040d32b12d3d1344e4a639ffabf3571ec9bddeb0c511e41d5094043bc5a9cd127d749d81a0b1bfafc69d2df653e6ea4f39c4d5af17075dfaa42f122ea20484aa46a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e041604143c4b46ddff7f01cb9f0ec4692b050abc83e32505301f0603551d230418301680146332eae028a84abdce921e8196ce81f90cf36197300a06082a8648ce3d0403020348003045022100fa34acb00e67faf60be080af46c4dfb3f8d9476c1746b506b9fefb924241476d02201be1aae5af707cadf0706deee9bd18cb2508e22c55ddb83b7d7174f9104fb096", + "pai_cert": "308201ba30820161a00302010202082635999f6d0b7610300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303432303030303030305a180f39393939313233313233353935395a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d03010703420004dae2eb7675c49a7ed81b8e0dd6c0b9dba53a57494b7793c9414d7347e00025546d8af7961f8fadf5b5e0235fde58c278392304188c841634094a07b070e612fba3633061300f0603551d130101ff04053003020101300e0603551d0f0101ff040403020106301d0603551d0e041604146332eae028a84abdce921e8196ce81f90cf36197301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d04030203470030440220183b323c093048166b98c2bda76cd9142c9be988c3a45a736ae373bd4d88db3602207b99fb0ad1d9d1a7706c28cca2a790e3201890cce3b465bf0f2b09b5dd91532f", + "certification_declaration": "3081e906092a864886f70d010702a081db3081d8020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204473045022100dd55f47d0c3c1ff2ad4a1c4b4c34af6bcef03655bc53c12b3d1154f32967d56902207045c35c93b08ed29707fa9b9a7cd3bf3cea6351a7fed139fd4ab2bcbe514887", + "dac_private_key": "cf8ff8b59869e6bdb8f05bc259223c3def433b8b997b72da6e3c6ad2f9c86d85", + "dac_public_key": "040d32b12d3d1344e4a639ffabf3571ec9bddeb0c511e41d5094043bc5a9cd127d749d81a0b1bfafc69d2df653e6ea4f39c4d5af17075dfaa42f122ea20484aa46" +} diff --git a/credentials/development/commissioner_dut/struct_pai_ext_basic_ca_wrong/cd.der b/credentials/development/commissioner_dut/struct_pai_ext_basic_ca_wrong/cd.der new file mode 100644 index 0000000000000000000000000000000000000000..ff16691d1516732f021781fba073525cbbcfafb3 GIT binary patch literal 236 zcmXqLe96YC)#lOmotKfFX+h&{gT@<7jLe3-2Hb3%32h#Xsmv@)j0Ua!P4{l{{&&tb Un>16fcfy`ucb6L*Z#XLs0R4eV8vpQ}nHZr?W@cn(c4A|+2^R8@4Vq5o3&Hl#nH1osm(qf0D_*|8GL~f~kOO0L~_e*YvcFYu&rC(2< z+J5K#pU6)Z!9{J06Aa=Ec!1uP6=r1o&%$KDV893B@q>84U}0}CkOlGiSj1RFq8~@R zJNo-U$(Ly3>*+ezmprTHL`wK31Xzt;f6tnZtz7MHi*CPiq zvpa)<3zLG-p`XgtR|`KqxF5FLJLc?Mr(@@CuAj@faEbV(LkE2>sxm3)uB`t!byIBE dr0BM+!`E1B9&HS^v79+ajLER*T4w(CLjZd(l(+x@ literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_pai_ext_basic_ca_wrong/dac-Cert.pem b/credentials/development/commissioner_dut/struct_pai_ext_basic_ca_wrong/dac-Cert.pem new file mode 100644 index 00000000000000..6859a04d799f40 --- /dev/null +++ b/credentials/development/commissioner_dut/struct_pai_ext_basic_ca_wrong/dac-Cert.pem @@ -0,0 +1,12 @@ +-----BEGIN CERTIFICATE----- +MIIBzTCCAXSgAwIBAgIIV9X0y0qgVJUwCgYIKoZIzj0EAwIwMDEYMBYGA1UEAwwP +TWF0dGVyIFRlc3QgUEFJMRQwEgYKKwYBBAGConwCAQwERkZGMTAgFw0yMjA0MjAw +MDAwMDBaGA85OTk5MTIzMTIzNTk1OVowRjEYMBYGA1UEAwwPTWF0dGVyIFRlc3Qg +REFDMRQwEgYKKwYBBAGConwCAQwERkZGMTEUMBIGCisGAQQBgqJ8AgIMBDgwMDAw +WTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAASVbtnqNqXT5P6Zik5LeYJiBq72Jj/Y +p2Y3w0cbFsMaDkUijBTaJPZlW6te+h64K1yUJKX1y8q33O/8WfI4U3KGo2AwXjAM +BgNVHRMBAf8EAjAAMA4GA1UdDwEB/wQEAwIHgDAdBgNVHQ4EFgQUW+NY7sX74HT0 +WzPXZyzXpeSLQgQwHwYDVR0jBBgwFoAUtblO2L9w0YgpvAqSXLnCvvBl9a8wCgYI +KoZIzj0EAwIDRwAwRAIgEsL5I3vVcfLg31a7S1zNnULGztmvnQmhpBfSwsFM0SUC +IC2pf/GVsl1WkluGasPWBDzisVM8OZmcFgIxctZpb7fC +-----END CERTIFICATE----- diff --git a/credentials/development/commissioner_dut/struct_pai_ext_basic_ca_wrong/dac-Key.der b/credentials/development/commissioner_dut/struct_pai_ext_basic_ca_wrong/dac-Key.der new file mode 100644 index 0000000000000000000000000000000000000000..171f2e6ae229be32654ed6ed0cc701300ca4cd79 GIT binary patch literal 121 zcmV-<0EYiCcLD(c1R(jNA~2CnudKiH>cH^WC87Q-42MIww8+9dX6 bTdQ9B9=I!9lq99~%gVRh@BCTvI8$1d%#7^JP7EyCb%*zf9}8 z4H6CbfgY3p z=b?QcQopV@kOxUCvj9V?K_u(1Qn`Gf{G0t^j?>cx?%Xk4SXhS~qRj3L1};nr3HqL< z_1yl7s=t=aSb683o|xL5D1-7Ge#QkQPPgnEdYKe>u6}>W=y)PdXS!=k+0Hw5TOu~* R#NR)sqf@Ue_*Ww{7XWLZh5rBm literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_pai_ext_basic_ca_wrong/pai-Cert.pem b/credentials/development/commissioner_dut/struct_pai_ext_basic_ca_wrong/pai-Cert.pem new file mode 100644 index 00000000000000..3d638bdb191982 --- /dev/null +++ b/credentials/development/commissioner_dut/struct_pai_ext_basic_ca_wrong/pai-Cert.pem @@ -0,0 +1,12 @@ +-----BEGIN CERTIFICATE----- +MIIBujCCAWGgAwIBAgIIEIYYGqPzqXMwCgYIKoZIzj0EAwIwMDEYMBYGA1UEAwwP +TWF0dGVyIFRlc3QgUEFBMRQwEgYKKwYBBAGConwCAQwERkZGMTAgFw0yMjA0MjAw +MDAwMDBaGA85OTk5MTIzMTIzNTk1OVowMDEYMBYGA1UEAwwPTWF0dGVyIFRlc3Qg +UEFJMRQwEgYKKwYBBAGConwCAQwERkZGMTBZMBMGByqGSM49AgEGCCqGSM49AwEH +A0IABCt+w74XxlaAMCsQz2GOJIUMNyYwM/dHCFzduUpfaaaH1XbGglOt5LzB5evP +sH8qiX+H8zKPdUudV9268FkI2jSjYzBhMA8GA1UdEwEB/wQFMAMCAQEwDgYDVR0P +AQH/BAQDAgEGMB0GA1UdDgQWBBS1uU7Yv3DRiCm8CpJcucK+8GX1rzAfBgNVHSME +GDAWgBRq/SJ3H1Ef7L8WQZdnENzcMaFxfjAKBggqhkjOPQQDAgNHADBEAiBgL0k1 +fwtPISX6ppip3N4uFibcWjB3bA8BoHRC2j+AjQIgDNX34QFByF4sl0WEdrncPrRY +sWxf384sLH8jEf0oaW0= +-----END CERTIFICATE----- diff --git a/credentials/development/commissioner_dut/struct_pai_ext_basic_ca_wrong/pai-Key.der b/credentials/development/commissioner_dut/struct_pai_ext_basic_ca_wrong/pai-Key.der new file mode 100644 index 0000000000000000000000000000000000000000..4ec31d810e5e6a96e9d7df6644871954520a2331 GIT binary patch literal 121 zcmV-<0EYiCcLD(c1R(Tp?QFkHPooqdOuT&D&mBD3d><0F)NuLyGcx^l3a_Q%5Gv(WH`G0uaz6O-OJ^RwlF+OaFUML U>l5DeXzTjrceGD(Y)dl)05NJxi2wiq literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_pai_ext_basic_critical_missing/dac-Cert.der b/credentials/development/commissioner_dut/struct_pai_ext_basic_critical_missing/dac-Cert.der new file mode 100644 index 0000000000000000000000000000000000000000..c1fc2223f1f89f5285cc45ffcf0099064024df39 GIT binary patch literal 466 zcmXqLVmxQi#8|R`nTe5!i6g^QXeCei-&_MOHV&;ek8`#x%uEIbh7ty1Y|No7%sl+Q zi6teeMG7IQ#U%;>j-G}h210CH+H8z0j7^Jbm>79j+}zv@4HU$Ajf@OTj0_+kN`l`K z2n>ykfymU-)H2Gz4TqU7j?UQ4L=$D=VX*)i9%&%V#twEV6C>2g%#7^JP7EwYY{vFy zdyVtlUPYX-{oQ=`>LJFJ`q{?sTaL^tzINt)@ZMwXKkJW)`0uq}oVf7kt=*iq(^s-h z+x5Ql9qZw|BfG^GCm6&T@BqCnE6m9FpM}YQ!GI6M;|KA8!NT5PAPeI2v52vVoPES` zr)Oadd-t#J!c!PzJAF^gPd1PTNh`Ae1Fu1(EaPX;@rr%lWrK3pO_|!VuVg|iH*z2| zdoUQdGAS}F6kao@qN&Gil3Wvvwmj5b!VI~DnZ*7LYy7!Mb cGp-R6W?4ReL*)xrU(FKaXJgv6e6*39oyy~c<6f5sF~ by+5O2q50ao2|bso29~<-iS7l%Zp6D53S~7T literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_pai_ext_basic_critical_missing/dac-Key.pem b/credentials/development/commissioner_dut/struct_pai_ext_basic_critical_missing/dac-Key.pem new file mode 100644 index 00000000000000..8b7c572174fa82 --- /dev/null +++ b/credentials/development/commissioner_dut/struct_pai_ext_basic_critical_missing/dac-Key.pem @@ -0,0 +1,5 @@ +-----BEGIN EC PRIVATE KEY----- +MHcCAQEEIDTVAw1c2BWxq5IuK3NGyefYe2ZZPn9EBheotHpwDF67oAoGCCqGSM49 +AwEHoUQDQgAEMgYzP82NM25G6ljMPfuD3dXCAakvazPvhMSec9bM71O9xof5f8YU +T70/o2Gh+dq7CT2XqQaWuu+J7gXDbsS7Fg== +-----END EC PRIVATE KEY----- diff --git a/credentials/development/commissioner_dut/struct_pai_ext_basic_critical_missing/pai-Cert.der b/credentials/development/commissioner_dut/struct_pai_ext_basic_critical_missing/pai-Cert.der new file mode 100644 index 0000000000000000000000000000000000000000..9c0ecbda27fd22c315d3e956a66f1fbbbc89be31 GIT binary patch literal 447 zcmXqLV%%-e#F)5%nTe5!i6eJulhB!roFW4*HV&;ek8`#x%uEIbh7ty1Y|No7%sl+Q zi6teeMG7IQ#U%;>j*f;R210CH+H8z0j7^Jbm>79j+}zv@4HU$Ajf@OTj0_+kN`l`K z2n>ykfymU-)G`W>nVvYzj5H8tV+Xs5i4p2JW=3{qCkB>#(+!R|p7MLZD5@8j=ezR7 zzT+7YT4!6GdnH3WKKwdW)f;fygNJEekJ~oMKb%?B?Qv<`krPtaSxeMR(%X38dd%Wv zgG2*1_&yK zNX|V20SBQ(13~}<-j^`MLCQ|x0TnJ$ZcVA^zQ<@-D$RvMjTux(@cPPnjZn)-3<92v bMz$IJ32J+XUScRNBTaL~T^Z!_+&&_R2$`egEknx3gDRT;wf@JO1oBTI7smfTmCq|ske6aDX T)aEV^Iirh}kG~p)ZVdqd<_Spf literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_pai_ext_basic_critical_wrong/dac-Cert.der b/credentials/development/commissioner_dut/struct_pai_ext_basic_critical_wrong/dac-Cert.der new file mode 100644 index 0000000000000000000000000000000000000000..605e7ac8cc8ca4e3d6b631cf8775987cceca5c7a GIT binary patch literal 466 zcmXqLVmxQi#8|R`nTe5!i9_iV&*Hb6?@Tw~V&l+i^EhYA!pvk~U?^cA#>O1V!py_( zn^;nkTBHz?T3n(K;OJ>6Vj#rErOn33!q~K^hKZ4f#m&vl&_F?)*T~4g#K-^wq9ph& zfxytn7>GUsOf*p@9u^Cb;gJTyZ0ul{GBHA(%*@En?8LxwVoBa5 z>q>F=wI7d8mwNa`OKh3Ojo5RdANR!ltaoH?-uO@?=1+R(8>RyrINkV16dHCk420{B+Ba6 z{U5O!K_%54GlS;+?qK*R+iV~Yl2&E`23~{6n#FY|DjmL_|HpP+X`hDiWO;LyY~(;@ z_Fyn@Wm04~@AkZ{zL)p>sty0;77H)a*!t-8;p!N#ll5#ffl~~)*f_M>JkHs&Ff$n#7)lt3u`!3TF!S*H zCYF?>7Ab_J7MCalI64}N7znX(X|pl1Fg7i!VPfQAadUGsG*A%dH8L_VF*1OFC<%T` zATTsC1|m~SQ_CnkW_scJobofufka_--mXViZ*CgxeUhI%ij z@nUX|Q!jJ+4EBYwT@=4x6}i*s#O`>ZJ2S0WmXz~b?Yd)}uyqyJ*R)jOVmBTggsC2NK{1a#(<2z{qAG3*z&!h_Q&QSzLFb(&6j*e{9#4 z_GuVTmN!?)HjoENE3*JYszD^{uTr^up!}QtVvf_(1@7E2Tv%9#9HPwb31_&yK zNX|V20SBQ(13~}(HGx(S-CREyI&IA bnL7lecMm$c+%sUcstWaHWfOBo3@jkJF5@tA literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_pai_ext_basic_critical_wrong/pai-Key.pem b/credentials/development/commissioner_dut/struct_pai_ext_basic_critical_wrong/pai-Key.pem new file mode 100644 index 00000000000000..f1707313b3d9d7 --- /dev/null +++ b/credentials/development/commissioner_dut/struct_pai_ext_basic_critical_wrong/pai-Key.pem @@ -0,0 +1,5 @@ +-----BEGIN EC PRIVATE KEY----- +MHcCAQEEILEy5NfchV4cNpY6M9xnIYV/KiJP4Db61L0nHJ+B+kEKoAoGCCqGSM49 +AwEHoUQDQgAEdmzf3J4yj8VcXOaLKCeNCTOjC0jK6WyOML5WBtEX33pZuTLIu18S +3Jk7BKR3Dzq63DNgtaoK9WZlE3NGDCwgug== +-----END EC PRIVATE KEY----- diff --git a/credentials/development/commissioner_dut/struct_pai_ext_basic_critical_wrong/test_case_vector.json b/credentials/development/commissioner_dut/struct_pai_ext_basic_critical_wrong/test_case_vector.json new file mode 100644 index 00000000000000..36164cd4a77db9 --- /dev/null +++ b/credentials/development/commissioner_dut/struct_pai_ext_basic_critical_wrong/test_case_vector.json @@ -0,0 +1,9 @@ +{ + "description": "PAI Test Vector: Certificate Basic Constraint extension critical field is set as 'non-critical'", + "is_success_case": "false", + "dac_cert": "308201ce30820174a003020102020822f20ca3edb3dc97300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313020170d3232303432303030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004c8a46ed23b791747adf1c5971ae1f42a16a628d85dce15f1bc5ef97f410383b1e1145cfc6789ec02c0b0882b7551e0cb52968fd187e9b1e63a4a5e11afd39bb6a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e041604145a3adadff85d2852747b8899529efb8800f11d83301f0603551d23041830168014aca37ec87940f5cffe06d722be2833931f37246b300a06082a8648ce3d0403020348003045022100cf46e7867f8d0dcfaab0ff1ea313a628b5e2ebc37b5c4a64d73c7fd7d342bde7022048a0ea4feef2666f9e6a4546773c03984164193310c6384966bcc266a1aa2466", + "pai_cert": "308201ba30820161a003020102020822a805e44bf15194300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303432303030303030305a180f39393939313233313233353935395a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d03010703420004766cdfdc9e328fc55c5ce68b28278d0933a30b48cae96c8e30be5606d117df7a59b932c8bb5f12dc993b04a4770f3abadc3360b5aa0af566651373460c2c20baa3633061300f0603551d13040830060101ff020101300e0603551d0f0101ff040403020106301d0603551d0e04160414aca37ec87940f5cffe06d722be2833931f37246b301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d040302034700304402206d85561002d9b2c161a8282529cc5ea122f02d0dcdcfa8d6b321a96e4430af0302207f262e4eae2b843e10733294747c25d1268d2259b82d0c61430c079c359c91b0", + "certification_declaration": "3081e906092a864886f70d010702a081db3081d8020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204473045022100c46e78d1ec5865c15f7eda4143e16ffc38679d6d81626e1560c068f40da503640220197db5d90fd9b2251c38476158cb69e0b1cd1ab38a481e32d179e3f53255b554", + "dac_private_key": "ae3d1b6e99d533a37f8f59ae930ee803b19ab61143bf9f3ebb25c6ccebf878ba", + "dac_public_key": "04c8a46ed23b791747adf1c5971ae1f42a16a628d85dce15f1bc5ef97f410383b1e1145cfc6789ec02c0b0882b7551e0cb52968fd187e9b1e63a4a5e11afd39bb6" +} diff --git a/credentials/development/commissioner_dut/struct_pai_ext_basic_missing/cd.der b/credentials/development/commissioner_dut/struct_pai_ext_basic_missing/cd.der new file mode 100644 index 0000000000000000000000000000000000000000..55013e0ec24f80053ef241706343f538619c5c9e GIT binary patch literal 237 zcmXqLe8tA8)#lOmotKfFX+h&1gT|XojLe3-2Hb3%32h#Xsmv@)j0UaJkHs&Ff$n#7)lt3u`!3TF!S*H zCYF?>7Ab_J7MCalIC>h27znX(X|pl1Fg7i!VPfQAadUGsG*A%dH8L_VF*1OFC<%T` zATTsC1|m~SQ_Cm=HymcVI67lD6HSzfhs6S9c%*?a8#~ygOpH(`Gc&R?J29}hIF={d z%eXLzmghX!_0>s6%dlhK+|LKa!Wf^0T>C%iwOCA3<588@-`1N=YyT9NtQpF}q!&81 zbp5aOJKN6*e|fYx!643n2k32CVMfOPEKCLr27DkMKZpkm7WM`MSrDI(MT|w{+UnkW zE3;T79Ck%V*QVC1<=Kk-HjoENE3*ItuR&y$?u($bD@Q73c_^!iO)xrVDR;ygIgpt> z7z|vQ6d8VfJ7p+i#Ie4@b&K*!uiA-$m1X5^1&dyN>Y3xb?Z+EUCWU;>i`V!Z literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_pai_ext_basic_missing/dac-Cert.pem b/credentials/development/commissioner_dut/struct_pai_ext_basic_missing/dac-Cert.pem new file mode 100644 index 00000000000000..79748652d112d3 --- /dev/null +++ b/credentials/development/commissioner_dut/struct_pai_ext_basic_missing/dac-Cert.pem @@ -0,0 +1,12 @@ +-----BEGIN CERTIFICATE----- +MIIBzjCCAXSgAwIBAgIIcqj4HIFV+OQwCgYIKoZIzj0EAwIwMDEYMBYGA1UEAwwP +TWF0dGVyIFRlc3QgUEFJMRQwEgYKKwYBBAGConwCAQwERkZGMTAgFw0yMjA0MjAw +MDAwMDBaGA85OTk5MTIzMTIzNTk1OVowRjEYMBYGA1UEAwwPTWF0dGVyIFRlc3Qg +REFDMRQwEgYKKwYBBAGConwCAQwERkZGMTEUMBIGCisGAQQBgqJ8AgIMBDgwMDAw +WTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAAREQXdjPxxEABV3bOC69UIcKjGInp3z +wRZWAeZU1v+S6xZcgoHFJOv2rzaWh/JeYylVBAIuVZV1r/qvuYfOE/Tio2AwXjAM +BgNVHRMBAf8EAjAAMA4GA1UdDwEB/wQEAwIHgDAdBgNVHQ4EFgQU1quN3qlqBRhA +ultbfWV/Jm49FPswHwYDVR0jBBgwFoAUqi3oUmbUxHiaSCMmFpAyzjkexDswCgYI +KoZIzj0EAwIDSAAwRQIhAPr2yjEcMgiveEW0I6lKfZFReXZ3hnCi6vKMnEO2+Owp +AiBvKdELQarCsoQb/n6VTNhjOpPpAjm+iF6bOSDLQkjrUg== +-----END CERTIFICATE----- diff --git a/credentials/development/commissioner_dut/struct_pai_ext_basic_missing/dac-Key.der b/credentials/development/commissioner_dut/struct_pai_ext_basic_missing/dac-Key.der new file mode 100644 index 0000000000000000000000000000000000000000..8d28d2664fde1f6227bb513f2f4f6c15cdf73a43 GIT binary patch literal 121 zcmV-<0EYiCcLD(c1R(EH(mIQCENST`)J(&!y+w}IvRc>{N`s!%I^~6@sXw3!1_&yK zNX|V20SBQ(13~}dX#U$(Y buQry4@?K*pRRjVqRh4zG`mec%&J*j*f;R210CH+H8z0j7^Jbm>79j+}zv@4HU$Ajf@OTj0_+kN`l`K z2n>ykfymU-)G`W>nVvYzj5H8tV+Xs5i4p2JW=3{qCkB@LOP4n3&CuHyKI!^R*@IHY zg(W{V%9k&mex~baf`eFr^4bN{1g`Td_+G93_@w^yv&vOM`J3HONVzks$VaX_X|20B z$RNOg59mQzen!UsEI=rklBO5z?DfsP`oBM|ww7&i$Inw<`Vb#FdXl-~Mg!pV-V`@a@!k H!rKlE}!Soeq`Iqty>`~?zc7M6zHQu^L7apJr1_&yK zNX|V20SBQ(13~}<-=(F3E|@O9SCZG+9l;vM6B+V>A9tgd%!6@zy9#=D)?}_OQ TyS$?Jc|cP8j78TjH?#l%_liuB literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_pai_ext_basic_pathlen0/dac-Cert.der b/credentials/development/commissioner_dut/struct_pai_ext_basic_pathlen0/dac-Cert.der new file mode 100644 index 0000000000000000000000000000000000000000..bd5405e34f3638a3ddf4bcd49304bbaac6991015 GIT binary patch literal 465 zcmXqLVmxcm#8|R`nTe5!i6dO|-kQ}nHZr?W@cn(c4A;D4gbxd zHsfpR%p<1xl5bgWxmyQUpV#sva^yl?LU8@1TwQb zgMkZ^LS^23X6~-J3;MhF%(J(+xMY|8ylK+CO@Hkd%z9`4B~ph;LE!Ta&!~8TPkBi` a(L7gs{g#RwpB)J>oY1_&yK zNX|V20SBQ(13~}JkHs&Ff$n#7)lt3u`!3TF!S*H zCYF?>7Ab_J7MCalI64}N7znX(X|pl1Fg7i!VPfQAadUGsG*A%dH8L_VF*1OFC<%T` zATTsC1|m~SQ_CnkW_scJobofue78NSeXS+)Ad*W>&Pswx`! z?}}~uIYV+Pd%9Kl(a_Xy$G@`db~NcMPYwSg8Tt1K$DfM@XO^)PzER~;dfavHhu!SO zX$C1kZ!m|-3NtePXW=kl15!+k3icD9C2iV&{+MDQ50X}90R~osNY-Daa``~{H~YmLr>6_txnsDnunsv;nLQW`T$vOZ zS}UiRmH+;}Af-R%>*vH3J?D*AZ`u+*R5CYc}ge8Z-t(_I6P X-eTNcoAuD@ps2&9!xt6?E5-o;=FE^p literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_pai_ext_basic_pathlen0/pai-Cert.pem b/credentials/development/commissioner_dut/struct_pai_ext_basic_pathlen0/pai-Cert.pem new file mode 100644 index 00000000000000..4d22147506ba5b --- /dev/null +++ b/credentials/development/commissioner_dut/struct_pai_ext_basic_pathlen0/pai-Cert.pem @@ -0,0 +1,12 @@ +-----BEGIN CERTIFICATE----- +MIIBvjCCAWSgAwIBAgIIKRp9Cuiy3eMwCgYIKoZIzj0EAwIwMDEYMBYGA1UEAwwP +TWF0dGVyIFRlc3QgUEFBMRQwEgYKKwYBBAGConwCAQwERkZGMTAgFw0yMjA0MjAw +MDAwMDBaGA85OTk5MTIzMTIzNTk1OVowMDEYMBYGA1UEAwwPTWF0dGVyIFRlc3Qg +UEFJMRQwEgYKKwYBBAGConwCAQwERkZGMTBZMBMGByqGSM49AgEGCCqGSM49AwEH +A0IABMox6Cjpeqv49ccPoHp4gQ/dFrL5mBmVB2c6V8VVZfbH9QS7QTSJd2VX/BlZ +/eQI/NFwzKYEcewlCiLjis74PpujZjBkMBIGA1UdEwEB/wQIMAYBAf8CAQAwDgYD +VR0PAQH/BAQDAgEGMB0GA1UdDgQWBBRm9+aa8u4rSw+hle+mzRk8h/n4lDAfBgNV +HSMEGDAWgBRq/SJ3H1Ef7L8WQZdnENzcMaFxfjAKBggqhkjOPQQDAgNIADBFAiEA +hXmUNnf796Bkj1z182GojM8zq7SeWfFtAKn9qu2XIbECIDkvn4YZb1rnsLKll0VR +xdoBu31q4TrBFUCyw9ChUyFe +-----END CERTIFICATE----- diff --git a/credentials/development/commissioner_dut/struct_pai_ext_basic_pathlen0/pai-Key.der b/credentials/development/commissioner_dut/struct_pai_ext_basic_pathlen0/pai-Key.der new file mode 100644 index 0000000000000000000000000000000000000000..bbfdcdb2dfaaf30e1969c9301efa3a399890b6c3 GIT binary patch literal 121 zcmV-<0EYiCcLD(c1R%$tGNsqrz*YSfOJonTG=UC`4#QulLecIJk2iWZ;>1_&yK zNX|V20SBQ(13~}<$}#9D>3Xa9^~VpOdU$~k-4?R>m>HD^XF6BKRb}?a^#r>?G>La* bSNs`S{p1Mz(QwSB1aa&o3L@i*&iFo?@g6oZ literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_pai_ext_basic_pathlen0/pai-Key.pem b/credentials/development/commissioner_dut/struct_pai_ext_basic_pathlen0/pai-Key.pem new file mode 100644 index 00000000000000..f1397d17baeafc --- /dev/null +++ b/credentials/development/commissioner_dut/struct_pai_ext_basic_pathlen0/pai-Key.pem @@ -0,0 +1,5 @@ +-----BEGIN EC PRIVATE KEY----- +MHcCAQEEIMegMqXX2sBV/RVLZA+zNIEOjA7DX6hC0e4Qjzq2yooWoAoGCCqGSM49 +AwEHoUQDQgAEyjHoKOl6q/j1xw+geniBD90WsvmYGZUHZzpXxVVl9sf1BLtBNIl3 +ZVf8GVn95Aj80XDMpgRx7CUKIuOKzvg+mw== +-----END EC PRIVATE KEY----- diff --git a/credentials/development/commissioner_dut/struct_pai_ext_basic_pathlen0/test_case_vector.json b/credentials/development/commissioner_dut/struct_pai_ext_basic_pathlen0/test_case_vector.json new file mode 100644 index 00000000000000..1801e9330904f3 --- /dev/null +++ b/credentials/development/commissioner_dut/struct_pai_ext_basic_pathlen0/test_case_vector.json @@ -0,0 +1,9 @@ +{ + "description": "PAI Test Vector: Certificate Basic Constraint extension PathLen field set to 0", + "is_success_case": "false", + "dac_cert": "308201cd30820174a00302010202085729defcb722b794300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313020170d3232303432303030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d030107034200047557fb082698f56599c4356f19ed05da44d0e02275bef51abb34d871db7b36550a313096c47828177ecfcca147198ab3fcae1c26118919e015425941353098cda360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414729a84a369b958830a1714e130c738165cad20eb301f0603551d2304183016801466f7e69af2ee2b4b0fa195efa6cd193c87f9f894300a06082a8648ce3d04030203470030440220796e9f030b8a9da08f8bbc9e3f38d1a4ba3f9e961b8d82fd3fa09aee3ff4592c022010f3b8495a5f10f26e624c5b0cd58d4ea517306d6ca389ebb753db6a5eb51c9b", + "pai_cert": "308201be30820164a0030201020208291a7d0ae8b2dde3300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303432303030303030305a180f39393939313233313233353935395a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d03010703420004ca31e828e97aabf8f5c70fa07a78810fdd16b2f998199507673a57c55565f6c7f504bb413489776557fc1959fde408fcd170cca60471ec250a22e38acef83e9ba366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e0416041466f7e69af2ee2b4b0fa195efa6cd193c87f9f894301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d04030203480030450221008579943677fbf7a0648f5cf5f361a88ccf33abb49e59f16d00a9fdaaed9721b10220392f9f86196f5ae7b0b2a5974551c5da01bb7d6ae13ac11540b2c3d0a153215e", + "certification_declaration": "3081e806092a864886f70d010702a081da3081d7020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317c307a020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d040302044630440220482ad9a336283c8a0f90bb78e27c930df1e1ff6fdfa0d96dd440d07ac0a8e64f0220527d13c193762175ecd5a0e37b0337bc5c8956d3a88de750628798a2d6d38084", + "dac_private_key": "a36ff75399f319dfee529eecd8c4cf8ab17ca10fa88fc7ead367e36265b4d44d", + "dac_public_key": "047557fb082698f56599c4356f19ed05da44d0e02275bef51abb34d871db7b36550a313096c47828177ecfcca147198ab3fcae1c26118919e015425941353098cd" +} diff --git a/credentials/development/commissioner_dut/struct_pai_ext_basic_pathlen1/cd.der b/credentials/development/commissioner_dut/struct_pai_ext_basic_pathlen1/cd.der new file mode 100644 index 0000000000000000000000000000000000000000..eaa2200a14548baca42920793d187df4cae901b6 GIT binary patch literal 236 zcmXqLe96YC)#lOmotKfFX+h&{gT@<7jLe3-2Hb3%32h#Xsmv@)j0UagEb+^(=lYPP}!Fx=K48K|fE^JR+e9S64+Aq$T^ZP~_ TFv9Am2NlSV&l+i^EhYA!pvk~U?^cA#>O1V!py_( zn^;nkTBHz?T3n(K;OJ>6Vj#rErOn33!q~K^hKZ4f#m&vl&_F?)*T~4g#K-^wq9ph& zfxytn7>GUsOf*p@9u^Cb;gJTyZ0ul{GBHA(%*@En?8LzGHzLz? zo%+_?rr(|~!eR^i4s!6vUECP?>DPMQxD8U8dA2j}lrQr1R`CIfkpv@#1Y@ESxOt37=r^3j}ctqo6qQ;+RL+52B7BL_0G z2ZMntlY)KzvDv1(7M7{9usern-nP2C*7VN$?JAsizxF!wG1shTQe>DjOO|)V8>=XH c9cjO+up@gS);^HiI91)fi+mU3;mI!Qg2=z#vLP{q25@s|* literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_pai_ext_basic_pathlen1/dac-Key.pem b/credentials/development/commissioner_dut/struct_pai_ext_basic_pathlen1/dac-Key.pem new file mode 100644 index 00000000000000..a72b155b242e8e --- /dev/null +++ b/credentials/development/commissioner_dut/struct_pai_ext_basic_pathlen1/dac-Key.pem @@ -0,0 +1,5 @@ +-----BEGIN EC PRIVATE KEY----- +MHcCAQEEIHAOr/SVijKkeETRjIECLJXQE6iztcWfGfVo70qioO+MoAoGCCqGSM49 +AwEHoUQDQgAE/VhpNa4ntW2C+0noVl1xjsEID17RsVny+q8tXrAaKW49mdx3oklL +J3zaxEscEZYT25Fky5YIbHQI9UidQkom+Q== +-----END EC PRIVATE KEY----- diff --git a/credentials/development/commissioner_dut/struct_pai_ext_basic_pathlen1/pai-Cert.der b/credentials/development/commissioner_dut/struct_pai_ext_basic_pathlen1/pai-Cert.der new file mode 100644 index 0000000000000000000000000000000000000000..89c14de17c5c831fb6cd6a4247061b19d7165a47 GIT binary patch literal 450 zcmXqLV%%rY#F(;xnTe5!iNktBLE0ZF_ z+_U%juJ>G7JyAbyUxoIih#OCTDwcGfUm5FR{c~!z@?s_h>qFXYPuNsmU!Tmbx%>Ru WfJX)|i=yNFBIN#;+5fusNge=JbB#&> literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_pai_ext_basic_pathlen1/pai-Cert.pem b/credentials/development/commissioner_dut/struct_pai_ext_basic_pathlen1/pai-Cert.pem new file mode 100644 index 00000000000000..e8417114821ca8 --- /dev/null +++ b/credentials/development/commissioner_dut/struct_pai_ext_basic_pathlen1/pai-Cert.pem @@ -0,0 +1,12 @@ +-----BEGIN CERTIFICATE----- +MIIBvjCCAWSgAwIBAgIIO6AbDsnA+7owCgYIKoZIzj0EAwIwMDEYMBYGA1UEAwwP +TWF0dGVyIFRlc3QgUEFBMRQwEgYKKwYBBAGConwCAQwERkZGMTAgFw0yMjA0MjAw +MDAwMDBaGA85OTk5MTIzMTIzNTk1OVowMDEYMBYGA1UEAwwPTWF0dGVyIFRlc3Qg +UEFJMRQwEgYKKwYBBAGConwCAQwERkZGMTBZMBMGByqGSM49AgEGCCqGSM49AwEH +A0IABB2/smboO4ptf7nYCnsDarQ3bUQ8FXP8JLGlM6ra6Ds29KBeasbj4MlmD8iR +qut3WBFomka9ZYii6e6lUzfT012jZjBkMBIGA1UdEwEB/wQIMAYBAf8CAQEwDgYD +VR0PAQH/BAQDAgEGMB0GA1UdDgQWBBTjJuXiFPE3Dq08DI+CjD2RHd/1kzAfBgNV +HSMEGDAWgBRq/SJ3H1Ef7L8WQZdnENzcMaFxfjAKBggqhkjOPQQDAgNIADBFAiEA +nc3fDteM1KuRL16+eCvSWNjl+SF0ic+pXUg7+ZVrI6MCIDvCK4bkBiTr15MHKbvP +rVDiMOlyW15OWB7/dj/61vIf +-----END CERTIFICATE----- diff --git a/credentials/development/commissioner_dut/struct_pai_ext_basic_pathlen1/pai-Key.der b/credentials/development/commissioner_dut/struct_pai_ext_basic_pathlen1/pai-Key.der new file mode 100644 index 0000000000000000000000000000000000000000..aa971c0319cde8902887c0134516214383cc8f2b GIT binary patch literal 121 zcmV-<0EYiCcLD(c1Rz_^;^qEUWY8B|GOqHvziSWDDfmQpG4G#h7$&)yh&iAN1_&yK zNX|V20SBQ(13~}<9lx?>=sSvSf4SHSdjo2;H*G{b6?6O~v86Mr+UPqr^q^j9#^d10 bW)H}bs_S=H5onr5y=91^>F%XdH`CKyDrPqy literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_pai_ext_basic_pathlen1/pai-Key.pem b/credentials/development/commissioner_dut/struct_pai_ext_basic_pathlen1/pai-Key.pem new file mode 100644 index 00000000000000..d9c99ad6627a72 --- /dev/null +++ b/credentials/development/commissioner_dut/struct_pai_ext_basic_pathlen1/pai-Key.pem @@ -0,0 +1,5 @@ +-----BEGIN EC PRIVATE KEY----- +MHcCAQEEIFvO4uX+VmTQF1syrvK6v2sP0in4RHcx759qGCa5mYg5oAoGCCqGSM49 +AwEHoUQDQgAEHb+yZug7im1/udgKewNqtDdtRDwVc/wksaUzqtroOzb0oF5qxuPg +yWYPyJGq63dYEWiaRr1liKLp7qVTN9PTXQ== +-----END EC PRIVATE KEY----- diff --git a/credentials/development/commissioner_dut/struct_pai_ext_basic_pathlen1/test_case_vector.json b/credentials/development/commissioner_dut/struct_pai_ext_basic_pathlen1/test_case_vector.json new file mode 100644 index 00000000000000..1d31c361df1080 --- /dev/null +++ b/credentials/development/commissioner_dut/struct_pai_ext_basic_pathlen1/test_case_vector.json @@ -0,0 +1,9 @@ +{ + "description": "PAI Test Vector: Certificate Basic Constraint extension PathLen field set to 1", + "is_success_case": "false", + "dac_cert": "308201ce30820174a0030201020208579dcbb7baba75b7300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313020170d3232303432303030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004fd586935ae27b56d82fb49e8565d718ec1080f5ed1b159f2faaf2d5eb01a296e3d99dc77a2494b277cdac44b1c119613db9164cb96086c7408f5489d424a26f9a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414cd6393b1b8866245d7b0e5fb7b6617165c1bb702301f0603551d23041830168014e326e5e214f1370ead3c0c8f828c3d911ddff593300a06082a8648ce3d040302034800304502203f6fc69b35baa176250407435429db3addad35dcafb72409ddf58d430e037caf0221009c9a1d0da8ec3a5a472c1b4e7a56c4bc58ade018f113323d98ae87dd0e0258cf", + "pai_cert": "308201be30820164a00302010202083ba01b0ec9c0fbba300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303432303030303030305a180f39393939313233313233353935395a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d030107034200041dbfb266e83b8a6d7fb9d80a7b036ab4376d443c1573fc24b1a533aadae83b36f4a05e6ac6e3e0c9660fc891aaeb775811689a46bd6588a2e9eea55337d3d35da366306430120603551d130101ff040830060101ff020101300e0603551d0f0101ff040403020106301d0603551d0e04160414e326e5e214f1370ead3c0c8f828c3d911ddff593301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d04030203480030450221009dcddf0ed78cd4ab912f5ebe782bd258d8e5f9217489cfa95d483bf9956b23a302203bc22b86e40624ebd7930729bbcfad50e230e9725b5e4e581eff763ffad6f21f", + "certification_declaration": "3081e906092a864886f70d010702a081db3081d8020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d0403020447304502206fa26f3807f0d97c57652a38fc299564f543465c9ed9cadd793a290790aa11de022100fa8550d0b761a3c63a6b5b4e5e4309f7b11c23d83deef774a605e23a28d8c5e1", + "dac_private_key": "700eaff4958a32a47844d18c81022c95d013a8b3b5c59f19f568ef4aa2a0ef8c", + "dac_public_key": "04fd586935ae27b56d82fb49e8565d718ec1080f5ed1b159f2faaf2d5eb01a296e3d99dc77a2494b277cdac44b1c119613db9164cb96086c7408f5489d424a26f9" +} diff --git a/credentials/development/commissioner_dut/struct_pai_ext_basic_pathlen2/cd.der b/credentials/development/commissioner_dut/struct_pai_ext_basic_pathlen2/cd.der new file mode 100644 index 0000000000000000000000000000000000000000..9cd34316368ab87666d5075eb5c035a6d1f3e01e GIT binary patch literal 236 zcmXqLe96YC)#lOmotKfFX+h&{gT@<7jLe3-2Hb3%32h#Xsmv@)j0UaUzT)?z^ryV3A{Ix|FP&`flba>j#hsJCesAW*&mwa? zx6fVAwIg_ShN9Qv1cNvO9-y~ng&7(DvoIMj81R93{2(4MSlAm3WI=pB7BLo)Q`T!W z1AqU&$jGOez337DLdt0rZ{mB!VB)2}h_y|w-{lOn^0z&3Ml4~~j0 d7b>o} bnh}Z%Y;Uii(oJqHxuL`(Rt7sugy3#ZF literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_pai_ext_basic_pathlen2/dac-Key.pem b/credentials/development/commissioner_dut/struct_pai_ext_basic_pathlen2/dac-Key.pem new file mode 100644 index 00000000000000..87309f31bc10b1 --- /dev/null +++ b/credentials/development/commissioner_dut/struct_pai_ext_basic_pathlen2/dac-Key.pem @@ -0,0 +1,5 @@ +-----BEGIN EC PRIVATE KEY----- +MHcCAQEEIBPWuv1HhPAWitV3kRlwVPHYqYYPTh94In5qTq6sP3r2oAoGCCqGSM49 +AwEHoUQDQgAEAZTtvNK5CJUF50RljQ0RNGSN0H20LcenqPviZ+UNZRQ4xGfSyYeO +HpoRigtsb6+9adHzFJxJt52vCrhTq2ghSg== +-----END EC PRIVATE KEY----- diff --git a/credentials/development/commissioner_dut/struct_pai_ext_basic_pathlen2/pai-Cert.der b/credentials/development/commissioner_dut/struct_pai_ext_basic_pathlen2/pai-Cert.der new file mode 100644 index 0000000000000000000000000000000000000000..bf079b4c3ae3c239f82fd2876c567daad11b56cd GIT binary patch literal 450 zcmXqLV%%rY#F(;xnTe5!iNnZ8VV$CR*Hi;8HV&;ek8`#x%uEIbh7ty1Y|No7%sl+Q zi6teeMG7IQ#U%;>j*f;R210CH+H8z0j7^Jbm>79j+}zv@4HU$Ajf@OTj0_+kN`l`K z2n>ykfymU-)G`W>nVvYzj5H8tV+Xs5i4p2JW=3{qCkB>2)wjRnjpms=c#vmpV;$1T z9>3sh{~t%@?^|ownZ<+FoZDTxc+c}6>n8<&+^i$~dBLHh7ao?kHy+K`_ZHd8;VH8? z%^(Hn4dzf;VMfOPEF1=GKnfTf27DkfevlY27#P_MWI=pB7BLnPg{2!}woRxD_`$wP zr|gu2nc~Db^#<}FX=N5*U^R$j{Z%TL50rniU(9iOy1<<~h6@YpkOP(3gTcU+Ns-~3 zlbu!Phch`J>PsZ;%s-kP=&x(@+$OqW%Lro=Y08eSf%T<&NKzGuNK{ UJBcMbvdcV+@!My;9ZEd80EWbfkN^Mx literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_pai_ext_basic_pathlen2/pai-Cert.pem b/credentials/development/commissioner_dut/struct_pai_ext_basic_pathlen2/pai-Cert.pem new file mode 100644 index 00000000000000..0c0502bd7ac8f6 --- /dev/null +++ b/credentials/development/commissioner_dut/struct_pai_ext_basic_pathlen2/pai-Cert.pem @@ -0,0 +1,12 @@ +-----BEGIN CERTIFICATE----- +MIIBvjCCAWSgAwIBAgIIMkwgriE3ipUwCgYIKoZIzj0EAwIwMDEYMBYGA1UEAwwP +TWF0dGVyIFRlc3QgUEFBMRQwEgYKKwYBBAGConwCAQwERkZGMTAgFw0yMjA0MjAw +MDAwMDBaGA85OTk5MTIzMTIzNTk1OVowMDEYMBYGA1UEAwwPTWF0dGVyIFRlc3Qg +UEFJMRQwEgYKKwYBBAGConwCAQwERkZGMTBZMBMGByqGSM49AgEGCCqGSM49AwEH +A0IABI4l7ftfMp404OBuOzw7VIkHX6DNj/xBA/e1fAcDF1Kszrt1o7zn+K+SU/Gz +LBPzoMLF0OF3h4HFby9LFLUISRyjZjBkMBIGA1UdEwEB/wQIMAYBAf8CAQIwDgYD +VR0PAQH/BAQDAgEGMB0GA1UdDgQWBBQgpbBctpB+UPgHqix2ykA2IZGcfzAfBgNV +HSMEGDAWgBRq/SJ3H1Ef7L8WQZdnENzcMaFxfjAKBggqhkjOPQQDAgNIADBFAiEA +9kI+OonwzGzwf3QZPjfxNsCPfoZJthWotKgIWktfRJkCIHdCSaSA1vfhvKm4+5Np +rcn9kgRrWYo3agH28y64Igxt +-----END CERTIFICATE----- diff --git a/credentials/development/commissioner_dut/struct_pai_ext_basic_pathlen2/pai-Key.der b/credentials/development/commissioner_dut/struct_pai_ext_basic_pathlen2/pai-Key.der new file mode 100644 index 0000000000000000000000000000000000000000..d8b1ef63a1b806d9acfd06348d24ce7a01629dcf GIT binary patch literal 121 zcmV-<0EYiCcLD(c1RzBB2nDSQg?@9`ucD~2)%=vToy0*PjN$z1%NQmCWoMIjNBHj6JhtlJ0PUGoa Srd9%fbKAHlqFzOpH7%Zfp^;>QS zub#xPP2BVBgEtSuwl2HzzUj@wfcaH>6O5-xOc42MGfk$b2S4t2pj=6IU$R zRqn}nhk3!zyCE`*6Aa=Ec!1uP6=r1o&%$KDV893B@q>84U}0}CkOlGiSj1RF?w3C2 zs9JeSD(8r!-?PJum>B*nEisS>Nh`Ae1Fu1Z^U3OiyJVE-oibr&tx@!BwQS#!j2y_! z9t;MqOo|M1D~~?E^W)YkgZqk;ifxrOES7atPP}l!B|dwl)bf78ASQ+46W5JYyWaqY?jM@KLGtPjhp}g literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_pai_ext_basic_pathlen_presence_wrong/dac-Cert.pem b/credentials/development/commissioner_dut/struct_pai_ext_basic_pathlen_presence_wrong/dac-Cert.pem new file mode 100644 index 00000000000000..d30c9c11492931 --- /dev/null +++ b/credentials/development/commissioner_dut/struct_pai_ext_basic_pathlen_presence_wrong/dac-Cert.pem @@ -0,0 +1,12 @@ +-----BEGIN CERTIFICATE----- +MIIBzjCCAXSgAwIBAgIIUiZjEXYyY+cwCgYIKoZIzj0EAwIwMDEYMBYGA1UEAwwP +TWF0dGVyIFRlc3QgUEFJMRQwEgYKKwYBBAGConwCAQwERkZGMTAgFw0yMjA0MjAw +MDAwMDBaGA85OTk5MTIzMTIzNTk1OVowRjEYMBYGA1UEAwwPTWF0dGVyIFRlc3Qg +REFDMRQwEgYKKwYBBAGConwCAQwERkZGMTEUMBIGCisGAQQBgqJ8AgIMBDgwMDAw +WTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAAT2f7TbU6uSALYXSc3g7OFWtabY74Ls +4VCfer1gM5YYkBT1Okh5Qqjop3RZbwIxOl4L7pGopLp3SQHcA6D53VQco2AwXjAM +BgNVHRMBAf8EAjAAMA4GA1UdDwEB/wQEAwIHgDAdBgNVHQ4EFgQU33XnCHqpyhps +xEFO5sOiAgD8pXQwHwYDVR0jBBgwFoAUCeSrwbocI57KNAMFfCFJhTmHuGMwCgYI +KoZIzj0EAwIDSAAwRQIhAJ15xefc+NqqMN8hknM9Iyg4poh5kdDIRF9rqRqnjxFS +AiBzyPcwhfIwk3U9DYbtsra24sgD4MAPRk6H9M0WmkS/Tg== +-----END CERTIFICATE----- diff --git a/credentials/development/commissioner_dut/struct_pai_ext_basic_pathlen_presence_wrong/dac-Key.der b/credentials/development/commissioner_dut/struct_pai_ext_basic_pathlen_presence_wrong/dac-Key.der new file mode 100644 index 0000000000000000000000000000000000000000..5092408cb41a9f55453537dd61219a6efd5f88f4 GIT binary patch literal 121 zcmV-<0EYiCcLD(c1RxI@ft8|LLHONt-oWD?mjd`F71_&yK zNX|V20SBQ(13~}<_J6e7Q>&5ywiijw;Oya6wWiqbg6!c?pL)GuGnN>T6!khtc|xe@ br*v6w0x>#X3+|Dqq`G%W0o((i`Q20;Z?`lB literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_pai_ext_basic_pathlen_presence_wrong/dac-Key.pem b/credentials/development/commissioner_dut/struct_pai_ext_basic_pathlen_presence_wrong/dac-Key.pem new file mode 100644 index 00000000000000..d6723c139c507f --- /dev/null +++ b/credentials/development/commissioner_dut/struct_pai_ext_basic_pathlen_presence_wrong/dac-Key.pem @@ -0,0 +1,5 @@ +-----BEGIN EC PRIVATE KEY----- +MHcCAQEEIA8agZWiW0H43XTewOMe5DYvH7FbNV09G7AdnwA5V415oAoGCCqGSM49 +AwEHoUQDQgAE9n+021OrkgC2F0nN4OzhVrWm2O+C7OFQn3q9YDOWGJAU9TpIeUKo +6Kd0WW8CMTpeC+6RqKS6d0kB3AOg+d1UHA== +-----END EC PRIVATE KEY----- diff --git a/credentials/development/commissioner_dut/struct_pai_ext_basic_pathlen_presence_wrong/pai-Cert.der b/credentials/development/commissioner_dut/struct_pai_ext_basic_pathlen_presence_wrong/pai-Cert.der new file mode 100644 index 0000000000000000000000000000000000000000..91e9c7a1b556e6d077e42da8a99931eb1f34f937 GIT binary patch literal 448 zcmXqLV%%fU#F)5%nTe5!iG$oCN(R zD|7nu)=kx46rEpR9B!YuFQHuKgq;6{;A1MP8ErQ^@5jZ@?VS7S{p9P5t_4hHlYF!| z*&xw?ALv0@VMfOPEUX61K+1p*B)|_60EPi0n}IBd&&MLhBEtD(^}$^-%JWW{FtgSu zdbV1&??^U~2T3cl07I%lB<%$^JeZcK^{(_dOl zThaT`_OQJe`+~_I`Fd?zmbdosFS+oiTS~jpiXW(Ce^T)OvnF@XGVS;*d}|U?w4V-=LJ?1sBMDCpew8nxTW^1JS3hCCV0RqI9#7Cy b#v~B5>s2mIW8KE2V6nF(ao^ppEvBWNNnHNZj=S}6 SW!4r6?XUQJSX;b*+I0YQ`9|3Q literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_pai_ext_extended_key_usage_present/dac-Cert.der b/credentials/development/commissioner_dut/struct_pai_ext_extended_key_usage_present/dac-Cert.der new file mode 100644 index 0000000000000000000000000000000000000000..a454952fea9c884fa39a353620f2fb8951423b3e GIT binary patch literal 466 zcmXqLVmxQi#8|R`nTe5!i6d9~iKa@0>?{K=HV&;ek8`#x%uEIbh7ty1Y|No7%sl+Q zi6teeMG7IQ#U%;>j-G}h210CH+H8z0j7^Jbm>79j+}zv@4HU$Ajf@OTj0_+kN`l`K z2n>ykfymU-)H2Gz4TqU7j?UQ4L=$D=VX*)i9%&%V#twEV6C>2g%#7^JP7Ew_873t5 zT|KCg>HFQuN+vD3^+n1AZF|2P_g_mdTYG+gSIEPKs*%qn+Si$Aohmtd>`*gH=0`t% zOY!BbTd%mE)xNbj!643n2k32CVMfOPEKCLr27DkMKZpkm7WM`MSrDI(MT|vc;}NEN zbMM}L_{}Wi>_UUBPq%ySnQI^ql2&E`23~_m@Z5yIC;ED>%{Z0SabwO=lLm9-?gj3y>GJ2 e4NpUkb2B-PEpC}P;jG!sr2K2@*1b>W&I17He2&ck literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_pai_ext_extended_key_usage_present/dac-Cert.pem b/credentials/development/commissioner_dut/struct_pai_ext_extended_key_usage_present/dac-Cert.pem new file mode 100644 index 00000000000000..35647681415c40 --- /dev/null +++ b/credentials/development/commissioner_dut/struct_pai_ext_extended_key_usage_present/dac-Cert.pem @@ -0,0 +1,12 @@ +-----BEGIN CERTIFICATE----- +MIIBzjCCAXSgAwIBAgIIbRvkKSR4HZowCgYIKoZIzj0EAwIwMDEYMBYGA1UEAwwP +TWF0dGVyIFRlc3QgUEFJMRQwEgYKKwYBBAGConwCAQwERkZGMTAgFw0yMjA0MjAw +MDAwMDBaGA85OTk5MTIzMTIzNTk1OVowRjEYMBYGA1UEAwwPTWF0dGVyIFRlc3Qg +REFDMRQwEgYKKwYBBAGConwCAQwERkZGMTEUMBIGCisGAQQBgqJ8AgIMBDgwMDAw +WTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAASdAJBhjtXBKGlN90I6HGZbhehkkCs/ +Ttjf6xumrc+/ilThoSVZ5xiHrjQqynTNxsKDBGnxTg85F6cFtdRHzSvao2AwXjAM +BgNVHRMBAf8EAjAAMA4GA1UdDwEB/wQEAwIHgDAdBgNVHQ4EFgQUscQC3p3d3eH2 +NmjNoTC15bdJvJ0wHwYDVR0jBBgwFoAUU51g/ciOjNaYymqI2JzFNIAY8DUwCgYI +KoZIzj0EAwIDSAAwRQIgRM3YEgb8BRlLLrbbzT0Sok/a5QNd6zQbd6Oa0jENGcYC +IQD3urqAR46THNhJMQjOmQjGo4SZkM022WJv1ic7jeSdng== +-----END CERTIFICATE----- diff --git a/credentials/development/commissioner_dut/struct_pai_ext_extended_key_usage_present/dac-Key.der b/credentials/development/commissioner_dut/struct_pai_ext_extended_key_usage_present/dac-Key.der new file mode 100644 index 0000000000000000000000000000000000000000..ebe7f3a9214556e601872f6aadc7880da5fed948 GIT binary patch literal 121 zcmV-<0EYiCcLD(c1R$15y0Ms^pi{CM%Y=NUT+a~RGqkaE8>}3NZ>>Ek27I6j1_&yK zNX|V20SBQ(13~}1d%#7^JP7Ew67sT0$x`L zR9450IY&(zBtDoL$b+PnS%AUSAd>Z0sa!r#{>^?d$LZ+;ckUQ2EUYt704Y!fnI~o- z!o~p%I9676W+pg`5jo(QJs1pJnG}3Z{JD7d?Rn*2!6Mo5WhED^ b$29GPn}4Dx6c(kh=FeGgFE*YLi|bP5Yh*I^ literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_pai_ext_extended_key_usage_present/pai-Key.pem b/credentials/development/commissioner_dut/struct_pai_ext_extended_key_usage_present/pai-Key.pem new file mode 100644 index 00000000000000..419e55b38c70af --- /dev/null +++ b/credentials/development/commissioner_dut/struct_pai_ext_extended_key_usage_present/pai-Key.pem @@ -0,0 +1,5 @@ +-----BEGIN EC PRIVATE KEY----- +MHcCAQEEIN2ZM/2MI4zaAAkF+1m4p+f9O1pAkwDR8XIQoHsLsi/woAoGCCqGSM49 +AwEHoUQDQgAEJNAXB2P49al3RgFacwI0oPBi6I5QSFAny10z9R55tcc6excPyeGL +bMc07YSbf6IoFBalsObPWW8vNp4Ri+tS5Q== +-----END EC PRIVATE KEY----- diff --git a/credentials/development/commissioner_dut/struct_pai_ext_extended_key_usage_present/test_case_vector.json b/credentials/development/commissioner_dut/struct_pai_ext_extended_key_usage_present/test_case_vector.json new file mode 100644 index 00000000000000..1cf21e133a58e1 --- /dev/null +++ b/credentials/development/commissioner_dut/struct_pai_ext_extended_key_usage_present/test_case_vector.json @@ -0,0 +1,9 @@ +{ + "description": "PAI Test Vector: Certificate includes optional Extended Key Usage extension", + "is_success_case": "true", + "dac_cert": "308201ce30820174a00302010202086d1be42924781d9a300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313020170d3232303432303030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d030107034200049d0090618ed5c128694df7423a1c665b85e864902b3f4ed8dfeb1ba6adcfbf8a54e1a12559e71887ae342aca74cdc6c2830469f14e0f3917a705b5d447cd2bdaa360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414b1c402de9ddddde1f63668cda130b5e5b749bc9d301f0603551d23041830168014539d60fdc88e8cd698ca6a88d89cc5348018f035300a06082a8648ce3d0403020348003045022044cdd81206fc05194b2eb6dbcd3d12a24fdae5035deb341b77a39ad2310d19c6022100f7baba80478e931cd8493108ce9908c6a3849990cd36d9626fd6273b8de49d9e", + "pai_cert": "308201e230820188a003020102020847ce31e24a6ae91c300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303432303030303030305a180f39393939313233313233353935395a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d0301070342000424d0170763f8f5a97746015a730234a0f062e88e50485027cb5d33f51e79b5c73a7b170fc9e18b6cc734ed849b7fa2281416a5b0e6cf596f2f369e118beb52e5a3818930818630120603551d130101ff040830060101ff020101300e0603551d0f0101ff040403020106301d0603551d0e04160414539d60fdc88e8cd698ca6a88d89cc5348018f035301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e30200603551d250101ff0416301406082b0601050507030206082b06010505070301300a06082a8648ce3d040302034800304502204cc8fcd1ddedcf23fa53146b5f76a9e5e9abbf3b327e8c22dd86c7eaf717e9e1022100c2b60628f28bd08448274cb9cdb0bfe4a110ad1e71d41a9b5cfece8f5398abae", + "certification_declaration": "3081e906092a864886f70d010702a081db3081d8020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d040302044730450221009e517b74b38b852f7a859a0619d04ae6063c4b5bc3957182fd068d23756605b6022038bd7461bedd8ab4357589620a4f96c7468c0a697d7212bf78f3c32b178f96d7", + "dac_private_key": "964abab1989ea053b21acb847ca65ccf10de33b4b1741bac1c886fad3d29067c", + "dac_public_key": "049d0090618ed5c128694df7423a1c665b85e864902b3f4ed8dfeb1ba6adcfbf8a54e1a12559e71887ae342aca74cdc6c2830469f14e0f3917a705b5d447cd2bda" +} diff --git a/credentials/development/commissioner_dut/struct_pai_ext_key_usage_critical_missing/cd.der b/credentials/development/commissioner_dut/struct_pai_ext_key_usage_critical_missing/cd.der new file mode 100644 index 0000000000000000000000000000000000000000..773ed44abf832e2fc1c418b081ce06f2f252bd95 GIT binary patch literal 235 zcmXqLe8I-4)#lOmotKfFX+h&HgU0JjjLe3-2Hb3%32h#Xsmv@)j0UapG#WN-KB%|o9t96nm Sdk&pVljmgd+wpTwGamq;MM%W} literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_pai_ext_key_usage_critical_missing/dac-Cert.der b/credentials/development/commissioner_dut/struct_pai_ext_key_usage_critical_missing/dac-Cert.der new file mode 100644 index 0000000000000000000000000000000000000000..a59b4865e1500a8f1caaabd0c1705a78b86e9c69 GIT binary patch literal 467 zcmXqLVmxoq#8|R`nTe5!i6dA`Shas;(GCMHHV&;ek8`#x%uEIbh7ty1Y|No7%sl+Q zi6teeMG7IQ#U%;>j-G}h210CH+H8z0j7^Jbm>79j+}zv@4HU$Ajf@OTj0_+kN`l`K z2n>ykfymU-)H2Gz4TqU7j?UQ4L=$D=VX*)i9%&%V#twEV6C>2g%#7^JP7Ewum&-SN z|7V=H>k$LrkN0-Fxo_MLH$E1|BwM?SRd0vxY1?0XK7rGM;vO}6h~)*xJ`O(qs_12C zTEGv(c}MlW@}60oU=U}(1N646FeBrC7A6A*13nOsAH)L&3wwisEQrs?BE}+8nBOWJ z_$}A?>{B+zYNvO;NfUa08pwmBm05s+*C3*}l4mYUe)XeEk27W&ow-=;uwq>+av(E% zG8niqDKb1-o>sC(Y@c}kb4?C5)2pj0yL3J;NlxjCwLYTm(Ch2~RMK`WdU{Ffq4Ktg b$CO?kh*S=gxbUODf46$;x{l8#y527U$C!%s literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_pai_ext_key_usage_critical_missing/dac-Cert.pem b/credentials/development/commissioner_dut/struct_pai_ext_key_usage_critical_missing/dac-Cert.pem new file mode 100644 index 00000000000000..7109505fe34bab --- /dev/null +++ b/credentials/development/commissioner_dut/struct_pai_ext_key_usage_critical_missing/dac-Cert.pem @@ -0,0 +1,12 @@ +-----BEGIN CERTIFICATE----- +MIIBzzCCAXSgAwIBAgIIUyoTJY+pcrgwCgYIKoZIzj0EAwIwMDEYMBYGA1UEAwwP +TWF0dGVyIFRlc3QgUEFJMRQwEgYKKwYBBAGConwCAQwERkZGMTAgFw0yMjA0MjAw +MDAwMDBaGA85OTk5MTIzMTIzNTk1OVowRjEYMBYGA1UEAwwPTWF0dGVyIFRlc3Qg +REFDMRQwEgYKKwYBBAGConwCAQwERkZGMTEUMBIGCisGAQQBgqJ8AgIMBDgwMDAw +WTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAAQK03ew9/4zbrriAA747z67C9jfVzPG +VgIdfboFLrgtyz36DkxRllJe4oFIFm5TXeNTx+py6VVmUPgxnsUu9Q3Mo2AwXjAM +BgNVHRMBAf8EAjAAMA4GA1UdDwEB/wQEAwIHgDAdBgNVHQ4EFgQUcW+FHVH2bTPN +5QYBe0LuTWKQjPkwHwYDVR0jBBgwFoAUIakMnQRve+LS42iaMszRe0CoroUwCgYI +KoZIzj0EAwIDSQAwRgIhAOKnZnSsFr4Xb+cpCAY11ap5iizzpGNkil07xCdAjUNA +AiEAhtZbl3RlwneGkcYi6cBZI1EY0PiPj7snha6I8zQtS+g= +-----END CERTIFICATE----- diff --git a/credentials/development/commissioner_dut/struct_pai_ext_key_usage_critical_missing/dac-Key.der b/credentials/development/commissioner_dut/struct_pai_ext_key_usage_critical_missing/dac-Key.der new file mode 100644 index 0000000000000000000000000000000000000000..1ad6b68646477d86ccb486eb1d79fad02b82d3fc GIT binary patch literal 121 zcmV-<0EYiCcLD(c1R$~VH%SPw7|~QPP1}4pvs_&kY^&A%yX~OyNiVkJmJpx{1_&yK zNX|V20SBQ(13~}<3e$J6_x>|(y5ay1`0qZu3)tURGsac|9euh5F1RhrJ^BtzQI=9( b;(_%WWvF7*w}+7~qD literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_pai_ext_key_usage_critical_missing/dac-Key.pem b/credentials/development/commissioner_dut/struct_pai_ext_key_usage_critical_missing/dac-Key.pem new file mode 100644 index 00000000000000..a0f98ee1892c2d --- /dev/null +++ b/credentials/development/commissioner_dut/struct_pai_ext_key_usage_critical_missing/dac-Key.pem @@ -0,0 +1,5 @@ +-----BEGIN EC PRIVATE KEY----- +MHcCAQEEILHzN0kIsRjRVDBN23w4s1xdFmyr1f277aDxSS+245YQoAoGCCqGSM49 +AwEHoUQDQgAECtN3sPf+M2664gAO+O8+uwvY31czxlYCHX26BS64Lcs9+g5MUZZS +XuKBSBZuU13jU8fqculVZlD4MZ7FLvUNzA== +-----END EC PRIVATE KEY----- diff --git a/credentials/development/commissioner_dut/struct_pai_ext_key_usage_critical_missing/pai-Cert.der b/credentials/development/commissioner_dut/struct_pai_ext_key_usage_critical_missing/pai-Cert.der new file mode 100644 index 0000000000000000000000000000000000000000..20db1e7ea764aca85cbc95e24d7d3aedad9a61a5 GIT binary patch literal 446 zcmXqLV%%lW#F)5%nTe5!i6d>{h9cAb(a#OI*f_M>JkHs&Ff$n#7)lt3u`!3TF!S*H zCYF?>7Ab_J7MCalI64}N7znX(X|pl1Fg7i!VPfQAadUGsG*A%dH8L_VF*1OFC<%T` zATTsC1|m~SQ_CnkW_scJobofudi7A%~sEBkbLckic^%tE72 zUJa{~TJ<_avXjq!*qYUKvZP(fi*??Cf1TwK1uIq@-|@osVP{@TOxBf|vfsPPUQJn? zY>)`_26L#aFeBrC77hb8AjQPUXuu5;<7WYe0VA7%EQrI$BE}-3xRPfsOMdmEOOG>V z8J)RU?XY59tARX7TA2kHQVk+mf0fGR1LfcB7jvARE^z0L;ljc?^@cyA?^!>CfgY%17ZhDSBd7P2lF?D2$i4;1_&yK zNX|V20SBQ(13~}<;c%goEgj{ji;ePRX>l_0N`R_jg)WE`Yh%vvwQ7pVbcZ5J1)jkE biFa6VsHn%d=sn?yZiHNF)R`UkigxOhgPb#w literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_pai_ext_key_usage_critical_missing/pai-Key.pem b/credentials/development/commissioner_dut/struct_pai_ext_key_usage_critical_missing/pai-Key.pem new file mode 100644 index 00000000000000..ed0fb76b1159cd --- /dev/null +++ b/credentials/development/commissioner_dut/struct_pai_ext_key_usage_critical_missing/pai-Key.pem @@ -0,0 +1,5 @@ +-----BEGIN EC PRIVATE KEY----- +MHcCAQEEIGvoKTqhAuw+VhAh7guFJtsZJgNiB0tXieamB/M3hQiVoAoGCCqGSM49 +AwEHoUQDQgAE4XChky0d5aeLjfJkaXEy8kqAqmKFLogUa2PO8LVqisl0hyJKBZ7A +/ol3WHCoqMe46D3hiW6EXGrUmR33inbqlA== +-----END EC PRIVATE KEY----- diff --git a/credentials/development/commissioner_dut/struct_pai_ext_key_usage_critical_missing/test_case_vector.json b/credentials/development/commissioner_dut/struct_pai_ext_key_usage_critical_missing/test_case_vector.json new file mode 100644 index 00000000000000..4d8e1a7c2c6480 --- /dev/null +++ b/credentials/development/commissioner_dut/struct_pai_ext_key_usage_critical_missing/test_case_vector.json @@ -0,0 +1,9 @@ +{ + "description": "PAI Test Vector: Certificate Key Usage extension critical field is missing", + "is_success_case": "false", + "dac_cert": "308201cf30820174a0030201020208532a13258fa972b8300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313020170d3232303432303030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d030107034200040ad377b0f7fe336ebae2000ef8ef3ebb0bd8df5733c656021d7dba052eb82dcb3dfa0e4c5196525ee28148166e535de353c7ea72e9556650f8319ec52ef50dcca360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414716f851d51f66d33cde506017b42ee4d62908cf9301f0603551d2304183016801421a90c9d046f7be2d2e3689a32ccd17b40a8ae85300a06082a8648ce3d0403020349003046022100e2a76674ac16be176fe729080635d5aa798a2cf3a463648a5d3bc427408d434002210086d65b977465c2778691c622e9c059235118d0f88f8fbb2785ae88f3342d4be8", + "pai_cert": "308201ba30820161a003020102020866a1b07235bf5be7300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303432303030303030305a180f39393939313233313233353935395a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d03010703420004e170a1932d1de5a78b8df264697132f24a80aa62852e88146b63cef0b56a8ac97487224a059ec0fe89775870a8a8c7b8e83de1896e845c6ad4991df78a76ea94a363306130120603551d130101ff040830060101ff020101300b0603551d0f040403020106301d0603551d0e0416041421a90c9d046f7be2d2e3689a32ccd17b40a8ae85301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d040302034700304402204df1248dd346ab1959298df2e1203593afd047b6a9d763b3853ed6d89bb92b3302204c2cc79f7c296c57d5ba41fbfb5507171a26c35574d459604fc9f6feb6833a60", + "certification_declaration": "3081e806092a864886f70d010702a081da3081d7020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317c307a020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204463044022016a10fbb091c9f1dfcea447a6c650472c16ce8b1f9efdfce8a2dd69a87633950022026ed8b4a9435f794496465c90115dad57e19c98cc2cd661f09044eb8f99c830e", + "dac_private_key": "b1f3374908b118d154304ddb7c38b35c5d166cabd5fdbbeda0f1492fb6e39610", + "dac_public_key": "040ad377b0f7fe336ebae2000ef8ef3ebb0bd8df5733c656021d7dba052eb82dcb3dfa0e4c5196525ee28148166e535de353c7ea72e9556650f8319ec52ef50dcc" +} diff --git a/credentials/development/commissioner_dut/struct_pai_ext_key_usage_critical_wrong/cd.der b/credentials/development/commissioner_dut/struct_pai_ext_key_usage_critical_wrong/cd.der new file mode 100644 index 0000000000000000000000000000000000000000..8c0dddaa5d19fc5d340bc6b9572bc22704428ccf GIT binary patch literal 235 zcmXqLe8I-4)#lOmotKfFX+h&HgU0JjjLe3-2Hb3%32h#Xsmv@)j0UaRBh<%bzNAr-zv@}J`~@q|s2_8A@vb8O!U-k?BL%kJ_d;5GxU;vGUi^B2mCJB} S`*nkZ0&~kl4H}Q|p9BCVo<;`% literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_pai_ext_key_usage_critical_wrong/dac-Cert.der b/credentials/development/commissioner_dut/struct_pai_ext_key_usage_critical_wrong/dac-Cert.der new file mode 100644 index 0000000000000000000000000000000000000000..5994db23ee89dc43c681a42b490675350657e332 GIT binary patch literal 466 zcmXqLVmxQi#8|R`nTe5!iNis6r+VCv+a(5EY#dr`9_MUXn3)U=3?&T2*qB3En0fep z6H7``ixfgqi%S#&96b$1420OYwAmP07@HQ=FfsD5xVgC*8YqbK8W|aw7#To7lmx#e z5EvR61Cgnvsb!Rb8xAvF9G$V7i6+X#!(st4JkmgzjUDV#CPt`}nHkxcofug5S@@g| zpK@H@IY`j!yhmAgZ*w^z bM9Ur~bT#y_4mB+h)18t${>Mx1Cia6ct<*5r literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_pai_ext_key_usage_critical_wrong/dac-Key.pem b/credentials/development/commissioner_dut/struct_pai_ext_key_usage_critical_wrong/dac-Key.pem new file mode 100644 index 00000000000000..af6abfec73d6f1 --- /dev/null +++ b/credentials/development/commissioner_dut/struct_pai_ext_key_usage_critical_wrong/dac-Key.pem @@ -0,0 +1,5 @@ +-----BEGIN EC PRIVATE KEY----- +MHcCAQEEIP4QnKbZIkAwC0Km3XAD3lYcB1IZgvUpGHHqjKhI2oyPoAoGCCqGSM49 +AwEHoUQDQgAEvjhMy1eUxx9DUhFKyepHsWRrewaUBTCeXs8xx0RP0Ui7q/UNxQW7 +tkTLHiZ0NfSwDjUtENOdkjz+x0vuJvaDMA== +-----END EC PRIVATE KEY----- diff --git a/credentials/development/commissioner_dut/struct_pai_ext_key_usage_critical_wrong/pai-Cert.der b/credentials/development/commissioner_dut/struct_pai_ext_key_usage_critical_wrong/pai-Cert.der new file mode 100644 index 0000000000000000000000000000000000000000..46129ac8016a9b031cafb1afedcc7749b92d5b8a GIT binary patch literal 447 zcmXqLV%%-e#F)5%nTe5!iKDRF>SxuGBQ^$HY#dr`9_MUXn3)U=3?&T2*qB3En0fep z6H7``ixfgqi%S#&932fs420OYwAmP07@HQ=FfsD5xVgC*8YqbK8W|aw7#To7lmx#e z5EvR61Cgnvsbv%%Gd*#b8EGKQ#twE96C>1d%#7^JP7EyHBHCKcG(WoYzu~p9zv8ldvW!} z$p(o)Z!m|-3NtePXW=kl15!+kj0W5wF@6?c7%;LK$bvY0EMhDoB`gYD{SQxa?lCTO zdnHnA#Zvrvwt+lITA2kHQVk+mf0fGR1LfcB7jvARE^z0L;ljc?xY6?MeA%A1*n$?#w+VMTX9wM^9LJ=(aS76PlmEFVVw7Ei-6N8H3`fM+B4Z?4(hBlxI1_&yK zNX|V20SBQ(13~}<_E?65%!A_G|A6Z=Pa*E~H#dK2PqXDl9)B(V1E(-%7-2yDR~F2f b-uA8L&Cnudg T@$k*Hs|}GJX^D9;z5Y7^O-xG` literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_pai_ext_key_usage_crl_sign_wrong/dac-Cert.der b/credentials/development/commissioner_dut/struct_pai_ext_key_usage_crl_sign_wrong/dac-Cert.der new file mode 100644 index 0000000000000000000000000000000000000000..9e3ae97471e915c86e764029ea85cff17a448a73 GIT binary patch literal 467 zcmXqLVmxoq#8|R`nTe5!i9<*0VD8N~?L7uuY#dr`9_MUXn3)U=3?&T2*qB3En0fep z6H7``ixfgqi%S#&96b$1420OYwAmP07@HQ=FfsD5xVgC*8YqbK8W|aw7#To7lmx#e z5EvR61Cgnvsb!Rb8xAvF9G$V7i6+X#!(st4JkmgzjUDV#CPt`}nHkxcofufGYfdZ7 z?3rzH>RQH84!f6pk^Qx|j!aWXXM4LxHZ1G?m6qOXj~u;Bjh~*;I<<3Jm3Wve%O$Pe zZyi%Mv`t7qq!PV2!643n2k32CVMfOPEKCLr27DkMKZpkm7WM`MSrDI(MT|wnao%>> zsS}sB-92Jle*eJFeG1ZF4;#pXq?K8Kf!82%B7*T~yp#^tr1A&zHca&iUD4LtiyX+z zo(u+VOo|Lse_n5@t}J*g@~KefKmkweFvKlE?y! cJGDg{{$F@68=KRY;lb^^=Dye@+pk5}00LT##sB~S literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_pai_ext_key_usage_crl_sign_wrong/dac-Cert.pem b/credentials/development/commissioner_dut/struct_pai_ext_key_usage_crl_sign_wrong/dac-Cert.pem new file mode 100644 index 00000000000000..8509fa14bbd1a7 --- /dev/null +++ b/credentials/development/commissioner_dut/struct_pai_ext_key_usage_crl_sign_wrong/dac-Cert.pem @@ -0,0 +1,12 @@ +-----BEGIN CERTIFICATE----- +MIIBzzCCAXSgAwIBAgIILCrBbdnsh4wwCgYIKoZIzj0EAwIwMDEYMBYGA1UEAwwP +TWF0dGVyIFRlc3QgUEFJMRQwEgYKKwYBBAGConwCAQwERkZGMTAgFw0yMjA0MjAw +MDAwMDBaGA85OTk5MTIzMTIzNTk1OVowRjEYMBYGA1UEAwwPTWF0dGVyIFRlc3Qg +REFDMRQwEgYKKwYBBAGConwCAQwERkZGMTEUMBIGCisGAQQBgqJ8AgIMBDgwMDAw +WTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAAQ7fMsgmYybNMrWaMUIPukOWY992sSW +IGcG7bwdVmrv1ISN1uJBSjUz5cwqyrmWehdWHQTSKo32iJSwhpBnwiRbo2AwXjAM +BgNVHRMBAf8EAjAAMA4GA1UdDwEB/wQEAwIHgDAdBgNVHQ4EFgQUQZ63HZWRpYbd +xDN338D5viAb9cMwHwYDVR0jBBgwFoAUyFgBxV8aLAqSd+CesJVMVaiGjY0wCgYI +KoZIzj0EAwIDSQAwRgIhAJX514J7eXDjFPJxHMB19jzYTosOOSAY1WYYs38ZS2U7 +AiEAk5qu/idiFKA43H1ysP/Q7x1dbI5oSAtDrN8Wkj31ctY= +-----END CERTIFICATE----- diff --git a/credentials/development/commissioner_dut/struct_pai_ext_key_usage_crl_sign_wrong/dac-Key.der b/credentials/development/commissioner_dut/struct_pai_ext_key_usage_crl_sign_wrong/dac-Key.der new file mode 100644 index 0000000000000000000000000000000000000000..53af0454bf5bd5172c3b23e98531e63fc16f66ea GIT binary patch literal 121 zcmV-<0EYiCcLD(c1R!FMY1(A&+Kq)*^pW9uZ?F_yaU-np0*C1U425f@i9(%GPMb2tMf!S&x0%#Fiju2JO5ZR%-9mgpJnXK}t0< b<;*I|xt4ktRviS=DvkDtl(2@7XTl^~@4__P literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_pai_ext_key_usage_crl_sign_wrong/dac-Key.pem b/credentials/development/commissioner_dut/struct_pai_ext_key_usage_crl_sign_wrong/dac-Key.pem new file mode 100644 index 00000000000000..9cfe93724fbc34 --- /dev/null +++ b/credentials/development/commissioner_dut/struct_pai_ext_key_usage_crl_sign_wrong/dac-Key.pem @@ -0,0 +1,5 @@ +-----BEGIN EC PRIVATE KEY----- +MHcCAQEEIGKPadpk7tqNhVf0keF6b7AUXXEjrPECh+kADIVrpYlCoAoGCCqGSM49 +AwEHoUQDQgAEO3zLIJmMmzTK1mjFCD7pDlmPfdrEliBnBu28HVZq79SEjdbiQUo1 +M+XMKsq5lnoXVh0E0iqN9oiUsIaQZ8IkWw== +-----END EC PRIVATE KEY----- diff --git a/credentials/development/commissioner_dut/struct_pai_ext_key_usage_crl_sign_wrong/pai-Cert.der b/credentials/development/commissioner_dut/struct_pai_ext_key_usage_crl_sign_wrong/pai-Cert.der new file mode 100644 index 0000000000000000000000000000000000000000..111744fe59df962dea06ff5896a12dc6a8b22c80 GIT binary patch literal 450 zcmXqLV%%rY#F(;xnTe5!i9_8fw&&Q5-XsGqHV&;ek8`#x%uEIbh7ty1Y|No7%sl+Q zi6teeMG7IQ#U%;>j*f;R210CH+H8z0j7^Jbm>79j+}zv@4HU$Ajf@OTj0_+kN`l`K z2n>ykfymU-)G`W>nVvYzj5H8tV+Xs5i4p2JW=3{qCk7TB1BH5aMb~4iukJ0fIWYgl zY37toW{oC|nS%bBk5yy!SDw&LZ`r3mLqdPvQDt9&oMneLEt;&7<;A$~evMPE>6XQ5 z1}Q*qFo((tGcx{X;V@tWQcR4D27DkfevlY27?@ZLWI=pB7BLo)6A_F@IZq{#4C z`E#z{l5KmYUt;+@Nid@|^UhRsO^M@r VQ##XuTgG}xf}!!o`w!Ju0RZ(tf&c&j literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_pai_ext_key_usage_crl_sign_wrong/pai-Cert.pem b/credentials/development/commissioner_dut/struct_pai_ext_key_usage_crl_sign_wrong/pai-Cert.pem new file mode 100644 index 00000000000000..0905e9c3765eea --- /dev/null +++ b/credentials/development/commissioner_dut/struct_pai_ext_key_usage_crl_sign_wrong/pai-Cert.pem @@ -0,0 +1,12 @@ +-----BEGIN CERTIFICATE----- +MIIBvjCCAWSgAwIBAgIIJ0JdjMbYjWIwCgYIKoZIzj0EAwIwMDEYMBYGA1UEAwwP +TWF0dGVyIFRlc3QgUEFBMRQwEgYKKwYBBAGConwCAQwERkZGMTAgFw0yMjA0MjAw +MDAwMDBaGA85OTk5MTIzMTIzNTk1OVowMDEYMBYGA1UEAwwPTWF0dGVyIFRlc3Qg +UEFJMRQwEgYKKwYBBAGConwCAQwERkZGMTBZMBMGByqGSM49AgEGCCqGSM49AwEH +A0IABCwwIH8HIUXGq9W9cjzAn+jLA2SyNoE0gWkRTynjJV0vqcgrZ4S+L5gYL57F +I00QbKbCsqKTJGpKAb7ffEJtNbSjZjBkMBIGA1UdEwEB/wQIMAYBAf8CAQEwDgYD +VR0PAQH/BAQDAgIEMB0GA1UdDgQWBBTIWAHFXxosCpJ34J6wlUxVqIaNjTAfBgNV +HSMEGDAWgBRq/SJ3H1Ef7L8WQZdnENzcMaFxfjAKBggqhkjOPQQDAgNIADBFAiEA +4yPzbU6ktryX0gTzkhFodmJc6rnpLgUn6BWSne6a8V4CIAS6rQi9EimrLw2ZIUVk +XgrsdZlACxw7pGAxM7Hf4Seq +-----END CERTIFICATE----- diff --git a/credentials/development/commissioner_dut/struct_pai_ext_key_usage_crl_sign_wrong/pai-Key.der b/credentials/development/commissioner_dut/struct_pai_ext_key_usage_crl_sign_wrong/pai-Key.der new file mode 100644 index 0000000000000000000000000000000000000000..7118a2cace263847dbec56680e0fc0ddd4ee78bb GIT binary patch literal 121 zcmV-<0EYiCcLD(c1R&f8fu@Ej-G}h210CH+H8z0j7^Jbm>79j+}zv@4HU$Ajf@OTj0_+kN`l`K z2n>ykfymU-)H2Gz4TqU7j?UQ4L=$D=VX*)i9%&%V#twEV6C>2g%#7^JP7ExX56nzd z-dghgd|gs_|4Q1{ympK2WkQz!RZ<=(GzcnKFOWIR_x)X25}WhMkKJ!2C+p@Je7tZ~ zCQ3t4FRnrJ!q3GC25|;FKyS+mGcx{XVKQJa-~;jaK|Elvus0aUg7|zaVk{z|6Xxdz z230O_lepn`{>I-`{l8+a8pwmBm05s+*C4XIZq)?J8x+}WDh5OcZk1su^nO7LgO}ICA{@oiZ-J5M0`&Rv6Qe-$PoOHx+U#^mj c>zagPKjWsqN+~&+8P~L1E>Jw_lFW-m0MF8m*8l(j literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_pai_ext_key_usage_dig_sig_wrong/dac-Cert.pem b/credentials/development/commissioner_dut/struct_pai_ext_key_usage_dig_sig_wrong/dac-Cert.pem new file mode 100644 index 00000000000000..940220a7b0fe86 --- /dev/null +++ b/credentials/development/commissioner_dut/struct_pai_ext_key_usage_dig_sig_wrong/dac-Cert.pem @@ -0,0 +1,12 @@ +-----BEGIN CERTIFICATE----- +MIIBzjCCAXSgAwIBAgIIC4u07HoxDRkwCgYIKoZIzj0EAwIwMDEYMBYGA1UEAwwP +TWF0dGVyIFRlc3QgUEFJMRQwEgYKKwYBBAGConwCAQwERkZGMTAgFw0yMjA0MjAw +MDAwMDBaGA85OTk5MTIzMTIzNTk1OVowRjEYMBYGA1UEAwwPTWF0dGVyIFRlc3Qg +REFDMRQwEgYKKwYBBAGConwCAQwERkZGMTEUMBIGCisGAQQBgqJ8AgIMBDgwMDAw +WTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAAQp4DY0JO05DvnrdHHf1Ga1boc4t3YS +Of8kZOAggBEgO6Acww737nZiBkPJ8YvtGZMtbjDx0NUcWigRLl6AKdD5o2AwXjAM +BgNVHRMBAf8EAjAAMA4GA1UdDwEB/wQEAwIHgDAdBgNVHQ4EFgQUVZCfbVFSeaBG +GNhOz9j9qo/6XNUwHwYDVR0jBBgwFoAUuetPx/mKxu/s4mt6++GsPFIMFq4wCgYI +KoZIzj0EAwIDSAAwRQIgdG0VuluARAva10j0jMsDqDMekN6dn93YqUeDPQGOqvgC +IQDFE2LEMb5tIhxFrGDG+V6X6mR0yWlegrseURdi0hzoog== +-----END CERTIFICATE----- diff --git a/credentials/development/commissioner_dut/struct_pai_ext_key_usage_dig_sig_wrong/dac-Key.der b/credentials/development/commissioner_dut/struct_pai_ext_key_usage_dig_sig_wrong/dac-Key.der new file mode 100644 index 0000000000000000000000000000000000000000..e227ae6300b54d283d8192406cafa747c1f56cc6 GIT binary patch literal 121 zcmV-<0EYiCcLD(c1Rz_p>H){ryx9(Rp-iZ|ckV)cnIdO&e#p3*cCuUCGBThF1_&yK zNX|V20SBQ(13~}JkHs&Ff$n#7)lt3u`!3TF!S*H zCYF?>7Ab_J7MCalI64}N7znX(X|pl1Fg7i!VPfQAadUGsG*A%dH8L_VF*1OFC<%T` zATTsC1|m~SQ_CnkW_scJobofudQI-fY|XsS3fRB(Ab&D;OH zq2k!ayLrZ+7w%Urh{^2zp76!MaQDByf0rIExv=HTdG&M!@3+3TPX(gSTu7Jm)19+8 z%^(Hn4dzf;VMfOPEF1=GK#GZx(SQ#m#t#w$1_NW8fh>s6$0Eievh%h7@tyQJL*`2|_g-OBg zwYt2a)cPY18i9TiZT8o`zTK%br`2hbCg-oRFDn?8nG|$#OAeGMo%b&jTK&lVDvCCyZ(;; b(&41gw9L;ZXCO=MO+DohTg=dB9!@QsgU2+v literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_pai_ext_key_usage_dig_sig_wrong/pai-Key.pem b/credentials/development/commissioner_dut/struct_pai_ext_key_usage_dig_sig_wrong/pai-Key.pem new file mode 100644 index 00000000000000..8e8fc0cf720ac8 --- /dev/null +++ b/credentials/development/commissioner_dut/struct_pai_ext_key_usage_dig_sig_wrong/pai-Key.pem @@ -0,0 +1,5 @@ +-----BEGIN EC PRIVATE KEY----- +MHcCAQEEIN3Wg87XP3SZGees/FsjU3pmRknvBAigRGNckms/mmcooAoGCCqGSM49 +AwEHoUQDQgAEMInkQSwpJEMAeApI5W6/54B4xrHdbjPzob8lcFxpjfdg9DAxu/6O +/tLhpNC0zM8nZyBL7U095RBbzNBnHk4tnA== +-----END EC PRIVATE KEY----- diff --git a/credentials/development/commissioner_dut/struct_pai_ext_key_usage_dig_sig_wrong/test_case_vector.json b/credentials/development/commissioner_dut/struct_pai_ext_key_usage_dig_sig_wrong/test_case_vector.json new file mode 100644 index 00000000000000..ca148003a218cd --- /dev/null +++ b/credentials/development/commissioner_dut/struct_pai_ext_key_usage_dig_sig_wrong/test_case_vector.json @@ -0,0 +1,9 @@ +{ + "description": "PAI Test Vector: Certificate Key Usage extension diginalSignature field is wrong (not present for DAC and present for PAI", + "is_success_case": "false", + "dac_cert": "308201ce30820174a00302010202080b8bb4ec7a310d19300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313020170d3232303432303030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d0301070342000429e0363424ed390ef9eb7471dfd466b56e8738b7761239ff2464e0208011203ba01cc30ef7ee76620643c9f18bed19932d6e30f1d0d51c5a28112e5e8029d0f9a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e0416041455909f6d515279a04618d84ecfd8fdaa8ffa5cd5301f0603551d23041830168014b9eb4fc7f98ac6efece26b7afbe1ac3c520c16ae300a06082a8648ce3d04030203480030450220746d15ba5b80440bdad748f48ccb03a8331e90de9d9fddd8a947833d018eaaf8022100c51362c431be6d221c45ac60c6f95e97ea6474c9695e82bb1e511762d21ce8a2", + "pai_cert": "308201bd30820164a003020102020856faa89dca603f66300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303432303030303030305a180f39393939313233313233353935395a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d030107034200043089e4412c29244300780a48e56ebfe78078c6b1dd6e33f3a1bf25705c698df760f43031bbfe8efed2e1a4d0b4cccf2767204bed4d3de5105bccd0671e4e2d9ca366306430120603551d130101ff040830060101ff020101300e0603551d0f0101ff040403020186301d0603551d0e04160414b9eb4fc7f98ac6efece26b7afbe1ac3c520c16ae301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d040302034700304402203eeb271f311aafc44028514e18863fd6f5edb9229c8542b22909fa76f4a8012302202c6d74c07422cf4f7612abf24c6022bd29f8235035dc847edd8f358958a8c198", + "certification_declaration": "3081ea06092a864886f70d010702a081dc3081d9020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317e307c020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204483046022100d8a4e31e6270ba0e9dc5d019eb91dcdf2b7a55a51b78d47941c756c6fb5ea8fb0221008ef9bf84a762e459ed3f1a54861bc1c8a5767afd1d463f4fa3e7d72c280850d3", + "dac_private_key": "5bb3ea01c7d6bcd90e76a14ca8bb77ee427d992267747ec8b89a76b25bdc3232", + "dac_public_key": "0429e0363424ed390ef9eb7471dfd466b56e8738b7761239ff2464e0208011203ba01cc30ef7ee76620643c9f18bed19932d6e30f1d0d51c5a28112e5e8029d0f9" +} diff --git a/credentials/development/commissioner_dut/struct_pai_ext_key_usage_key_cert_sign_wrong/cd.der b/credentials/development/commissioner_dut/struct_pai_ext_key_usage_key_cert_sign_wrong/cd.der new file mode 100644 index 0000000000000000000000000000000000000000..235ec98e227e88cf7e971992ace354e2f4f798a3 GIT binary patch literal 236 zcmXqLe96YC)#lOmotKfFX+h&{gT@<7jLe3-2Hb3%32h#Xsmv@)j0UamYJT95aKxq3mXEa#a+>AB Td#0r}NNsmandwrS)BYC#%U?)F literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_pai_ext_key_usage_key_cert_sign_wrong/dac-Cert.der b/credentials/development/commissioner_dut/struct_pai_ext_key_usage_key_cert_sign_wrong/dac-Cert.der new file mode 100644 index 0000000000000000000000000000000000000000..6a600f9570741876aabf58c58064687ab304f82b GIT binary patch literal 466 zcmXqLVmxQi#8|R`nTe5!iKArBoa-&=8mb0dY#dr`9_MUXn3)U=3?&T2*qB3En0fep z6H7``ixfgqi%S#&96b$1420OYwAmP07@HQ=FfsD5xVgC*8YqbK8W|aw7#To7lmx#e z5EvR61Cgnvsb!Rb8xAvF9G$V7i6+X#!(st4JkmgzjUDV#CPt`}nHkxcofueVK0W_> zp1jerAKn?qPiqx_+n^yLA-bVbl3UhfvrVCOaFl7$Lfa=>3wEm}Mej@Cda?f1#U2sg zMS13hfh{2oYkw|IFo-kY0eV|jn33^63zGqZ0UwCR58?rXg}uQ*7R2Xc5n~Zy_UHV> zGBbKV=S$H_PQ|w;J8LE}8_0vCm05s+*C5hxK04~u&+Baexz!a}lVc3njYKc9oL;vXLc>|P~gfVZ7UBQVp52>apg@->c8Vv d&3DyXjG4EsP(J_M`)&TYn-)J9E^9ER0|0jTjj{j$ literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_pai_ext_key_usage_key_cert_sign_wrong/dac-Cert.pem b/credentials/development/commissioner_dut/struct_pai_ext_key_usage_key_cert_sign_wrong/dac-Cert.pem new file mode 100644 index 00000000000000..dffd80a6f42f1e --- /dev/null +++ b/credentials/development/commissioner_dut/struct_pai_ext_key_usage_key_cert_sign_wrong/dac-Cert.pem @@ -0,0 +1,12 @@ +-----BEGIN CERTIFICATE----- +MIIBzjCCAXSgAwIBAgIIdJyc14RnKCUwCgYIKoZIzj0EAwIwMDEYMBYGA1UEAwwP +TWF0dGVyIFRlc3QgUEFJMRQwEgYKKwYBBAGConwCAQwERkZGMTAgFw0yMjA0MjAw +MDAwMDBaGA85OTk5MTIzMTIzNTk1OVowRjEYMBYGA1UEAwwPTWF0dGVyIFRlc3Qg +REFDMRQwEgYKKwYBBAGConwCAQwERkZGMTEUMBIGCisGAQQBgqJ8AgIMBDgwMDAw +WTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAASZ5c/rnh8ypvhLaMfLKnP2sCgUGBWw +eRkLHTSzPHE7U1o1cqE95LVwuyViW75gCuiv6tGMFE2ibjdxUYRUgK35o2AwXjAM +BgNVHRMBAf8EAjAAMA4GA1UdDwEB/wQEAwIHgDAdBgNVHQ4EFgQUA08J8gSZW78J +6RV5CSHtyYl8kgMwHwYDVR0jBBgwFoAUgM9bWsr51wb/CychBWKauo6HgP8wCgYI +KoZIzj0EAwIDSAAwRQIhAPXWVfYd+rtzRfm4gqcpSLaexy2YfjbWYcJRqcSGqcLC +AiBY2NTsfGX+x3qD3SeEMwO2qCPP50vtb87ZOPgA0ygBZw== +-----END CERTIFICATE----- diff --git a/credentials/development/commissioner_dut/struct_pai_ext_key_usage_key_cert_sign_wrong/dac-Key.der b/credentials/development/commissioner_dut/struct_pai_ext_key_usage_key_cert_sign_wrong/dac-Key.der new file mode 100644 index 0000000000000000000000000000000000000000..e7f79054c6674d485b5329e3bf17cdb61c9a0846 GIT binary patch literal 121 zcmV-<0EYiCcLD(c1R&A6siV~#T%PP>1mGl$M3*0jN?5r~h6KNt2^+|>)GMG01_&yK zNX|V20SBQ(13~}<1; byCq^FzOpH7%Zfj#0Yg9Gb1~*69dctN5-=m_vgwRvP&{V)>^A_ zJl}e|P${teZ&z04eyv@d=eF9X*R4$aBmN;EC8}MgICS6VU{|Z1FF3{I?i4uOKd?B> zAO+|R=1^H-M#ldv90qJaiiwfYfDa_b4-x|g10$1xEQrs?BE}-pa6UTf)X(c||GCu_ zS(9e%>T7TKZy*nnR%QVPR)a{^U!`*SK>0WO#T=)n3*5P5xUjGeIZ&BB7z|vQ6#R=E z_kTG4`jgfcNnhuwW*40&XL8>B{qp}weevW)*~g8T6dBH*KQYy(R$&XG=BAnPvgAw<8ap`&;3$heyL&n b7w}MIT8AuiRlf66MLN0Y2^JpQa6sR{%*Hd* literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_pai_ext_key_usage_key_cert_sign_wrong/pai-Key.pem b/credentials/development/commissioner_dut/struct_pai_ext_key_usage_key_cert_sign_wrong/pai-Key.pem new file mode 100644 index 00000000000000..98ea0315cdee34 --- /dev/null +++ b/credentials/development/commissioner_dut/struct_pai_ext_key_usage_key_cert_sign_wrong/pai-Key.pem @@ -0,0 +1,5 @@ +-----BEGIN EC PRIVATE KEY----- +MHcCAQEEIG34m0iTZy8L7ZHr0cdnZ0s1zJlmAbO3Iw+e+1vhseO4oAoGCCqGSM49 +AwEHoUQDQgAE/+IzmwG/bR8xBxkAWX07JQjntdtxIlGH/Ypqab8quonOtT9nfqlh +/BfwUGRahyxzVb7zU0U6uegJFh7ccEDfwA== +-----END EC PRIVATE KEY----- diff --git a/credentials/development/commissioner_dut/struct_pai_ext_key_usage_key_cert_sign_wrong/test_case_vector.json b/credentials/development/commissioner_dut/struct_pai_ext_key_usage_key_cert_sign_wrong/test_case_vector.json new file mode 100644 index 00000000000000..df7bfe36f829af --- /dev/null +++ b/credentials/development/commissioner_dut/struct_pai_ext_key_usage_key_cert_sign_wrong/test_case_vector.json @@ -0,0 +1,9 @@ +{ + "description": "PAI Test Vector: Certificate Key Usage extension keyCertSign field is wrong (present for DAC and not present for PAI", + "is_success_case": "false", + "dac_cert": "308201ce30820174a0030201020208749c9cd784672825300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313020170d3232303432303030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d0301070342000499e5cfeb9e1f32a6f84b68c7cb2a73f6b028141815b079190b1d34b33c713b535a3572a13de4b570bb25625bbe600ae8afead18c144da26e377151845480adf9a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414034f09f204995bbf09e915790921edc9897c9203301f0603551d2304183016801480cf5b5acaf9d706ff0b272105629aba8e8780ff300a06082a8648ce3d0403020348003045022100f5d655f61dfabb7345f9b882a72948b69ec72d987e36d661c251a9c486a9c2c2022058d8d4ec7c65fec77a83dd27843303b6a823cfe74bed6fced938f800d3280167", + "pai_cert": "308201be30820164a00302010202080354c26a1622254a300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303432303030303030305a180f39393939313233313233353935395a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d03010703420004ffe2339b01bf6d1f31071900597d3b2508e7b5db71225187fd8a6a69bf2aba89ceb53f677ea961fc17f050645a872c7355bef353453ab9e809161edc7040dfc0a366306430120603551d130101ff040830060101ff020101300e0603551d0f0101ff040403020102301d0603551d0e0416041480cf5b5acaf9d706ff0b272105629aba8e8780ff301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d040302034800304502204f7241bff0c7ebf22ab4194d439536d143936909d9fbe9ffc92f1763a26bc732022100cdcfc895467b1b9556d8a0a074b0a77a556468c5bc876a286d73f517d0dea3fb", + "certification_declaration": "3081e906092a864886f70d010702a081db3081d8020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d040302044730450221008cded09a324293cf55c69c256716640cceae2434bb41bffcb9086270b4f40ce902204aae4537c0c21358d27584f17d401e297713bc9665801ab7416499447d6c87fd", + "dac_private_key": "d1baa9a3d51c5c9eec6304e0248c44971f874a58b94d8604bf97091bc8b3d42b", + "dac_public_key": "0499e5cfeb9e1f32a6f84b68c7cb2a73f6b028141815b079190b1d34b33c713b535a3572a13de4b570bb25625bbe600ae8afead18c144da26e377151845480adf9" +} diff --git a/credentials/development/commissioner_dut/struct_pai_ext_key_usage_missing/cd.der b/credentials/development/commissioner_dut/struct_pai_ext_key_usage_missing/cd.der new file mode 100644 index 0000000000000000000000000000000000000000..52390d3d1341e747a2162eaba1b64f913d8f2f95 GIT binary patch literal 236 zcmXqLe96YC)#lOmotKfFX+h&{gT@<7jLe3-2Hb3%32h#Xsmv@)j0UabZkN_wskmz%zuSIfc8p@>P5Vco;fcmunwZ0nRoL;93lF4!-= Tx=>l#&EtmfOp61u$F2YX1`9(w literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_pai_ext_key_usage_missing/dac-Cert.der b/credentials/development/commissioner_dut/struct_pai_ext_key_usage_missing/dac-Cert.der new file mode 100644 index 0000000000000000000000000000000000000000..c940c7e89a38d45bb22036d3684e440553c388fd GIT binary patch literal 466 zcmXqLVmxQi#8|R`nTe5!i6e63#C;XVySxmz*f_M>JkHs&Ff$n#7)lt3u`!3TF!S*H zCYF?>7Ab_J7MCalIC>h27znX(X|pl1Fg7i!VPfQAadUGsG*A%dH8L_VF*1OFC<%T` zATTsC1|m~SQ_Cm=HymcVI67lD6HSzfhs6S9c%*?a8#~ygOpH(`Gc&R?J29|$mS#^? zEaYNX9K6hw^TE%bhb+`J4u9o8JNLbJ-`w{}^0m+Wa&Av=x#Fd$=5Xi0wZ?TNr=Mw< z*?!}`*&_T}znOn=fxv;_d@UqiPiVSadACR1>By2mS cHIDnB`^tlPGpv_y@UOb~q~^e@Eu5`=hC^kLz3)zGd>o0>3?xQt1 literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_pai_ext_key_usage_missing/dac-Key.pem b/credentials/development/commissioner_dut/struct_pai_ext_key_usage_missing/dac-Key.pem new file mode 100644 index 00000000000000..89856d7711d3f2 --- /dev/null +++ b/credentials/development/commissioner_dut/struct_pai_ext_key_usage_missing/dac-Key.pem @@ -0,0 +1,5 @@ +-----BEGIN EC PRIVATE KEY----- +MHcCAQEEINZvmrSIj2gCExDcCsrrTOIWXNPR9x4/pPmvkJTOFjH7oAoGCCqGSM49 +AwEHoUQDQgAESXVrlSFxCgCjU6Y1CeD5+cI4JyjD9Q/Nne9Ljp3vYh995k5s25eE +1EohJkDcwNaBrnTL5ig2PfYL2YQT6y+DDw== +-----END EC PRIVATE KEY----- diff --git a/credentials/development/commissioner_dut/struct_pai_ext_key_usage_missing/pai-Cert.der b/credentials/development/commissioner_dut/struct_pai_ext_key_usage_missing/pai-Cert.der new file mode 100644 index 0000000000000000000000000000000000000000..6fab237acd76e770df3fe69c3fcf0700d6ee9904 GIT binary patch literal 433 zcmXqLVq9y`#2B)GnTe5!iKG6T;gU&Tnx`3Xv2kd%d7QIlVP-NgFqAM5V`C0wVdmlY zO)M!%Em8x7660eLV-b0t<9O9qd&z|j-(QA>@}?JXPFkmC zAPW|`8WH;9H*xX+__`8u&@p}5SiT>3|yELG^Z&%ZxPqLc4+_0 z!m!Avd#~L!xZdpRx5at!?N^&^*mp50s6J#}a>24fb2F=s%Kk#$s~XB*I4WAcCR^NX K-ITM=uNVN}=!y>j literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_pai_ext_key_usage_missing/pai-Cert.pem b/credentials/development/commissioner_dut/struct_pai_ext_key_usage_missing/pai-Cert.pem new file mode 100644 index 00000000000000..ec40ed24cbd213 --- /dev/null +++ b/credentials/development/commissioner_dut/struct_pai_ext_key_usage_missing/pai-Cert.pem @@ -0,0 +1,12 @@ +-----BEGIN CERTIFICATE----- +MIIBrTCCAVSgAwIBAgIIf/YxpJL0g5YwCgYIKoZIzj0EAwIwMDEYMBYGA1UEAwwP +TWF0dGVyIFRlc3QgUEFBMRQwEgYKKwYBBAGConwCAQwERkZGMTAgFw0yMjA0MjAw +MDAwMDBaGA85OTk5MTIzMTIzNTk1OVowMDEYMBYGA1UEAwwPTWF0dGVyIFRlc3Qg +UEFJMRQwEgYKKwYBBAGConwCAQwERkZGMTBZMBMGByqGSM49AgEGCCqGSM49AwEH +A0IABJm6Yd1KeN1eMWyELMXfeAdpF9V2OWrMvQme5sacUimWgp3/2aL2xygZP7Vq +WguiLkGi5bbcdznuvPa7UB6qzOKjVjBUMBIGA1UdEwEB/wQIMAYBAf8CAQEwHQYD +VR0OBBYEFOdsQdVNK6TQsPfpVlUNZ3AJkq4mMB8GA1UdIwQYMBaAFGr9IncfUR/s +vxZBl2cQ3NwxoXF+MAoGCCqGSM49BAMCA0cAMEQCICmWIOeEFynWwr/pcVZZ5b3W +3TDXg01OtEOj2+qzPAe6AiAl4QWk0Dl4KbMFLCS/cQ3VKCP0CHiE9WM43YWybK5O +cw== +-----END CERTIFICATE----- diff --git a/credentials/development/commissioner_dut/struct_pai_ext_key_usage_missing/pai-Key.der b/credentials/development/commissioner_dut/struct_pai_ext_key_usage_missing/pai-Key.der new file mode 100644 index 0000000000000000000000000000000000000000..4641385277723ff5ce985e40469a9f80719b5ad2 GIT binary patch literal 121 zcmV-<0EYiCcLD(c1Rycf&%8P@4fV=8m3n((^MTv52CcgAV+OJrT=)4!MKYiY1_&yK zNX|V20SBQ(13~}Hh^#ou@bX&2RYIcm(k37+Q0oKh*4f}Q`_qV~rq b89%jZS_`5sL89fh+;=(dy!N|L9;(dZ9LG16 literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_pai_ext_key_usage_missing/pai-Key.pem b/credentials/development/commissioner_dut/struct_pai_ext_key_usage_missing/pai-Key.pem new file mode 100644 index 00000000000000..a0bd25606d5950 --- /dev/null +++ b/credentials/development/commissioner_dut/struct_pai_ext_key_usage_missing/pai-Key.pem @@ -0,0 +1,5 @@ +-----BEGIN EC PRIVATE KEY----- +MHcCAQEEIDHTz7w6MQ31yjqVenti84HbswatuvBjBrIZXPf5RUUyoAoGCCqGSM49 +AwEHoUQDQgAEmbph3Up43V4xbIQsxd94B2kX1XY5asy9CZ7mxpxSKZaCnf/ZovbH +KBk/tWpaC6IuQaLlttx3Oe689rtQHqrM4g== +-----END EC PRIVATE KEY----- diff --git a/credentials/development/commissioner_dut/struct_pai_ext_key_usage_missing/test_case_vector.json b/credentials/development/commissioner_dut/struct_pai_ext_key_usage_missing/test_case_vector.json new file mode 100644 index 00000000000000..a03ddb6e10304c --- /dev/null +++ b/credentials/development/commissioner_dut/struct_pai_ext_key_usage_missing/test_case_vector.json @@ -0,0 +1,9 @@ +{ + "description": "PAI Test Vector: Certificate doesn't include Key Usage extension", + "is_success_case": "false", + "dac_cert": "308201ce30820174a003020102020859b191be78c78a4a300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313020170d3232303432303030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d0301070342000449756b9521710a00a353a63509e0f9f9c2382728c3f50fcd9def4b8e9def621f7de64e6cdb9784d44a212640dcc0d681ae74cbe628363df60bd98413eb2f830fa360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414b38e343242c8b0dd81d0ff4abe3e6379d4360aef301f0603551d23041830168014e76c41d54d2ba4d0b0f7e956550d67700992ae26300a06082a8648ce3d0403020348003045022015036ca76354ca749e7fd6256200620ec748de65b43a6043316371803bc3a6cb022100ecbbc0199922133d94855e0bc147a9c16e983ba7b04f7ad1e47cc0ea8a110cc2", + "pai_cert": "308201ad30820154a00302010202087ff631a492f48396300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303432303030303030305a180f39393939313233313233353935395a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d0301070342000499ba61dd4a78dd5e316c842cc5df78076917d576396accbd099ee6c69c522996829dffd9a2f6c728193fb56a5a0ba22e41a2e5b6dc7739eebcf6bb501eaacce2a356305430120603551d130101ff040830060101ff020101301d0603551d0e04160414e76c41d54d2ba4d0b0f7e956550d67700992ae26301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d04030203470030440220299620e7841729d6c2bfe9715659e5bdd6dd30d7834d4eb443a3dbeab33c07ba022025e105a4d0397829b3052c24bf710dd52823f4087884f56338dd85b26cae4e73", + "certification_declaration": "3081e906092a864886f70d010702a081db3081d8020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d0403020447304502202423dec1aa29a65d8442a21d87179e23ff184d1949a8171e97bb0d2a40464072022100aee1555f303eb506ae2315548e2244d03fa3d5a1231b4648d8139938c01dc6d4", + "dac_private_key": "d66f9ab4888f68021310dc0acaeb4ce2165cd3d1f71e3fa4f9af9094ce1631fb", + "dac_public_key": "0449756b9521710a00a353a63509e0f9f9c2382728c3f50fcd9def4b8e9def621f7de64e6cdb9784d44a212640dcc0d681ae74cbe628363df60bd98413eb2f830f" +} diff --git a/credentials/development/commissioner_dut/struct_pai_ext_skid_missing/cd.der b/credentials/development/commissioner_dut/struct_pai_ext_skid_missing/cd.der new file mode 100644 index 0000000000000000000000000000000000000000..a921332e0d67d9ebe4aca629ec5c973fd9bdf094 GIT binary patch literal 235 zcmXqLe8I-4)#lOmotKfFX+h&HgU0JjjLe3-2Hb3%32h#Xsmv@)j0UaQ}nHZr?W@cn(c4A=Zki5Q5 zUFh{yrs>L4bW&?M&sx_br1_&yK zNX|V20SBQ(13~}1d%#7^JP7Exr+8dg9q}Ih1eV_KG^J&kT z=MiV-uB^Ooxj(^xFQaDeg(J68-Xsb{WU?xQL(%1_&yK zNX|V20SBQ(13~}vOpa`%?(iRFx}=UB|0sd?WyzhE#9XndW}#M)%+VGvkp b2cvP}jCl^QVc|6pdz1&lcVC;;k=kj)qLDQf literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_pai_ext_skid_missing/pai-Key.pem b/credentials/development/commissioner_dut/struct_pai_ext_skid_missing/pai-Key.pem new file mode 100644 index 00000000000000..63aea807da2ea4 --- /dev/null +++ b/credentials/development/commissioner_dut/struct_pai_ext_skid_missing/pai-Key.pem @@ -0,0 +1,5 @@ +-----BEGIN EC PRIVATE KEY----- +MHcCAQEEIOop+Er8Q+A/0l48vC5MEzIiiu4ffBKh9lyOcGSHRLiIoAoGCCqGSM49 +AwEHoUQDQgAERSuwggwarl5y95bsieWMrOdYzJ2ped85v2AwDmh8ndDE2mTsYRBY +aQejceGMeQ6wYeE1EHuUB8J3X5vVkdppww== +-----END EC PRIVATE KEY----- diff --git a/credentials/development/commissioner_dut/struct_pai_ext_skid_missing/test_case_vector.json b/credentials/development/commissioner_dut/struct_pai_ext_skid_missing/test_case_vector.json new file mode 100644 index 00000000000000..8404c0d21be131 --- /dev/null +++ b/credentials/development/commissioner_dut/struct_pai_ext_skid_missing/test_case_vector.json @@ -0,0 +1,9 @@ +{ + "description": "PAI Test Vector: Certificate doesn't include Subject Key ID (SKID) extension", + "is_success_case": "false", + "dac_cert": "308201ac30820153a00302010202087494bae5dd2cc965300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313020170d3232303432303030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d030107034200048819d7ae2712ebd5236c493cf3523081bf228b36592f93fbd4b38967d4475cf6b9172ef3dc9dd6de1a13cefc103b378d99831489c7494729404f09fb9043d302a33f303d300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e0416041447d0bd0ad13c87ecf1b5c9a9e475bdccd42f2a64300a06082a8648ce3d040302034700304402206cef635bbfc9aba21dfae777f0f469c9f589c5f0eb95189b1f605f9d5b9e7eaa02205600bd9cd890fe117cf20cdd8bc208749b5b1de1ba844c56035d6167d09e3528", + "pai_cert": "3082019e30820145a003020102020800d48d5fcb19a663300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303432303030303030305a180f39393939313233313233353935395a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d03010703420004452bb0820c1aae5e72f796ec89e58cace758cc9da979df39bf60300e687c9dd0c4da64ec6110586907a371e18c790eb061e135107b9407c2775f9bd591da69c3a347304530120603551d130101ff040830060101ff020101300e0603551d0f0101ff040403020106301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d040302034700304402200b51f806741f819087b8f518fc99bde462d633c2dd9bf196c75911277d40589702201b89cc8eff4e5b0eb776a77277ea1c2c1bb241513a62f0723a895cf2b420915e", + "certification_declaration": "3081e806092a864886f70d010702a081da3081d7020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317c307a020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204463044022061ecf1cf3b1b58fe4cfd9d864b08d3b30e44c58a7fde88ffe01afbd04fc956e602203118949266eea3c953167e875c9131a06ef5c21c2526f903aa87017d4571c06e", + "dac_private_key": "b36af657c36b0825c9c81470c34b3204b09ae07cb3ceaac51eeb660377b6aa35", + "dac_public_key": "048819d7ae2712ebd5236c493cf3523081bf228b36592f93fbd4b38967d4475cf6b9172ef3dc9dd6de1a13cefc103b378d99831489c7494729404f09fb9043d302" +} diff --git a/credentials/development/commissioner_dut/struct_pai_ext_subject_alt_name_present/cd.der b/credentials/development/commissioner_dut/struct_pai_ext_subject_alt_name_present/cd.der new file mode 100644 index 0000000000000000000000000000000000000000..cdd2eab340f6593dadf6ba94c85665c7a82c2cc1 GIT binary patch literal 236 zcmXqLe96YC)#lOmotKfFX+h&{gT@<7jLe3-2Hb3%32h#Xsmv@)j0Uaj-G}h210CH+H8z0j7^Jbm>79j+}zv@4HU$Ajf@OTj0_+kN`l`K z2n>ykfymU-)H2Gz4TqU7j?UQ4L=$D=VX*)i9%&%V#twEV6C>2g%#7^JP7EwM@6tDI zvWc8kq`SB;$o^hsM}+Uz!+|KmYJM-TXKPIgpv% z84O&Q6k^k=PV_$cKWoOn{KF^im0bMg>;8_3xs1nr>FTKrtK%jxDR}SxcyyLZjhmD2 bJJUchZVe~HZ$D-!9gj%+_U^#a^9~vS32BRw literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_pai_ext_subject_alt_name_present/dac-Cert.pem b/credentials/development/commissioner_dut/struct_pai_ext_subject_alt_name_present/dac-Cert.pem new file mode 100644 index 00000000000000..34331a23dd8e1c --- /dev/null +++ b/credentials/development/commissioner_dut/struct_pai_ext_subject_alt_name_present/dac-Cert.pem @@ -0,0 +1,12 @@ +-----BEGIN CERTIFICATE----- +MIIBzTCCAXSgAwIBAgIIKR+H/wMSsXgwCgYIKoZIzj0EAwIwMDEYMBYGA1UEAwwP +TWF0dGVyIFRlc3QgUEFJMRQwEgYKKwYBBAGConwCAQwERkZGMTAgFw0yMjA0MjAw +MDAwMDBaGA85OTk5MTIzMTIzNTk1OVowRjEYMBYGA1UEAwwPTWF0dGVyIFRlc3Qg +REFDMRQwEgYKKwYBBAGConwCAQwERkZGMTEUMBIGCisGAQQBgqJ8AgIMBDgwMDAw +WTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAAQs7meysjxZmnIto45SP955WZf2cTzq +8mu/sgwGYb/onq80LxdRV/tpEbONvnVPDs5LXBMmd608C4pJNFumSWVlo2AwXjAM +BgNVHRMBAf8EAjAAMA4GA1UdDwEB/wQEAwIHgDAdBgNVHQ4EFgQUS+IXzyATlsmU +iSh6hLKYrKO1XrAwHwYDVR0jBBgwFoAUggAnUeP+qqRS9IIBI/P4TsuD41wwCgYI +KoZIzj0EAwIDRwAwRAIgXWZ6yI3k/5qY/m/DyN500fpNR+4CA3YMN6WrlQCrXpAC +IEu78cWaJHxGQk3uNVEWCyhCMfb4miLHWGb27sClz0Ao +-----END CERTIFICATE----- diff --git a/credentials/development/commissioner_dut/struct_pai_ext_subject_alt_name_present/dac-Key.der b/credentials/development/commissioner_dut/struct_pai_ext_subject_alt_name_present/dac-Key.der new file mode 100644 index 0000000000000000000000000000000000000000..94089a298f4006d92a614e0b35ff02a9c77aa4be GIT binary patch literal 121 zcmV-<0EYiCcLD(c1R%q~iXv&2GiQ;U?Qc!HyX-v5q7nYm=EhwxC(0(K7R{gv1_&yK zNX|V20SBQ(13~}FzOpH7%Zfj#0Yg9Gb1~*69bFNy%=_!_WEa_c`Bd{yUKxba`hWm1gO8s7alp4U|GBT@d(EJ$?8hI`I#MsLdZy8Vkf?Y_9$ zpc3c}=1^H-M#ldv90qJaiiwfYfDa_b4-x|g10$P(EQrs?BE}-p#GoGd_}{7}L0_5} zl|TRRJKg*^#y}ns5U;T=|=r1NqKPH75 lX}x)Fyk2|Le>}DedGxq*>#`pYpL_BeCh>fHXujOs2LK#%hfx3k literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_pai_ext_subject_alt_name_present/pai-Cert.pem b/credentials/development/commissioner_dut/struct_pai_ext_subject_alt_name_present/pai-Cert.pem new file mode 100644 index 00000000000000..3ac44c52f1642d --- /dev/null +++ b/credentials/development/commissioner_dut/struct_pai_ext_subject_alt_name_present/pai-Cert.pem @@ -0,0 +1,12 @@ +-----BEGIN CERTIFICATE----- +MIIB0jCCAXmgAwIBAgIIdwEBV4tzNpswCgYIKoZIzj0EAwIwMDEYMBYGA1UEAwwP +TWF0dGVyIFRlc3QgUEFBMRQwEgYKKwYBBAGConwCAQwERkZGMTAgFw0yMjA0MjAw +MDAwMDBaGA85OTk5MTIzMTIzNTk1OVowMDEYMBYGA1UEAwwPTWF0dGVyIFRlc3Qg +UEFJMRQwEgYKKwYBBAGConwCAQwERkZGMTBZMBMGByqGSM49AgEGCCqGSM49AwEH +A0IABCTeXBUfG5Q5PgRnisIePC1Fw4wPsrFmBhPVLNZXM/05phoBloDu+Mdugn9M +GHf+NlIVpLDeQ0Yy7He9Rv5ay0ejezB5MBIGA1UdEwEB/wQIMAYBAf8CAQEwDgYD +VR0PAQH/BAQDAgEGMB0GA1UdDgQWBBSCACdR4/6qpFL0ggEj8/hOy4PjXDAfBgNV +HSMEGDAWgBRq/SJ3H1Ef7L8WQZdnENzcMaFxfjATBgNVHREEDDAKggh0ZXN0LmNv +bTAKBggqhkjOPQQDAgNHADBEAiAdy2Mt/W1D80nsOL8Lj11JJH1HxjcaVy8n1E8V ++gI5TgIgfBsunkYNSr1n+OM+VOLjibWm+OHnSQ0xYgzx4TenN0w= +-----END CERTIFICATE----- diff --git a/credentials/development/commissioner_dut/struct_pai_ext_subject_alt_name_present/pai-Key.der b/credentials/development/commissioner_dut/struct_pai_ext_subject_alt_name_present/pai-Key.der new file mode 100644 index 0000000000000000000000000000000000000000..c967601a552c0f6b86dbde71ce8a796bcd88d008 GIT binary patch literal 121 zcmV-<0EYiCcLD(c1R&Aut1e7vb{Pv3Etkh-0P<*%#v9*x7i{YZOd$q(`L>`61_&yK zNX|V20SBQ(13~}Q}nHZr?W@cn(c4A<0-Nt&t z*EHJW`|@iQA1?6OaGRM=d98DqYx5(Pga7L{_sadQdG@$*uQcnyvuQGK4EJo9Iel~0 zRGqfvt2vIW?(X+ooL~@VzytKQtS}?ve-s6$0Eiel6tIE zmF3toUuHXpAFKPDme-YA8yd)iq?K8Kf!81+(*HjyxpJAM|MG|{w@vm6PD_$`fE>uo z9t;MqOo|MDlphpUWNzVp#AGVg@wdn0&a`ul^GqI2Fx$lb<#~vz1(SlBw!Pq{Mt7U6 dTj##qowj`IOc}wLgT5+%)_2a3&AR>ZGyqAij#&Tz literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_pai_sig_algo_ecdsa_with_sha1/dac-Cert.pem b/credentials/development/commissioner_dut/struct_pai_sig_algo_ecdsa_with_sha1/dac-Cert.pem new file mode 100644 index 00000000000000..7c9f73f75fb6c9 --- /dev/null +++ b/credentials/development/commissioner_dut/struct_pai_sig_algo_ecdsa_with_sha1/dac-Cert.pem @@ -0,0 +1,12 @@ +-----BEGIN CERTIFICATE----- +MIIBzjCCAXSgAwIBAgIIRpWZsmN09+4wCgYIKoZIzj0EAwIwMDEYMBYGA1UEAwwP +TWF0dGVyIFRlc3QgUEFJMRQwEgYKKwYBBAGConwCAQwERkZGMTAgFw0yMjA0MjAw +MDAwMDBaGA85OTk5MTIzMTIzNTk1OVowRjEYMBYGA1UEAwwPTWF0dGVyIFRlc3Qg +REFDMRQwEgYKKwYBBAGConwCAQwERkZGMTEUMBIGCisGAQQBgqJ8AgIMBDgwMDAw +WTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAARFtgXITTVbSPen1njw0A48CzY3lOss +0wqz4gTB/3+zjR77fObjgb0bBcHNZhzsMbywmZezepUshqerCMSri49Jo2AwXjAM +BgNVHRMBAf8EAjAAMA4GA1UdDwEB/wQEAwIHgDAdBgNVHQ4EFgQUZcZ1JQTG5k0D +PkD4q4+Cp353OzEwHwYDVR0jBBgwFoAUFI//WmN5pjlPp1jU2zS9EZZiHOAwCgYI +KoZIzj0EAwIDSAAwRQIhAPwj4HF4abQL4gI1Foj9jEjcls6BnjThkDayB/TnVCU4 +AiAmKz8RsoFHPGrazvTdlqe1mRwRXMFNJPyviZgdatvxyw== +-----END CERTIFICATE----- diff --git a/credentials/development/commissioner_dut/struct_pai_sig_algo_ecdsa_with_sha1/dac-Key.der b/credentials/development/commissioner_dut/struct_pai_sig_algo_ecdsa_with_sha1/dac-Key.der new file mode 100644 index 0000000000000000000000000000000000000000..8507d351c0fadc3353bef0238b2f233e7cba8836 GIT binary patch literal 121 zcmV-<0EYiCcLD(c1R&ILG!M;nb73onva#|CyrkwBAr6rVzc%bE-f7e)+SH&51_&yK zNX|V20SBQ(13~}nzg>v*HB7|9`WM9{YUe! b1;Nc`9PBZ?u$h;$dX+4Or>h9WtBa3GuDdn0 literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_pai_sig_algo_ecdsa_with_sha1/dac-Key.pem b/credentials/development/commissioner_dut/struct_pai_sig_algo_ecdsa_with_sha1/dac-Key.pem new file mode 100644 index 00000000000000..329b2400de9fb6 --- /dev/null +++ b/credentials/development/commissioner_dut/struct_pai_sig_algo_ecdsa_with_sha1/dac-Key.pem @@ -0,0 +1,5 @@ +-----BEGIN EC PRIVATE KEY----- +MHcCAQEEINRxNA/NdXNhK4aysfIKvKTmGCEOkQm/Nuwr3mnUJ9rUoAoGCCqGSM49 +AwEHoUQDQgAERbYFyE01W0j3p9Z48NAOPAs2N5TrLNMKs+IEwf9/s40e+3zm44G9 +GwXBzWYc7DG8sJmXs3qVLIanqwjEq4uPSQ== +-----END EC PRIVATE KEY----- diff --git a/credentials/development/commissioner_dut/struct_pai_sig_algo_ecdsa_with_sha1/pai-Cert.der b/credentials/development/commissioner_dut/struct_pai_sig_algo_ecdsa_with_sha1/pai-Cert.der new file mode 100644 index 0000000000000000000000000000000000000000..6bfd84ae0f54de967db90f336c7389d5319b254f GIT binary patch literal 447 zcmXqLV%%-e#F)H*nTe5!i6ejS@6A)KD&81yvaxHmd7QIlVKgu>lrRuuV-96u=Hd5E zEGbDXQV2;cE>Q?@bTkw(5MtxfW@BVwY+6*q#K^tC68x4x zU}$6vM5dOemQi@j^u%Fiq=7KhNlc7v9ALLGGqN)~F|aiGy}oY3yXShj!p3<`^IdQ7 z&Gu*$uYCJ2=AUqbQp5jadpg`KDSrDI(MT|v6r2l_Za^*5h|K$-^ zZky~CoR%c>z(5`(t;_-ptOk*+ze?ruf%0$mi#bkD7r1lBaA9E`QkXKkGZ?rqDQK17 zJjIl@EAd%_b48N!)QE|dbvId08ZBl@YOLBZa~&&_0^h%&OJ5m|EGzn#Hn&VKlG#zL T_OHOgl;hcR?$+1ltTX@sxTJ_} literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_pai_sig_algo_ecdsa_with_sha1/pai-Cert.pem b/credentials/development/commissioner_dut/struct_pai_sig_algo_ecdsa_with_sha1/pai-Cert.pem new file mode 100644 index 00000000000000..881683cb88d2b3 --- /dev/null +++ b/credentials/development/commissioner_dut/struct_pai_sig_algo_ecdsa_with_sha1/pai-Cert.pem @@ -0,0 +1,12 @@ +-----BEGIN CERTIFICATE----- +MIIBuzCCAWOgAwIBAgIIb737s5U6eOwwCQYHKoZIzj0EATAwMRgwFgYDVQQDDA9N +YXR0ZXIgVGVzdCBQQUExFDASBgorBgEEAYKifAIBDARGRkYxMCAXDTIyMDQyMDAw +MDAwMFoYDzk5OTkxMjMxMjM1OTU5WjAwMRgwFgYDVQQDDA9NYXR0ZXIgVGVzdCBQ +QUkxFDASBgorBgEEAYKifAIBDARGRkYxMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcD +QgAEgk7r1zQNvNd3ILGegp9F2A6bSIYXee3+XP4TgCKA/8a8iQY+WfBmh3BBc5RB +6wmqJfWRsBnWcxsZkzhz0FqykaNmMGQwEgYDVR0TAQH/BAgwBgEB/wIBATAOBgNV +HQ8BAf8EBAMCAQYwHQYDVR0OBBYEFBSP/1pjeaY5T6dY1Ns0vRGWYhzgMB8GA1Ud +IwQYMBaAFGr9IncfUR/svxZBl2cQ3NwxoXF+MAkGByqGSM49BAEDRwAwRAIgKnfZ +ygJmumHmgEN4YiOVWJF5ftkFyTKjAmKBeriZrgUCIA7+UtL1AMSmcv5mnXYuWQNB +Fn39EKFkx2uc3X99bKkw +-----END CERTIFICATE----- diff --git a/credentials/development/commissioner_dut/struct_pai_sig_algo_ecdsa_with_sha1/pai-Key.der b/credentials/development/commissioner_dut/struct_pai_sig_algo_ecdsa_with_sha1/pai-Key.der new file mode 100644 index 0000000000000000000000000000000000000000..e04c8442d902c19ae057e88bd34e622df826abad GIT binary patch literal 121 zcmV-<0EYiCcLD(c1R(aCzOs6Dd!=;9P1E>ok(<>K$8m{tU|R=>y=@cY)B7pzKyom-rS@33u ba6xmFLF);sCH0Z88P;j-G}h210CH+H8z0j7^Jbm>79j+}zv@4HU$Ajf@OTj0_+kN`l`K z2n>ykfymU-)H2Gz4TqU7j?UQ4L=$D=VX*)i9%&%V#twEV6C>2g%#7^JP7Evw!9u$n zrSJKj>l8Ck7l}RO>#Y-gLuGTVQ(;y1@ZY<#8^a3O;p6U zZaq^mW3I@dG~PhPz<|!f2J#?jWfoxIHHgGUH1RQfdUNyLno=fqcK;5|sz>d}fz0gA zVBo@};CX%5>6INZ#@?)=4P>!I1!X1z4JM5j*f;R210CH+H8z0j7^Jbm>79j+}zv@4HU$Ajf@OTj0_+kN`l`K z2n>ykfymU-)G`W>nVvYzj5H8tV+Xs5i4p2JW=3{qCkB?tk2b4hMIB>rhDZE6aqIG4 z1}j6u#gX1MR?d4$#rcC%B?`YBd%i7g`H|a;>sC4!ujfjzSIZq)=LM zel17mCXdyoCVon5)Y#Pw7D#*LH(YSEp0oG&RJQ^qMTU($Ya6|;mR)C0_t(ATCn2%; U=IN^eyK9%&&Y8gc;ryC#0N;0my#N3J literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_pai_sig_algo_ecdsa_with_sha256/pai-Cert.pem b/credentials/development/commissioner_dut/struct_pai_sig_algo_ecdsa_with_sha256/pai-Cert.pem new file mode 100644 index 00000000000000..7140ad7bbbc639 --- /dev/null +++ b/credentials/development/commissioner_dut/struct_pai_sig_algo_ecdsa_with_sha256/pai-Cert.pem @@ -0,0 +1,12 @@ +-----BEGIN CERTIFICATE----- +MIIBvjCCAWSgAwIBAgIIOzNnLbPqbVwwCgYIKoZIzj0EAwIwMDEYMBYGA1UEAwwP +TWF0dGVyIFRlc3QgUEFBMRQwEgYKKwYBBAGConwCAQwERkZGMTAgFw0yMjA0MjAw +MDAwMDBaGA85OTk5MTIzMTIzNTk1OVowMDEYMBYGA1UEAwwPTWF0dGVyIFRlc3Qg +UEFJMRQwEgYKKwYBBAGConwCAQwERkZGMTBZMBMGByqGSM49AgEGCCqGSM49AwEH +A0IABFnxPKodFUFd2VdY/sja070AOjExo1lLfDpDvHUXD1NlGHH0xue2ZqfE26N+ +qUNzrwpgPKMMHoY1pL5ckFXNgNyjZjBkMBIGA1UdEwEB/wQIMAYBAf8CAQEwDgYD +VR0PAQH/BAQDAgEGMB0GA1UdDgQWBBRdWIIOAPLs2e6sdQIHB0+IKXrihzAfBgNV +HSMEGDAWgBRq/SJ3H1Ef7L8WQZdnENzcMaFxfjAKBggqhkjOPQQDAgNIADBFAiB1 +eM+tCImySKs1NE4irCYHJjCgG0pvgNBBO5y9+5VGcAIhALEMrYFK1XbXB2dPLdJO +GBij2cvVULt9pD2ckAPwz6xX +-----END CERTIFICATE----- diff --git a/credentials/development/commissioner_dut/struct_pai_sig_algo_ecdsa_with_sha256/pai-Key.der b/credentials/development/commissioner_dut/struct_pai_sig_algo_ecdsa_with_sha256/pai-Key.der new file mode 100644 index 0000000000000000000000000000000000000000..7e801f752cc5524a7c63486a36c7b946ed35d549 GIT binary patch literal 121 zcmV-<0EYiCcLD(c1R!kH9nFlIFd=9P8|!pVxRMz4lY}*Use1Ib?bZyy3(24g1_&yK zNX|V20SBQ(13~}I>u;a@5f1=OSVx=y literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_pai_sig_curve_prime256v1/dac-Cert.der b/credentials/development/commissioner_dut/struct_pai_sig_curve_prime256v1/dac-Cert.der new file mode 100644 index 0000000000000000000000000000000000000000..ac6d07ba6c3fbcb5b21b88ab567b641e04e46d67 GIT binary patch literal 466 zcmXqLVmxQi#8|R`nTe5!iNo@*1#8~=@IwY%Y#dr`9_MUXn3)U=3?&T2*qB3En0fep z6H7``ixfgqi%S#&96b$1420OYwAmP07@HQ=FfsD5xVgC*8YqbK8W|aw7#To7lmx#e z5EvR61Cgnvsb!Rb8xAvF9G$V7i6+X#!(st4JkmgzjUDV#CPt`}nHkxcofuelEUzuO zzh&{Z1@hmE6bjpBJkq$b_xqJj^&bk&?dQHYtY^6_zc|@&bM>U9;nhzbnq1ne|9rzf z%}+u~hOSoDn~(7>PB4fw-~oDDR+y3TKMRuqg8?6i#}DEGgN41pKo-R3V-aH!k+yK~ zKAY%Y&*oLo^kqg^-9_0&Z3glnX=N5*;5CRe6gkbk5$!K|=W($9`{LeT(-tnii5$qx z9t;MqObXiidw!-JR(@AsCMpT}wPXA1LPBkH`ibsz&=~E>55d1_&yK zNX|V20SBQ(13~}ChkFgU*f_M>JkHs&Ff$n#7)lt3u`!3TF!S*H zCYF?>7Ab_J7MCalI64}N7znX(X|pl1Fg7i!VPfQAadUGsG*A%dH8L_VF*1OFC<%T` zATTsC1|m~SQ_CnkW_scJobofuet-2XG<{*L=5H^mmsQaQik zP)qtN1@5!6>)s1}`M@+W>vl_%nd0kPc8m%lix)4bo^7?je7>>7ull^BH%$GzETdf) zrx~OGy}=wRE6m9FpM}GK4M;IDG8*uK#P~sCz+hlxGmr)G`B=nQL>h{m=H7_*m%Q^h zSpR)-@2_bK7vD6H2T3cl00XN*B_%ZE=&r^ zS1j&d>|8hD{PS!1Uq34@us^!7#D8J>`6JUcIWw7lF)%3@Fde#Tv}_Ak&~xDVxo WZeBCI_y5n%i10=CW9lZ}-wXiBm5@IG literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_pai_sig_curve_prime256v1/pai-Cert.pem b/credentials/development/commissioner_dut/struct_pai_sig_curve_prime256v1/pai-Cert.pem new file mode 100644 index 00000000000000..caf52f3512a4d6 --- /dev/null +++ b/credentials/development/commissioner_dut/struct_pai_sig_curve_prime256v1/pai-Cert.pem @@ -0,0 +1,12 @@ +-----BEGIN CERTIFICATE----- +MIIBvTCCAWSgAwIBAgIISNrAqnBxw40wCgYIKoZIzj0EAwIwMDEYMBYGA1UEAwwP +TWF0dGVyIFRlc3QgUEFBMRQwEgYKKwYBBAGConwCAQwERkZGMTAgFw0yMjA0MjAw +MDAwMDBaGA85OTk5MTIzMTIzNTk1OVowMDEYMBYGA1UEAwwPTWF0dGVyIFRlc3Qg +UEFJMRQwEgYKKwYBBAGConwCAQwERkZGMTBZMBMGByqGSM49AgEGCCqGSM49AwEH +A0IABPjf/JjfuN802RaimiTPqMKEZ+ogC82bfu8S9PACkWrbhII2IevaPgEgFKOj +oHubOqA3nzMY+n9uxdg1T4o5W0WjZjBkMBIGA1UdEwEB/wQIMAYBAf8CAQEwDgYD +VR0PAQH/BAQDAgEGMB0GA1UdDgQWBBSAckKd2FtPGdzjUy/vc436lqGj2TAfBgNV +HSMEGDAWgBRq/SJ3H1Ef7L8WQZdnENzcMaFxfjAKBggqhkjOPQQDAgNHADBEAiBj +1Djf0YmukM/n1m/18yGgP8WxdE+hZ8/ElykJaQL6AAIgMALC1TKmtApS5xPEfle8 +KtnWMd7//LlYV6LfXH6R37M= +-----END CERTIFICATE----- diff --git a/credentials/development/commissioner_dut/struct_pai_sig_curve_prime256v1/pai-Key.der b/credentials/development/commissioner_dut/struct_pai_sig_curve_prime256v1/pai-Key.der new file mode 100644 index 0000000000000000000000000000000000000000..3597daf2bc418dba43e04785192b1bd0e71bbcbb GIT binary patch literal 121 zcmV-<0EYiCcLD(c1RyM?)QhS6>~(KIf}D*EYc)=wRO)Jj6 bAQYpcpnID-pf{g082W#1#n?4ZiaA?Fmnk-p literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_pai_sig_curve_prime256v1/pai-Key.pem b/credentials/development/commissioner_dut/struct_pai_sig_curve_prime256v1/pai-Key.pem new file mode 100644 index 00000000000000..6b6b7a5bc42c4a --- /dev/null +++ b/credentials/development/commissioner_dut/struct_pai_sig_curve_prime256v1/pai-Key.pem @@ -0,0 +1,5 @@ +-----BEGIN EC PRIVATE KEY----- +MHcCAQEEICym1Iup++x1b0CCnI0MazVOoFTq9c9jTlqNsJmGeWgioAoGCCqGSM49 +AwEHoUQDQgAE+N/8mN+43zTZFqKaJM+owoRn6iALzZt+7xL08AKRatuEgjYh69o+ +ASAUo6Oge5s6oDefMxj6f27F2DVPijlbRQ== +-----END EC PRIVATE KEY----- diff --git a/credentials/development/commissioner_dut/struct_pai_sig_curve_prime256v1/test_case_vector.json b/credentials/development/commissioner_dut/struct_pai_sig_curve_prime256v1/test_case_vector.json new file mode 100644 index 00000000000000..2000ce4259092b --- /dev/null +++ b/credentials/development/commissioner_dut/struct_pai_sig_curve_prime256v1/test_case_vector.json @@ -0,0 +1,9 @@ +{ + "description": "PAI Test Vector: Valid certificate public key curve prime256v1", + "is_success_case": "true", + "dac_cert": "308201ce30820174a003020102020839fd38056eaf57c2300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313020170d3232303432303030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004b8a77d74dfb4a3b6a01ff77220718698e228d4bdf7d48927f8208387cef440af04d31fa36331b37b92a5577be4e134d2bd2fe7b0be29f2122231453a3bb3c60da360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e041604141b38404bcd614f7f064a7082f498567ed11da286301f0603551d230418301680148072429dd85b4f19dce3532fef738dfa96a1a3d9300a06082a8648ce3d040302034800304502202b2fbcf966c323e3381051e333dfe48ae57e0015b1917ce40a29ae227bb39e85022100ade9a04cb7f28434f26b4516ae04acb931d0e1dc53363ac6163bf4546a6aa245", + "pai_cert": "308201bd30820164a003020102020848dac0aa7071c38d300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303432303030303030305a180f39393939313233313233353935395a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d03010703420004f8dffc98dfb8df34d916a29a24cfa8c28467ea200bcd9b7eef12f4f002916adb84823621ebda3e012014a3a3a07b9b3aa0379f3318fa7f6ec5d8354f8a395b45a366306430120603551d130101ff040830060101ff020101300e0603551d0f0101ff040403020106301d0603551d0e041604148072429dd85b4f19dce3532fef738dfa96a1a3d9301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020347003044022063d438dfd189ae90cfe7d66ff5f321a03fc5b1744fa167cfc49729096902fa0002203002c2d532a6b40a52e713c47e57bc2ad9d631defffcb95857a2df5c7e91dfb3", + "certification_declaration": "3081e806092a864886f70d010702a081da3081d7020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317c307a020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d0403020446304402207776d33f3372fb13042d87bbe4f79c205f74a7835af133164a625834afeefd3f02203e0f8104061262e51e690afd67a0029e74b5b4ba05b661ee907d12afdbc9f85f", + "dac_private_key": "54b02c7c8af9259fb87821188f155d4b3c3c1f28e6dc8fc8061caa46fb672e4e", + "dac_public_key": "04b8a77d74dfb4a3b6a01ff77220718698e228d4bdf7d48927f8208387cef440af04d31fa36331b37b92a5577be4e134d2bd2fe7b0be29f2122231453a3bb3c60d" +} diff --git a/credentials/development/commissioner_dut/struct_pai_sig_curve_secp256k1/cd.der b/credentials/development/commissioner_dut/struct_pai_sig_curve_secp256k1/cd.der new file mode 100644 index 0000000000000000000000000000000000000000..1a2a029375eb2f78abf029024b4f1e814feeeab2 GIT binary patch literal 236 zcmXqLe96YC)#lOmotKfFX+h&{gT@<7jLe3-2Hb3%32h#Xsmv@)j0UaswHuo9{U(@v2kd%d7QIlVP-NgFqAM5V`C0wVdmlY zO)M!%Em8Q}nHZr?W@cn(c4A=Jrg4>R z&zwX1Y>Fl{$5i_J>VHp`VEXlzOUdPz#GO4RYHSyll@{jIHB_(mm7Q4kQXoR*yrh}v zP38LscP~ESmaVfm!643n2k32CVMfOPEKCLr27DkMKZpkm7WM`MSrDI(MT|wn?e5*I z?7}yb8d)n2UOv~b@y{N`ZUcFcv@#1Y@ESyRp1QVFdG0sG!+~rC2eU+(i^4SRkOP_7 zgTcU+Nr8XEe}4%RSGCEZ9+wNbb*D*gRybE#E*ZFF#`;f7e*W6bq{z@NFO}(HlBNGd c%Xs;`qX$i==ENN;V&h(!y!Y{h!ZHm901x|!WdHyG literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_pai_sig_curve_secp256k1/dac-Cert.pem b/credentials/development/commissioner_dut/struct_pai_sig_curve_secp256k1/dac-Cert.pem new file mode 100644 index 00000000000000..79dad1dc151d7a --- /dev/null +++ b/credentials/development/commissioner_dut/struct_pai_sig_curve_secp256k1/dac-Cert.pem @@ -0,0 +1,12 @@ +-----BEGIN CERTIFICATE----- +MIIBzjCCAXSgAwIBAgIIMJOqpF6y40wwCgYIKoZIzj0EAwIwMDEYMBYGA1UEAwwP +TWF0dGVyIFRlc3QgUEFJMRQwEgYKKwYBBAGConwCAQwERkZGMTAgFw0yMjA0MjAw +MDAwMDBaGA85OTk5MTIzMTIzNTk1OVowRjEYMBYGA1UEAwwPTWF0dGVyIFRlc3Qg +REFDMRQwEgYKKwYBBAGConwCAQwERkZGMTEUMBIGCisGAQQBgqJ8AgIMBDgwMDAw +WTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAAS2KNUGvJzCvjxykINceU9NL/djGAL6 +7QoiRPoY3Lw0JgbQpnVxbH6Ae6tNHZF+6RBYJM8ZNhXZI9/Bu6PIRmsso2AwXjAM +BgNVHRMBAf8EAjAAMA4GA1UdDwEB/wQEAwIHgDAdBgNVHQ4EFgQURt3damtx7JKB +BXjB086Asfy8IYswHwYDVR0jBBgwFoAUucrWpSOd9iHDUQZwwWoVA3JWKT4wCgYI +KoZIzj0EAwIDSAAwRQIgD7D/Txg0RSaTVUjTcQstlhmzIM55dxlRpJiv8qT5+rMC +IQCHHxppRDRqL+QqM6eexcE1lWxewnIGC6ljveOQcXYoQA== +-----END CERTIFICATE----- diff --git a/credentials/development/commissioner_dut/struct_pai_sig_curve_secp256k1/dac-Key.der b/credentials/development/commissioner_dut/struct_pai_sig_curve_secp256k1/dac-Key.der new file mode 100644 index 0000000000000000000000000000000000000000..1193c098aaadb042e922d96edac132dbf769a5fd GIT binary patch literal 121 zcmV-<0EYiCcLD(c1Ry78Bn&-9pJ_J_MwaozL7DF+LoVv0G}~J;ppT7WFdd)@1_&yK zNX|V20SBQ(13~}JkHs&Ff$n#7)lt3u`!3TF!S*H zCYF?>7Ab_J7MCalI64}N7znX(X|pl1Fg7i!VPfQAadUGsG*A%dH8L_VF*1OFC<%T` zATTsC1|m~SQ_CnkW_sceuAWI=pB7BLo)ou{rXRi67z z@o*qp!NDw1=Atl7I|F%;v@#1Yq#8uB{wkHr2g<+MFXlKsUEt0g!-a))$RWz?&S2oe zq)=ZzO=rKoNyFMd_xC+anZWSpzj!Y5^~C#C4-E0 literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_pai_sig_curve_secp256k1/pai-Cert.pem b/credentials/development/commissioner_dut/struct_pai_sig_curve_secp256k1/pai-Cert.pem new file mode 100644 index 00000000000000..b404977eebf7d7 --- /dev/null +++ b/credentials/development/commissioner_dut/struct_pai_sig_curve_secp256k1/pai-Cert.pem @@ -0,0 +1,12 @@ +-----BEGIN CERTIFICATE----- +MIIBujCCAWGgAwIBAgIIQw/MBT645L8wCgYIKoZIzj0EAwIwMDEYMBYGA1UEAwwP +TWF0dGVyIFRlc3QgUEFBMRQwEgYKKwYBBAGConwCAQwERkZGMTAgFw0yMjA0MjAw +MDAwMDBaGA85OTk5MTIzMTIzNTk1OVowMDEYMBYGA1UEAwwPTWF0dGVyIFRlc3Qg +UEFJMRQwEgYKKwYBBAGConwCAQwERkZGMTBWMBAGByqGSM49AgEGBSuBBAAKA0IA +BEnQeNyjKLu5quBZ7GGJ5q/XPxjj7jXlGJmsISKhKPvScOrtv3zRyj9wZ3/Wq3LB +o6Sti1TlILO0g+Wi18Lhn/mjZjBkMBIGA1UdEwEB/wQIMAYBAf8CAQEwDgYDVR0P +AQH/BAQDAgEGMB0GA1UdDgQWBBS5ytalI532IcNRBnDBahUDclYpPjAfBgNVHSME +GDAWgBRq/SJ3H1Ef7L8WQZdnENzcMaFxfjAKBggqhkjOPQQDAgNHADBEAiB/d5Ys +vz80gK38377hZJAA/P8XbQOT/vuEO6l9/+gIAQIgGaJzTjdG7KBtEUxX0IwsthL2 +WiItYGNudMAmdjqzT5k= +-----END CERTIFICATE----- diff --git a/credentials/development/commissioner_dut/struct_pai_sig_curve_secp256k1/pai-Key.der b/credentials/development/commissioner_dut/struct_pai_sig_curve_secp256k1/pai-Key.der new file mode 100644 index 0000000000000000000000000000000000000000..be539e7decddaf08f036a06e0458e628ff584416 GIT binary patch literal 118 zcmV-+0Ez!FbOHeZ1R$#=eA$PpQp};S8rX~`h$+I~*Ta?cT2Lv0v%=x9gMpw21_djD z1ON)5L<2$q1WC|%+@mPFxvJn<>|u%Kuh%~q+p&vNQ)m2F=l%6w&_9-??^e^@{6G7aN=KOjl{Bd3_y+!ab-=jybGqb1=g&4L TvnS4!nR_C4E$^n#j$~#4S;9&@ literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_pai_subject_pid_mismatch/dac-Cert.der b/credentials/development/commissioner_dut/struct_pai_subject_pid_mismatch/dac-Cert.der new file mode 100644 index 0000000000000000000000000000000000000000..016ebe730c2aaee7945e018e4fd9024261f91665 GIT binary patch literal 466 zcmXqLVmxQi#8|R`nTe5!iGy)v*L&F*-%AEuY#dr`9_MUXn3)U=3?&T2*qB3En0fep z6H7``ixfgqi%S#&96b$1420OYwAmP07@HQ=FfsD5xVgC*8YqbK8W|aw7#To7lmx#e z5EvR61Cgnvsb!Rb8xAvF9G$V7i6+X#!(st+m_ek0FdIAArA&-aCo?m$GdnS`tjU`e z&3!-T;?ab+Svg(Dwxn7-Sh0WIm2%DG`sFLx7BpQu_~qY*j@U_>lP?8rH{`fFO)5nzkZ!e8JAz$^367o2T3cl00XZ<LLTWjNrdzpm7GDPw=9sRp2e*1`1tu!vof bDU;Gtw=oFSmLXesjzDvZvp&_JK{%C!=EOMG literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_pai_subject_pid_mismatch/dac-Key.pem b/credentials/development/commissioner_dut/struct_pai_subject_pid_mismatch/dac-Key.pem new file mode 100644 index 00000000000000..a35cf8ef8a2290 --- /dev/null +++ b/credentials/development/commissioner_dut/struct_pai_subject_pid_mismatch/dac-Key.pem @@ -0,0 +1,5 @@ +-----BEGIN EC PRIVATE KEY----- +MHcCAQEEIJuS1bh4olkrp3dOFmmK2NJ9ZRvusqujTpXbw/F+bY2loAoGCCqGSM49 +AwEHoUQDQgAErG6WWwvfbNHFYO1qbIrGtGU44Ki/rtR3KWN/p6kGoILWwfT+sIhd +kimT0lK3MQjVliFbeI5Ac4uzPtWgQTiVhA== +-----END EC PRIVATE KEY----- diff --git a/credentials/development/commissioner_dut/struct_pai_subject_pid_mismatch/pai-Cert.der b/credentials/development/commissioner_dut/struct_pai_subject_pid_mismatch/pai-Cert.der new file mode 100644 index 0000000000000000000000000000000000000000..95e60363a7ea3b3179e540edfea7f6924f4f4141 GIT binary patch literal 451 zcmXqLV%%@g#F(;xnTe5!i9>0#PxqDwtECLM*f_M>JkHs&Ff$n#7)lt3u`!3TF!S*H zCYF?>7Ab_J7MCalI64}N7znX(X|pl1Fg7i!VPfQAadUGsG*A%dH8L_VF*1OFC<%T` zATTsC1|m~SQ_CnkW_scJobofue_)=f$0577)Snpau9UugcK zDh6v_iI@|Y%QeoMT70{->axu*b>^bp1raYL&mLQx zW{?8(26L#aFeBrC77hb8AjQPUXut;&;|GZWgMpFFKo-R3V-aH!`S?!z&?=S#KeN|3 zO-)yvoV=_-#M3|?B(2N>46Fu`tiMX-@`3Vi_KP`APZzjz$8cd`9de*DdomcfF)1?q zkF~og^+$Q-A)dsV?2Y{oo7ZgfFFL)?MEub1a~!AC*nmndHQV_7ZTZxru$?u=PW!<1 VujMP}$e!60m$c)Q$cs$}0s$f0ibVhb literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_pai_subject_pid_mismatch/pai-Cert.pem b/credentials/development/commissioner_dut/struct_pai_subject_pid_mismatch/pai-Cert.pem new file mode 100644 index 00000000000000..74a7442e0245df --- /dev/null +++ b/credentials/development/commissioner_dut/struct_pai_subject_pid_mismatch/pai-Cert.pem @@ -0,0 +1,12 @@ +-----BEGIN CERTIFICATE----- +MIIBvzCCAWSgAwIBAgIIIrNMi7TgqxowCgYIKoZIzj0EAwIwMDEYMBYGA1UEAwwP +TWF0dGVyIFRlc3QgUEFBMRQwEgYKKwYBBAGConwCAQwERkZGMTAgFw0yMjA0MjAw +MDAwMDBaGA85OTk5MTIzMTIzNTk1OVowMDEYMBYGA1UEAwwPTWF0dGVyIFRlc3Qg +UEFJMRQwEgYKKwYBBAGConwCAQwERkZGMTBZMBMGByqGSM49AgEGCCqGSM49AwEH +A0IABKV+lGcPVClXcp55e78Sn6LUFB1VwRKtG+NM+BdxZ3yLz6cSq4uIbhhcyNN3 +KM81OPbSqtM8+icDco2gWOkZzcajZjBkMBIGA1UdEwEB/wQIMAYBAf8CAQEwDgYD +VR0PAQH/BAQDAgEGMB0GA1UdDgQWBBTx7ivCqgTA+WusQpVnIZNjpoAUSTAfBgNV +HSMEGDAWgBRq/SJ3H1Ef7L8WQZdnENzcMaFxfjAKBggqhkjOPQQDAgNJADBGAiEA +/10+2Rr8I6nCDGF8a7GP4YOstk9yy740F8K7zgjKJgYCIQDSgzxM/YTyjCC3BVw+ +K8DX9XepnB3Msl5iuMoU6LLAUQ== +-----END CERTIFICATE----- diff --git a/credentials/development/commissioner_dut/struct_pai_subject_pid_mismatch/pai-Key.der b/credentials/development/commissioner_dut/struct_pai_subject_pid_mismatch/pai-Key.der new file mode 100644 index 0000000000000000000000000000000000000000..2e7c073427b3f86fdc68fc1b0005aa7885743d8f GIT binary patch literal 121 zcmV-<0EYiCcLD(c1Ry#r*D4h=uVM+2^>Q~;{qAyDVKwPNIVGl7lIuBhWF?>q1_&yK zNX|V20SBQ(13~}L* bT*%XRD9<%G_R^};Jo+aCa*d!^=^4$&j=(XA literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_pai_subject_pid_mismatch/pai-Key.pem b/credentials/development/commissioner_dut/struct_pai_subject_pid_mismatch/pai-Key.pem new file mode 100644 index 00000000000000..e32128c0000ae8 --- /dev/null +++ b/credentials/development/commissioner_dut/struct_pai_subject_pid_mismatch/pai-Key.pem @@ -0,0 +1,5 @@ +-----BEGIN EC PRIVATE KEY----- +MHcCAQEEIDos1yoVM69iCZH1cjdT/e5yWGE16UE5JaZXkus5c2QloAoGCCqGSM49 +AwEHoUQDQgAEpX6UZw9UKVdynnl7vxKfotQUHVXBEq0b40z4F3FnfIvPpxKri4hu +GFzI03cozzU49tKq0zz6JwNyjaBY6RnNxg== +-----END EC PRIVATE KEY----- diff --git a/credentials/development/commissioner_dut/struct_pai_subject_pid_mismatch/test_case_vector.json b/credentials/development/commissioner_dut/struct_pai_subject_pid_mismatch/test_case_vector.json new file mode 100644 index 00000000000000..409a99f9980ff1 --- /dev/null +++ b/credentials/development/commissioner_dut/struct_pai_subject_pid_mismatch/test_case_vector.json @@ -0,0 +1,9 @@ +{ + "description": "PAI Test Vector: PID in Subject field doesn't match PID in Issuer field", + "is_success_case": "false", + "dac_cert": "308201ce30820174a003020102020801a98aef1d5c4dd2300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313020170d3232303432303030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030313059301306072a8648ce3d020106082a8648ce3d03010703420004ac6e965b0bdf6cd1c560ed6a6c8ac6b46538e0a8bfaed47729637fa7a906a082d6c1f4feb0885d922993d252b73108d596215b788e40738bb33ed5a041389584a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414f2e137882de173fb8595fd4e890268d3e93d0e9b301f0603551d23041830168014f1ee2bc2aa04c0f96bac429567219363a6801449300a06082a8648ce3d040302034800304502210088a8de72ea5f15549c9269a311656b7103de2bc27b4f62248e52b0eb802d85c002203c9b0fef0fb2037bfdfcbe6c30cf0105032b2ffbcfe8c9721547cc5f815d9003", + "pai_cert": "308201bf30820164a003020102020822b34c8bb4e0ab1a300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303432303030303030305a180f39393939313233313233353935395a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d03010703420004a57e94670f542957729e797bbf129fa2d4141d55c112ad1be34cf81771677c8bcfa712ab8b886e185cc8d37728cf3538f6d2aad33cfa2703728da058e919cdc6a366306430120603551d130101ff040830060101ff020101300e0603551d0f0101ff040403020106301d0603551d0e04160414f1ee2bc2aa04c0f96bac429567219363a6801449301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020349003046022100ff5d3ed91afc23a9c20c617c6bb18fe183acb64f72cbbe3417c2bbce08ca2606022100d2833c4cfd84f28c20b7055c3e2bc0d7f577a99c1dccb25e62b8ca14e8b2c051", + "certification_declaration": "3081ea06092a864886f70d010702a081dc3081d9020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205018018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317e307c020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204483046022100889a248339a7f6c6d1956598ff270dfaef114f5d048eda82dd6ffcbea51b5a3502210080266c4d51feeac0338df36719e143f33cc96b91991c9dc86dad0db255886303", + "dac_private_key": "9b92d5b878a2592ba7774e16698ad8d27d651beeb2aba34e95dbc3f17e6d8da5", + "dac_public_key": "04ac6e965b0bdf6cd1c560ed6a6c8ac6b46538e0a8bfaed47729637fa7a906a082d6c1f4feb0885d922993d252b73108d596215b788e40738bb33ed5a041389584" +} diff --git a/credentials/development/commissioner_dut/struct_pai_subject_vid_mismatch/cd.der b/credentials/development/commissioner_dut/struct_pai_subject_vid_mismatch/cd.der new file mode 100644 index 0000000000000000000000000000000000000000..955eaaa4411922ac30e6cb2c8728ccdbca2fb883 GIT binary patch literal 235 zcmXqLe8I-4)#lOmotKfFX+h&HgU0JjjLe3-2Hb3%32h#Xsmv@)j0UaZ*LiJv2kd%d7QIlVP-NgFqAM5V`C0wVdmlY zO)M!%Em8Q}nHZr?W@cn(c4A2IJ=>A1H$bro4 z&S2oeq#*CQ|5d;##g4TP8j6|grXKpE_P9{-nEEp1kJIuN-bkn*8K*6BCjM`gPG| b*PlaBg!Rskjm$VGH*f_M>JkHs&Ff$n#7)lt3u`!3TF!S*H zCYF?>7Ab_J7MCalI64}N7znX(X|pl1Fg7i!VPfQAadUGsG*A%dH8L_VF*1OFC<%T` zATTsC1|m~SQ_CnkW_n^Z)5svwK$wjk>?S5gsN#&t?%u>r4 zPAU8C^(Tqc?6-1eFmW%I*_fiGZpXkaao+3PvHYd8(y#q}AGW!)R=cuTsk)@Ie$`9A z#c2j9KyNUI$_g_w{%7GZU;|Q2jEn|+ATfTB7%&(Z*$iYsd_ER277s$}?JmLoc!Q+N7 literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_pai_subject_vid_mismatch/pai-Cert.pem b/credentials/development/commissioner_dut/struct_pai_subject_vid_mismatch/pai-Cert.pem new file mode 100644 index 00000000000000..b4035dd99d5923 --- /dev/null +++ b/credentials/development/commissioner_dut/struct_pai_subject_vid_mismatch/pai-Cert.pem @@ -0,0 +1,12 @@ +-----BEGIN CERTIFICATE----- +MIIBvzCCAWSgAwIBAgIIJqhw65Q60iowCgYIKoZIzj0EAwIwMDEYMBYGA1UEAwwP +TWF0dGVyIFRlc3QgUEFBMRQwEgYKKwYBBAGConwCAQwERkZGMTAgFw0yMjA0MjAw +MDAwMDBaGA85OTk5MTIzMTIzNTk1OVowMDEYMBYGA1UEAwwPTWF0dGVyIFRlc3Qg +UEFJMRQwEgYKKwYBBAGConwCAQwERkZGMjBZMBMGByqGSM49AgEGCCqGSM49AwEH +A0IABFrYCZiYQ/rDOk1cpTmYQmS/Py+SFHy/OkMANEdzHLFkKic+AAsYz0rOxm+l +mmfW/e9Ws3V9K3lzInt0iX+q6U6jZjBkMBIGA1UdEwEB/wQIMAYBAf8CAQEwDgYD +VR0PAQH/BAQDAgEGMB0GA1UdDgQWBBQFTrnsCsagbydqAQNGKp9oFb+ibDAfBgNV +HSMEGDAWgBRq/SJ3H1Ef7L8WQZdnENzcMaFxfjAKBggqhkjOPQQDAgNJADBGAiEA +hZhZzVaF7sn2kePWeY12JDF1YhyHJY62SZfQHNrStO0CIQDIBPokVZnKqqjCFjI8 +7XtS8OsfrGQ6mN5Cqa5FwIziDw== +-----END CERTIFICATE----- diff --git a/credentials/development/commissioner_dut/struct_pai_subject_vid_mismatch/pai-Key.der b/credentials/development/commissioner_dut/struct_pai_subject_vid_mismatch/pai-Key.der new file mode 100644 index 0000000000000000000000000000000000000000..0b61acbcaee36f34fc22dddff7f6ba34c09232df GIT binary patch literal 121 zcmV-<0EYiCcLD(c1R%@L*J#)k%!YvV5_NB>XXOL)5yu^L6~r$&wBnKhEcKuY1_&yK zNX|V20SBQ(13~}(subjectVID + 1) : subjectVID; + uint16_t pid = certConfig.IsSubjectPIDMismatch() ? static_cast(subjectPID + 1) : subjectPID; VerifyOrReturnError(subjectCN != nullptr, false); VerifyOrReturnError(caCert != nullptr, false); @@ -759,8 +761,7 @@ bool MakeAttCert(AttCertType attCertType, const char * subjectCN, uint16_t subje VerifyOrReturnError(newCert != nullptr, false); VerifyOrReturnError(newKey != nullptr, false); - // Set the certificate version (must be 2, a.k.a. v3). - if (!X509_set_version(newCert, 2)) + if (!X509_set_version(newCert, certConfig.GetCertVersion())) { ReportOpenSSLErrorAndExit("X509_set_version", res = false); } @@ -810,7 +811,7 @@ bool MakeAttCert(AttCertType attCertType, const char * subjectCN, uint16_t subje strlen(chip::Crypto::kVIDPrefixForCNEncoding)); cnAttrStrLen += strlen(chip::Crypto::kVIDPrefixForCNEncoding); - VerifyOrReturnError(Encoding::Uint16ToHex(subjectVID, &cnAttrStr[cnAttrStrLen], chip::Crypto::kVIDandPIDHexLength, + VerifyOrReturnError(Encoding::Uint16ToHex(vid, &cnAttrStr[cnAttrStrLen], chip::Crypto::kVIDandPIDHexLength, Encoding::HexFlags::kUppercase) == CHIP_NO_ERROR, false); cnAttrStrLen += chip::Crypto::kVIDandPIDHexLength; @@ -833,7 +834,7 @@ bool MakeAttCert(AttCertType attCertType, const char * subjectCN, uint16_t subje strlen(chip::Crypto::kPIDPrefixForCNEncoding)); cnAttrStrLen += strlen(chip::Crypto::kPIDPrefixForCNEncoding); - VerifyOrReturnError(Encoding::Uint16ToHex(subjectPID, &cnAttrStr[cnAttrStrLen], chip::Crypto::kVIDandPIDHexLength, + VerifyOrReturnError(Encoding::Uint16ToHex(pid, &cnAttrStr[cnAttrStrLen], chip::Crypto::kVIDandPIDHexLength, Encoding::HexFlags::kUppercase) == CHIP_NO_ERROR, false); cnAttrStrLen += chip::Crypto::kVIDandPIDHexLength; @@ -854,7 +855,7 @@ bool MakeAttCert(AttCertType attCertType, const char * subjectCN, uint16_t subje if (subjectVID != VendorId::NotSpecified) { char chipAttrStr[chip::Crypto::kVIDandPIDHexLength]; - VerifyOrReturnError(Encoding::Uint16ToHex(subjectVID, chipAttrStr, chip::Crypto::kVIDandPIDHexLength, + VerifyOrReturnError(Encoding::Uint16ToHex(vid, chipAttrStr, chip::Crypto::kVIDandPIDHexLength, Encoding::HexFlags::kUppercase) == CHIP_NO_ERROR, false); @@ -869,7 +870,7 @@ bool MakeAttCert(AttCertType attCertType, const char * subjectCN, uint16_t subje if (subjectPID != 0) { char chipAttrStr[chip::Crypto::kVIDandPIDHexLength]; - VerifyOrReturnError(Encoding::Uint16ToHex(subjectPID, chipAttrStr, chip::Crypto::kVIDandPIDHexLength, + VerifyOrReturnError(Encoding::Uint16ToHex(pid, chipAttrStr, chip::Crypto::kVIDandPIDHexLength, Encoding::HexFlags::kUppercase) == CHIP_NO_ERROR, false); @@ -888,35 +889,141 @@ bool MakeAttCert(AttCertType attCertType, const char * subjectCN, uint16_t subje ReportOpenSSLErrorAndExit("X509_set_issuer_name", res = false); } - // Add the appropriate certificate extensions. - if (attCertType == kAttCertType_DAC) + if (certConfig.IsExtensionBasicPresent()) { - res = AddExtension(newCert, NID_basic_constraints, "critical,CA:FALSE") && - AddExtension(newCert, NID_key_usage, "critical,digitalSignature"); + std::string basicConstraintsExt; + + if (certConfig.IsExtensionBasicCriticalPresent()) + { + if (certConfig.IsExtensionBasicCritical()) + { + basicConstraintsExt += "critical"; + } + } + + if (certConfig.IsExtensionBasicCAPresent()) + { + if (!basicConstraintsExt.empty()) + { + basicConstraintsExt += ","; + } + if ((certConfig.IsExtensionBasicCACorrect() && attCertType == kAttCertType_DAC) || + (!certConfig.IsExtensionBasicCACorrect() && attCertType != kAttCertType_DAC)) + { + basicConstraintsExt += "CA:FALSE"; + } + else + { + basicConstraintsExt += "CA:TRUE"; + } + } + + if (certConfig.IsExtensionBasicPathLenPresent(attCertType) || !certConfig.IsExtensionBasicCAPresent()) + { + if (!basicConstraintsExt.empty()) + { + basicConstraintsExt += ","; + } + basicConstraintsExt.append("pathlen:" + std::to_string(certConfig.GetExtensionBasicPathLenValue(attCertType))); + } + + res = AddExtension(newCert, NID_basic_constraints, basicConstraintsExt.c_str()); + VerifyTrueOrExit(res); } - else if (attCertType == kAttCertType_PAI) + + if (certConfig.IsExtensionKeyUsagePresent()) { - res = AddExtension(newCert, NID_basic_constraints, "critical,CA:TRUE,pathlen:0") && - AddExtension(newCert, NID_key_usage, "critical,keyCertSign,cRLSign"); + std::string keyUsageExt; + + if (certConfig.IsExtensionKeyUsageCriticalPresent()) + { + if (certConfig.IsExtensionKeyUsageCritical()) + { + keyUsageExt += "critical"; + } + } + + if ((certConfig.IsExtensionKeyUsageDigitalSigCorrect() && attCertType == kAttCertType_DAC) || + (!certConfig.IsExtensionKeyUsageDigitalSigCorrect() && attCertType != kAttCertType_DAC)) + { + if (!keyUsageExt.empty()) + { + keyUsageExt += ","; + } + keyUsageExt += "digitalSignature"; + } + + if ((certConfig.IsExtensionKeyUsageKeyCertSignCorrect() && attCertType != kAttCertType_DAC) || + (!certConfig.IsExtensionKeyUsageKeyCertSignCorrect() && attCertType == kAttCertType_DAC)) + { + if (!keyUsageExt.empty()) + { + keyUsageExt += ","; + } + keyUsageExt += "keyCertSign"; + } + + if ((certConfig.IsExtensionKeyUsageCRLSignCorrect() && attCertType != kAttCertType_DAC) || + (!certConfig.IsExtensionKeyUsageCRLSignCorrect() && attCertType == kAttCertType_DAC)) + { + if (!keyUsageExt.empty()) + { + keyUsageExt += ","; + } + keyUsageExt += "cRLSign"; + } + + // In test mode only: just add an extra extension flag to prevent empty extantion. + if (certConfig.IsErrorTestCaseEnabled() && (keyUsageExt.empty() || (keyUsageExt.compare("critical") == 0))) + { + if (!keyUsageExt.empty()) + { + keyUsageExt += ","; + } + keyUsageExt += "keyEncipherment"; + } + + res = AddExtension(newCert, NID_key_usage, keyUsageExt.c_str()); + VerifyTrueOrExit(res); } - // otherwise, it is PAA - else + + if (certConfig.IsExtensionSKIDPresent()) { - res = AddExtension(newCert, NID_basic_constraints, "critical,CA:TRUE,pathlen:1") && - AddExtension(newCert, NID_key_usage, "critical,keyCertSign,cRLSign"); + // Add a subject key id extension for the certificate. + res = AddSubjectKeyId(newCert); + VerifyTrueOrExit(res); } - VerifyTrueOrExit(res); - // Add a subject key id extension for the certificate. - res = AddSubjectKeyId(newCert); - VerifyTrueOrExit(res); + if (certConfig.IsExtensionAKIDPresent()) + { + // Add the authority key id extension from the signing certificate. + res = AddAuthorityKeyId(newCert, caCert); + VerifyTrueOrExit(res); + } - // Add the authority key id extension from the signing certificate. - res = AddAuthorityKeyId(newCert, caCert); - VerifyTrueOrExit(res); + if (certConfig.IsExtensionExtendedKeyUsagePresent()) + { + // Add optional Extended Key Usage extentsion. + res = AddExtension(newCert, NID_ext_key_usage, "critical,clientAuth,serverAuth"); + VerifyTrueOrExit(res); + } + + if (certConfig.IsExtensionAuthorityInfoAccessPresent()) + { + // Add optional Authority Informational Access extentsion. + res = AddExtension(newCert, NID_info_access, "OCSP;URI:http://ocsp.example.com/"); + VerifyTrueOrExit(res); + } + + if (certConfig.IsExtensionSubjectAltNamePresent()) + { + // Add optional Subject Alternative Name extentsion. + res = AddExtension(newCert, NID_subject_alt_name, "DNS:test.com"); + VerifyTrueOrExit(res); + } // Sign the new certificate. - if (!X509_sign(newCert, caKey, EVP_sha256())) + if (!X509_sign(newCert, caKey, certConfig.GetSignatureAlgorithm())) { ReportOpenSSLErrorAndExit("X509_sign", res = false); } diff --git a/src/tools/chip-cert/Cmd_GenAttCert.cpp b/src/tools/chip-cert/Cmd_GenAttCert.cpp index 766f64b69c1fae..6c98076c1fd4c5 100644 --- a/src/tools/chip-cert/Cmd_GenAttCert.cpp +++ b/src/tools/chip-cert/Cmd_GenAttCert.cpp @@ -57,6 +57,10 @@ OptionDef gCmdOptionDefs[] = { "out-key", kArgumentRequired, 'O' }, { "valid-from", kArgumentRequired, 'f' }, { "lifetime", kArgumentRequired, 'l' }, +#if CHIP_CONFIG_INTERNAL_FLAG_GENERATE_DA_TEST_CASES + { "ignore-error", kNoArgument, 'i' }, + { "error-type", kArgumentRequired, 'e' }, +#endif { } }; @@ -119,6 +123,57 @@ const char * const gCmdOptionHelp = " 4294967295 to indicate that certificate doesn't have well defined\n" " expiration date\n" "\n" +#if CHIP_CONFIG_INTERNAL_FLAG_GENERATE_DA_TEST_CASES + " -i, --ignore-error\n" + "\n" + " Ignore some input parameters error.\n" + " WARNING: This option makes it possible to circumvent attestation certificate\n" + " structure requirement. This is required for negative testing of the attestation flow.\n" + " Because of this it SHOULD NEVER BE ENABLED IN PRODUCTION BUILDS.\n" + "\n" + " -e, --error-type \n" + "\n" + " When specified injects specific error into the structure of generated attestation certificate.\n" + " Note that 'ignore-error' option MUST be specified for this error injection to take effect.\n" + " Supported error types that can be injected are:\n" + " no-error - No error to inject.\n" + " cert-version - Certificate version will be set to v2 instead of required v3.\n" + " sig-algo - Use ecdsa-with-SHA1 signature algorithm instead of required ecdsa-with-SHA256.\n" + " issuer-vid - TODO\n" + " issuer-pid - TODO\n" + " subject-vid - TODO\n" + " subject-vid-mismatch - The VID value in the subject field won't match VID in the issuer field.\n" + " subject-pid - TODO\n" + " subject-pid-mismatch - The PID value in the subject field won't match PID in the issuer field.\n" + " sig-curve - Use secp256k1 curve to generate certificate signature instead of\n" + " required secp256r1 (aka prime256v1).\n" + " ext-basic-missing - Certificate won't have required Basic Constraint extension.\n" + " ext-basic-critical-missing - Basic Constraint extension won't have critical field.\n" + " ext-basic-critical-wrong - Basic Constraint extension will be marked as non-critical.\n" + " ext-basic-ca-missing - Basic Constraint extension won't have cA field.\n" + " ext-basic-ca-wrong - Basic Constraint extension cA field will be set to TRUE for DAC\n" + " and to FALSE for PAI and PAA.\n" + " ext-basic-pathlen-presence-wrong - Basic Constraint extension will include pathLen field for DAC\n" + " and won't have pathLen field for PAI and PAA.\n" + " ext-basic-pathlen0 - Basic Constraint extension pathLen field will be set to 0.\n" + " ext-basic-pathlen1 - Basic Constraint extension pathLen field will be set to 1.\n" + " ext-basic-pathlen2 - Basic Constraint extension pathLen field will be set to 2.\n" + " ext-key-usage-missing - Certificate won't have required Key Usage extension.\n" + " ext-key-usage-critical-missing - Key Usage extension won't have critical field.\n" + " ext-key-usage-critical-wrong - Key Usage extension will be marked as non-critical.\n" + " ext-key-usage-dig-sig - Key Usage extension digitalSignature flag won't be set for DAC\n" + " and will be set for PAI/PAA.\n" + " ext-key-usage-key-cert-sign - Key Usage extension keyCertSign flag will be set for DAC\n" + " and won't be set for PAI/PAA.\n" + " ext-key-usage-crl-sign - Key Usage extension cRLSign flag will be set for DAC\n" + " and won't set for PAI/PAA.\n" + " ext-akid-missing - Certificate won't have required Authority Key ID extension.\n" + " ext-skid-missing - Certificate won't have required Subject Key ID extension.\n" + " ext-extended-key-usage - Certificate will include optional Extended Key Usage extension.\n" + " ext-authority-info-access - Certificate will include optional Authority Information Access extension.\n" + " ext-subject-alt-name - Certificate will include optional Subject Alternative Name extension.\n" + "\n" +#endif ; OptionSet gCmdOptions = @@ -156,6 +211,7 @@ const char * gOutCertFileName = nullptr; const char * gOutKeyFileName = nullptr; uint32_t gValidDays = kCertValidDays_Undefined; struct tm gValidFrom; +AttCertStructConfig gCertConfig; bool HandleOption(const char * progName, OptionSet * optSet, int id, const char * name, const char * arg) { @@ -233,6 +289,118 @@ bool HandleOption(const char * progName, OptionSet * optSet, int id, const char return false; } break; +#if CHIP_CONFIG_INTERNAL_FLAG_GENERATE_DA_TEST_CASES + case 'i': + gCertConfig.EnableErrorTestCase(); + break; + case 'e': + if (strcmp(arg, "cert-version") == 0) + { + gCertConfig.SetCertVersionWrong(); + } + else if (strcmp(arg, "sig-algo") == 0) + { + gCertConfig.SetSigAlgoWrong(); + } + else if (strcmp(arg, "subject-vid-mismatch") == 0) + { + gCertConfig.SetSubjectVIDMismatch(); + } + else if (strcmp(arg, "subject-pid-mismatch") == 0) + { + gCertConfig.SetSubjectPIDMismatch(); + } + else if (strcmp(arg, "sig-curve") == 0) + { + gCertConfig.SetSigCurveWrong(); + } + else if (strcmp(arg, "ext-basic-missing") == 0) + { + gCertConfig.SetExtensionBasicMissing(); + } + else if (strcmp(arg, "ext-basic-critical-missing") == 0) + { + gCertConfig.SetExtensionBasicCriticalMissing(); + } + else if (strcmp(arg, "ext-basic-critical-wrong") == 0) + { + gCertConfig.SetExtensionBasicCriticalWrong(); + } + else if (strcmp(arg, "ext-basic-ca-missing") == 0) + { + gCertConfig.SetExtensionBasicCAMissing(); + } + else if (strcmp(arg, "ext-basic-ca-wrong") == 0) + { + gCertConfig.SetExtensionBasicCAWrong(); + } + else if (strcmp(arg, "ext-basic-pathlen-presence-wrong") == 0) + { + gCertConfig.SetExtensionBasicPathLenPresenceWrong(); + } + else if (strcmp(arg, "ext-basic-pathlen0") == 0) + { + gCertConfig.SetExtensionBasicPathLen0(); + } + else if (strcmp(arg, "ext-basic-pathlen1") == 0) + { + gCertConfig.SetExtensionBasicPathLen1(); + } + else if (strcmp(arg, "ext-basic-pathlen2") == 0) + { + gCertConfig.SetExtensionBasicPathLen2(); + } + else if (strcmp(arg, "ext-key-usage-missing") == 0) + { + gCertConfig.SetExtensionKeyUsageMissing(); + } + else if (strcmp(arg, "ext-key-usage-critical-missing") == 0) + { + gCertConfig.SetExtensionKeyUsageCriticalMissing(); + } + else if (strcmp(arg, "ext-key-usage-critical-wrong") == 0) + { + gCertConfig.SetExtensionKeyUsageCriticalWrong(); + } + else if (strcmp(arg, "ext-key-usage-dig-sig") == 0) + { + gCertConfig.SetExtensionKeyUsageDigitalSigWrong(); + } + else if (strcmp(arg, "ext-key-usage-key-cert-sign") == 0) + { + gCertConfig.SetExtensionKeyUsageKeyCertSignWrong(); + } + else if (strcmp(arg, "ext-key-usage-crl-sign") == 0) + { + gCertConfig.SetExtensionKeyUsageCRLSignWrong(); + } + else if (strcmp(arg, "ext-akid-missing") == 0) + { + gCertConfig.SetExtensionAKIDMissing(); + } + else if (strcmp(arg, "ext-skid-missing") == 0) + { + gCertConfig.SetExtensionSKIDMissing(); + } + else if (strcmp(arg, "ext-extended-key-usage") == 0) + { + gCertConfig.SetExtensionExtendedKeyUsagePresent(); + } + else if (strcmp(arg, "ext-authority-info-access") == 0) + { + gCertConfig.SetExtensionAuthorityInfoAccessPresent(); + } + else if (strcmp(arg, "ext-subject-alt-name") == 0) + { + gCertConfig.SetExtensionSubjectAltNamePresent(); + } + else if (strcmp(arg, "no-error") != 0) + { + PrintArgError("%s: Invalid value specified for the error type: %s\n", progName, arg); + return false; + } + break; +#endif default: PrintArgError("%s: Unhandled option: %s\n", progName, name); return false; @@ -266,33 +434,42 @@ bool Cmd_GenAttCert(int argc, char * argv[]) res = ParseArgs(CMD_NAME, argc, argv, gCmdOptionSets); VerifyTrueOrExit(res); + if (gCertConfig.IsErrorTestCaseEnabled()) + { + fprintf(stderr, + "WARNING: The ignor-error option is set. This option makes it possible to generate invalid certificates.\n"); + } + if (gAttCertType == kAttCertType_NotSpecified) { fprintf(stderr, "Please specify attestation certificate type.\n"); return false; } - if (gAttCertType == kAttCertType_DAC) + if (!gCertConfig.IsErrorTestCaseEnabled()) { - if (gSubjectVID == VendorId::NotSpecified || gSubjectPID == 0) + if (gAttCertType == kAttCertType_DAC) { - fprintf(stderr, "Please specify VID and PID subject DN attributes.\n"); - return false; + if (gSubjectVID == VendorId::NotSpecified || gSubjectPID == 0) + { + fprintf(stderr, "Please specify VID and PID subject DN attributes.\n"); + return false; + } } - } - else if (gAttCertType == kAttCertType_PAI) - { - if (gSubjectVID == VendorId::NotSpecified) + if (gAttCertType == kAttCertType_PAI) { - fprintf(stderr, "Please specify VID subject DN attributes.\n"); - return false; + if (gSubjectVID == VendorId::NotSpecified) + { + fprintf(stderr, "Please specify VID subject DN attributes.\n"); + return false; + } } - } - else if (gAttCertType == kAttCertType_PAA) - { - if (gSubjectPID != 0) + if (gAttCertType == kAttCertType_PAA) { - fprintf(stderr, "VID & PID SHALL NOT specify subject DN attributes.\n"); - return false; + if (gSubjectPID != 0) + { + fprintf(stderr, "VID & PID SHALL NOT specify subject DN attributes.\n"); + return false; + } } } @@ -360,14 +537,22 @@ bool Cmd_GenAttCert(int argc, char * argv[]) } else { - res = GenerateKeyPair(newKey.get()); - VerifyTrueOrExit(res); + if (gCertConfig.IsSigCurveWrong()) + { + res = GenerateKeyPair_Secp256k1(newKey.get()); + VerifyTrueOrExit(res); + } + else + { + res = GenerateKeyPair(newKey.get()); + VerifyTrueOrExit(res); + } } if (gAttCertType == kAttCertType_PAA) { res = MakeAttCert(gAttCertType, gSubjectCN, gSubjectVID, gSubjectPID, gEncodeVIDandPIDasCN, newCert.get(), newKey.get(), - gValidFrom, gValidDays, newCert.get(), newKey.get()); + gValidFrom, gValidDays, newCert.get(), newKey.get(), gCertConfig); VerifyTrueOrExit(res); } else @@ -378,11 +563,11 @@ bool Cmd_GenAttCert(int argc, char * argv[]) res = ReadCert(gCACertFileName, caCert.get()); VerifyTrueOrExit(res); - res = ReadKey(gCAKeyFileName, caKey.get()); + res = ReadKey(gCAKeyFileName, caKey.get(), gCertConfig.IsErrorTestCaseEnabled()); VerifyTrueOrExit(res); res = MakeAttCert(gAttCertType, gSubjectCN, gSubjectVID, gSubjectPID, gEncodeVIDandPIDasCN, caCert.get(), caKey.get(), - gValidFrom, gValidDays, newCert.get(), newKey.get()); + gValidFrom, gValidDays, newCert.get(), newKey.get(), gCertConfig); VerifyTrueOrExit(res); } diff --git a/src/tools/chip-cert/KeyUtils.cpp b/src/tools/chip-cert/KeyUtils.cpp index 272c54e747bb3a..34d3ecc0211b11 100644 --- a/src/tools/chip-cert/KeyUtils.cpp +++ b/src/tools/chip-cert/KeyUtils.cpp @@ -142,7 +142,7 @@ bool SerializeKeyPair(EVP_PKEY * key, P256SerializedKeypair & serializedKeypair) return res; } -bool ReadKey(const char * fileName, EVP_PKEY * key) +bool ReadKey(const char * fileName, EVP_PKEY * key, bool ignorErrorIfUnsupportedCurve) { bool res = true; uint32_t keyDataLen = 0; @@ -207,7 +207,8 @@ bool ReadKey(const char * fileName, EVP_PKEY * key) } } - if (EC_GROUP_get_curve_name(EC_KEY_get0_group(EVP_PKEY_get1_EC_KEY(key))) != gNIDChipCurveP256) + if ((EC_GROUP_get_curve_name(EC_KEY_get0_group(EVP_PKEY_get1_EC_KEY(key))) != gNIDChipCurveP256) && + !ignorErrorIfUnsupportedCurve) { fprintf(stderr, "Specified key uses unsupported Elliptic Curve\n"); ExitNow(res = false); @@ -238,6 +239,27 @@ bool GenerateKeyPair(EVP_PKEY * key) return res; } +bool GenerateKeyPair_Secp256k1(EVP_PKEY * key) +{ + bool res = true; + std::unique_ptr ecKey(EC_KEY_new_by_curve_name(NID_secp256k1), &EC_KEY_free); + + VerifyOrExit(key != nullptr, res = false); + + if (!EC_KEY_generate_key(ecKey.get())) + { + ReportOpenSSLErrorAndExit("EC_KEY_generate_key", res = false); + } + + if (!EVP_PKEY_set1_EC_KEY(key, ecKey.get())) + { + ReportOpenSSLErrorAndExit("EVP_PKEY_set1_EC_KEY", res = false); + } + +exit: + return res; +} + bool WritePrivateKey(const char * fileName, EVP_PKEY * key, KeyFormat keyFmt) { bool res = true; diff --git a/src/tools/chip-cert/chip-cert.h b/src/tools/chip-cert/chip-cert.h index b56aa16610e61a..d51d3b89291d25 100644 --- a/src/tools/chip-cert/chip-cert.h +++ b/src/tools/chip-cert/chip-cert.h @@ -66,9 +66,15 @@ using chip::ASN1::OID; +#ifndef CHIP_CONFIG_INTERNAL_FLAG_GENERATE_DA_TEST_CASES +#define CHIP_CONFIG_INTERNAL_FLAG_GENERATE_DA_TEST_CASES CHIP_CONFIG_TEST +#endif + #define COPYRIGHT_STRING \ - "Copyright (c) 2021 Project CHIP Authors.\nCopyright (c) 2019 Google LLC.\nCopyright (c) 2013-2017 Nest Labs, Inc.\nAll " \ - "rights reserved.\n" + "Copyright (c) 2021-2022 Project CHIP Authors" \ + "Copyright (c) 2019 Google LLC." \ + "Copyright (c) 2013-2017 Nest Labs, Inc." \ + "All rights reserved.\n" enum { @@ -110,6 +116,132 @@ struct FutureExtension const char * info; }; +/** Attestation Certificate Error Flags + * + * By default all methods (if none of the class setters were used) return valid + * attestation certificate configuration parameter as described in the spec. + * These parameters can be modified to inject errors into certificate structure. + */ +class AttCertStructConfig +{ +public: + void EnableErrorTestCase() { mEnabled = true; } + void SetCertVersionWrong() { mFlags.Set(CertErrorFlags::kCertVersion); } + void SetSigAlgoWrong() { mFlags.Set(CertErrorFlags::kSigAlgo); } + void SetSubjectVIDMismatch() { mFlags.Set(CertErrorFlags::kSubjectVIDMismatch); } + void SetSubjectPIDMismatch() { mFlags.Set(CertErrorFlags::kSubjectPIDMismatch); } + void SetSigCurveWrong() { mFlags.Set(CertErrorFlags::kSigCurve); } + void SetExtensionBasicMissing() { mFlags.Set(CertErrorFlags::kExtBasicMissing); } + void SetExtensionBasicCriticalMissing() { mFlags.Set(CertErrorFlags::kExtBasicCriticalMissing); } + void SetExtensionBasicCriticalWrong() { mFlags.Set(CertErrorFlags::kExtBasicCriticalWrong); } + void SetExtensionBasicCAMissing() { mFlags.Set(CertErrorFlags::kExtBasicCAMissing); } + void SetExtensionBasicCAWrong() { mFlags.Set(CertErrorFlags::kExtBasicCAWrong); } + void SetExtensionBasicPathLenPresenceWrong() { mFlags.Set(CertErrorFlags::kExtBasicPathLenWrong); } + void SetExtensionBasicPathLen0() { mFlags.Set(CertErrorFlags::kExtBasicPathLen0); } + void SetExtensionBasicPathLen1() { mFlags.Set(CertErrorFlags::kExtBasicPathLen1); } + void SetExtensionBasicPathLen2() { mFlags.Set(CertErrorFlags::kExtBasicPathLen2); } + void SetExtensionKeyUsageMissing() { mFlags.Set(CertErrorFlags::kExtKeyUsageMissing); } + void SetExtensionKeyUsageCriticalMissing() { mFlags.Set(CertErrorFlags::kExtKeyUsageCriticalMissing); } + void SetExtensionKeyUsageCriticalWrong() { mFlags.Set(CertErrorFlags::kExtKeyUsageCriticalWrong); } + void SetExtensionKeyUsageDigitalSigWrong() { mFlags.Set(CertErrorFlags::kExtKeyUsageDigSig); } + void SetExtensionKeyUsageKeyCertSignWrong() { mFlags.Set(CertErrorFlags::kExtKeyUsageKeyCertSign); } + void SetExtensionKeyUsageCRLSignWrong() { mFlags.Set(CertErrorFlags::kExtKeyUsageCRLSign); } + void SetExtensionAKIDMissing() { mFlags.Set(CertErrorFlags::kExtAKIDMissing); } + void SetExtensionSKIDMissing() { mFlags.Set(CertErrorFlags::kExtSKIDMissing); } + void SetExtensionExtendedKeyUsagePresent() { mFlags.Set(CertErrorFlags::kExtExtendedKeyUsage); } + void SetExtensionAuthorityInfoAccessPresent() { mFlags.Set(CertErrorFlags::kExtAuthorityInfoAccess); } + void SetExtensionSubjectAltNamePresent() { mFlags.Set(CertErrorFlags::kExtSubjectAltName); } + + bool IsErrorTestCaseEnabled() { return mEnabled; } + int GetCertVersion() { return (mEnabled && mFlags.Has(CertErrorFlags::kCertVersion)) ? 1 : 2; } + const EVP_MD * GetSignatureAlgorithm() + { + return (mEnabled && mFlags.Has(CertErrorFlags::kSigAlgo)) ? EVP_sha1() : EVP_sha256(); + } + bool IsSubjectVIDMismatch() { return (mEnabled && mFlags.Has(CertErrorFlags::kSubjectVIDMismatch)); } + bool IsSubjectPIDMismatch() { return (mEnabled && mFlags.Has(CertErrorFlags::kSubjectPIDMismatch)); } + bool IsSigCurveWrong() { return (mEnabled && mFlags.Has(CertErrorFlags::kSigCurve)); } + bool IsExtensionBasicPresent() { return (!mEnabled || !mFlags.Has(CertErrorFlags::kExtBasicMissing)); } + bool IsExtensionBasicCriticalPresent() { return (!mEnabled || !mFlags.Has(CertErrorFlags::kExtBasicCriticalMissing)); } + bool IsExtensionBasicCritical() { return (!mEnabled || !mFlags.Has(CertErrorFlags::kExtBasicCriticalWrong)); } + bool IsExtensionBasicCAPresent() { return (!mEnabled || !mFlags.Has(CertErrorFlags::kExtBasicCAMissing)); } + bool IsExtensionBasicCACorrect() { return (!mEnabled || !mFlags.Has(CertErrorFlags::kExtBasicCAWrong)); } + bool IsExtensionBasicPathLenPresent(AttCertType & attCertType) + { + bool normallyPresent = (attCertType != kAttCertType_DAC); + bool testCaseWrong = (mEnabled && mFlags.Has(CertErrorFlags::kExtBasicPathLenWrong)); + return (normallyPresent ^ testCaseWrong); + } + int GetExtensionBasicPathLenValue(AttCertType & attCertType) + { + if (mFlags.Has(CertErrorFlags::kExtBasicPathLen0)) + { + return 0; + } + if (mFlags.Has(CertErrorFlags::kExtBasicPathLen1)) + { + return 1; + } + if (mFlags.Has(CertErrorFlags::kExtBasicPathLen2)) + { + return 2; + } + if (attCertType == kAttCertType_PAA) + { + return 0; + } + if (attCertType == kAttCertType_PAI) + { + return 1; + } + return 0; + } + bool IsExtensionKeyUsagePresent() { return (!mEnabled || !mFlags.Has(CertErrorFlags::kExtKeyUsageMissing)); } + bool IsExtensionKeyUsageCriticalPresent() { return (!mEnabled || !mFlags.Has(CertErrorFlags::kExtKeyUsageCriticalMissing)); } + bool IsExtensionKeyUsageCritical() { return (!mEnabled || !mFlags.Has(CertErrorFlags::kExtKeyUsageCriticalWrong)); } + bool IsExtensionKeyUsageDigitalSigCorrect() { return (!mEnabled || !mFlags.Has(CertErrorFlags::kExtKeyUsageDigSig)); } + bool IsExtensionKeyUsageKeyCertSignCorrect() { return (!mEnabled || !mFlags.Has(CertErrorFlags::kExtKeyUsageKeyCertSign)); } + bool IsExtensionKeyUsageCRLSignCorrect() { return (!mEnabled || !mFlags.Has(CertErrorFlags::kExtKeyUsageCRLSign)); } + bool IsExtensionAKIDPresent() { return (!mEnabled || !mFlags.Has(CertErrorFlags::kExtAKIDMissing)); } + bool IsExtensionSKIDPresent() { return (!mEnabled || !mFlags.Has(CertErrorFlags::kExtSKIDMissing)); } + bool IsExtensionExtendedKeyUsagePresent() { return (mEnabled && mFlags.Has(CertErrorFlags::kExtExtendedKeyUsage)); } + bool IsExtensionAuthorityInfoAccessPresent() { return (mEnabled && mFlags.Has(CertErrorFlags::kExtAuthorityInfoAccess)); } + bool IsExtensionSubjectAltNamePresent() { return (mEnabled && mFlags.Has(CertErrorFlags::kExtSubjectAltName)); } + +private: + enum class CertErrorFlags : uint32_t + { + kCertVersion = 0x00000001, + kSigAlgo = 0x00000002, + kSubjectVIDMismatch = 0x00000004, + kSubjectPIDMismatch = 0x00000008, + kSigCurve = 0x00000010, + kExtBasicMissing = 0x00000020, + kExtBasicCriticalMissing = 0x00000040, + kExtBasicCriticalWrong = 0x00000080, + kExtBasicCAMissing = 0x00000100, + kExtBasicCAWrong = 0x00000200, + kExtBasicPathLenWrong = 0x00000400, + kExtBasicPathLen0 = 0x00000800, + kExtBasicPathLen1 = 0x00001000, + kExtBasicPathLen2 = 0x00002000, + kExtKeyUsageMissing = 0x00004000, + kExtKeyUsageCriticalMissing = 0x00008000, + kExtKeyUsageCriticalWrong = 0x00010000, + kExtKeyUsageDigSig = 0x00020000, + kExtKeyUsageKeyCertSign = 0x00040000, + kExtKeyUsageCRLSign = 0x00080000, + kExtAKIDMissing = 0x00100000, + kExtSKIDMissing = 0x00200000, + kExtExtendedKeyUsage = 0x00400000, + kExtAuthorityInfoAccess = 0x00800000, + kExtSubjectAltName = 0x01000000, + }; + + bool mEnabled = false; + chip::BitFlags mFlags; +}; + class ToolChipDN : public chip::Credentials::ChipDN { public: @@ -143,10 +275,10 @@ extern bool ResignCert(X509 * cert, X509 * caCert, EVP_PKEY * caKey); extern bool MakeAttCert(AttCertType attCertType, const char * subjectCN, uint16_t subjectVID, uint16_t subjectPID, bool encodeVIDandPIDasCN, X509 * caCert, EVP_PKEY * caKey, const struct tm & validFrom, uint32_t validDays, - X509 * newCert, EVP_PKEY * newKey); - + X509 * newCert, EVP_PKEY * newKey, AttCertStructConfig & certConfig); extern bool GenerateKeyPair(EVP_PKEY * key); -extern bool ReadKey(const char * fileName, EVP_PKEY * key); +extern bool GenerateKeyPair_Secp256k1(EVP_PKEY * key); +extern bool ReadKey(const char * fileName, EVP_PKEY * key, bool ignorErrorIfUnsupportedCurve = false); extern bool WritePrivateKey(const char * fileName, EVP_PKEY * key, KeyFormat keyFmt); extern bool SerializeKeyPair(EVP_PKEY * key, chip::Crypto::P256SerializedKeypair & serializedKeypair); @@ -169,6 +301,7 @@ extern int gNIDChipRootId; extern int gNIDChipFabricId; extern int gNIDChipCASEAuthenticatedTag; extern int gNIDChipCurveP256; +extern int gNIDTestCurveSecp256k1; extern int gNIDChipAttAttrVID; extern int gNIDChipAttAttrPID; diff --git a/src/tools/chip-cert/gen_com_dut_test_vectors.py b/src/tools/chip-cert/gen_com_dut_test_vectors.py new file mode 100755 index 00000000000000..0cace7f4192b74 --- /dev/null +++ b/src/tools/chip-cert/gen_com_dut_test_vectors.py @@ -0,0 +1,392 @@ +#!/usr/bin/env python + +import argparse +import json +import os +import subprocess +import sys +import typing +import cryptography.x509 +import os.path +import glob +from binascii import hexlify, unhexlify +from enum import Enum + + +class CertType(Enum): + PAA = 1 + PAI = 2 + DAC = 3 + + +CERT_STRUCT_TEST_CASES = [ + { + "description": 'Valid certificate version field set to v3(2)', + "test_folder": 'cert_version_v3', + "error_flag": 'no-error', + "is_success_case": 'true', + }, + { + "description": 'Invalid certificate version field set to v2(1)', + "test_folder": 'cert_version_v2', + "error_flag": 'cert-version', + "is_success_case": 'false', + }, + { + "description": 'Valid certificate signature algorithm ECDSA_WITH_SHA256', + "test_folder": 'sig_algo_ecdsa_with_sha256', + "error_flag": 'no-error', + "is_success_case": 'true', + }, + { + "description": 'Invalid certificate signature algorithm ECDSA_WITH_SHA1', + "test_folder": 'sig_algo_ecdsa_with_sha1', + "error_flag": 'sig-algo', + "is_success_case": 'false', + }, + { + "description": "VID in Subject field doesn't match VID in Issuer field", + "test_folder": 'subject_vid_mismatch', + "error_flag": 'subject-vid-mismatch', + "is_success_case": 'false', + }, + { + "description": "PID in Subject field doesn't match PID in Issuer field", + "test_folder": 'subject_pid_mismatch', + "error_flag": 'subject-pid-mismatch', + "is_success_case": 'false', + }, + { + "description": "Valid certificate public key curve prime256v1", + "test_folder": 'sig_curve_prime256v1', + "error_flag": 'no-error', + "is_success_case": 'true', + }, + { + "description": "Invalid certificate public key curve secp256k1", + "test_folder": 'sig_curve_secp256k1', + "error_flag": 'sig-curve', + "is_success_case": 'false', + }, + # TODO Cases: + # 'issuer-vid' + # 'issuer-pid' + # 'subject-vid' + # 'subject-pid' + { + "description": "Certificate doesn't include Basic Constraint extension", + "test_folder": 'ext_basic_missing', + "error_flag": 'ext-basic-missing', + "is_success_case": 'false', + }, + { + "description": "Certificate Basic Constraint extension critical field is missing", + "test_folder": 'ext_basic_critical_missing', + "error_flag": 'ext-basic-critical-missing', + "is_success_case": 'false', + }, + { + "description": "Certificate Basic Constraint extension critical field is set as 'non-critical'", + "test_folder": 'ext_basic_critical_wrong', + "error_flag": 'ext-basic-critical-wrong', + "is_success_case": 'false', + }, + { + "description": "Certificate Basic Constraint extension CA field is missing", + "test_folder": 'ext_basic_ca_missing', + "error_flag": 'ext-basic-ca-missing', + "is_success_case": 'false', + }, + { + "description": "Certificate Basic Constraint extension CA field is wrong (TRUE for DAC and FALSE for PAI)", + "test_folder": 'ext_basic_ca_wrong', + "error_flag": 'ext-basic-ca-wrong', + "is_success_case": 'false', + }, + { + "description": "Certificate Basic Constraint extension PathLen field presence is wrong (present for DAC not present for PAI)", + "test_folder": 'ext_basic_pathlen_presence_wrong', + "error_flag": 'ext-basic-pathlen-presence-wrong', + "is_success_case": 'false', + }, + { + "description": "Certificate Basic Constraint extension PathLen field set to 0", + "test_folder": 'ext_basic_pathlen0', + "error_flag": 'ext-basic-pathlen0', + "is_success_case": 'false', + }, + { + "description": "Certificate Basic Constraint extension PathLen field set to 1", + "test_folder": 'ext_basic_pathlen1', + "error_flag": 'ext-basic-pathlen1', + "is_success_case": 'false', + }, + { + "description": "Certificate Basic Constraint extension PathLen field set to 2", + "test_folder": 'ext_basic_pathlen2', + "error_flag": 'ext-basic-pathlen2', + "is_success_case": 'false', + }, + { + "description": "Certificate doesn't include Key Usage extension", + "test_folder": 'ext_key_usage_missing', + "error_flag": 'ext-key-usage-missing', + "is_success_case": 'false', + }, + { + "description": "Certificate Key Usage extension critical field is missing", + "test_folder": 'ext_key_usage_critical_missing', + "error_flag": 'ext-key-usage-critical-missing', + "is_success_case": 'false', + }, + { + "description": "Certificate Key Usage extension critical field is set as 'non-critical'", + "test_folder": 'ext_key_usage_critical_wrong', + "error_flag": 'ext-key-usage-critical-wrong', + "is_success_case": 'false', + }, + { + "description": "Certificate Key Usage extension diginalSignature field is wrong (not present for DAC and present for PAI", + "test_folder": 'ext_key_usage_dig_sig_wrong', + "error_flag": 'ext-key-usage-dig-sig', + "is_success_case": 'false', + }, + { + "description": "Certificate Key Usage extension keyCertSign field is wrong (present for DAC and not present for PAI", + "test_folder": 'ext_key_usage_key_cert_sign_wrong', + "error_flag": 'ext-key-usage-key-cert-sign', + "is_success_case": 'false', + }, + { + "description": "Certificate Key Usage extension cRLSign field is wrong (present for DAC and not present for PAI", + "test_folder": 'ext_key_usage_crl_sign_wrong', + "error_flag": 'ext-key-usage-crl-sign', + "is_success_case": 'false', + }, + { + "description": "Certificate doesn't include Authority Key ID (AKID) extension", + "test_folder": 'ext_akid_missing', + "error_flag": 'ext-akid-missing', + "is_success_case": 'false', + }, + { + "description": "Certificate doesn't include Subject Key ID (SKID) extension", + "test_folder": 'ext_skid_missing', + "error_flag": 'ext-skid-missing', + "is_success_case": 'false', + }, + { + "description": "Certificate includes optional Extended Key Usage extension", + "test_folder": 'ext_extended_key_usage_present', + "error_flag": 'ext-extended-key-usage', + "is_success_case": 'true', + }, + { + "description": "Certificate includes optional Authority Information Access extension", + "test_folder": 'ext_authority_info_access_present', + "error_flag": 'ext-authority-info-access', + "is_success_case": 'true', + }, + { + "description": "Certificate includes optional Subject Alternative Name extension", + "test_folder": 'ext_subject_alt_name_present', + "error_flag": 'ext-subject-alt-name', + "is_success_case": 'true', + }, +] + + +class Names: + def __init__(self, cert_type: CertType, paa_path, test_case_out_dir): + prefixes = {CertType.PAA: paa_path, + CertType.PAI: test_case_out_dir + '/pai-', + CertType.DAC: test_case_out_dir + '/dac-'} + prefix = prefixes[cert_type] + + self.cert_pem = prefix + 'Cert.pem' + self.cert_der = prefix + 'Cert.der' + self.key_pem = prefix + 'Key.pem' + self.key_der = prefix + 'Key.der' + + +class DevCertBuilder: + def __init__(self, cert_type: CertType, error_type: str, paa_path: str, test_case_out_dir: str, chip_cert: str, vid: int, pid: int): + self.vid = vid + self.pid = pid + self.cert_type = cert_type + self.error_type = error_type + self.chipcert = chip_cert + + if not os.path.exists(self.chipcert): + raise Exception('Path not found: %s' % self.chipcert) + + if not os.path.exists(test_case_out_dir): + os.mkdir(test_case_out_dir) + + paa = Names(CertType.PAA, paa_path, test_case_out_dir) + pai = Names(CertType.PAI, paa_path, test_case_out_dir) + dac = Names(CertType.DAC, paa_path, test_case_out_dir) + if cert_type == CertType.PAI: + self.signer = paa + self.own = pai + if cert_type == CertType.DAC: + self.signer = pai + self.own = dac + + def make_certs_and_keys(self) -> None: + """Creates the PEM and DER certs and keyfiles""" + error_type_flag = ' -i -e' + self.error_type + + if self.cert_type == CertType.PAI: + subject_name = 'Matter Test PAI' + vid_flag = ' -V 0x{:X}'.format(self.vid) + pid_flag = '' + type_flag = '-t i' + elif self.cert_type == CertType.DAC: + subject_name = 'Matter Test DAC' + vid_flag = ' -V 0x{:X}'.format(self.vid) + pid_flag = ' -P 0x{:X}'.format(self.pid) + type_flag = '-t d' + else: + return + + cmd = self.chipcert + ' gen-att-cert ' + type_flag + error_type_flag + ' -c "' + subject_name + '" -C ' + self.signer.cert_pem + ' -K ' + \ + self.signer.key_pem + vid_flag + pid_flag + ' -l 4294967295 -o ' + self.own.cert_pem + ' -O ' + self.own.key_pem + subprocess.run(cmd, shell=True) + cmd = 'openssl x509 -inform pem -in ' + self.own.cert_pem + \ + ' -out ' + self.own.cert_der + ' -outform DER' + subprocess.run(cmd, shell=True) + cmd = 'openssl ec -inform pem -in ' + self.own.key_pem + \ + ' -out ' + self.own.key_der + ' -outform DER' + subprocess.run(cmd, shell=True) + + +def add_raw_ec_keypair_to_dict_from_der(der_key_filename: str, json_dict: dict): + with open(der_key_filename, 'rb') as infile: + key_data_der = infile.read() + + key_der = cryptography.hazmat.primitives.serialization.load_der_private_key(key_data_der, None) + json_dict["dac_private_key"] = hexlify(key_der.private_numbers().private_value.to_bytes(32, byteorder='big')).decode('utf-8') + + pk_x = key_der.public_key().public_numbers().x + pk_y = key_der.public_key().public_numbers().y + + public_key_raw_bytes = bytearray([0x04]) + public_key_raw_bytes.extend(bytearray(pk_x.to_bytes(32, byteorder='big'))) + public_key_raw_bytes.extend(bytearray(pk_y.to_bytes(32, byteorder='big'))) + + json_dict["dac_public_key"] = hexlify(bytes(public_key_raw_bytes)).decode('utf-8') + + +def add_files_to_json_config(files_mapping: dict, json_dict: dict): + for output_key_name, filename in files_mapping.items(): + with open(filename, "rb") as infile: + file_bytes = infile.read() + json_dict[output_key_name] = hexlify(file_bytes).decode('utf-8') + + +def generate_test_case_vector_json(test_case_out_dir: str, test_cert: str, test_case): + json_dict = {} + files_in_path = glob.glob(os.path.join(test_case_out_dir, "*")) + output_json_filename = test_case_out_dir + "/test_case_vector.json" + + files_to_add = { + "dac_cert": "dac-Cert.der", + "pai_cert": "pai-Cert.der", + "firmware_information": "firmware-info.bin", + "certification_declaration": "cd.der", + } + + # Add description fields to JSON Config + if "description" in test_case: + json_dict["description"] = test_cert.upper() + " Test Vector: " + test_case["description"] + if "is_success_case" in test_case: + json_dict["is_success_case"] = test_case["is_success_case"] + + # Out of all files we could add, find the ones that were present in test case, and embed them in hex + files_available = {os.path.basename(path) for path in files_in_path} + files_to_add = {key: os.path.join(test_case_out_dir, filename) + for key, filename in files_to_add.items() if filename in files_available} + + add_files_to_json_config(files_to_add, json_dict) + + # Embed the DAC key if present + if "dac-Key.der" in files_available: + der_key_filename = os.path.join(test_case_out_dir, "dac-Key.der") + add_raw_ec_keypair_to_dict_from_der(der_key_filename, json_dict) + + with open(output_json_filename, "wt+") as outfile: + json.dump(json_dict, outfile, indent=2) + + +def main(): + argparser = argparse.ArgumentParser() + argparser.add_argument('-o', '--out_dir', dest='outdir', + default='credentials/development/commissioner_dut', + help='output directory for all generated test vectors') + argparser.add_argument('-p', '--paa', dest='paapath', + default='credentials/test/attestation/Chip-Test-PAA-FFF1-', help='PAA to use') + argparser.add_argument('-d', '--cd', dest='cdpath', + default='credentials/test/certification-declaration/Chip-Test-CD-Signing-', + help='CD Signing Key/Cert to use') + argparser.add_argument('-c', '--chip-cert_dir', dest='chipcertdir', + default='out/debug/linux_x64_clang/', help='Directory where chip-cert tool is located') + + args = argparser.parse_args() + + if not os.path.exists(args.outdir): + os.mkdir(args.outdir) + + chipcert = args.chipcertdir + 'chip-cert' + + if not os.path.exists(chipcert): + raise Exception('Path not found: %s' % chipcert) + + cd_cert = args.cdpath + 'Cert.pem' + cd_key = args.cdpath + 'Key.pem' + + for test_cert in ['dac', 'pai']: + for test_case in CERT_STRUCT_TEST_CASES: + test_case_out_dir = args.outdir + '/struct_' + test_cert + '_' + test_case["test_folder"] + if test_cert == 'dac': + error_type_dac = test_case["error_flag"] + error_type_pai = 'no-error' + else: + if test_case["error_flag"] == 'ext-skid-missing': + error_type_dac = 'ext-akid-missing' + else: + error_type_dac = 'no-error' + error_type_pai = test_case["error_flag"] + + vid = 0xFFF1 + pid = 0x8000 + + # Generate PAI Cert/Key + builder = DevCertBuilder(CertType.PAI, error_type_pai, args.paapath, test_case_out_dir, + chipcert, vid, pid) + builder.make_certs_and_keys() + + if test_cert == 'pai': + if test_case["error_flag"] == 'subject-vid-mismatch': + vid += 1 + if test_case["error_flag"] == 'subject-pid-mismatch': + pid += 1 + + # Generate DAC Cert/Key + builder = DevCertBuilder(CertType.DAC, error_type_dac, args.paapath, test_case_out_dir, + chipcert, vid, pid) + builder.make_certs_and_keys() + + # Generate Certification Declaration (CD) + vid_flag = ' -V 0x{:X}'.format(vid) + pid_flag = ' -p 0x{:X}'.format(pid) + cmd = chipcert + ' gen-cd -K ' + cd_key + ' -C ' + cd_cert + ' -O ' + test_case_out_dir + '/cd.der' + \ + ' -f 1 ' + vid_flag + pid_flag + ' -d 0x1234 -c "ZIG20141ZB330001-24" -l 0 -i 0 -n 9876 -t 0' + subprocess.run(cmd, shell=True) + + # Generate Test Case Data Container in JSON Format + generate_test_case_vector_json(test_case_out_dir, test_cert, test_case) + + +if __name__ == '__main__': + sys.exit(main()) From 74c68479705e5047eb1437fb8347188c0188d331 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damian=20Kr=C3=B3lik?= <66667989+Damian-Nordic@users.noreply.github.com> Date: Mon, 25 Apr 2022 21:45:38 +0200 Subject: [PATCH 10/25] [modeselect] Fix ChangeToMode error code (#17685) * [modeselect] Fix ChangeToMode error code ChangeToMode run with an unsupported mode returns CONSTRAINT_ERROR instead of INVALID_COMMAND (as defined in the spec). * Restyled by clang-format Co-authored-by: Restyled.io --- .../src/static-supported-modes-manager.cpp | 2 +- .../placeholder/linux/static-supported-modes-manager.cpp | 2 +- src/app/tests/suites/TestModeSelectCluster.yaml | 6 +++--- zzz_generated/chip-tool/zap-generated/test/Commands.h | 6 +++--- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/examples/all-clusters-app/all-clusters-common/src/static-supported-modes-manager.cpp b/examples/all-clusters-app/all-clusters-common/src/static-supported-modes-manager.cpp index c4ad314f236961..251e10b1904e12 100644 --- a/examples/all-clusters-app/all-clusters-common/src/static-supported-modes-manager.cpp +++ b/examples/all-clusters-app/all-clusters-common/src/static-supported-modes-manager.cpp @@ -62,7 +62,7 @@ EmberAfStatus StaticSupportedModesManager::getModeOptionByMode(unsigned short en } } emberAfPrintln(EMBER_AF_PRINT_DEBUG, "Cannot find the mode %u", mode); - return EMBER_ZCL_STATUS_INVALID_VALUE; + return EMBER_ZCL_STATUS_INVALID_COMMAND; } const ModeSelect::SupportedModesManager * ModeSelect::getSupportedModesManager() diff --git a/examples/placeholder/linux/static-supported-modes-manager.cpp b/examples/placeholder/linux/static-supported-modes-manager.cpp index c4ad314f236961..251e10b1904e12 100644 --- a/examples/placeholder/linux/static-supported-modes-manager.cpp +++ b/examples/placeholder/linux/static-supported-modes-manager.cpp @@ -62,7 +62,7 @@ EmberAfStatus StaticSupportedModesManager::getModeOptionByMode(unsigned short en } } emberAfPrintln(EMBER_AF_PRINT_DEBUG, "Cannot find the mode %u", mode); - return EMBER_ZCL_STATUS_INVALID_VALUE; + return EMBER_ZCL_STATUS_INVALID_COMMAND; } const ModeSelect::SupportedModesManager * ModeSelect::getSupportedModesManager() diff --git a/src/app/tests/suites/TestModeSelectCluster.yaml b/src/app/tests/suites/TestModeSelectCluster.yaml index 970567d7c31711..d48b0895c6448e 100644 --- a/src/app/tests/suites/TestModeSelectCluster.yaml +++ b/src/app/tests/suites/TestModeSelectCluster.yaml @@ -96,7 +96,7 @@ tests: - name: "NewMode" value: 2 response: - error: CONSTRAINT_ERROR + error: INVALID_COMMAND - label: "Toggle OnOff" cluster: "On/Off" @@ -118,7 +118,7 @@ tests: arguments: value: 2 response: - error: CONSTRAINT_ERROR + error: INVALID_COMMAND - label: "Change OnMode" command: "writeAttribute" @@ -153,7 +153,7 @@ tests: arguments: value: 2 response: - error: CONSTRAINT_ERROR + error: INVALID_COMMAND - label: "Change to Supported StartUp Mode" command: "writeAttribute" diff --git a/zzz_generated/chip-tool/zap-generated/test/Commands.h b/zzz_generated/chip-tool/zap-generated/test/Commands.h index 637c7177088709..6e26334cad0b11 100644 --- a/zzz_generated/chip-tool/zap-generated/test/Commands.h +++ b/zzz_generated/chip-tool/zap-generated/test/Commands.h @@ -99109,7 +99109,7 @@ class TestModeSelectClusterSuite : public TestCommand void OnFailureResponse_9(CHIP_ERROR error) { chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_COMMAND)); NextTest(); } @@ -99211,7 +99211,7 @@ class TestModeSelectClusterSuite : public TestCommand void OnFailureResponse_13(CHIP_ERROR error) { chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_COMMAND)); NextTest(); } @@ -99362,7 +99362,7 @@ class TestModeSelectClusterSuite : public TestCommand void OnFailureResponse_19(CHIP_ERROR error) { chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_COMMAND)); NextTest(); } From e3c52444a5df43ea1547023004d29e656b7cb9a7 Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Mon, 25 Apr 2022 15:45:58 -0400 Subject: [PATCH 11/25] Start annotating things that we always implement via AttributeAccessInterface. (#17616) Those things are then forced to use external storage in ZAP, since we're not touching the attribute store for them anyway. Also updates ZAP to a version that will fail out of the annotations have incorrect cluster/attribute names. --- src/app/zap-templates/zcl/zcl.json | 45 +- third_party/zap/repo | 2 +- .../zap-generated/endpoint_config.h | 470 ++++++++---------- .../zap-generated/endpoint_config.h | 92 ++-- .../zap-generated/endpoint_config.h | 80 +-- .../zap-generated/endpoint_config.h | 98 ++-- .../lock-app/zap-generated/endpoint_config.h | 116 ++--- .../zap-generated/endpoint_config.h | 11 +- .../zap-generated/endpoint_config.h | 22 +- .../app1/zap-generated/endpoint_config.h | 151 +++--- .../app2/zap-generated/endpoint_config.h | 151 +++--- .../pump-app/zap-generated/endpoint_config.h | 11 +- .../zap-generated/endpoint_config.h | 11 +- .../zap-generated/endpoint_config.h | 80 +-- .../zap-generated/endpoint_config.h | 91 ++-- .../tv-app/zap-generated/endpoint_config.h | 176 +++---- .../zap-generated/endpoint_config.h | 128 ++--- .../zap-generated/endpoint_config.h | 92 ++-- 18 files changed, 747 insertions(+), 1080 deletions(-) diff --git a/src/app/zap-templates/zcl/zcl.json b/src/app/zap-templates/zcl/zcl.json index 08b8cc66fd6a36..d43f81aef75247 100644 --- a/src/app/zap-templates/zcl/zcl.json +++ b/src/app/zap-templates/zcl/zcl.json @@ -91,6 +91,49 @@ } }, "listsUseAttributeAccessInterface": true, - "attributeAccessInterfaceAttributes": {}, + "attributeAccessInterfaceAttributes": { + "Access Control": [ + "ClusterRevision", + "SubjectsPerAccessControlEntry", + "TargetsPerAccessControlEntry", + "AccessControlEntriesPerFabric" + ], + "AdministratorCommissioning": [ + "WindowStatus", + "AdminFabricIndex", + "AdminVendorId" + ], + "Basic": [ + "DataModelRevision", + "VendorName", + "VendorID", + "ProductName", + "ProductID", + "Location", + "HardwareVersion", + "HardwareVersionString", + "SoftwareVersion", + "SoftwareVersionString", + "ManufacturingDate", + "PartNumber", + "ProductURL", + "ProductLabel", + "SerialNumber", + "UniqueID", + "CapabilityMinima" + ], + "Descriptor": ["ClusterRevision"], + "Ethernet Network Diagnostics": [ + "PHYRate", + "FullDuplex", + "CarrierDetect", + "TimeSinceReset", + "PacketRxCount", + "PacketTxCount", + "TxErrCount", + "CollisionCount", + "OverrunCount" + ] + }, "defaultReportingPolicy": "mandatory" } diff --git a/third_party/zap/repo b/third_party/zap/repo index 7ab717d08dfe9b..1136effb0e0ee8 160000 --- a/third_party/zap/repo +++ b/third_party/zap/repo @@ -1 +1 @@ -Subproject commit 7ab717d08dfe9b0ba9de907fc7c6eb6549c86bf7 +Subproject commit 1136effb0e0ee8cd1f6bfc730492db799f878cba diff --git a/zzz_generated/all-clusters-app/zap-generated/endpoint_config.h b/zzz_generated/all-clusters-app/zap-generated/endpoint_config.h index 476fdf315e3053..19d836bb6fb652 100644 --- a/zzz_generated/all-clusters-app/zap-generated/endpoint_config.h +++ b/zzz_generated/all-clusters-app/zap-generated/endpoint_config.h @@ -239,254 +239,236 @@ \ /* Endpoint: 0, Cluster: Ethernet Network Diagnostics (server), big-endian */ \ \ - /* 303 - PacketRxCount, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 311 - PacketTxCount, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 319 - TxErrCount, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 327 - CollisionCount, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 335 - OverrunCount, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 343 - TimeSinceReset, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 351 - FeatureMap, */ \ + /* 303 - FeatureMap, */ \ 0x00, 0x00, 0x00, 0x03, \ \ /* Endpoint: 1, Cluster: On/Off (server), big-endian */ \ \ - /* 355 - FeatureMap, */ \ + /* 307 - FeatureMap, */ \ 0x00, 0x00, 0x00, 0x01, \ \ /* Endpoint: 1, Cluster: Level Control (server), big-endian */ \ \ - /* 359 - FeatureMap, */ \ + /* 311 - FeatureMap, */ \ 0x00, 0x00, 0x00, 0x03, \ \ /* Endpoint: 1, Cluster: Power Source (server), big-endian */ \ \ - /* 363 - BatteryVoltage, */ \ + /* 315 - BatteryVoltage, */ \ 0x00, 0x00, 0x00, 0x00, \ \ - /* 367 - BatteryTimeRemaining, */ \ + /* 319 - BatteryTimeRemaining, */ \ 0x00, 0x00, 0x00, 0x00, \ \ - /* 371 - FeatureMap, */ \ + /* 323 - FeatureMap, */ \ 0x00, 0x00, 0x00, 0x00, \ \ /* Endpoint: 1, Cluster: Switch (server), big-endian */ \ \ - /* 375 - FeatureMap, */ \ + /* 327 - FeatureMap, */ \ 0x00, 0x00, 0x00, 0x00, \ \ /* Endpoint: 1, Cluster: Mode Select (server), big-endian */ \ \ - /* 379 - Description, */ \ + /* 331 - Description, */ \ 6, 'C', 'o', 'f', 'f', 'e', 'e', \ \ - /* 386 - FeatureMap, */ \ + /* 338 - FeatureMap, */ \ 0x00, 0x00, 0x00, 0x01, \ \ /* Endpoint: 1, Cluster: Door Lock (server), big-endian */ \ \ - /* 390 - DoorOpenEvents, */ \ + /* 342 - DoorOpenEvents, */ \ 0x00, 0x00, 0x00, 0x00, \ \ - /* 394 - DoorClosedEvents, */ \ + /* 346 - DoorClosedEvents, */ \ 0x00, 0x00, 0x00, 0x00, \ \ - /* 398 - Language, */ \ + /* 350 - Language, */ \ 2, 'e', 'n', \ \ - /* 401 - AutoRelockTime, */ \ + /* 353 - AutoRelockTime, */ \ 0x00, 0x00, 0x00, 0x60, \ \ - /* 405 - FeatureMap, */ \ + /* 357 - FeatureMap, */ \ 0x00, 0x00, 0x01, 0x13, \ \ /* Endpoint: 1, Cluster: Window Covering (server), big-endian */ \ \ - /* 409 - FeatureMap, */ \ + /* 361 - FeatureMap, */ \ 0x00, 0x00, 0x00, 0x17, \ \ /* Endpoint: 1, Cluster: Pump Configuration and Control (server), big-endian */ \ \ - /* 413 - LifetimeRunningHours, */ \ + /* 365 - LifetimeRunningHours, */ \ 0x00, 0x00, 0x00, \ \ - /* 416 - Power, */ \ + /* 368 - Power, */ \ 0x00, 0x00, 0x00, \ \ - /* 419 - LifetimeEnergyConsumed, */ \ + /* 371 - LifetimeEnergyConsumed, */ \ 0x00, 0x00, 0x00, 0x00, \ \ - /* 423 - FeatureMap, */ \ + /* 375 - FeatureMap, */ \ 0x00, 0x00, 0x00, 0x00, \ \ /* Endpoint: 1, Cluster: Thermostat (server), big-endian */ \ \ - /* 427 - FeatureMap, */ \ + /* 379 - FeatureMap, */ \ 0x00, 0x00, 0x00, 0x0B, \ \ /* Endpoint: 1, Cluster: Fan Control (server), big-endian */ \ \ - /* 431 - FeatureMap, */ \ + /* 383 - FeatureMap, */ \ 0x00, 0x00, 0x00, 0x00, \ \ /* Endpoint: 1, Cluster: Color Control (server), big-endian */ \ \ - /* 435 - FeatureMap, */ \ + /* 387 - FeatureMap, */ \ 0x00, 0x00, 0x00, 0x1F, \ \ /* Endpoint: 1, Cluster: IAS Zone (server), big-endian */ \ \ - /* 439 - IAS CIE address, */ \ + /* 391 - IAS CIE address, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ /* Endpoint: 1, Cluster: Media Playback (server), big-endian */ \ \ - /* 447 - StartTime, */ \ + /* 399 - StartTime, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, \ \ - /* 455 - Duration, */ \ + /* 407 - Duration, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 463 - PlaybackSpeed, */ \ + /* 415 - PlaybackSpeed, */ \ 0x00, 0x00, 0x00, 0x00, \ \ - /* 467 - SeekRangeEnd, */ \ + /* 419 - SeekRangeEnd, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 475 - SeekRangeStart, */ \ + /* 427 - SeekRangeStart, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ /* Endpoint: 1, Cluster: Content Launcher (server), big-endian */ \ \ - /* 483 - SupportedStreamingProtocols, */ \ + /* 435 - SupportedStreamingProtocols, */ \ 0x00, 0x00, 0x00, 0x00, \ \ /* Endpoint: 1, Cluster: Test Cluster (server), big-endian */ \ \ - /* 487 - bitmap32, */ \ + /* 439 - bitmap32, */ \ 0x00, 0x00, 0x00, 0x00, \ \ - /* 491 - bitmap64, */ \ + /* 443 - bitmap64, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 499 - int24u, */ \ + /* 451 - int24u, */ \ 0x00, 0x00, 0x00, \ \ - /* 502 - int32u, */ \ + /* 454 - int32u, */ \ 0x00, 0x00, 0x00, 0x00, \ \ - /* 506 - int40u, */ \ + /* 458 - int40u, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 511 - int48u, */ \ + /* 463 - int48u, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 517 - int56u, */ \ + /* 469 - int56u, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 524 - int64u, */ \ + /* 476 - int64u, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 532 - int24s, */ \ + /* 484 - int24s, */ \ 0x00, 0x00, 0x00, \ \ - /* 535 - int32s, */ \ + /* 487 - int32s, */ \ 0x00, 0x00, 0x00, 0x00, \ \ - /* 539 - int40s, */ \ + /* 491 - int40s, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 544 - int48s, */ \ + /* 496 - int48s, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 550 - int56s, */ \ + /* 502 - int56s, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 557 - int64s, */ \ + /* 509 - int64s, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 565 - float_single, */ \ + /* 517 - float_single, */ \ 0x00, 0x00, 0x00, 0x00, \ \ - /* 569 - float_double, */ \ + /* 521 - float_double, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 577 - epoch_us, */ \ + /* 529 - epoch_us, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 585 - epoch_s, */ \ + /* 537 - epoch_s, */ \ 0x00, 0x00, 0x00, 0x00, \ \ - /* 589 - nullable_bitmap32, */ \ + /* 541 - nullable_bitmap32, */ \ 0x00, 0x00, 0x00, 0x00, \ \ - /* 593 - nullable_bitmap64, */ \ + /* 545 - nullable_bitmap64, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 601 - nullable_int24u, */ \ + /* 553 - nullable_int24u, */ \ 0x00, 0x00, 0x00, \ \ - /* 604 - nullable_int32u, */ \ + /* 556 - nullable_int32u, */ \ 0x00, 0x00, 0x00, 0x00, \ \ - /* 608 - nullable_int40u, */ \ + /* 560 - nullable_int40u, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 613 - nullable_int48u, */ \ + /* 565 - nullable_int48u, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 619 - nullable_int56u, */ \ + /* 571 - nullable_int56u, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 626 - nullable_int64u, */ \ + /* 578 - nullable_int64u, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 634 - nullable_int24s, */ \ + /* 586 - nullable_int24s, */ \ 0x00, 0x00, 0x00, \ \ - /* 637 - nullable_int32s, */ \ + /* 589 - nullable_int32s, */ \ 0x00, 0x00, 0x00, 0x00, \ \ - /* 641 - nullable_int40s, */ \ + /* 593 - nullable_int40s, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 646 - nullable_int48s, */ \ + /* 598 - nullable_int48s, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 652 - nullable_int56s, */ \ + /* 604 - nullable_int56s, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 659 - nullable_int64s, */ \ + /* 611 - nullable_int64s, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 667 - nullable_float_single, */ \ + /* 619 - nullable_float_single, */ \ 0x00, 0x00, 0x00, 0x00, \ \ - /* 671 - nullable_float_double, */ \ + /* 623 - nullable_float_double, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ /* Endpoint: 1, Cluster: Electrical Measurement (server), big-endian */ \ \ - /* 679 - measurement type, */ \ + /* 631 - measurement type, */ \ 0x00, 0x00, 0x00, 0x00, \ \ - /* 683 - total active power, */ \ + /* 635 - total active power, */ \ 0x00, 0x00, 0x00, 0x00, \ \ /* Endpoint: 2, Cluster: On/Off (server), big-endian */ \ \ - /* 687 - FeatureMap, */ \ + /* 639 - FeatureMap, */ \ 0x00, 0x00, 0x00, 0x00, \ } @@ -704,260 +686,242 @@ \ /* Endpoint: 0, Cluster: Ethernet Network Diagnostics (server), little-endian */ \ \ - /* 303 - PacketRxCount, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 311 - PacketTxCount, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 319 - TxErrCount, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 327 - CollisionCount, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 335 - OverrunCount, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 343 - TimeSinceReset, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 351 - FeatureMap, */ \ + /* 303 - FeatureMap, */ \ 0x03, 0x00, 0x00, 0x00, \ \ /* Endpoint: 1, Cluster: On/Off (server), little-endian */ \ \ - /* 355 - FeatureMap, */ \ + /* 307 - FeatureMap, */ \ 0x01, 0x00, 0x00, 0x00, \ \ /* Endpoint: 1, Cluster: Level Control (server), little-endian */ \ \ - /* 359 - FeatureMap, */ \ + /* 311 - FeatureMap, */ \ 0x03, 0x00, 0x00, 0x00, \ \ /* Endpoint: 1, Cluster: Power Source (server), little-endian */ \ \ - /* 363 - BatteryVoltage, */ \ + /* 315 - BatteryVoltage, */ \ 0x00, 0x00, 0x00, 0x00, \ \ - /* 367 - BatteryTimeRemaining, */ \ + /* 319 - BatteryTimeRemaining, */ \ 0x00, 0x00, 0x00, 0x00, \ \ - /* 371 - FeatureMap, */ \ + /* 323 - FeatureMap, */ \ 0x00, 0x00, 0x00, 0x00, \ \ /* Endpoint: 1, Cluster: Switch (server), little-endian */ \ \ - /* 375 - FeatureMap, */ \ + /* 327 - FeatureMap, */ \ 0x00, 0x00, 0x00, 0x00, \ \ /* Endpoint: 1, Cluster: Mode Select (server), little-endian */ \ \ - /* 379 - Description, */ \ + /* 331 - Description, */ \ 6, 'C', 'o', 'f', 'f', 'e', 'e', \ \ - /* 386 - FeatureMap, */ \ + /* 338 - FeatureMap, */ \ 0x01, 0x00, 0x00, 0x00, \ \ /* Endpoint: 1, Cluster: Door Lock (server), little-endian */ \ \ - /* 390 - DoorOpenEvents, */ \ + /* 342 - DoorOpenEvents, */ \ 0x00, 0x00, 0x00, 0x00, \ \ - /* 394 - DoorClosedEvents, */ \ + /* 346 - DoorClosedEvents, */ \ 0x00, 0x00, 0x00, 0x00, \ \ - /* 398 - Language, */ \ + /* 350 - Language, */ \ 2, 'e', 'n', \ \ - /* 401 - AutoRelockTime, */ \ + /* 353 - AutoRelockTime, */ \ 0x60, 0x00, 0x00, 0x00, \ \ - /* 405 - FeatureMap, */ \ + /* 357 - FeatureMap, */ \ 0x13, 0x01, 0x00, 0x00, \ \ /* Endpoint: 1, Cluster: Window Covering (server), little-endian */ \ \ - /* 409 - FeatureMap, */ \ + /* 361 - FeatureMap, */ \ 0x17, 0x00, 0x00, 0x00, \ \ /* Endpoint: 1, Cluster: Pump Configuration and Control (server), little-endian */ \ \ - /* 413 - LifetimeRunningHours, */ \ + /* 365 - LifetimeRunningHours, */ \ 0x00, 0x00, 0x00, \ \ - /* 416 - Power, */ \ + /* 368 - Power, */ \ 0x00, 0x00, 0x00, \ \ - /* 419 - LifetimeEnergyConsumed, */ \ + /* 371 - LifetimeEnergyConsumed, */ \ 0x00, 0x00, 0x00, 0x00, \ \ - /* 423 - FeatureMap, */ \ + /* 375 - FeatureMap, */ \ 0x00, 0x00, 0x00, 0x00, \ \ /* Endpoint: 1, Cluster: Thermostat (server), little-endian */ \ \ - /* 427 - FeatureMap, */ \ + /* 379 - FeatureMap, */ \ 0x0B, 0x00, 0x00, 0x00, \ \ /* Endpoint: 1, Cluster: Fan Control (server), little-endian */ \ \ - /* 431 - FeatureMap, */ \ + /* 383 - FeatureMap, */ \ 0x00, 0x00, 0x00, 0x00, \ \ /* Endpoint: 1, Cluster: Color Control (server), little-endian */ \ \ - /* 435 - FeatureMap, */ \ + /* 387 - FeatureMap, */ \ 0x1F, 0x00, 0x00, 0x00, \ \ /* Endpoint: 1, Cluster: IAS Zone (server), little-endian */ \ \ - /* 439 - IAS CIE address, */ \ + /* 391 - IAS CIE address, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ /* Endpoint: 1, Cluster: Media Playback (server), little-endian */ \ \ - /* 447 - StartTime, */ \ + /* 399 - StartTime, */ \ 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 455 - Duration, */ \ + /* 407 - Duration, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 463 - PlaybackSpeed, */ \ + /* 415 - PlaybackSpeed, */ \ 0x00, 0x00, 0x00, 0x00, \ \ - /* 467 - SeekRangeEnd, */ \ + /* 419 - SeekRangeEnd, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 475 - SeekRangeStart, */ \ + /* 427 - SeekRangeStart, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ /* Endpoint: 1, Cluster: Content Launcher (server), little-endian */ \ \ - /* 483 - SupportedStreamingProtocols, */ \ + /* 435 - SupportedStreamingProtocols, */ \ 0x00, 0x00, 0x00, 0x00, \ \ /* Endpoint: 1, Cluster: Test Cluster (server), little-endian */ \ \ - /* 487 - bitmap32, */ \ + /* 439 - bitmap32, */ \ 0x00, 0x00, 0x00, 0x00, \ \ - /* 491 - bitmap64, */ \ + /* 443 - bitmap64, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 499 - int24u, */ \ + /* 451 - int24u, */ \ 0x00, 0x00, 0x00, \ \ - /* 502 - int32u, */ \ + /* 454 - int32u, */ \ 0x00, 0x00, 0x00, 0x00, \ \ - /* 506 - int40u, */ \ + /* 458 - int40u, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 511 - int48u, */ \ + /* 463 - int48u, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 517 - int56u, */ \ + /* 469 - int56u, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 524 - int64u, */ \ + /* 476 - int64u, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 532 - int24s, */ \ + /* 484 - int24s, */ \ 0x00, 0x00, 0x00, \ \ - /* 535 - int32s, */ \ + /* 487 - int32s, */ \ 0x00, 0x00, 0x00, 0x00, \ \ - /* 539 - int40s, */ \ + /* 491 - int40s, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 544 - int48s, */ \ + /* 496 - int48s, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 550 - int56s, */ \ + /* 502 - int56s, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 557 - int64s, */ \ + /* 509 - int64s, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 565 - float_single, */ \ + /* 517 - float_single, */ \ 0x00, 0x00, 0x00, 0x00, \ \ - /* 569 - float_double, */ \ + /* 521 - float_double, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 577 - epoch_us, */ \ + /* 529 - epoch_us, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 585 - epoch_s, */ \ + /* 537 - epoch_s, */ \ 0x00, 0x00, 0x00, 0x00, \ \ - /* 589 - nullable_bitmap32, */ \ + /* 541 - nullable_bitmap32, */ \ 0x00, 0x00, 0x00, 0x00, \ \ - /* 593 - nullable_bitmap64, */ \ + /* 545 - nullable_bitmap64, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 601 - nullable_int24u, */ \ + /* 553 - nullable_int24u, */ \ 0x00, 0x00, 0x00, \ \ - /* 604 - nullable_int32u, */ \ + /* 556 - nullable_int32u, */ \ 0x00, 0x00, 0x00, 0x00, \ \ - /* 608 - nullable_int40u, */ \ + /* 560 - nullable_int40u, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 613 - nullable_int48u, */ \ + /* 565 - nullable_int48u, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 619 - nullable_int56u, */ \ + /* 571 - nullable_int56u, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 626 - nullable_int64u, */ \ + /* 578 - nullable_int64u, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 634 - nullable_int24s, */ \ + /* 586 - nullable_int24s, */ \ 0x00, 0x00, 0x00, \ \ - /* 637 - nullable_int32s, */ \ + /* 589 - nullable_int32s, */ \ 0x00, 0x00, 0x00, 0x00, \ \ - /* 641 - nullable_int40s, */ \ + /* 593 - nullable_int40s, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 646 - nullable_int48s, */ \ + /* 598 - nullable_int48s, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 652 - nullable_int56s, */ \ + /* 604 - nullable_int56s, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 659 - nullable_int64s, */ \ + /* 611 - nullable_int64s, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 667 - nullable_float_single, */ \ + /* 619 - nullable_float_single, */ \ 0x00, 0x00, 0x00, 0x00, \ \ - /* 671 - nullable_float_double, */ \ + /* 623 - nullable_float_double, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ /* Endpoint: 1, Cluster: Electrical Measurement (server), little-endian */ \ \ - /* 679 - measurement type, */ \ + /* 631 - measurement type, */ \ 0x00, 0x00, 0x00, 0x00, \ \ - /* 683 - total active power, */ \ + /* 635 - total active power, */ \ 0x00, 0x00, 0x00, 0x00, \ \ /* Endpoint: 2, Cluster: On/Off (server), little-endian */ \ \ - /* 687 - FeatureMap, */ \ + /* 639 - FeatureMap, */ \ 0x00, 0x00, 0x00, 0x00, \ } #endif // BIGENDIAN_CPU -#define GENERATED_DEFAULTS_COUNT (136) +#define GENERATED_DEFAULTS_COUNT (130) #define ZAP_TYPE(type) ZCL_##type##_ATTRIBUTE_TYPE #define ZAP_LONG_DEFAULTS_INDEX(index) \ @@ -1095,7 +1059,8 @@ { 0x0000FFFD, ZAP_TYPE(INT16U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* ClusterRevision */ \ \ /* Endpoint: 0, Cluster: Basic (server) */ \ - { 0x00000000, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(SINGLETON), ZAP_SIMPLE_DEFAULT(10) }, /* DataModelRevision */ \ + { 0x00000000, ZAP_TYPE(INT16U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(SINGLETON), \ + ZAP_EMPTY_DEFAULT() }, /* DataModelRevision */ \ { 0x00000001, ZAP_TYPE(CHAR_STRING), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(SINGLETON), \ ZAP_EMPTY_DEFAULT() }, /* VendorName */ \ { 0x00000002, ZAP_TYPE(VENDOR_ID), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(SINGLETON), \ @@ -1303,17 +1268,20 @@ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ \ /* Endpoint: 0, Cluster: Ethernet Network Diagnostics (server) */ \ - { 0x00000000, ZAP_TYPE(ENUM8), 1, ZAP_ATTRIBUTE_MASK(NULLABLE), ZAP_EMPTY_DEFAULT() }, /* PHYRate */ \ - { 0x00000001, ZAP_TYPE(BOOLEAN), 1, ZAP_ATTRIBUTE_MASK(NULLABLE), ZAP_SIMPLE_DEFAULT(0x00) }, /* FullDuplex */ \ - { 0x00000002, ZAP_TYPE(INT64U), 8, 0, ZAP_LONG_DEFAULTS_INDEX(303) }, /* PacketRxCount */ \ - { 0x00000003, ZAP_TYPE(INT64U), 8, 0, ZAP_LONG_DEFAULTS_INDEX(311) }, /* PacketTxCount */ \ - { 0x00000004, ZAP_TYPE(INT64U), 8, 0, ZAP_LONG_DEFAULTS_INDEX(319) }, /* TxErrCount */ \ - { 0x00000005, ZAP_TYPE(INT64U), 8, 0, ZAP_LONG_DEFAULTS_INDEX(327) }, /* CollisionCount */ \ - { 0x00000006, ZAP_TYPE(INT64U), 8, 0, ZAP_LONG_DEFAULTS_INDEX(335) }, /* OverrunCount */ \ - { 0x00000007, ZAP_TYPE(BOOLEAN), 1, ZAP_ATTRIBUTE_MASK(NULLABLE), ZAP_SIMPLE_DEFAULT(0x00) }, /* CarrierDetect */ \ - { 0x00000008, ZAP_TYPE(INT64U), 8, 0, ZAP_LONG_DEFAULTS_INDEX(343) }, /* TimeSinceReset */ \ - { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(351) }, /* FeatureMap */ \ - { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ + { 0x00000000, ZAP_TYPE(ENUM8), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ + ZAP_EMPTY_DEFAULT() }, /* PHYRate */ \ + { 0x00000001, ZAP_TYPE(BOOLEAN), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ + ZAP_EMPTY_DEFAULT() }, /* FullDuplex */ \ + { 0x00000002, ZAP_TYPE(INT64U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* PacketRxCount */ \ + { 0x00000003, ZAP_TYPE(INT64U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* PacketTxCount */ \ + { 0x00000004, ZAP_TYPE(INT64U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* TxErrCount */ \ + { 0x00000005, ZAP_TYPE(INT64U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* CollisionCount */ \ + { 0x00000006, ZAP_TYPE(INT64U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* OverrunCount */ \ + { 0x00000007, ZAP_TYPE(BOOLEAN), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ + ZAP_EMPTY_DEFAULT() }, /* CarrierDetect */ \ + { 0x00000008, ZAP_TYPE(INT64U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* TimeSinceReset */ \ + { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(303) }, /* FeatureMap */ \ + { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ \ /* Endpoint: 0, Cluster: AdministratorCommissioning (server) */ \ { 0x00000000, ZAP_TYPE(INT8U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* WindowStatus */ \ @@ -1384,7 +1352,7 @@ ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(TOKENIZE) | ZAP_ATTRIBUTE_MASK(WRITABLE) | \ ZAP_ATTRIBUTE_MASK(NULLABLE), \ ZAP_MIN_MAX_DEFAULTS_INDEX(1) }, /* StartUpOnOff */ \ - { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(355) }, /* FeatureMap */ \ + { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(307) }, /* FeatureMap */ \ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(4) }, /* ClusterRevision */ \ \ /* Endpoint: 1, Cluster: On/off Switch Configuration (server) */ \ @@ -1416,7 +1384,7 @@ { 0x00004000, ZAP_TYPE(INT8U), 1, \ ZAP_ATTRIBUTE_MASK(TOKENIZE) | ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ ZAP_SIMPLE_DEFAULT(255) }, /* start up current level */ \ - { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(359) }, /* FeatureMap */ \ + { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(311) }, /* FeatureMap */ \ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(5) }, /* ClusterRevision */ \ \ /* Endpoint: 1, Cluster: Binary Input (Basic) (server) */ \ @@ -1449,21 +1417,21 @@ { 0x00000000, ZAP_TYPE(ENUM8), 1, 0, ZAP_EMPTY_DEFAULT() }, /* Status */ \ { 0x00000001, ZAP_TYPE(INT8U), 1, 0, ZAP_EMPTY_DEFAULT() }, /* Order */ \ { 0x00000002, ZAP_TYPE(CHAR_STRING), 61, 0, ZAP_EMPTY_DEFAULT() }, /* Description */ \ - { 0x0000000B, ZAP_TYPE(INT32U), 4, 0, ZAP_LONG_DEFAULTS_INDEX(363) }, /* BatteryVoltage */ \ + { 0x0000000B, ZAP_TYPE(INT32U), 4, 0, ZAP_LONG_DEFAULTS_INDEX(315) }, /* BatteryVoltage */ \ { 0x0000000C, ZAP_TYPE(INT8U), 1, 0, ZAP_EMPTY_DEFAULT() }, /* BatteryPercentRemaining */ \ - { 0x0000000D, ZAP_TYPE(INT32U), 4, 0, ZAP_LONG_DEFAULTS_INDEX(367) }, /* BatteryTimeRemaining */ \ + { 0x0000000D, ZAP_TYPE(INT32U), 4, 0, ZAP_LONG_DEFAULTS_INDEX(319) }, /* BatteryTimeRemaining */ \ { 0x0000000E, ZAP_TYPE(ENUM8), 1, 0, ZAP_EMPTY_DEFAULT() }, /* BatteryChargeLevel */ \ { 0x00000012, ZAP_TYPE(ARRAY), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), \ ZAP_EMPTY_DEFAULT() }, /* ActiveBatteryFaults */ \ { 0x0000001A, ZAP_TYPE(ENUM8), 1, 0, ZAP_EMPTY_DEFAULT() }, /* BatteryChargeState */ \ - { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(371) }, /* FeatureMap */ \ + { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(323) }, /* FeatureMap */ \ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ \ /* Endpoint: 1, Cluster: Switch (server) */ \ { 0x00000000, ZAP_TYPE(INT8U), 1, 0, ZAP_SIMPLE_DEFAULT(2) }, /* number of positions */ \ { 0x00000001, ZAP_TYPE(INT8U), 1, 0, ZAP_EMPTY_DEFAULT() }, /* current position */ \ { 0x00000002, ZAP_TYPE(INT8U), 1, 0, ZAP_SIMPLE_DEFAULT(2) }, /* multi press max */ \ - { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(375) }, /* FeatureMap */ \ + { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(327) }, /* FeatureMap */ \ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ \ /* Endpoint: 1, Cluster: Fixed Label (server) */ \ @@ -1480,7 +1448,7 @@ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ \ /* Endpoint: 1, Cluster: Mode Select (server) */ \ - { 0x00000000, ZAP_TYPE(CHAR_STRING), 33, 0, ZAP_LONG_DEFAULTS_INDEX(379) }, /* Description */ \ + { 0x00000000, ZAP_TYPE(CHAR_STRING), 33, 0, ZAP_LONG_DEFAULTS_INDEX(331) }, /* Description */ \ { 0x00000001, ZAP_TYPE(ENUM16), 2, ZAP_ATTRIBUTE_MASK(NULLABLE), ZAP_SIMPLE_DEFAULT(0) }, /* StandardNamespace */ \ { 0x00000002, ZAP_TYPE(ARRAY), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* SupportedModes */ \ { 0x00000003, ZAP_TYPE(INT8U), 1, ZAP_ATTRIBUTE_MASK(TOKENIZE), ZAP_SIMPLE_DEFAULT(0) }, /* CurrentMode */ \ @@ -1490,7 +1458,7 @@ { 0x00000005, ZAP_TYPE(INT8U), 1, \ ZAP_ATTRIBUTE_MASK(TOKENIZE) | ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ ZAP_SIMPLE_DEFAULT(255) }, /* OnMode */ \ - { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(386) }, /* FeatureMap */ \ + { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(338) }, /* FeatureMap */ \ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ \ /* Endpoint: 1, Cluster: Door Lock (server) */ \ @@ -1498,9 +1466,9 @@ { 0x00000001, ZAP_TYPE(ENUM8), 1, 0, ZAP_EMPTY_DEFAULT() }, /* LockType */ \ { 0x00000002, ZAP_TYPE(BOOLEAN), 1, 0, ZAP_EMPTY_DEFAULT() }, /* ActuatorEnabled */ \ { 0x00000003, ZAP_TYPE(ENUM8), 1, ZAP_ATTRIBUTE_MASK(NULLABLE), ZAP_EMPTY_DEFAULT() }, /* DoorState */ \ - { 0x00000004, ZAP_TYPE(INT32U), 4, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_LONG_DEFAULTS_INDEX(390) }, /* DoorOpenEvents */ \ + { 0x00000004, ZAP_TYPE(INT32U), 4, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_LONG_DEFAULTS_INDEX(342) }, /* DoorOpenEvents */ \ { 0x00000005, ZAP_TYPE(INT32U), 4, ZAP_ATTRIBUTE_MASK(WRITABLE), \ - ZAP_LONG_DEFAULTS_INDEX(394) }, /* DoorClosedEvents */ \ + ZAP_LONG_DEFAULTS_INDEX(346) }, /* DoorClosedEvents */ \ { 0x00000006, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_EMPTY_DEFAULT() }, /* OpenPeriod */ \ { 0x00000011, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(10) }, /* NumberOfTotalUsersSupported */ \ { 0x00000012, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(10) }, /* NumberOfPINUsersSupported */ \ @@ -1513,8 +1481,8 @@ { 0x00000019, ZAP_TYPE(INT8U), 1, 0, ZAP_SIMPLE_DEFAULT(20) }, /* MaxRFIDCodeLength */ \ { 0x0000001A, ZAP_TYPE(INT8U), 1, 0, ZAP_SIMPLE_DEFAULT(10) }, /* MinRFIDCodeLength */ \ { 0x0000001B, ZAP_TYPE(BITMAP8), 1, 0, ZAP_SIMPLE_DEFAULT(1) }, /* CredentialRulesSupport */ \ - { 0x00000021, ZAP_TYPE(CHAR_STRING), 4, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_LONG_DEFAULTS_INDEX(398) }, /* Language */ \ - { 0x00000023, ZAP_TYPE(INT32U), 4, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_LONG_DEFAULTS_INDEX(401) }, /* AutoRelockTime */ \ + { 0x00000021, ZAP_TYPE(CHAR_STRING), 4, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_LONG_DEFAULTS_INDEX(350) }, /* Language */ \ + { 0x00000023, ZAP_TYPE(INT32U), 4, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_LONG_DEFAULTS_INDEX(353) }, /* AutoRelockTime */ \ { 0x00000024, ZAP_TYPE(INT8U), 1, ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ ZAP_MIN_MAX_DEFAULTS_INDEX(5) }, /* SoundVolume */ \ { 0x00000025, ZAP_TYPE(ENUM8), 1, ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ @@ -1532,7 +1500,7 @@ ZAP_MIN_MAX_DEFAULTS_INDEX(8) }, /* UserCodeTemporaryDisableTime */ \ { 0x00000033, ZAP_TYPE(BOOLEAN), 1, ZAP_ATTRIBUTE_MASK(WRITABLE), \ ZAP_SIMPLE_DEFAULT(0) }, /* RequirePINforRemoteOperation */ \ - { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(405) }, /* FeatureMap */ \ + { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(357) }, /* FeatureMap */ \ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(6) }, /* ClusterRevision */ \ \ /* Endpoint: 1, Cluster: Window Covering (server) */ \ @@ -1568,7 +1536,7 @@ ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(TOKENIZE) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ ZAP_MIN_MAX_DEFAULTS_INDEX(9) }, /* Mode */ \ { 0x0000001A, ZAP_TYPE(BITMAP16), 2, 0, ZAP_SIMPLE_DEFAULT(0x00) }, /* SafetyStatus */ \ - { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(409) }, /* FeatureMap */ \ + { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(361) }, /* FeatureMap */ \ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(5) }, /* ClusterRevision */ \ \ /* Endpoint: 1, Cluster: Barrier Control (server) */ \ @@ -1598,16 +1566,16 @@ { 0x00000013, ZAP_TYPE(INT16S), 2, ZAP_ATTRIBUTE_MASK(NULLABLE), ZAP_EMPTY_DEFAULT() }, /* Capacity */ \ { 0x00000014, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(NULLABLE), ZAP_EMPTY_DEFAULT() }, /* Speed */ \ { 0x00000015, ZAP_TYPE(INT24U), 3, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ - ZAP_LONG_DEFAULTS_INDEX(413) }, /* LifetimeRunningHours */ \ - { 0x00000016, ZAP_TYPE(INT24U), 3, ZAP_ATTRIBUTE_MASK(NULLABLE), ZAP_LONG_DEFAULTS_INDEX(416) }, /* Power */ \ + ZAP_LONG_DEFAULTS_INDEX(365) }, /* LifetimeRunningHours */ \ + { 0x00000016, ZAP_TYPE(INT24U), 3, ZAP_ATTRIBUTE_MASK(NULLABLE), ZAP_LONG_DEFAULTS_INDEX(368) }, /* Power */ \ { 0x00000017, ZAP_TYPE(INT32U), 4, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ - ZAP_LONG_DEFAULTS_INDEX(419) }, /* LifetimeEnergyConsumed */ \ + ZAP_LONG_DEFAULTS_INDEX(371) }, /* LifetimeEnergyConsumed */ \ { 0x00000020, ZAP_TYPE(ENUM8), 1, ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ ZAP_MIN_MAX_DEFAULTS_INDEX(10) }, /* OperationMode */ \ { 0x00000021, ZAP_TYPE(ENUM8), 1, ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ ZAP_MIN_MAX_DEFAULTS_INDEX(11) }, /* ControlMode */ \ { 0x00000022, ZAP_TYPE(BITMAP16), 2, 0, ZAP_EMPTY_DEFAULT() }, /* AlarmMask */ \ - { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(423) }, /* FeatureMap */ \ + { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(375) }, /* FeatureMap */ \ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(3) }, /* ClusterRevision */ \ \ /* Endpoint: 1, Cluster: Thermostat (server) */ \ @@ -1637,7 +1605,7 @@ { 0x00000020, ZAP_TYPE(ENUM8), 1, 0, ZAP_SIMPLE_DEFAULT(0) }, /* start of week */ \ { 0x00000021, ZAP_TYPE(INT8U), 1, 0, ZAP_SIMPLE_DEFAULT(7) }, /* number of weekly transitions */ \ { 0x00000022, ZAP_TYPE(INT8U), 1, 0, ZAP_SIMPLE_DEFAULT(4) }, /* number of daily transitions */ \ - { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(427) }, /* FeatureMap */ \ + { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(379) }, /* FeatureMap */ \ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(5) }, /* ClusterRevision */ \ \ /* Endpoint: 1, Cluster: Fan Control (server) */ \ @@ -1656,7 +1624,7 @@ { 0x00000008, ZAP_TYPE(BITMAP8), 1, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_SIMPLE_DEFAULT(0x00) }, /* rock setting */ \ { 0x00000009, ZAP_TYPE(BITMAP8), 1, 0, ZAP_SIMPLE_DEFAULT(0x00) }, /* wind support */ \ { 0x0000000A, ZAP_TYPE(BITMAP8), 1, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_SIMPLE_DEFAULT(0x00) }, /* wind setting */ \ - { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(431) }, /* FeatureMap */ \ + { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(383) }, /* FeatureMap */ \ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(2) }, /* ClusterRevision */ \ \ /* Endpoint: 1, Cluster: Thermostat User Interface Configuration (server) */ \ @@ -1731,7 +1699,7 @@ { 0x0000400D, ZAP_TYPE(INT16U), 2, 0, ZAP_EMPTY_DEFAULT() }, /* couple color temp to level min-mireds */ \ { 0x00004010, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ ZAP_MIN_MAX_DEFAULTS_INDEX(34) }, /* start up color temperature mireds */ \ - { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(435) }, /* FeatureMap */ \ + { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(387) }, /* FeatureMap */ \ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(5) }, /* ClusterRevision */ \ \ /* Endpoint: 1, Cluster: Illuminance Measurement (server) */ \ @@ -1780,7 +1748,7 @@ { 0x00000001, ZAP_TYPE(ENUM16), 2, 0, ZAP_EMPTY_DEFAULT() }, /* zone type */ \ { 0x00000002, ZAP_TYPE(BITMAP16), 2, 0, ZAP_SIMPLE_DEFAULT(0x0000) }, /* zone status */ \ { 0x00000010, ZAP_TYPE(NODE_ID), 8, ZAP_ATTRIBUTE_MASK(WRITABLE), \ - ZAP_LONG_DEFAULTS_INDEX(439) }, /* IAS CIE address */ \ + ZAP_LONG_DEFAULTS_INDEX(391) }, /* IAS CIE address */ \ { 0x00000011, ZAP_TYPE(INT8U), 1, 0, ZAP_SIMPLE_DEFAULT(0xff) }, /* Zone ID */ \ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(2) }, /* ClusterRevision */ \ \ @@ -1799,11 +1767,11 @@ \ /* Endpoint: 1, Cluster: Media Playback (server) */ \ { 0x00000000, ZAP_TYPE(ENUM8), 1, 0, ZAP_SIMPLE_DEFAULT(0x00) }, /* CurrentState */ \ - { 0x00000001, ZAP_TYPE(EPOCH_US), 8, ZAP_ATTRIBUTE_MASK(NULLABLE), ZAP_LONG_DEFAULTS_INDEX(447) }, /* StartTime */ \ - { 0x00000002, ZAP_TYPE(INT64U), 8, ZAP_ATTRIBUTE_MASK(NULLABLE), ZAP_LONG_DEFAULTS_INDEX(455) }, /* Duration */ \ - { 0x00000004, ZAP_TYPE(SINGLE), 4, 0, ZAP_LONG_DEFAULTS_INDEX(463) }, /* PlaybackSpeed */ \ - { 0x00000005, ZAP_TYPE(INT64U), 8, ZAP_ATTRIBUTE_MASK(NULLABLE), ZAP_LONG_DEFAULTS_INDEX(467) }, /* SeekRangeEnd */ \ - { 0x00000006, ZAP_TYPE(INT64U), 8, ZAP_ATTRIBUTE_MASK(NULLABLE), ZAP_LONG_DEFAULTS_INDEX(475) }, /* SeekRangeStart */ \ + { 0x00000001, ZAP_TYPE(EPOCH_US), 8, ZAP_ATTRIBUTE_MASK(NULLABLE), ZAP_LONG_DEFAULTS_INDEX(399) }, /* StartTime */ \ + { 0x00000002, ZAP_TYPE(INT64U), 8, ZAP_ATTRIBUTE_MASK(NULLABLE), ZAP_LONG_DEFAULTS_INDEX(407) }, /* Duration */ \ + { 0x00000004, ZAP_TYPE(SINGLE), 4, 0, ZAP_LONG_DEFAULTS_INDEX(415) }, /* PlaybackSpeed */ \ + { 0x00000005, ZAP_TYPE(INT64U), 8, ZAP_ATTRIBUTE_MASK(NULLABLE), ZAP_LONG_DEFAULTS_INDEX(419) }, /* SeekRangeEnd */ \ + { 0x00000006, ZAP_TYPE(INT64U), 8, ZAP_ATTRIBUTE_MASK(NULLABLE), ZAP_LONG_DEFAULTS_INDEX(427) }, /* SeekRangeStart */ \ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ \ /* Endpoint: 1, Cluster: Media Input (server) */ \ @@ -1820,7 +1788,7 @@ /* Endpoint: 1, Cluster: Content Launcher (server) */ \ { 0x00000000, ZAP_TYPE(ARRAY), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* AcceptHeader */ \ { 0x00000001, ZAP_TYPE(BITMAP32), 4, ZAP_ATTRIBUTE_MASK(WRITABLE), \ - ZAP_LONG_DEFAULTS_INDEX(483) }, /* SupportedStreamingProtocols */ \ + ZAP_LONG_DEFAULTS_INDEX(435) }, /* SupportedStreamingProtocols */ \ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ \ /* Endpoint: 1, Cluster: Audio Output (server) */ \ @@ -1849,28 +1817,28 @@ { 0x00000000, ZAP_TYPE(BOOLEAN), 1, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_SIMPLE_DEFAULT(false) }, /* boolean */ \ { 0x00000001, ZAP_TYPE(BITMAP8), 1, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_SIMPLE_DEFAULT(0) }, /* bitmap8 */ \ { 0x00000002, ZAP_TYPE(BITMAP16), 2, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_SIMPLE_DEFAULT(0) }, /* bitmap16 */ \ - { 0x00000003, ZAP_TYPE(BITMAP32), 4, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_LONG_DEFAULTS_INDEX(487) }, /* bitmap32 */ \ - { 0x00000004, ZAP_TYPE(BITMAP64), 8, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_LONG_DEFAULTS_INDEX(491) }, /* bitmap64 */ \ + { 0x00000003, ZAP_TYPE(BITMAP32), 4, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_LONG_DEFAULTS_INDEX(439) }, /* bitmap32 */ \ + { 0x00000004, ZAP_TYPE(BITMAP64), 8, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_LONG_DEFAULTS_INDEX(443) }, /* bitmap64 */ \ { 0x00000005, ZAP_TYPE(INT8U), 1, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_SIMPLE_DEFAULT(0) }, /* int8u */ \ { 0x00000006, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_SIMPLE_DEFAULT(0) }, /* int16u */ \ - { 0x00000007, ZAP_TYPE(INT24U), 3, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_LONG_DEFAULTS_INDEX(499) }, /* int24u */ \ - { 0x00000008, ZAP_TYPE(INT32U), 4, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_LONG_DEFAULTS_INDEX(502) }, /* int32u */ \ - { 0x00000009, ZAP_TYPE(INT40U), 5, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_LONG_DEFAULTS_INDEX(506) }, /* int40u */ \ - { 0x0000000A, ZAP_TYPE(INT48U), 6, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_LONG_DEFAULTS_INDEX(511) }, /* int48u */ \ - { 0x0000000B, ZAP_TYPE(INT56U), 7, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_LONG_DEFAULTS_INDEX(517) }, /* int56u */ \ - { 0x0000000C, ZAP_TYPE(INT64U), 8, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_LONG_DEFAULTS_INDEX(524) }, /* int64u */ \ + { 0x00000007, ZAP_TYPE(INT24U), 3, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_LONG_DEFAULTS_INDEX(451) }, /* int24u */ \ + { 0x00000008, ZAP_TYPE(INT32U), 4, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_LONG_DEFAULTS_INDEX(454) }, /* int32u */ \ + { 0x00000009, ZAP_TYPE(INT40U), 5, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_LONG_DEFAULTS_INDEX(458) }, /* int40u */ \ + { 0x0000000A, ZAP_TYPE(INT48U), 6, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_LONG_DEFAULTS_INDEX(463) }, /* int48u */ \ + { 0x0000000B, ZAP_TYPE(INT56U), 7, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_LONG_DEFAULTS_INDEX(469) }, /* int56u */ \ + { 0x0000000C, ZAP_TYPE(INT64U), 8, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_LONG_DEFAULTS_INDEX(476) }, /* int64u */ \ { 0x0000000D, ZAP_TYPE(INT8S), 1, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_SIMPLE_DEFAULT(0) }, /* int8s */ \ { 0x0000000E, ZAP_TYPE(INT16S), 2, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_SIMPLE_DEFAULT(0) }, /* int16s */ \ - { 0x0000000F, ZAP_TYPE(INT24S), 3, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_LONG_DEFAULTS_INDEX(532) }, /* int24s */ \ - { 0x00000010, ZAP_TYPE(INT32S), 4, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_LONG_DEFAULTS_INDEX(535) }, /* int32s */ \ - { 0x00000011, ZAP_TYPE(INT40S), 5, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_LONG_DEFAULTS_INDEX(539) }, /* int40s */ \ - { 0x00000012, ZAP_TYPE(INT48S), 6, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_LONG_DEFAULTS_INDEX(544) }, /* int48s */ \ - { 0x00000013, ZAP_TYPE(INT56S), 7, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_LONG_DEFAULTS_INDEX(550) }, /* int56s */ \ - { 0x00000014, ZAP_TYPE(INT64S), 8, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_LONG_DEFAULTS_INDEX(557) }, /* int64s */ \ + { 0x0000000F, ZAP_TYPE(INT24S), 3, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_LONG_DEFAULTS_INDEX(484) }, /* int24s */ \ + { 0x00000010, ZAP_TYPE(INT32S), 4, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_LONG_DEFAULTS_INDEX(487) }, /* int32s */ \ + { 0x00000011, ZAP_TYPE(INT40S), 5, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_LONG_DEFAULTS_INDEX(491) }, /* int40s */ \ + { 0x00000012, ZAP_TYPE(INT48S), 6, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_LONG_DEFAULTS_INDEX(496) }, /* int48s */ \ + { 0x00000013, ZAP_TYPE(INT56S), 7, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_LONG_DEFAULTS_INDEX(502) }, /* int56s */ \ + { 0x00000014, ZAP_TYPE(INT64S), 8, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_LONG_DEFAULTS_INDEX(509) }, /* int64s */ \ { 0x00000015, ZAP_TYPE(ENUM8), 1, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_SIMPLE_DEFAULT(0) }, /* enum8 */ \ { 0x00000016, ZAP_TYPE(ENUM16), 2, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_SIMPLE_DEFAULT(0) }, /* enum16 */ \ - { 0x00000017, ZAP_TYPE(SINGLE), 4, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_LONG_DEFAULTS_INDEX(565) }, /* float_single */ \ - { 0x00000018, ZAP_TYPE(DOUBLE), 8, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_LONG_DEFAULTS_INDEX(569) }, /* float_double */ \ + { 0x00000017, ZAP_TYPE(SINGLE), 4, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_LONG_DEFAULTS_INDEX(517) }, /* float_single */ \ + { 0x00000018, ZAP_TYPE(DOUBLE), 8, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_LONG_DEFAULTS_INDEX(521) }, /* float_double */ \ { 0x00000019, ZAP_TYPE(OCTET_STRING), 11, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_EMPTY_DEFAULT() }, /* octet_string */ \ { 0x0000001A, ZAP_TYPE(ARRAY), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ ZAP_EMPTY_DEFAULT() }, /* list_int8u */ \ @@ -1883,8 +1851,8 @@ { 0x0000001E, ZAP_TYPE(CHAR_STRING), 11, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_EMPTY_DEFAULT() }, /* char_string */ \ { 0x0000001F, ZAP_TYPE(LONG_CHAR_STRING), 1002, ZAP_ATTRIBUTE_MASK(WRITABLE), \ ZAP_EMPTY_DEFAULT() }, /* long_char_string */ \ - { 0x00000020, ZAP_TYPE(EPOCH_US), 8, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_LONG_DEFAULTS_INDEX(577) }, /* epoch_us */ \ - { 0x00000021, ZAP_TYPE(EPOCH_S), 4, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_LONG_DEFAULTS_INDEX(585) }, /* epoch_s */ \ + { 0x00000020, ZAP_TYPE(EPOCH_US), 8, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_LONG_DEFAULTS_INDEX(529) }, /* epoch_us */ \ + { 0x00000021, ZAP_TYPE(EPOCH_S), 4, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_LONG_DEFAULTS_INDEX(537) }, /* epoch_s */ \ { 0x00000022, ZAP_TYPE(VENDOR_ID), 2, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_EMPTY_DEFAULT() }, /* vendor_id */ \ { 0x00000023, ZAP_TYPE(ARRAY), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ ZAP_EMPTY_DEFAULT() }, /* list_nullables_and_optionals_struct */ \ @@ -1916,49 +1884,49 @@ { 0x00008002, ZAP_TYPE(BITMAP16), 2, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ ZAP_SIMPLE_DEFAULT(0) }, /* nullable_bitmap16 */ \ { 0x00008003, ZAP_TYPE(BITMAP32), 4, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ - ZAP_LONG_DEFAULTS_INDEX(589) }, /* nullable_bitmap32 */ \ + ZAP_LONG_DEFAULTS_INDEX(541) }, /* nullable_bitmap32 */ \ { 0x00008004, ZAP_TYPE(BITMAP64), 8, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ - ZAP_LONG_DEFAULTS_INDEX(593) }, /* nullable_bitmap64 */ \ + ZAP_LONG_DEFAULTS_INDEX(545) }, /* nullable_bitmap64 */ \ { 0x00008005, ZAP_TYPE(INT8U), 1, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ ZAP_SIMPLE_DEFAULT(0) }, /* nullable_int8u */ \ { 0x00008006, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ ZAP_SIMPLE_DEFAULT(0) }, /* nullable_int16u */ \ { 0x00008007, ZAP_TYPE(INT24U), 3, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ - ZAP_LONG_DEFAULTS_INDEX(601) }, /* nullable_int24u */ \ + ZAP_LONG_DEFAULTS_INDEX(553) }, /* nullable_int24u */ \ { 0x00008008, ZAP_TYPE(INT32U), 4, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ - ZAP_LONG_DEFAULTS_INDEX(604) }, /* nullable_int32u */ \ + ZAP_LONG_DEFAULTS_INDEX(556) }, /* nullable_int32u */ \ { 0x00008009, ZAP_TYPE(INT40U), 5, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ - ZAP_LONG_DEFAULTS_INDEX(608) }, /* nullable_int40u */ \ + ZAP_LONG_DEFAULTS_INDEX(560) }, /* nullable_int40u */ \ { 0x0000800A, ZAP_TYPE(INT48U), 6, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ - ZAP_LONG_DEFAULTS_INDEX(613) }, /* nullable_int48u */ \ + ZAP_LONG_DEFAULTS_INDEX(565) }, /* nullable_int48u */ \ { 0x0000800B, ZAP_TYPE(INT56U), 7, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ - ZAP_LONG_DEFAULTS_INDEX(619) }, /* nullable_int56u */ \ + ZAP_LONG_DEFAULTS_INDEX(571) }, /* nullable_int56u */ \ { 0x0000800C, ZAP_TYPE(INT64U), 8, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ - ZAP_LONG_DEFAULTS_INDEX(626) }, /* nullable_int64u */ \ + ZAP_LONG_DEFAULTS_INDEX(578) }, /* nullable_int64u */ \ { 0x0000800D, ZAP_TYPE(INT8S), 1, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ ZAP_SIMPLE_DEFAULT(0) }, /* nullable_int8s */ \ { 0x0000800E, ZAP_TYPE(INT16S), 2, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ ZAP_SIMPLE_DEFAULT(0) }, /* nullable_int16s */ \ { 0x0000800F, ZAP_TYPE(INT24S), 3, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ - ZAP_LONG_DEFAULTS_INDEX(634) }, /* nullable_int24s */ \ + ZAP_LONG_DEFAULTS_INDEX(586) }, /* nullable_int24s */ \ { 0x00008010, ZAP_TYPE(INT32S), 4, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ - ZAP_LONG_DEFAULTS_INDEX(637) }, /* nullable_int32s */ \ + ZAP_LONG_DEFAULTS_INDEX(589) }, /* nullable_int32s */ \ { 0x00008011, ZAP_TYPE(INT40S), 5, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ - ZAP_LONG_DEFAULTS_INDEX(641) }, /* nullable_int40s */ \ + ZAP_LONG_DEFAULTS_INDEX(593) }, /* nullable_int40s */ \ { 0x00008012, ZAP_TYPE(INT48S), 6, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ - ZAP_LONG_DEFAULTS_INDEX(646) }, /* nullable_int48s */ \ + ZAP_LONG_DEFAULTS_INDEX(598) }, /* nullable_int48s */ \ { 0x00008013, ZAP_TYPE(INT56S), 7, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ - ZAP_LONG_DEFAULTS_INDEX(652) }, /* nullable_int56s */ \ + ZAP_LONG_DEFAULTS_INDEX(604) }, /* nullable_int56s */ \ { 0x00008014, ZAP_TYPE(INT64S), 8, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ - ZAP_LONG_DEFAULTS_INDEX(659) }, /* nullable_int64s */ \ + ZAP_LONG_DEFAULTS_INDEX(611) }, /* nullable_int64s */ \ { 0x00008015, ZAP_TYPE(ENUM8), 1, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ ZAP_SIMPLE_DEFAULT(0) }, /* nullable_enum8 */ \ { 0x00008016, ZAP_TYPE(ENUM16), 2, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ ZAP_SIMPLE_DEFAULT(0) }, /* nullable_enum16 */ \ { 0x00008017, ZAP_TYPE(SINGLE), 4, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ - ZAP_LONG_DEFAULTS_INDEX(667) }, /* nullable_float_single */ \ + ZAP_LONG_DEFAULTS_INDEX(619) }, /* nullable_float_single */ \ { 0x00008018, ZAP_TYPE(DOUBLE), 8, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ - ZAP_LONG_DEFAULTS_INDEX(671) }, /* nullable_float_double */ \ + ZAP_LONG_DEFAULTS_INDEX(623) }, /* nullable_float_double */ \ { 0x00008019, ZAP_TYPE(OCTET_STRING), 11, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ ZAP_EMPTY_DEFAULT() }, /* nullable_octet_string */ \ { 0x0000801E, ZAP_TYPE(CHAR_STRING), 11, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ @@ -1983,8 +1951,8 @@ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ \ /* Endpoint: 1, Cluster: Electrical Measurement (server) */ \ - { 0x00000000, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(679) }, /* measurement type */ \ - { 0x00000304, ZAP_TYPE(INT32S), 4, 0, ZAP_LONG_DEFAULTS_INDEX(683) }, /* total active power */ \ + { 0x00000000, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(631) }, /* measurement type */ \ + { 0x00000304, ZAP_TYPE(INT32S), 4, 0, ZAP_LONG_DEFAULTS_INDEX(635) }, /* total active power */ \ { 0x00000505, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0xffff) }, /* rms voltage */ \ { 0x00000506, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x8000) }, /* rms voltage min */ \ { 0x00000507, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x8000) }, /* rms voltage max */ \ @@ -2008,7 +1976,7 @@ { 0x00004003, ZAP_TYPE(ENUM8), 1, \ ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ ZAP_MIN_MAX_DEFAULTS_INDEX(43) }, /* StartUpOnOff */ \ - { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(687) }, /* FeatureMap */ \ + { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(639) }, /* FeatureMap */ \ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(4) }, /* ClusterRevision */ \ \ /* Endpoint: 2, Cluster: Descriptor (server) */ \ @@ -2535,7 +2503,7 @@ .clusterId = 0x00000028, \ .attributes = ZAP_ATTRIBUTE_INDEX(18), \ .attributeCount = 21, \ - .clusterSize = 39, \ + .clusterSize = 37, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ .functions = chipFuncArrayBasicServer, \ .acceptedCommandList = nullptr ,\ @@ -2689,7 +2657,7 @@ .clusterId = 0x00000037, \ .attributes = ZAP_ATTRIBUTE_INDEX(168), \ .attributeCount = 11, \ - .clusterSize = 57, \ + .clusterSize = 6, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ .functions = NULL, \ .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 47 ) ,\ @@ -3322,7 +3290,7 @@ // This is an array of EmberAfEndpointType structures. #define GENERATED_ENDPOINT_TYPES \ { \ - { ZAP_CLUSTER_INDEX(0), 26, 598 }, { ZAP_CLUSTER_INDEX(26), 45, 3346 }, { ZAP_CLUSTER_INDEX(71), 4, 21 }, \ + { ZAP_CLUSTER_INDEX(0), 26, 545 }, { ZAP_CLUSTER_INDEX(26), 45, 3346 }, { ZAP_CLUSTER_INDEX(71), 4, 21 }, \ { ZAP_CLUSTER_INDEX(75), 1, 0 }, \ } @@ -3332,10 +3300,10 @@ static_assert(ATTRIBUTE_LARGEST <= CHIP_CONFIG_MAX_ATTRIBUTE_STORE_ELEMENT_SIZE, "ATTRIBUTE_LARGEST larger than expected"); // Total size of singleton attributes -#define ATTRIBUTE_SINGLETONS_SIZE (39) +#define ATTRIBUTE_SINGLETONS_SIZE (37) // Total size of attribute storage -#define ATTRIBUTE_MAX_SIZE (3965) +#define ATTRIBUTE_MAX_SIZE (3912) // Number of fixed endpoints #define FIXED_ENDPOINT_COUNT (4) diff --git a/zzz_generated/bridge-app/zap-generated/endpoint_config.h b/zzz_generated/bridge-app/zap-generated/endpoint_config.h index b6bb4c43a112a0..0584a6f45eeec0 100644 --- a/zzz_generated/bridge-app/zap-generated/endpoint_config.h +++ b/zzz_generated/bridge-app/zap-generated/endpoint_config.h @@ -239,35 +239,17 @@ \ /* Endpoint: 0, Cluster: Ethernet Network Diagnostics (server), big-endian */ \ \ - /* 303 - PacketRxCount, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 311 - PacketTxCount, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 319 - TxErrCount, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 327 - CollisionCount, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 335 - OverrunCount, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 343 - TimeSinceReset, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 351 - FeatureMap, */ \ + /* 303 - FeatureMap, */ \ 0x00, 0x00, 0x00, 0x03, \ \ /* Endpoint: 1, Cluster: Level Control (server), big-endian */ \ \ - /* 355 - FeatureMap, */ \ + /* 307 - FeatureMap, */ \ 0x00, 0x00, 0x00, 0x03, \ \ /* Endpoint: 1, Cluster: Switch (server), big-endian */ \ \ - /* 359 - FeatureMap, */ \ + /* 311 - FeatureMap, */ \ 0x00, 0x00, 0x00, 0x00, \ } @@ -485,41 +467,23 @@ \ /* Endpoint: 0, Cluster: Ethernet Network Diagnostics (server), little-endian */ \ \ - /* 303 - PacketRxCount, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 311 - PacketTxCount, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 319 - TxErrCount, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 327 - CollisionCount, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 335 - OverrunCount, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 343 - TimeSinceReset, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 351 - FeatureMap, */ \ + /* 303 - FeatureMap, */ \ 0x03, 0x00, 0x00, 0x00, \ \ /* Endpoint: 1, Cluster: Level Control (server), little-endian */ \ \ - /* 355 - FeatureMap, */ \ + /* 307 - FeatureMap, */ \ 0x03, 0x00, 0x00, 0x00, \ \ /* Endpoint: 1, Cluster: Switch (server), little-endian */ \ \ - /* 359 - FeatureMap, */ \ + /* 311 - FeatureMap, */ \ 0x00, 0x00, 0x00, 0x00, \ } #endif // BIGENDIAN_CPU -#define GENERATED_DEFAULTS_COUNT (73) +#define GENERATED_DEFAULTS_COUNT (67) #define ZAP_TYPE(type) ZCL_##type##_ATTRIBUTE_TYPE #define ZAP_LONG_DEFAULTS_INDEX(index) \ @@ -577,7 +541,8 @@ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ \ /* Endpoint: 0, Cluster: Basic (server) */ \ - { 0x00000000, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(SINGLETON), ZAP_SIMPLE_DEFAULT(10) }, /* DataModelRevision */ \ + { 0x00000000, ZAP_TYPE(INT16U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(SINGLETON), \ + ZAP_EMPTY_DEFAULT() }, /* DataModelRevision */ \ { 0x00000001, ZAP_TYPE(CHAR_STRING), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(SINGLETON), \ ZAP_EMPTY_DEFAULT() }, /* VendorName */ \ { 0x00000002, ZAP_TYPE(VENDOR_ID), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(SINGLETON), \ @@ -773,17 +738,20 @@ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ \ /* Endpoint: 0, Cluster: Ethernet Network Diagnostics (server) */ \ - { 0x00000000, ZAP_TYPE(ENUM8), 1, ZAP_ATTRIBUTE_MASK(NULLABLE), ZAP_EMPTY_DEFAULT() }, /* PHYRate */ \ - { 0x00000001, ZAP_TYPE(BOOLEAN), 1, ZAP_ATTRIBUTE_MASK(NULLABLE), ZAP_SIMPLE_DEFAULT(0x00) }, /* FullDuplex */ \ - { 0x00000002, ZAP_TYPE(INT64U), 8, 0, ZAP_LONG_DEFAULTS_INDEX(303) }, /* PacketRxCount */ \ - { 0x00000003, ZAP_TYPE(INT64U), 8, 0, ZAP_LONG_DEFAULTS_INDEX(311) }, /* PacketTxCount */ \ - { 0x00000004, ZAP_TYPE(INT64U), 8, 0, ZAP_LONG_DEFAULTS_INDEX(319) }, /* TxErrCount */ \ - { 0x00000005, ZAP_TYPE(INT64U), 8, 0, ZAP_LONG_DEFAULTS_INDEX(327) }, /* CollisionCount */ \ - { 0x00000006, ZAP_TYPE(INT64U), 8, 0, ZAP_LONG_DEFAULTS_INDEX(335) }, /* OverrunCount */ \ - { 0x00000007, ZAP_TYPE(BOOLEAN), 1, ZAP_ATTRIBUTE_MASK(NULLABLE), ZAP_SIMPLE_DEFAULT(0x00) }, /* CarrierDetect */ \ - { 0x00000008, ZAP_TYPE(INT64U), 8, 0, ZAP_LONG_DEFAULTS_INDEX(343) }, /* TimeSinceReset */ \ - { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(351) }, /* FeatureMap */ \ - { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ + { 0x00000000, ZAP_TYPE(ENUM8), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ + ZAP_EMPTY_DEFAULT() }, /* PHYRate */ \ + { 0x00000001, ZAP_TYPE(BOOLEAN), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ + ZAP_EMPTY_DEFAULT() }, /* FullDuplex */ \ + { 0x00000002, ZAP_TYPE(INT64U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* PacketRxCount */ \ + { 0x00000003, ZAP_TYPE(INT64U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* PacketTxCount */ \ + { 0x00000004, ZAP_TYPE(INT64U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* TxErrCount */ \ + { 0x00000005, ZAP_TYPE(INT64U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* CollisionCount */ \ + { 0x00000006, ZAP_TYPE(INT64U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* OverrunCount */ \ + { 0x00000007, ZAP_TYPE(BOOLEAN), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ + ZAP_EMPTY_DEFAULT() }, /* CarrierDetect */ \ + { 0x00000008, ZAP_TYPE(INT64U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* TimeSinceReset */ \ + { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(303) }, /* FeatureMap */ \ + { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ \ /* Endpoint: 0, Cluster: AdministratorCommissioning (server) */ \ { 0x00000000, ZAP_TYPE(INT8U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* WindowStatus */ \ @@ -839,7 +807,7 @@ { 0x00004000, ZAP_TYPE(INT8U), 1, \ ZAP_ATTRIBUTE_MASK(TOKENIZE) | ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ ZAP_SIMPLE_DEFAULT(255) }, /* start up current level */ \ - { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(355) }, /* FeatureMap */ \ + { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(307) }, /* FeatureMap */ \ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(5) }, /* ClusterRevision */ \ \ /* Endpoint: 1, Cluster: Descriptor (server) */ \ @@ -853,7 +821,7 @@ { 0x00000000, ZAP_TYPE(INT8U), 1, 0, ZAP_SIMPLE_DEFAULT(2) }, /* number of positions */ \ { 0x00000001, ZAP_TYPE(INT8U), 1, 0, ZAP_SIMPLE_DEFAULT(1) }, /* current position */ \ { 0x00000002, ZAP_TYPE(INT8U), 1, 0, ZAP_SIMPLE_DEFAULT(2) }, /* multi press max */ \ - { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(359) }, /* FeatureMap */ \ + { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(311) }, /* FeatureMap */ \ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ \ /* Endpoint: 1, Cluster: Fixed Label (server) */ \ @@ -1011,7 +979,7 @@ .clusterId = 0x00000028, \ .attributes = ZAP_ATTRIBUTE_INDEX(11), \ .attributeCount = 21, \ - .clusterSize = 39, \ + .clusterSize = 37, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ .functions = chipFuncArrayBasicServer, \ .acceptedCommandList = nullptr ,\ @@ -1132,7 +1100,7 @@ .clusterId = 0x00000037, \ .attributes = ZAP_ATTRIBUTE_INDEX(154), \ .attributeCount = 11, \ - .clusterSize = 57, \ + .clusterSize = 6, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ .functions = NULL, \ .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 21 ) ,\ @@ -1248,7 +1216,7 @@ // This is an array of EmberAfEndpointType structures. #define GENERATED_ENDPOINT_TYPES \ { \ - { ZAP_CLUSTER_INDEX(0), 19, 573 }, { ZAP_CLUSTER_INDEX(19), 5, 41 }, \ + { ZAP_CLUSTER_INDEX(0), 19, 520 }, { ZAP_CLUSTER_INDEX(19), 5, 41 }, \ } // Largest attribute size is needed for various buffers @@ -1257,10 +1225,10 @@ static_assert(ATTRIBUTE_LARGEST <= CHIP_CONFIG_MAX_ATTRIBUTE_STORE_ELEMENT_SIZE, "ATTRIBUTE_LARGEST larger than expected"); // Total size of singleton attributes -#define ATTRIBUTE_SINGLETONS_SIZE (39) +#define ATTRIBUTE_SINGLETONS_SIZE (37) // Total size of attribute storage -#define ATTRIBUTE_MAX_SIZE (614) +#define ATTRIBUTE_MAX_SIZE (561) // Number of fixed endpoints #define FIXED_ENDPOINT_COUNT (2) diff --git a/zzz_generated/light-switch-app/zap-generated/endpoint_config.h b/zzz_generated/light-switch-app/zap-generated/endpoint_config.h index 67de75d4575331..2411f55e77497e 100644 --- a/zzz_generated/light-switch-app/zap-generated/endpoint_config.h +++ b/zzz_generated/light-switch-app/zap-generated/endpoint_config.h @@ -229,25 +229,7 @@ \ /* Endpoint: 0, Cluster: Ethernet Network Diagnostics (server), big-endian */ \ \ - /* 293 - PacketRxCount, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 301 - PacketTxCount, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 309 - TxErrCount, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 317 - CollisionCount, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 325 - OverrunCount, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 333 - TimeSinceReset, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 341 - FeatureMap, */ \ + /* 293 - FeatureMap, */ \ 0x00, 0x00, 0x00, 0x03, \ } @@ -455,31 +437,13 @@ \ /* Endpoint: 0, Cluster: Ethernet Network Diagnostics (server), little-endian */ \ \ - /* 293 - PacketRxCount, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 301 - PacketTxCount, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 309 - TxErrCount, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 317 - CollisionCount, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 325 - OverrunCount, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 333 - TimeSinceReset, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 341 - FeatureMap, */ \ + /* 293 - FeatureMap, */ \ 0x03, 0x00, 0x00, 0x00, \ } #endif // BIGENDIAN_CPU -#define GENERATED_DEFAULTS_COUNT (69) +#define GENERATED_DEFAULTS_COUNT (63) #define ZAP_TYPE(type) ZCL_##type##_ATTRIBUTE_TYPE #define ZAP_LONG_DEFAULTS_INDEX(index) \ @@ -542,7 +506,8 @@ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ \ /* Endpoint: 0, Cluster: Basic (server) */ \ - { 0x00000000, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(SINGLETON), ZAP_SIMPLE_DEFAULT(10) }, /* DataModelRevision */ \ + { 0x00000000, ZAP_TYPE(INT16U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(SINGLETON), \ + ZAP_EMPTY_DEFAULT() }, /* DataModelRevision */ \ { 0x00000001, ZAP_TYPE(CHAR_STRING), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(SINGLETON), \ ZAP_EMPTY_DEFAULT() }, /* VendorName */ \ { 0x00000002, ZAP_TYPE(VENDOR_ID), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(SINGLETON), \ @@ -738,17 +703,20 @@ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ \ /* Endpoint: 0, Cluster: Ethernet Network Diagnostics (server) */ \ - { 0x00000000, ZAP_TYPE(ENUM8), 1, ZAP_ATTRIBUTE_MASK(NULLABLE), ZAP_EMPTY_DEFAULT() }, /* PHYRate */ \ - { 0x00000001, ZAP_TYPE(BOOLEAN), 1, ZAP_ATTRIBUTE_MASK(NULLABLE), ZAP_SIMPLE_DEFAULT(0x00) }, /* FullDuplex */ \ - { 0x00000002, ZAP_TYPE(INT64U), 8, 0, ZAP_LONG_DEFAULTS_INDEX(293) }, /* PacketRxCount */ \ - { 0x00000003, ZAP_TYPE(INT64U), 8, 0, ZAP_LONG_DEFAULTS_INDEX(301) }, /* PacketTxCount */ \ - { 0x00000004, ZAP_TYPE(INT64U), 8, 0, ZAP_LONG_DEFAULTS_INDEX(309) }, /* TxErrCount */ \ - { 0x00000005, ZAP_TYPE(INT64U), 8, 0, ZAP_LONG_DEFAULTS_INDEX(317) }, /* CollisionCount */ \ - { 0x00000006, ZAP_TYPE(INT64U), 8, 0, ZAP_LONG_DEFAULTS_INDEX(325) }, /* OverrunCount */ \ - { 0x00000007, ZAP_TYPE(BOOLEAN), 1, ZAP_ATTRIBUTE_MASK(NULLABLE), ZAP_SIMPLE_DEFAULT(0x00) }, /* CarrierDetect */ \ - { 0x00000008, ZAP_TYPE(INT64U), 8, 0, ZAP_LONG_DEFAULTS_INDEX(333) }, /* TimeSinceReset */ \ - { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(341) }, /* FeatureMap */ \ - { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ + { 0x00000000, ZAP_TYPE(ENUM8), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ + ZAP_EMPTY_DEFAULT() }, /* PHYRate */ \ + { 0x00000001, ZAP_TYPE(BOOLEAN), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ + ZAP_EMPTY_DEFAULT() }, /* FullDuplex */ \ + { 0x00000002, ZAP_TYPE(INT64U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* PacketRxCount */ \ + { 0x00000003, ZAP_TYPE(INT64U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* PacketTxCount */ \ + { 0x00000004, ZAP_TYPE(INT64U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* TxErrCount */ \ + { 0x00000005, ZAP_TYPE(INT64U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* CollisionCount */ \ + { 0x00000006, ZAP_TYPE(INT64U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* OverrunCount */ \ + { 0x00000007, ZAP_TYPE(BOOLEAN), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ + ZAP_EMPTY_DEFAULT() }, /* CarrierDetect */ \ + { 0x00000008, ZAP_TYPE(INT64U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* TimeSinceReset */ \ + { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(293) }, /* FeatureMap */ \ + { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ \ /* Endpoint: 0, Cluster: AdministratorCommissioning (server) */ \ { 0x00000000, ZAP_TYPE(INT8U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* WindowStatus */ \ @@ -990,7 +958,7 @@ .clusterId = 0x00000028, \ .attributes = ZAP_ATTRIBUTE_INDEX(13), \ .attributeCount = 21, \ - .clusterSize = 39, \ + .clusterSize = 37, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ .functions = chipFuncArrayBasicServer, \ .acceptedCommandList = nullptr ,\ @@ -1122,7 +1090,7 @@ .clusterId = 0x00000037, \ .attributes = ZAP_ATTRIBUTE_INDEX(157), \ .attributeCount = 11, \ - .clusterSize = 57, \ + .clusterSize = 6, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ .functions = NULL, \ .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 27 ) ,\ @@ -1293,7 +1261,7 @@ // This is an array of EmberAfEndpointType structures. #define GENERATED_ENDPOINT_TYPES \ { \ - { ZAP_CLUSTER_INDEX(0), 22, 573 }, { ZAP_CLUSTER_INDEX(22), 8, 10 }, \ + { ZAP_CLUSTER_INDEX(0), 22, 520 }, { ZAP_CLUSTER_INDEX(22), 8, 10 }, \ } // Largest attribute size is needed for various buffers @@ -1302,10 +1270,10 @@ static_assert(ATTRIBUTE_LARGEST <= CHIP_CONFIG_MAX_ATTRIBUTE_STORE_ELEMENT_SIZE, "ATTRIBUTE_LARGEST larger than expected"); // Total size of singleton attributes -#define ATTRIBUTE_SINGLETONS_SIZE (39) +#define ATTRIBUTE_SINGLETONS_SIZE (37) // Total size of attribute storage -#define ATTRIBUTE_MAX_SIZE (583) +#define ATTRIBUTE_MAX_SIZE (530) // Number of fixed endpoints #define FIXED_ENDPOINT_COUNT (2) diff --git a/zzz_generated/lighting-app/zap-generated/endpoint_config.h b/zzz_generated/lighting-app/zap-generated/endpoint_config.h index e0c0e21677ce42..b0c8e1d4ed12aa 100644 --- a/zzz_generated/lighting-app/zap-generated/endpoint_config.h +++ b/zzz_generated/lighting-app/zap-generated/endpoint_config.h @@ -234,40 +234,22 @@ \ /* Endpoint: 0, Cluster: Ethernet Network Diagnostics (server), big-endian */ \ \ - /* 299 - PacketRxCount, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 307 - PacketTxCount, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 315 - TxErrCount, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 323 - CollisionCount, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 331 - OverrunCount, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 339 - TimeSinceReset, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 347 - FeatureMap, */ \ + /* 299 - FeatureMap, */ \ 0x00, 0x00, 0x00, 0x03, \ \ /* Endpoint: 1, Cluster: On/Off (server), big-endian */ \ \ - /* 351 - FeatureMap, */ \ + /* 303 - FeatureMap, */ \ 0x00, 0x00, 0x00, 0x01, \ \ /* Endpoint: 1, Cluster: Level Control (server), big-endian */ \ \ - /* 355 - FeatureMap, */ \ + /* 307 - FeatureMap, */ \ 0x00, 0x00, 0x00, 0x03, \ \ /* Endpoint: 1, Cluster: Color Control (server), big-endian */ \ \ - /* 359 - FeatureMap, */ \ + /* 311 - FeatureMap, */ \ 0x00, 0x00, 0x00, 0x1F, \ } @@ -480,46 +462,28 @@ \ /* Endpoint: 0, Cluster: Ethernet Network Diagnostics (server), little-endian */ \ \ - /* 299 - PacketRxCount, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 307 - PacketTxCount, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 315 - TxErrCount, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 323 - CollisionCount, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 331 - OverrunCount, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 339 - TimeSinceReset, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 347 - FeatureMap, */ \ + /* 299 - FeatureMap, */ \ 0x03, 0x00, 0x00, 0x00, \ \ /* Endpoint: 1, Cluster: On/Off (server), little-endian */ \ \ - /* 351 - FeatureMap, */ \ + /* 303 - FeatureMap, */ \ 0x01, 0x00, 0x00, 0x00, \ \ /* Endpoint: 1, Cluster: Level Control (server), little-endian */ \ \ - /* 355 - FeatureMap, */ \ + /* 307 - FeatureMap, */ \ 0x03, 0x00, 0x00, 0x00, \ \ /* Endpoint: 1, Cluster: Color Control (server), little-endian */ \ \ - /* 359 - FeatureMap, */ \ + /* 311 - FeatureMap, */ \ 0x1F, 0x00, 0x00, 0x00, \ } #endif // BIGENDIAN_CPU -#define GENERATED_DEFAULTS_COUNT (73) +#define GENERATED_DEFAULTS_COUNT (67) #define ZAP_TYPE(type) ZCL_##type##_ATTRIBUTE_TYPE #define ZAP_LONG_DEFAULTS_INDEX(index) \ @@ -590,7 +554,8 @@ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ \ /* Endpoint: 0, Cluster: Basic (server) */ \ - { 0x00000000, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(SINGLETON), ZAP_SIMPLE_DEFAULT(10) }, /* DataModelRevision */ \ + { 0x00000000, ZAP_TYPE(INT16U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(SINGLETON), \ + ZAP_EMPTY_DEFAULT() }, /* DataModelRevision */ \ { 0x00000001, ZAP_TYPE(CHAR_STRING), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(SINGLETON), \ ZAP_EMPTY_DEFAULT() }, /* VendorName */ \ { 0x00000002, ZAP_TYPE(VENDOR_ID), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(SINGLETON), \ @@ -788,17 +753,20 @@ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ \ /* Endpoint: 0, Cluster: Ethernet Network Diagnostics (server) */ \ - { 0x00000000, ZAP_TYPE(ENUM8), 1, ZAP_ATTRIBUTE_MASK(NULLABLE), ZAP_EMPTY_DEFAULT() }, /* PHYRate */ \ - { 0x00000001, ZAP_TYPE(BOOLEAN), 1, ZAP_ATTRIBUTE_MASK(NULLABLE), ZAP_SIMPLE_DEFAULT(0x00) }, /* FullDuplex */ \ - { 0x00000002, ZAP_TYPE(INT64U), 8, 0, ZAP_LONG_DEFAULTS_INDEX(299) }, /* PacketRxCount */ \ - { 0x00000003, ZAP_TYPE(INT64U), 8, 0, ZAP_LONG_DEFAULTS_INDEX(307) }, /* PacketTxCount */ \ - { 0x00000004, ZAP_TYPE(INT64U), 8, 0, ZAP_LONG_DEFAULTS_INDEX(315) }, /* TxErrCount */ \ - { 0x00000005, ZAP_TYPE(INT64U), 8, 0, ZAP_LONG_DEFAULTS_INDEX(323) }, /* CollisionCount */ \ - { 0x00000006, ZAP_TYPE(INT64U), 8, 0, ZAP_LONG_DEFAULTS_INDEX(331) }, /* OverrunCount */ \ - { 0x00000007, ZAP_TYPE(BOOLEAN), 1, ZAP_ATTRIBUTE_MASK(NULLABLE), ZAP_SIMPLE_DEFAULT(0x00) }, /* CarrierDetect */ \ - { 0x00000008, ZAP_TYPE(INT64U), 8, 0, ZAP_LONG_DEFAULTS_INDEX(339) }, /* TimeSinceReset */ \ - { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(347) }, /* FeatureMap */ \ - { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ + { 0x00000000, ZAP_TYPE(ENUM8), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ + ZAP_EMPTY_DEFAULT() }, /* PHYRate */ \ + { 0x00000001, ZAP_TYPE(BOOLEAN), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ + ZAP_EMPTY_DEFAULT() }, /* FullDuplex */ \ + { 0x00000002, ZAP_TYPE(INT64U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* PacketRxCount */ \ + { 0x00000003, ZAP_TYPE(INT64U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* PacketTxCount */ \ + { 0x00000004, ZAP_TYPE(INT64U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* TxErrCount */ \ + { 0x00000005, ZAP_TYPE(INT64U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* CollisionCount */ \ + { 0x00000006, ZAP_TYPE(INT64U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* OverrunCount */ \ + { 0x00000007, ZAP_TYPE(BOOLEAN), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ + ZAP_EMPTY_DEFAULT() }, /* CarrierDetect */ \ + { 0x00000008, ZAP_TYPE(INT64U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* TimeSinceReset */ \ + { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(299) }, /* FeatureMap */ \ + { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ \ /* Endpoint: 0, Cluster: AdministratorCommissioning (server) */ \ { 0x00000000, ZAP_TYPE(INT8U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* WindowStatus */ \ @@ -855,7 +823,7 @@ ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(TOKENIZE) | ZAP_ATTRIBUTE_MASK(WRITABLE) | \ ZAP_ATTRIBUTE_MASK(NULLABLE), \ ZAP_MIN_MAX_DEFAULTS_INDEX(1) }, /* StartUpOnOff */ \ - { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(351) }, /* FeatureMap */ \ + { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(303) }, /* FeatureMap */ \ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(4) }, /* ClusterRevision */ \ \ /* Endpoint: 1, Cluster: Level Control (server) */ \ @@ -881,7 +849,7 @@ { 0x00004000, ZAP_TYPE(INT8U), 1, \ ZAP_ATTRIBUTE_MASK(TOKENIZE) | ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ ZAP_SIMPLE_DEFAULT(255) }, /* start up current level */ \ - { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(355) }, /* FeatureMap */ \ + { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(307) }, /* FeatureMap */ \ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(5) }, /* ClusterRevision */ \ \ /* Endpoint: 1, Cluster: Descriptor (server) */ \ @@ -915,7 +883,7 @@ { 0x0000400D, ZAP_TYPE(INT16U), 2, 0, ZAP_EMPTY_DEFAULT() }, /* couple color temp to level min-mireds */ \ { 0x00004010, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ ZAP_MIN_MAX_DEFAULTS_INDEX(3) }, /* start up color temperature mireds */ \ - { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(359) }, /* FeatureMap */ \ + { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(311) }, /* FeatureMap */ \ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(5) }, /* ClusterRevision */ \ \ /* Endpoint: 1, Cluster: Occupancy Sensing (server) */ \ @@ -1175,7 +1143,7 @@ .clusterId = 0x00000028, \ .attributes = ZAP_ATTRIBUTE_INDEX(13), \ .attributeCount = 21, \ - .clusterSize = 39, \ + .clusterSize = 37, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ .functions = chipFuncArrayBasicServer, \ .acceptedCommandList = nullptr ,\ @@ -1307,7 +1275,7 @@ .clusterId = 0x00000037, \ .attributes = ZAP_ATTRIBUTE_INDEX(158), \ .attributeCount = 11, \ - .clusterSize = 57, \ + .clusterSize = 6, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ .functions = NULL, \ .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 39 ) ,\ @@ -1467,7 +1435,7 @@ // This is an array of EmberAfEndpointType structures. #define GENERATED_ENDPOINT_TYPES \ { \ - { ZAP_CLUSTER_INDEX(0), 22, 576 }, { ZAP_CLUSTER_INDEX(22), 7, 93 }, \ + { ZAP_CLUSTER_INDEX(0), 22, 523 }, { ZAP_CLUSTER_INDEX(22), 7, 93 }, \ } // Largest attribute size is needed for various buffers @@ -1476,10 +1444,10 @@ static_assert(ATTRIBUTE_LARGEST <= CHIP_CONFIG_MAX_ATTRIBUTE_STORE_ELEMENT_SIZE, "ATTRIBUTE_LARGEST larger than expected"); // Total size of singleton attributes -#define ATTRIBUTE_SINGLETONS_SIZE (39) +#define ATTRIBUTE_SINGLETONS_SIZE (37) // Total size of attribute storage -#define ATTRIBUTE_MAX_SIZE (669) +#define ATTRIBUTE_MAX_SIZE (616) // Number of fixed endpoints #define FIXED_ENDPOINT_COUNT (2) diff --git a/zzz_generated/lock-app/zap-generated/endpoint_config.h b/zzz_generated/lock-app/zap-generated/endpoint_config.h index 827d73df4bb2f5..9e8c29b5115e8b 100644 --- a/zzz_generated/lock-app/zap-generated/endpoint_config.h +++ b/zzz_generated/lock-app/zap-generated/endpoint_config.h @@ -245,49 +245,31 @@ \ /* Endpoint: 0, Cluster: Ethernet Network Diagnostics (server), big-endian */ \ \ - /* 311 - PacketRxCount, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 319 - PacketTxCount, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 327 - TxErrCount, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 335 - CollisionCount, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 343 - OverrunCount, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 351 - TimeSinceReset, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 359 - FeatureMap, */ \ + /* 311 - FeatureMap, */ \ 0x00, 0x00, 0x00, 0x03, \ \ /* Endpoint: 1, Cluster: On/Off (server), big-endian */ \ \ - /* 363 - FeatureMap, */ \ + /* 315 - FeatureMap, */ \ 0x00, 0x00, 0x00, 0x00, \ \ /* Endpoint: 1, Cluster: Power Source (server), big-endian */ \ \ - /* 367 - Description, */ \ + /* 319 - Description, */ \ 7, 'B', 'a', 't', 't', 'e', 'r', 'y', \ \ - /* 375 - FeatureMap, */ \ + /* 327 - FeatureMap, */ \ 0x00, 0x00, 0x00, 0x0A, \ \ /* Endpoint: 1, Cluster: Door Lock (server), big-endian */ \ \ - /* 379 - Language, */ \ + /* 331 - Language, */ \ 2, 'e', 'n', \ \ - /* 382 - AutoRelockTime, */ \ + /* 334 - AutoRelockTime, */ \ 0x00, 0x00, 0x00, 0x60, \ \ - /* 386 - FeatureMap, */ \ + /* 338 - FeatureMap, */ \ 0x00, 0x00, 0x01, 0x13, \ } @@ -511,55 +493,37 @@ \ /* Endpoint: 0, Cluster: Ethernet Network Diagnostics (server), little-endian */ \ \ - /* 311 - PacketRxCount, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 319 - PacketTxCount, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 327 - TxErrCount, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 335 - CollisionCount, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 343 - OverrunCount, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 351 - TimeSinceReset, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 359 - FeatureMap, */ \ + /* 311 - FeatureMap, */ \ 0x03, 0x00, 0x00, 0x00, \ \ /* Endpoint: 1, Cluster: On/Off (server), little-endian */ \ \ - /* 363 - FeatureMap, */ \ + /* 315 - FeatureMap, */ \ 0x00, 0x00, 0x00, 0x00, \ \ /* Endpoint: 1, Cluster: Power Source (server), little-endian */ \ \ - /* 367 - Description, */ \ + /* 319 - Description, */ \ 7, 'B', 'a', 't', 't', 'e', 'r', 'y', \ \ - /* 375 - FeatureMap, */ \ + /* 327 - FeatureMap, */ \ 0x0A, 0x00, 0x00, 0x00, \ \ /* Endpoint: 1, Cluster: Door Lock (server), little-endian */ \ \ - /* 379 - Language, */ \ + /* 331 - Language, */ \ 2, 'e', 'n', \ \ - /* 382 - AutoRelockTime, */ \ + /* 334 - AutoRelockTime, */ \ 0x60, 0x00, 0x00, 0x00, \ \ - /* 386 - FeatureMap, */ \ + /* 338 - FeatureMap, */ \ 0x13, 0x01, 0x00, 0x00, \ } #endif // BIGENDIAN_CPU -#define GENERATED_DEFAULTS_COUNT (79) +#define GENERATED_DEFAULTS_COUNT (73) #define ZAP_TYPE(type) ZCL_##type##_ATTRIBUTE_TYPE #define ZAP_LONG_DEFAULTS_INDEX(index) \ @@ -626,7 +590,8 @@ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ \ /* Endpoint: 0, Cluster: Basic (server) */ \ - { 0x00000000, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(SINGLETON), ZAP_SIMPLE_DEFAULT(10) }, /* DataModelRevision */ \ + { 0x00000000, ZAP_TYPE(INT16U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(SINGLETON), \ + ZAP_EMPTY_DEFAULT() }, /* DataModelRevision */ \ { 0x00000001, ZAP_TYPE(CHAR_STRING), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(SINGLETON), \ ZAP_EMPTY_DEFAULT() }, /* VendorName */ \ { 0x00000002, ZAP_TYPE(VENDOR_ID), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(SINGLETON), \ @@ -836,17 +801,20 @@ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ \ /* Endpoint: 0, Cluster: Ethernet Network Diagnostics (server) */ \ - { 0x00000000, ZAP_TYPE(ENUM8), 1, ZAP_ATTRIBUTE_MASK(NULLABLE), ZAP_EMPTY_DEFAULT() }, /* PHYRate */ \ - { 0x00000001, ZAP_TYPE(BOOLEAN), 1, ZAP_ATTRIBUTE_MASK(NULLABLE), ZAP_SIMPLE_DEFAULT(0x00) }, /* FullDuplex */ \ - { 0x00000002, ZAP_TYPE(INT64U), 8, 0, ZAP_LONG_DEFAULTS_INDEX(311) }, /* PacketRxCount */ \ - { 0x00000003, ZAP_TYPE(INT64U), 8, 0, ZAP_LONG_DEFAULTS_INDEX(319) }, /* PacketTxCount */ \ - { 0x00000004, ZAP_TYPE(INT64U), 8, 0, ZAP_LONG_DEFAULTS_INDEX(327) }, /* TxErrCount */ \ - { 0x00000005, ZAP_TYPE(INT64U), 8, 0, ZAP_LONG_DEFAULTS_INDEX(335) }, /* CollisionCount */ \ - { 0x00000006, ZAP_TYPE(INT64U), 8, 0, ZAP_LONG_DEFAULTS_INDEX(343) }, /* OverrunCount */ \ - { 0x00000007, ZAP_TYPE(BOOLEAN), 1, ZAP_ATTRIBUTE_MASK(NULLABLE), ZAP_SIMPLE_DEFAULT(0x00) }, /* CarrierDetect */ \ - { 0x00000008, ZAP_TYPE(INT64U), 8, 0, ZAP_LONG_DEFAULTS_INDEX(351) }, /* TimeSinceReset */ \ - { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(359) }, /* FeatureMap */ \ - { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ + { 0x00000000, ZAP_TYPE(ENUM8), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ + ZAP_EMPTY_DEFAULT() }, /* PHYRate */ \ + { 0x00000001, ZAP_TYPE(BOOLEAN), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ + ZAP_EMPTY_DEFAULT() }, /* FullDuplex */ \ + { 0x00000002, ZAP_TYPE(INT64U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* PacketRxCount */ \ + { 0x00000003, ZAP_TYPE(INT64U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* PacketTxCount */ \ + { 0x00000004, ZAP_TYPE(INT64U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* TxErrCount */ \ + { 0x00000005, ZAP_TYPE(INT64U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* CollisionCount */ \ + { 0x00000006, ZAP_TYPE(INT64U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* OverrunCount */ \ + { 0x00000007, ZAP_TYPE(BOOLEAN), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ + ZAP_EMPTY_DEFAULT() }, /* CarrierDetect */ \ + { 0x00000008, ZAP_TYPE(INT64U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* TimeSinceReset */ \ + { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(311) }, /* FeatureMap */ \ + { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ \ /* Endpoint: 0, Cluster: AdministratorCommissioning (server) */ \ { 0x00000000, ZAP_TYPE(INT8U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* WindowStatus */ \ @@ -883,7 +851,7 @@ { 0x00004003, ZAP_TYPE(ENUM8), 1, \ ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ ZAP_MIN_MAX_DEFAULTS_INDEX(1) }, /* StartUpOnOff */ \ - { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(363) }, /* FeatureMap */ \ + { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(315) }, /* FeatureMap */ \ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(4) }, /* ClusterRevision */ \ \ /* Endpoint: 1, Cluster: Descriptor (server) */ \ @@ -896,12 +864,12 @@ /* Endpoint: 1, Cluster: Power Source (server) */ \ { 0x00000000, ZAP_TYPE(ENUM8), 1, 0, ZAP_SIMPLE_DEFAULT(1) }, /* Status */ \ { 0x00000001, ZAP_TYPE(INT8U), 1, 0, ZAP_SIMPLE_DEFAULT(1) }, /* Order */ \ - { 0x00000002, ZAP_TYPE(CHAR_STRING), 61, 0, ZAP_LONG_DEFAULTS_INDEX(367) }, /* Description */ \ + { 0x00000002, ZAP_TYPE(CHAR_STRING), 61, 0, ZAP_LONG_DEFAULTS_INDEX(319) }, /* Description */ \ { 0x0000000E, ZAP_TYPE(ENUM8), 1, 0, ZAP_EMPTY_DEFAULT() }, /* BatteryChargeLevel */ \ { 0x0000000F, ZAP_TYPE(BOOLEAN), 1, 0, ZAP_EMPTY_DEFAULT() }, /* BatteryReplacementNeeded */ \ { 0x00000010, ZAP_TYPE(ENUM8), 1, 0, ZAP_EMPTY_DEFAULT() }, /* BatteryReplaceability */ \ { 0x00000013, ZAP_TYPE(CHAR_STRING), 61, 0, ZAP_EMPTY_DEFAULT() }, /* BatteryReplacementDescription */ \ - { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(375) }, /* FeatureMap */ \ + { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(327) }, /* FeatureMap */ \ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ \ /* Endpoint: 1, Cluster: Door Lock (server) */ \ @@ -919,8 +887,8 @@ { 0x00000019, ZAP_TYPE(INT8U), 1, 0, ZAP_SIMPLE_DEFAULT(20) }, /* MaxRFIDCodeLength */ \ { 0x0000001A, ZAP_TYPE(INT8U), 1, 0, ZAP_SIMPLE_DEFAULT(10) }, /* MinRFIDCodeLength */ \ { 0x0000001B, ZAP_TYPE(BITMAP8), 1, 0, ZAP_SIMPLE_DEFAULT(1) }, /* CredentialRulesSupport */ \ - { 0x00000021, ZAP_TYPE(CHAR_STRING), 4, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_LONG_DEFAULTS_INDEX(379) }, /* Language */ \ - { 0x00000023, ZAP_TYPE(INT32U), 4, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_LONG_DEFAULTS_INDEX(382) }, /* AutoRelockTime */ \ + { 0x00000021, ZAP_TYPE(CHAR_STRING), 4, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_LONG_DEFAULTS_INDEX(331) }, /* Language */ \ + { 0x00000023, ZAP_TYPE(INT32U), 4, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_LONG_DEFAULTS_INDEX(334) }, /* AutoRelockTime */ \ { 0x00000024, ZAP_TYPE(INT8U), 1, ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ ZAP_MIN_MAX_DEFAULTS_INDEX(2) }, /* SoundVolume */ \ { 0x00000025, ZAP_TYPE(ENUM8), 1, ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ @@ -936,7 +904,7 @@ ZAP_MIN_MAX_DEFAULTS_INDEX(5) }, /* UserCodeTemporaryDisableTime */ \ { 0x00000033, ZAP_TYPE(BOOLEAN), 1, ZAP_ATTRIBUTE_MASK(WRITABLE), \ ZAP_SIMPLE_DEFAULT(0) }, /* RequirePINforRemoteOperation */ \ - { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(386) }, /* FeatureMap */ \ + { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(338) }, /* FeatureMap */ \ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(6) }, /* ClusterRevision */ \ } @@ -1099,7 +1067,7 @@ .clusterId = 0x00000028, \ .attributes = ZAP_ATTRIBUTE_INDEX(11), \ .attributeCount = 21, \ - .clusterSize = 39, \ + .clusterSize = 37, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ .functions = chipFuncArrayBasicServer, \ .acceptedCommandList = nullptr ,\ @@ -1253,7 +1221,7 @@ .clusterId = 0x00000037, \ .attributes = ZAP_ATTRIBUTE_INDEX(164), \ .attributeCount = 11, \ - .clusterSize = 57, \ + .clusterSize = 6, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ .functions = NULL, \ .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 27 ) ,\ @@ -1358,7 +1326,7 @@ // This is an array of EmberAfEndpointType structures. #define GENERATED_ENDPOINT_TYPES \ { \ - { ZAP_CLUSTER_INDEX(0), 21, 646 }, { ZAP_CLUSTER_INDEX(21), 4, 186 }, \ + { ZAP_CLUSTER_INDEX(0), 21, 593 }, { ZAP_CLUSTER_INDEX(21), 4, 186 }, \ } // Largest attribute size is needed for various buffers @@ -1367,10 +1335,10 @@ static_assert(ATTRIBUTE_LARGEST <= CHIP_CONFIG_MAX_ATTRIBUTE_STORE_ELEMENT_SIZE, "ATTRIBUTE_LARGEST larger than expected"); // Total size of singleton attributes -#define ATTRIBUTE_SINGLETONS_SIZE (39) +#define ATTRIBUTE_SINGLETONS_SIZE (37) // Total size of attribute storage -#define ATTRIBUTE_MAX_SIZE (832) +#define ATTRIBUTE_MAX_SIZE (779) // Number of fixed endpoints #define FIXED_ENDPOINT_COUNT (2) diff --git a/zzz_generated/ota-provider-app/zap-generated/endpoint_config.h b/zzz_generated/ota-provider-app/zap-generated/endpoint_config.h index 8c452a0431ade2..4b4e2589218efa 100644 --- a/zzz_generated/ota-provider-app/zap-generated/endpoint_config.h +++ b/zzz_generated/ota-provider-app/zap-generated/endpoint_config.h @@ -130,7 +130,8 @@ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ \ /* Endpoint: 0, Cluster: Basic (server) */ \ - { 0x00000000, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(SINGLETON), ZAP_SIMPLE_DEFAULT(10) }, /* DataModelRevision */ \ + { 0x00000000, ZAP_TYPE(INT16U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(SINGLETON), \ + ZAP_EMPTY_DEFAULT() }, /* DataModelRevision */ \ { 0x00000001, ZAP_TYPE(CHAR_STRING), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(SINGLETON), \ ZAP_EMPTY_DEFAULT() }, /* VendorName */ \ { 0x00000002, ZAP_TYPE(VENDOR_ID), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(SINGLETON), \ @@ -342,7 +343,7 @@ .clusterId = 0x00000028, \ .attributes = ZAP_ATTRIBUTE_INDEX(6), \ .attributeCount = 21, \ - .clusterSize = 39, \ + .clusterSize = 37, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ .functions = chipFuncArrayBasicServer, \ .acceptedCommandList = nullptr ,\ @@ -447,7 +448,7 @@ // This is an array of EmberAfEndpointType structures. #define GENERATED_ENDPOINT_TYPES \ { \ - { ZAP_CLUSTER_INDEX(0), 11, 157 }, \ + { ZAP_CLUSTER_INDEX(0), 11, 155 }, \ } // Largest attribute size is needed for various buffers @@ -456,10 +457,10 @@ static_assert(ATTRIBUTE_LARGEST <= CHIP_CONFIG_MAX_ATTRIBUTE_STORE_ELEMENT_SIZE, "ATTRIBUTE_LARGEST larger than expected"); // Total size of singleton attributes -#define ATTRIBUTE_SINGLETONS_SIZE (39) +#define ATTRIBUTE_SINGLETONS_SIZE (37) // Total size of attribute storage -#define ATTRIBUTE_MAX_SIZE (157) +#define ATTRIBUTE_MAX_SIZE (155) // Number of fixed endpoints #define FIXED_ENDPOINT_COUNT (1) diff --git a/zzz_generated/ota-requestor-app/zap-generated/endpoint_config.h b/zzz_generated/ota-requestor-app/zap-generated/endpoint_config.h index 035c94d28db686..df49c90b1e3d56 100644 --- a/zzz_generated/ota-requestor-app/zap-generated/endpoint_config.h +++ b/zzz_generated/ota-requestor-app/zap-generated/endpoint_config.h @@ -130,7 +130,8 @@ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ \ /* Endpoint: 0, Cluster: Basic (server) */ \ - { 0x00000000, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(SINGLETON), ZAP_SIMPLE_DEFAULT(10) }, /* DataModelRevision */ \ + { 0x00000000, ZAP_TYPE(INT16U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(SINGLETON), \ + ZAP_EMPTY_DEFAULT() }, /* DataModelRevision */ \ { 0x00000001, ZAP_TYPE(CHAR_STRING), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(SINGLETON), \ ZAP_EMPTY_DEFAULT() }, /* VendorName */ \ { 0x00000002, ZAP_TYPE(VENDOR_ID), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(SINGLETON), \ @@ -221,10 +222,11 @@ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ \ /* Endpoint: 0, Cluster: AdministratorCommissioning (server) */ \ - { 0x00000000, ZAP_TYPE(INT8U), 1, 0, ZAP_EMPTY_DEFAULT() }, /* WindowStatus */ \ - { 0x00000001, ZAP_TYPE(FABRIC_IDX), 1, 0, ZAP_EMPTY_DEFAULT() }, /* AdminFabricIndex */ \ - { 0x00000002, ZAP_TYPE(INT16U), 2, 0, ZAP_EMPTY_DEFAULT() }, /* AdminVendorId */ \ - { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ + { 0x00000000, ZAP_TYPE(INT8U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* WindowStatus */ \ + { 0x00000001, ZAP_TYPE(FABRIC_IDX), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), \ + ZAP_EMPTY_DEFAULT() }, /* AdminFabricIndex */ \ + { 0x00000002, ZAP_TYPE(INT16U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* AdminVendorId */ \ + { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ \ /* Endpoint: 0, Cluster: Operational Credentials (server) */ \ { 0x00000000, ZAP_TYPE(ARRAY), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* NOCs */ \ @@ -344,7 +346,7 @@ .clusterId = 0x00000028, \ .attributes = ZAP_ATTRIBUTE_INDEX(6), \ .attributeCount = 21, \ - .clusterSize = 39, \ + .clusterSize = 37, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ .functions = chipFuncArrayBasicServer, \ .acceptedCommandList = nullptr ,\ @@ -421,7 +423,7 @@ .clusterId = 0x0000003C, \ .attributes = ZAP_ATTRIBUTE_INDEX(56), \ .attributeCount = 4, \ - .clusterSize = 6, \ + .clusterSize = 2, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ .functions = NULL, \ .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 19 ) ,\ @@ -471,7 +473,7 @@ // This is an array of EmberAfEndpointType structures. #define GENERATED_ENDPOINT_TYPES \ { \ - { ZAP_CLUSTER_INDEX(0), 12, 166 }, \ + { ZAP_CLUSTER_INDEX(0), 12, 160 }, \ } // Largest attribute size is needed for various buffers @@ -480,10 +482,10 @@ static_assert(ATTRIBUTE_LARGEST <= CHIP_CONFIG_MAX_ATTRIBUTE_STORE_ELEMENT_SIZE, "ATTRIBUTE_LARGEST larger than expected"); // Total size of singleton attributes -#define ATTRIBUTE_SINGLETONS_SIZE (39) +#define ATTRIBUTE_SINGLETONS_SIZE (37) // Total size of attribute storage -#define ATTRIBUTE_MAX_SIZE (166) +#define ATTRIBUTE_MAX_SIZE (160) // Number of fixed endpoints #define FIXED_ENDPOINT_COUNT (1) diff --git a/zzz_generated/placeholder/app1/zap-generated/endpoint_config.h b/zzz_generated/placeholder/app1/zap-generated/endpoint_config.h index 81bd23ceb3da39..cf1dbcb50d80d5 100644 --- a/zzz_generated/placeholder/app1/zap-generated/endpoint_config.h +++ b/zzz_generated/placeholder/app1/zap-generated/endpoint_config.h @@ -141,74 +141,56 @@ \ /* Endpoint: 0, Cluster: Ethernet Network Diagnostics (server), big-endian */ \ \ - /* 156 - PacketRxCount, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 164 - PacketTxCount, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 172 - TxErrCount, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 180 - CollisionCount, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 188 - OverrunCount, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 196 - TimeSinceReset, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 204 - FeatureMap, */ \ + /* 156 - FeatureMap, */ \ 0x00, 0x00, 0x00, 0x03, \ \ /* Endpoint: 0, Cluster: Switch (server), big-endian */ \ \ - /* 208 - FeatureMap, */ \ + /* 160 - FeatureMap, */ \ 0x00, 0x00, 0x00, 0x00, \ \ /* Endpoint: 0, Cluster: Mode Select (server), big-endian */ \ \ - /* 212 - FeatureMap, */ \ + /* 164 - FeatureMap, */ \ 0x00, 0x00, 0x00, 0x00, \ \ /* Endpoint: 0, Cluster: Window Covering (server), big-endian */ \ \ - /* 216 - FeatureMap, */ \ + /* 168 - FeatureMap, */ \ 0x00, 0x00, 0x00, 0x17, \ \ /* Endpoint: 0, Cluster: Pump Configuration and Control (server), big-endian */ \ \ - /* 220 - LifetimeRunningHours, */ \ + /* 172 - LifetimeRunningHours, */ \ 0x00, 0x00, 0x00, \ \ - /* 223 - Power, */ \ + /* 175 - Power, */ \ 0x00, 0x00, 0x00, \ \ - /* 226 - LifetimeEnergyConsumed, */ \ + /* 178 - LifetimeEnergyConsumed, */ \ 0x00, 0x00, 0x00, 0x00, \ \ - /* 230 - FeatureMap, */ \ + /* 182 - FeatureMap, */ \ 0x00, 0x00, 0x00, 0x00, \ \ /* Endpoint: 0, Cluster: Thermostat (server), big-endian */ \ \ - /* 234 - FeatureMap, */ \ + /* 186 - FeatureMap, */ \ 0x00, 0x00, 0x00, 0x0B, \ \ /* Endpoint: 0, Cluster: Thermostat User Interface Configuration (server), big-endian */ \ \ - /* 238 - FeatureMap, */ \ + /* 190 - FeatureMap, */ \ 0x00, 0x00, 0x00, 0x00, \ \ /* Endpoint: 0, Cluster: Relative Humidity Measurement (server), big-endian */ \ \ - /* 242 - FeatureMap, */ \ + /* 194 - FeatureMap, */ \ 0x00, 0x00, 0x00, 0x00, \ \ /* Endpoint: 0, Cluster: Content Launcher (server), big-endian */ \ \ - /* 246 - SupportedStreamingProtocols, */ \ + /* 198 - SupportedStreamingProtocols, */ \ 0x00, 0x00, 0x00, 0x00, \ } @@ -328,80 +310,62 @@ \ /* Endpoint: 0, Cluster: Ethernet Network Diagnostics (server), little-endian */ \ \ - /* 156 - PacketRxCount, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 164 - PacketTxCount, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 172 - TxErrCount, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 180 - CollisionCount, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 188 - OverrunCount, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 196 - TimeSinceReset, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 204 - FeatureMap, */ \ + /* 156 - FeatureMap, */ \ 0x03, 0x00, 0x00, 0x00, \ \ /* Endpoint: 0, Cluster: Switch (server), little-endian */ \ \ - /* 208 - FeatureMap, */ \ + /* 160 - FeatureMap, */ \ 0x00, 0x00, 0x00, 0x00, \ \ /* Endpoint: 0, Cluster: Mode Select (server), little-endian */ \ \ - /* 212 - FeatureMap, */ \ + /* 164 - FeatureMap, */ \ 0x00, 0x00, 0x00, 0x00, \ \ /* Endpoint: 0, Cluster: Window Covering (server), little-endian */ \ \ - /* 216 - FeatureMap, */ \ + /* 168 - FeatureMap, */ \ 0x17, 0x00, 0x00, 0x00, \ \ /* Endpoint: 0, Cluster: Pump Configuration and Control (server), little-endian */ \ \ - /* 220 - LifetimeRunningHours, */ \ + /* 172 - LifetimeRunningHours, */ \ 0x00, 0x00, 0x00, \ \ - /* 223 - Power, */ \ + /* 175 - Power, */ \ 0x00, 0x00, 0x00, \ \ - /* 226 - LifetimeEnergyConsumed, */ \ + /* 178 - LifetimeEnergyConsumed, */ \ 0x00, 0x00, 0x00, 0x00, \ \ - /* 230 - FeatureMap, */ \ + /* 182 - FeatureMap, */ \ 0x00, 0x00, 0x00, 0x00, \ \ /* Endpoint: 0, Cluster: Thermostat (server), little-endian */ \ \ - /* 234 - FeatureMap, */ \ + /* 186 - FeatureMap, */ \ 0x0B, 0x00, 0x00, 0x00, \ \ /* Endpoint: 0, Cluster: Thermostat User Interface Configuration (server), little-endian */ \ \ - /* 238 - FeatureMap, */ \ + /* 190 - FeatureMap, */ \ 0x00, 0x00, 0x00, 0x00, \ \ /* Endpoint: 0, Cluster: Relative Humidity Measurement (server), little-endian */ \ \ - /* 242 - FeatureMap, */ \ + /* 194 - FeatureMap, */ \ 0x00, 0x00, 0x00, 0x00, \ \ /* Endpoint: 0, Cluster: Content Launcher (server), little-endian */ \ \ - /* 246 - SupportedStreamingProtocols, */ \ + /* 198 - SupportedStreamingProtocols, */ \ 0x00, 0x00, 0x00, 0x00, \ } #endif // BIGENDIAN_CPU -#define GENERATED_DEFAULTS_COUNT (50) +#define GENERATED_DEFAULTS_COUNT (44) #define ZAP_TYPE(type) ZCL_##type##_ATTRIBUTE_TYPE #define ZAP_LONG_DEFAULTS_INDEX(index) \ @@ -488,7 +452,8 @@ { 0x0000FFFD, ZAP_TYPE(INT16U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* ClusterRevision */ \ \ /* Endpoint: 0, Cluster: Basic (server) */ \ - { 0x00000000, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(SINGLETON), ZAP_SIMPLE_DEFAULT(10) }, /* DataModelRevision */ \ + { 0x00000000, ZAP_TYPE(INT16U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(SINGLETON), \ + ZAP_EMPTY_DEFAULT() }, /* DataModelRevision */ \ { 0x00000001, ZAP_TYPE(CHAR_STRING), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(SINGLETON), \ ZAP_EMPTY_DEFAULT() }, /* VendorName */ \ { 0x00000002, ZAP_TYPE(VENDOR_ID), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(SINGLETON), \ @@ -634,23 +599,26 @@ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ \ /* Endpoint: 0, Cluster: Ethernet Network Diagnostics (server) */ \ - { 0x00000000, ZAP_TYPE(ENUM8), 1, ZAP_ATTRIBUTE_MASK(NULLABLE), ZAP_EMPTY_DEFAULT() }, /* PHYRate */ \ - { 0x00000001, ZAP_TYPE(BOOLEAN), 1, ZAP_ATTRIBUTE_MASK(NULLABLE), ZAP_SIMPLE_DEFAULT(0x00) }, /* FullDuplex */ \ - { 0x00000002, ZAP_TYPE(INT64U), 8, 0, ZAP_LONG_DEFAULTS_INDEX(156) }, /* PacketRxCount */ \ - { 0x00000003, ZAP_TYPE(INT64U), 8, 0, ZAP_LONG_DEFAULTS_INDEX(164) }, /* PacketTxCount */ \ - { 0x00000004, ZAP_TYPE(INT64U), 8, 0, ZAP_LONG_DEFAULTS_INDEX(172) }, /* TxErrCount */ \ - { 0x00000005, ZAP_TYPE(INT64U), 8, 0, ZAP_LONG_DEFAULTS_INDEX(180) }, /* CollisionCount */ \ - { 0x00000006, ZAP_TYPE(INT64U), 8, 0, ZAP_LONG_DEFAULTS_INDEX(188) }, /* OverrunCount */ \ - { 0x00000007, ZAP_TYPE(BOOLEAN), 1, ZAP_ATTRIBUTE_MASK(NULLABLE), ZAP_SIMPLE_DEFAULT(0x00) }, /* CarrierDetect */ \ - { 0x00000008, ZAP_TYPE(INT64U), 8, 0, ZAP_LONG_DEFAULTS_INDEX(196) }, /* TimeSinceReset */ \ - { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(204) }, /* FeatureMap */ \ - { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ + { 0x00000000, ZAP_TYPE(ENUM8), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ + ZAP_EMPTY_DEFAULT() }, /* PHYRate */ \ + { 0x00000001, ZAP_TYPE(BOOLEAN), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ + ZAP_EMPTY_DEFAULT() }, /* FullDuplex */ \ + { 0x00000002, ZAP_TYPE(INT64U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* PacketRxCount */ \ + { 0x00000003, ZAP_TYPE(INT64U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* PacketTxCount */ \ + { 0x00000004, ZAP_TYPE(INT64U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* TxErrCount */ \ + { 0x00000005, ZAP_TYPE(INT64U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* CollisionCount */ \ + { 0x00000006, ZAP_TYPE(INT64U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* OverrunCount */ \ + { 0x00000007, ZAP_TYPE(BOOLEAN), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ + ZAP_EMPTY_DEFAULT() }, /* CarrierDetect */ \ + { 0x00000008, ZAP_TYPE(INT64U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* TimeSinceReset */ \ + { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(156) }, /* FeatureMap */ \ + { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ \ /* Endpoint: 0, Cluster: Switch (server) */ \ { 0x00000000, ZAP_TYPE(INT8U), 1, 0, ZAP_SIMPLE_DEFAULT(2) }, /* number of positions */ \ { 0x00000001, ZAP_TYPE(INT8U), 1, 0, ZAP_EMPTY_DEFAULT() }, /* current position */ \ { 0x00000002, ZAP_TYPE(INT8U), 1, 0, ZAP_SIMPLE_DEFAULT(2) }, /* multi press max */ \ - { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(208) }, /* FeatureMap */ \ + { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(160) }, /* FeatureMap */ \ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ \ /* Endpoint: 0, Cluster: AdministratorCommissioning (server) */ \ @@ -682,7 +650,7 @@ { 0x00000003, ZAP_TYPE(INT8U), 1, 0, ZAP_EMPTY_DEFAULT() }, /* CurrentMode */ \ { 0x00000004, ZAP_TYPE(INT8U), 1, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ ZAP_EMPTY_DEFAULT() }, /* StartUpMode */ \ - { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(212) }, /* FeatureMap */ \ + { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(164) }, /* FeatureMap */ \ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ \ /* Endpoint: 0, Cluster: Window Covering (server) */ \ @@ -718,7 +686,7 @@ ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(TOKENIZE) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ ZAP_MIN_MAX_DEFAULTS_INDEX(1) }, /* Mode */ \ { 0x0000001A, ZAP_TYPE(BITMAP16), 2, 0, ZAP_SIMPLE_DEFAULT(0x00) }, /* SafetyStatus */ \ - { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(216) }, /* FeatureMap */ \ + { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(168) }, /* FeatureMap */ \ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(5) }, /* ClusterRevision */ \ \ /* Endpoint: 0, Cluster: Pump Configuration and Control (server) */ \ @@ -741,16 +709,16 @@ { 0x00000013, ZAP_TYPE(INT16S), 2, ZAP_ATTRIBUTE_MASK(NULLABLE), ZAP_EMPTY_DEFAULT() }, /* Capacity */ \ { 0x00000014, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(NULLABLE), ZAP_EMPTY_DEFAULT() }, /* Speed */ \ { 0x00000015, ZAP_TYPE(INT24U), 3, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ - ZAP_LONG_DEFAULTS_INDEX(220) }, /* LifetimeRunningHours */ \ - { 0x00000016, ZAP_TYPE(INT24U), 3, ZAP_ATTRIBUTE_MASK(NULLABLE), ZAP_LONG_DEFAULTS_INDEX(223) }, /* Power */ \ + ZAP_LONG_DEFAULTS_INDEX(172) }, /* LifetimeRunningHours */ \ + { 0x00000016, ZAP_TYPE(INT24U), 3, ZAP_ATTRIBUTE_MASK(NULLABLE), ZAP_LONG_DEFAULTS_INDEX(175) }, /* Power */ \ { 0x00000017, ZAP_TYPE(INT32U), 4, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ - ZAP_LONG_DEFAULTS_INDEX(226) }, /* LifetimeEnergyConsumed */ \ + ZAP_LONG_DEFAULTS_INDEX(178) }, /* LifetimeEnergyConsumed */ \ { 0x00000020, ZAP_TYPE(ENUM8), 1, ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ ZAP_MIN_MAX_DEFAULTS_INDEX(2) }, /* OperationMode */ \ { 0x00000021, ZAP_TYPE(ENUM8), 1, ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ ZAP_MIN_MAX_DEFAULTS_INDEX(3) }, /* ControlMode */ \ { 0x00000022, ZAP_TYPE(BITMAP16), 2, 0, ZAP_EMPTY_DEFAULT() }, /* AlarmMask */ \ - { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(230) }, /* FeatureMap */ \ + { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(182) }, /* FeatureMap */ \ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(3) }, /* ClusterRevision */ \ \ /* Endpoint: 0, Cluster: Thermostat (server) */ \ @@ -779,7 +747,7 @@ { 0x00000020, ZAP_TYPE(ENUM8), 1, 0, ZAP_SIMPLE_DEFAULT(0) }, /* start of week */ \ { 0x00000021, ZAP_TYPE(INT8U), 1, 0, ZAP_SIMPLE_DEFAULT(7) }, /* number of weekly transitions */ \ { 0x00000022, ZAP_TYPE(INT8U), 1, 0, ZAP_SIMPLE_DEFAULT(4) }, /* number of daily transitions */ \ - { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(234) }, /* FeatureMap */ \ + { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(186) }, /* FeatureMap */ \ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(5) }, /* ClusterRevision */ \ \ /* Endpoint: 0, Cluster: Thermostat User Interface Configuration (server) */ \ @@ -789,7 +757,7 @@ ZAP_MIN_MAX_DEFAULTS_INDEX(12) }, /* keypad lockout */ \ { 0x00000002, ZAP_TYPE(ENUM8), 1, ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ ZAP_MIN_MAX_DEFAULTS_INDEX(13) }, /* schedule programming visibility */ \ - { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(238) }, /* FeatureMap */ \ + { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(190) }, /* FeatureMap */ \ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(2) }, /* ClusterRevision */ \ \ /* Endpoint: 0, Cluster: Illuminance Measurement (server) */ \ @@ -830,7 +798,7 @@ { 0x00000001, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0xFFFF) }, /* min measured value */ \ { 0x00000002, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0xFFFF) }, /* max measured value */ \ { 0x00000003, ZAP_TYPE(INT16U), 2, 0, ZAP_EMPTY_DEFAULT() }, /* tolerance */ \ - { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(242) }, /* FeatureMap */ \ + { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(194) }, /* FeatureMap */ \ \ /* Endpoint: 0, Cluster: Target Navigator (server) */ \ { 0x00000000, ZAP_TYPE(ARRAY), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* TargetList */ \ @@ -843,7 +811,7 @@ /* Endpoint: 0, Cluster: Content Launcher (server) */ \ { 0x00000000, ZAP_TYPE(ARRAY), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* AcceptHeader */ \ { 0x00000001, ZAP_TYPE(BITMAP32), 4, ZAP_ATTRIBUTE_MASK(WRITABLE), \ - ZAP_LONG_DEFAULTS_INDEX(246) }, /* SupportedStreamingProtocols */ \ + ZAP_LONG_DEFAULTS_INDEX(198) }, /* SupportedStreamingProtocols */ \ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ \ /* Endpoint: 0, Cluster: Application Basic (server) */ \ @@ -883,7 +851,8 @@ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(5) }, /* ClusterRevision */ \ \ /* Endpoint: 1, Cluster: Basic (server) */ \ - { 0x00000000, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(SINGLETON), ZAP_SIMPLE_DEFAULT(10) }, /* DataModelRevision */ \ + { 0x00000000, ZAP_TYPE(INT16U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(SINGLETON), \ + ZAP_EMPTY_DEFAULT() }, /* DataModelRevision */ \ { 0x00000001, ZAP_TYPE(CHAR_STRING), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(SINGLETON), \ ZAP_EMPTY_DEFAULT() }, /* VendorName */ \ { 0x00000002, ZAP_TYPE(VENDOR_ID), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(SINGLETON), \ @@ -1218,7 +1187,7 @@ .clusterId = 0x00000028, \ .attributes = ZAP_ATTRIBUTE_INDEX(16), \ .attributeCount = 21, \ - .clusterSize = 39, \ + .clusterSize = 37, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ .functions = chipFuncArrayBasicServer, \ .acceptedCommandList = nullptr ,\ @@ -1317,7 +1286,7 @@ .clusterId = 0x00000037, \ .attributes = ZAP_ATTRIBUTE_INDEX(119), \ .attributeCount = 11, \ - .clusterSize = 57, \ + .clusterSize = 6, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ .functions = NULL, \ .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 29 ) ,\ @@ -1702,7 +1671,7 @@ .clusterId = 0x00000028, \ .attributes = ZAP_ATTRIBUTE_INDEX(284), \ .attributeCount = 21, \ - .clusterSize = 39, \ + .clusterSize = 37, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ .functions = chipFuncArrayBasicServer, \ .acceptedCommandList = nullptr ,\ @@ -1730,7 +1699,7 @@ // This is an array of EmberAfEndpointType structures. #define GENERATED_ENDPOINT_TYPES \ { \ - { ZAP_CLUSTER_INDEX(0), 42, 874 }, { ZAP_CLUSTER_INDEX(42), 8, 72 }, \ + { ZAP_CLUSTER_INDEX(0), 42, 821 }, { ZAP_CLUSTER_INDEX(42), 8, 70 }, \ } // Largest attribute size is needed for various buffers @@ -1739,10 +1708,10 @@ static_assert(ATTRIBUTE_LARGEST <= CHIP_CONFIG_MAX_ATTRIBUTE_STORE_ELEMENT_SIZE, "ATTRIBUTE_LARGEST larger than expected"); // Total size of singleton attributes -#define ATTRIBUTE_SINGLETONS_SIZE (78) +#define ATTRIBUTE_SINGLETONS_SIZE (74) // Total size of attribute storage -#define ATTRIBUTE_MAX_SIZE (946) +#define ATTRIBUTE_MAX_SIZE (891) // Number of fixed endpoints #define FIXED_ENDPOINT_COUNT (2) diff --git a/zzz_generated/placeholder/app2/zap-generated/endpoint_config.h b/zzz_generated/placeholder/app2/zap-generated/endpoint_config.h index 81bd23ceb3da39..cf1dbcb50d80d5 100644 --- a/zzz_generated/placeholder/app2/zap-generated/endpoint_config.h +++ b/zzz_generated/placeholder/app2/zap-generated/endpoint_config.h @@ -141,74 +141,56 @@ \ /* Endpoint: 0, Cluster: Ethernet Network Diagnostics (server), big-endian */ \ \ - /* 156 - PacketRxCount, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 164 - PacketTxCount, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 172 - TxErrCount, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 180 - CollisionCount, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 188 - OverrunCount, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 196 - TimeSinceReset, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 204 - FeatureMap, */ \ + /* 156 - FeatureMap, */ \ 0x00, 0x00, 0x00, 0x03, \ \ /* Endpoint: 0, Cluster: Switch (server), big-endian */ \ \ - /* 208 - FeatureMap, */ \ + /* 160 - FeatureMap, */ \ 0x00, 0x00, 0x00, 0x00, \ \ /* Endpoint: 0, Cluster: Mode Select (server), big-endian */ \ \ - /* 212 - FeatureMap, */ \ + /* 164 - FeatureMap, */ \ 0x00, 0x00, 0x00, 0x00, \ \ /* Endpoint: 0, Cluster: Window Covering (server), big-endian */ \ \ - /* 216 - FeatureMap, */ \ + /* 168 - FeatureMap, */ \ 0x00, 0x00, 0x00, 0x17, \ \ /* Endpoint: 0, Cluster: Pump Configuration and Control (server), big-endian */ \ \ - /* 220 - LifetimeRunningHours, */ \ + /* 172 - LifetimeRunningHours, */ \ 0x00, 0x00, 0x00, \ \ - /* 223 - Power, */ \ + /* 175 - Power, */ \ 0x00, 0x00, 0x00, \ \ - /* 226 - LifetimeEnergyConsumed, */ \ + /* 178 - LifetimeEnergyConsumed, */ \ 0x00, 0x00, 0x00, 0x00, \ \ - /* 230 - FeatureMap, */ \ + /* 182 - FeatureMap, */ \ 0x00, 0x00, 0x00, 0x00, \ \ /* Endpoint: 0, Cluster: Thermostat (server), big-endian */ \ \ - /* 234 - FeatureMap, */ \ + /* 186 - FeatureMap, */ \ 0x00, 0x00, 0x00, 0x0B, \ \ /* Endpoint: 0, Cluster: Thermostat User Interface Configuration (server), big-endian */ \ \ - /* 238 - FeatureMap, */ \ + /* 190 - FeatureMap, */ \ 0x00, 0x00, 0x00, 0x00, \ \ /* Endpoint: 0, Cluster: Relative Humidity Measurement (server), big-endian */ \ \ - /* 242 - FeatureMap, */ \ + /* 194 - FeatureMap, */ \ 0x00, 0x00, 0x00, 0x00, \ \ /* Endpoint: 0, Cluster: Content Launcher (server), big-endian */ \ \ - /* 246 - SupportedStreamingProtocols, */ \ + /* 198 - SupportedStreamingProtocols, */ \ 0x00, 0x00, 0x00, 0x00, \ } @@ -328,80 +310,62 @@ \ /* Endpoint: 0, Cluster: Ethernet Network Diagnostics (server), little-endian */ \ \ - /* 156 - PacketRxCount, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 164 - PacketTxCount, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 172 - TxErrCount, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 180 - CollisionCount, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 188 - OverrunCount, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 196 - TimeSinceReset, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 204 - FeatureMap, */ \ + /* 156 - FeatureMap, */ \ 0x03, 0x00, 0x00, 0x00, \ \ /* Endpoint: 0, Cluster: Switch (server), little-endian */ \ \ - /* 208 - FeatureMap, */ \ + /* 160 - FeatureMap, */ \ 0x00, 0x00, 0x00, 0x00, \ \ /* Endpoint: 0, Cluster: Mode Select (server), little-endian */ \ \ - /* 212 - FeatureMap, */ \ + /* 164 - FeatureMap, */ \ 0x00, 0x00, 0x00, 0x00, \ \ /* Endpoint: 0, Cluster: Window Covering (server), little-endian */ \ \ - /* 216 - FeatureMap, */ \ + /* 168 - FeatureMap, */ \ 0x17, 0x00, 0x00, 0x00, \ \ /* Endpoint: 0, Cluster: Pump Configuration and Control (server), little-endian */ \ \ - /* 220 - LifetimeRunningHours, */ \ + /* 172 - LifetimeRunningHours, */ \ 0x00, 0x00, 0x00, \ \ - /* 223 - Power, */ \ + /* 175 - Power, */ \ 0x00, 0x00, 0x00, \ \ - /* 226 - LifetimeEnergyConsumed, */ \ + /* 178 - LifetimeEnergyConsumed, */ \ 0x00, 0x00, 0x00, 0x00, \ \ - /* 230 - FeatureMap, */ \ + /* 182 - FeatureMap, */ \ 0x00, 0x00, 0x00, 0x00, \ \ /* Endpoint: 0, Cluster: Thermostat (server), little-endian */ \ \ - /* 234 - FeatureMap, */ \ + /* 186 - FeatureMap, */ \ 0x0B, 0x00, 0x00, 0x00, \ \ /* Endpoint: 0, Cluster: Thermostat User Interface Configuration (server), little-endian */ \ \ - /* 238 - FeatureMap, */ \ + /* 190 - FeatureMap, */ \ 0x00, 0x00, 0x00, 0x00, \ \ /* Endpoint: 0, Cluster: Relative Humidity Measurement (server), little-endian */ \ \ - /* 242 - FeatureMap, */ \ + /* 194 - FeatureMap, */ \ 0x00, 0x00, 0x00, 0x00, \ \ /* Endpoint: 0, Cluster: Content Launcher (server), little-endian */ \ \ - /* 246 - SupportedStreamingProtocols, */ \ + /* 198 - SupportedStreamingProtocols, */ \ 0x00, 0x00, 0x00, 0x00, \ } #endif // BIGENDIAN_CPU -#define GENERATED_DEFAULTS_COUNT (50) +#define GENERATED_DEFAULTS_COUNT (44) #define ZAP_TYPE(type) ZCL_##type##_ATTRIBUTE_TYPE #define ZAP_LONG_DEFAULTS_INDEX(index) \ @@ -488,7 +452,8 @@ { 0x0000FFFD, ZAP_TYPE(INT16U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* ClusterRevision */ \ \ /* Endpoint: 0, Cluster: Basic (server) */ \ - { 0x00000000, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(SINGLETON), ZAP_SIMPLE_DEFAULT(10) }, /* DataModelRevision */ \ + { 0x00000000, ZAP_TYPE(INT16U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(SINGLETON), \ + ZAP_EMPTY_DEFAULT() }, /* DataModelRevision */ \ { 0x00000001, ZAP_TYPE(CHAR_STRING), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(SINGLETON), \ ZAP_EMPTY_DEFAULT() }, /* VendorName */ \ { 0x00000002, ZAP_TYPE(VENDOR_ID), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(SINGLETON), \ @@ -634,23 +599,26 @@ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ \ /* Endpoint: 0, Cluster: Ethernet Network Diagnostics (server) */ \ - { 0x00000000, ZAP_TYPE(ENUM8), 1, ZAP_ATTRIBUTE_MASK(NULLABLE), ZAP_EMPTY_DEFAULT() }, /* PHYRate */ \ - { 0x00000001, ZAP_TYPE(BOOLEAN), 1, ZAP_ATTRIBUTE_MASK(NULLABLE), ZAP_SIMPLE_DEFAULT(0x00) }, /* FullDuplex */ \ - { 0x00000002, ZAP_TYPE(INT64U), 8, 0, ZAP_LONG_DEFAULTS_INDEX(156) }, /* PacketRxCount */ \ - { 0x00000003, ZAP_TYPE(INT64U), 8, 0, ZAP_LONG_DEFAULTS_INDEX(164) }, /* PacketTxCount */ \ - { 0x00000004, ZAP_TYPE(INT64U), 8, 0, ZAP_LONG_DEFAULTS_INDEX(172) }, /* TxErrCount */ \ - { 0x00000005, ZAP_TYPE(INT64U), 8, 0, ZAP_LONG_DEFAULTS_INDEX(180) }, /* CollisionCount */ \ - { 0x00000006, ZAP_TYPE(INT64U), 8, 0, ZAP_LONG_DEFAULTS_INDEX(188) }, /* OverrunCount */ \ - { 0x00000007, ZAP_TYPE(BOOLEAN), 1, ZAP_ATTRIBUTE_MASK(NULLABLE), ZAP_SIMPLE_DEFAULT(0x00) }, /* CarrierDetect */ \ - { 0x00000008, ZAP_TYPE(INT64U), 8, 0, ZAP_LONG_DEFAULTS_INDEX(196) }, /* TimeSinceReset */ \ - { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(204) }, /* FeatureMap */ \ - { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ + { 0x00000000, ZAP_TYPE(ENUM8), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ + ZAP_EMPTY_DEFAULT() }, /* PHYRate */ \ + { 0x00000001, ZAP_TYPE(BOOLEAN), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ + ZAP_EMPTY_DEFAULT() }, /* FullDuplex */ \ + { 0x00000002, ZAP_TYPE(INT64U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* PacketRxCount */ \ + { 0x00000003, ZAP_TYPE(INT64U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* PacketTxCount */ \ + { 0x00000004, ZAP_TYPE(INT64U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* TxErrCount */ \ + { 0x00000005, ZAP_TYPE(INT64U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* CollisionCount */ \ + { 0x00000006, ZAP_TYPE(INT64U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* OverrunCount */ \ + { 0x00000007, ZAP_TYPE(BOOLEAN), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ + ZAP_EMPTY_DEFAULT() }, /* CarrierDetect */ \ + { 0x00000008, ZAP_TYPE(INT64U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* TimeSinceReset */ \ + { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(156) }, /* FeatureMap */ \ + { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ \ /* Endpoint: 0, Cluster: Switch (server) */ \ { 0x00000000, ZAP_TYPE(INT8U), 1, 0, ZAP_SIMPLE_DEFAULT(2) }, /* number of positions */ \ { 0x00000001, ZAP_TYPE(INT8U), 1, 0, ZAP_EMPTY_DEFAULT() }, /* current position */ \ { 0x00000002, ZAP_TYPE(INT8U), 1, 0, ZAP_SIMPLE_DEFAULT(2) }, /* multi press max */ \ - { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(208) }, /* FeatureMap */ \ + { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(160) }, /* FeatureMap */ \ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ \ /* Endpoint: 0, Cluster: AdministratorCommissioning (server) */ \ @@ -682,7 +650,7 @@ { 0x00000003, ZAP_TYPE(INT8U), 1, 0, ZAP_EMPTY_DEFAULT() }, /* CurrentMode */ \ { 0x00000004, ZAP_TYPE(INT8U), 1, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ ZAP_EMPTY_DEFAULT() }, /* StartUpMode */ \ - { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(212) }, /* FeatureMap */ \ + { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(164) }, /* FeatureMap */ \ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ \ /* Endpoint: 0, Cluster: Window Covering (server) */ \ @@ -718,7 +686,7 @@ ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(TOKENIZE) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ ZAP_MIN_MAX_DEFAULTS_INDEX(1) }, /* Mode */ \ { 0x0000001A, ZAP_TYPE(BITMAP16), 2, 0, ZAP_SIMPLE_DEFAULT(0x00) }, /* SafetyStatus */ \ - { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(216) }, /* FeatureMap */ \ + { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(168) }, /* FeatureMap */ \ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(5) }, /* ClusterRevision */ \ \ /* Endpoint: 0, Cluster: Pump Configuration and Control (server) */ \ @@ -741,16 +709,16 @@ { 0x00000013, ZAP_TYPE(INT16S), 2, ZAP_ATTRIBUTE_MASK(NULLABLE), ZAP_EMPTY_DEFAULT() }, /* Capacity */ \ { 0x00000014, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(NULLABLE), ZAP_EMPTY_DEFAULT() }, /* Speed */ \ { 0x00000015, ZAP_TYPE(INT24U), 3, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ - ZAP_LONG_DEFAULTS_INDEX(220) }, /* LifetimeRunningHours */ \ - { 0x00000016, ZAP_TYPE(INT24U), 3, ZAP_ATTRIBUTE_MASK(NULLABLE), ZAP_LONG_DEFAULTS_INDEX(223) }, /* Power */ \ + ZAP_LONG_DEFAULTS_INDEX(172) }, /* LifetimeRunningHours */ \ + { 0x00000016, ZAP_TYPE(INT24U), 3, ZAP_ATTRIBUTE_MASK(NULLABLE), ZAP_LONG_DEFAULTS_INDEX(175) }, /* Power */ \ { 0x00000017, ZAP_TYPE(INT32U), 4, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ - ZAP_LONG_DEFAULTS_INDEX(226) }, /* LifetimeEnergyConsumed */ \ + ZAP_LONG_DEFAULTS_INDEX(178) }, /* LifetimeEnergyConsumed */ \ { 0x00000020, ZAP_TYPE(ENUM8), 1, ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ ZAP_MIN_MAX_DEFAULTS_INDEX(2) }, /* OperationMode */ \ { 0x00000021, ZAP_TYPE(ENUM8), 1, ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ ZAP_MIN_MAX_DEFAULTS_INDEX(3) }, /* ControlMode */ \ { 0x00000022, ZAP_TYPE(BITMAP16), 2, 0, ZAP_EMPTY_DEFAULT() }, /* AlarmMask */ \ - { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(230) }, /* FeatureMap */ \ + { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(182) }, /* FeatureMap */ \ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(3) }, /* ClusterRevision */ \ \ /* Endpoint: 0, Cluster: Thermostat (server) */ \ @@ -779,7 +747,7 @@ { 0x00000020, ZAP_TYPE(ENUM8), 1, 0, ZAP_SIMPLE_DEFAULT(0) }, /* start of week */ \ { 0x00000021, ZAP_TYPE(INT8U), 1, 0, ZAP_SIMPLE_DEFAULT(7) }, /* number of weekly transitions */ \ { 0x00000022, ZAP_TYPE(INT8U), 1, 0, ZAP_SIMPLE_DEFAULT(4) }, /* number of daily transitions */ \ - { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(234) }, /* FeatureMap */ \ + { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(186) }, /* FeatureMap */ \ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(5) }, /* ClusterRevision */ \ \ /* Endpoint: 0, Cluster: Thermostat User Interface Configuration (server) */ \ @@ -789,7 +757,7 @@ ZAP_MIN_MAX_DEFAULTS_INDEX(12) }, /* keypad lockout */ \ { 0x00000002, ZAP_TYPE(ENUM8), 1, ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ ZAP_MIN_MAX_DEFAULTS_INDEX(13) }, /* schedule programming visibility */ \ - { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(238) }, /* FeatureMap */ \ + { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(190) }, /* FeatureMap */ \ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(2) }, /* ClusterRevision */ \ \ /* Endpoint: 0, Cluster: Illuminance Measurement (server) */ \ @@ -830,7 +798,7 @@ { 0x00000001, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0xFFFF) }, /* min measured value */ \ { 0x00000002, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0xFFFF) }, /* max measured value */ \ { 0x00000003, ZAP_TYPE(INT16U), 2, 0, ZAP_EMPTY_DEFAULT() }, /* tolerance */ \ - { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(242) }, /* FeatureMap */ \ + { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(194) }, /* FeatureMap */ \ \ /* Endpoint: 0, Cluster: Target Navigator (server) */ \ { 0x00000000, ZAP_TYPE(ARRAY), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* TargetList */ \ @@ -843,7 +811,7 @@ /* Endpoint: 0, Cluster: Content Launcher (server) */ \ { 0x00000000, ZAP_TYPE(ARRAY), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* AcceptHeader */ \ { 0x00000001, ZAP_TYPE(BITMAP32), 4, ZAP_ATTRIBUTE_MASK(WRITABLE), \ - ZAP_LONG_DEFAULTS_INDEX(246) }, /* SupportedStreamingProtocols */ \ + ZAP_LONG_DEFAULTS_INDEX(198) }, /* SupportedStreamingProtocols */ \ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ \ /* Endpoint: 0, Cluster: Application Basic (server) */ \ @@ -883,7 +851,8 @@ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(5) }, /* ClusterRevision */ \ \ /* Endpoint: 1, Cluster: Basic (server) */ \ - { 0x00000000, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(SINGLETON), ZAP_SIMPLE_DEFAULT(10) }, /* DataModelRevision */ \ + { 0x00000000, ZAP_TYPE(INT16U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(SINGLETON), \ + ZAP_EMPTY_DEFAULT() }, /* DataModelRevision */ \ { 0x00000001, ZAP_TYPE(CHAR_STRING), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(SINGLETON), \ ZAP_EMPTY_DEFAULT() }, /* VendorName */ \ { 0x00000002, ZAP_TYPE(VENDOR_ID), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(SINGLETON), \ @@ -1218,7 +1187,7 @@ .clusterId = 0x00000028, \ .attributes = ZAP_ATTRIBUTE_INDEX(16), \ .attributeCount = 21, \ - .clusterSize = 39, \ + .clusterSize = 37, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ .functions = chipFuncArrayBasicServer, \ .acceptedCommandList = nullptr ,\ @@ -1317,7 +1286,7 @@ .clusterId = 0x00000037, \ .attributes = ZAP_ATTRIBUTE_INDEX(119), \ .attributeCount = 11, \ - .clusterSize = 57, \ + .clusterSize = 6, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ .functions = NULL, \ .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 29 ) ,\ @@ -1702,7 +1671,7 @@ .clusterId = 0x00000028, \ .attributes = ZAP_ATTRIBUTE_INDEX(284), \ .attributeCount = 21, \ - .clusterSize = 39, \ + .clusterSize = 37, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ .functions = chipFuncArrayBasicServer, \ .acceptedCommandList = nullptr ,\ @@ -1730,7 +1699,7 @@ // This is an array of EmberAfEndpointType structures. #define GENERATED_ENDPOINT_TYPES \ { \ - { ZAP_CLUSTER_INDEX(0), 42, 874 }, { ZAP_CLUSTER_INDEX(42), 8, 72 }, \ + { ZAP_CLUSTER_INDEX(0), 42, 821 }, { ZAP_CLUSTER_INDEX(42), 8, 70 }, \ } // Largest attribute size is needed for various buffers @@ -1739,10 +1708,10 @@ static_assert(ATTRIBUTE_LARGEST <= CHIP_CONFIG_MAX_ATTRIBUTE_STORE_ELEMENT_SIZE, "ATTRIBUTE_LARGEST larger than expected"); // Total size of singleton attributes -#define ATTRIBUTE_SINGLETONS_SIZE (78) +#define ATTRIBUTE_SINGLETONS_SIZE (74) // Total size of attribute storage -#define ATTRIBUTE_MAX_SIZE (946) +#define ATTRIBUTE_MAX_SIZE (891) // Number of fixed endpoints #define FIXED_ENDPOINT_COUNT (2) diff --git a/zzz_generated/pump-app/zap-generated/endpoint_config.h b/zzz_generated/pump-app/zap-generated/endpoint_config.h index d6b26a322f4985..e245d4310cede1 100644 --- a/zzz_generated/pump-app/zap-generated/endpoint_config.h +++ b/zzz_generated/pump-app/zap-generated/endpoint_config.h @@ -725,7 +725,8 @@ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ \ /* Endpoint: 0, Cluster: Basic (server) */ \ - { 0x00000000, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(SINGLETON), ZAP_SIMPLE_DEFAULT(10) }, /* DataModelRevision */ \ + { 0x00000000, ZAP_TYPE(INT16U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(SINGLETON), \ + ZAP_EMPTY_DEFAULT() }, /* DataModelRevision */ \ { 0x00000001, ZAP_TYPE(CHAR_STRING), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(SINGLETON), \ ZAP_EMPTY_DEFAULT() }, /* VendorName */ \ { 0x00000002, ZAP_TYPE(VENDOR_ID), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(SINGLETON), \ @@ -1313,7 +1314,7 @@ .clusterId = 0x00000028, \ .attributes = ZAP_ATTRIBUTE_INDEX(27), \ .attributeCount = 22, \ - .clusterSize = 43, \ + .clusterSize = 41, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ .functions = chipFuncArrayBasicServer, \ .acceptedCommandList = nullptr ,\ @@ -1627,7 +1628,7 @@ // This is an array of EmberAfEndpointType structures. #define GENERATED_ENDPOINT_TYPES \ { \ - { ZAP_CLUSTER_INDEX(0), 22, 551 }, { ZAP_CLUSTER_INDEX(22), 11, 149 }, \ + { ZAP_CLUSTER_INDEX(0), 22, 549 }, { ZAP_CLUSTER_INDEX(22), 11, 149 }, \ } // Largest attribute size is needed for various buffers @@ -1636,10 +1637,10 @@ static_assert(ATTRIBUTE_LARGEST <= CHIP_CONFIG_MAX_ATTRIBUTE_STORE_ELEMENT_SIZE, "ATTRIBUTE_LARGEST larger than expected"); // Total size of singleton attributes -#define ATTRIBUTE_SINGLETONS_SIZE (43) +#define ATTRIBUTE_SINGLETONS_SIZE (41) // Total size of attribute storage -#define ATTRIBUTE_MAX_SIZE (700) +#define ATTRIBUTE_MAX_SIZE (698) // Number of fixed endpoints #define FIXED_ENDPOINT_COUNT (2) diff --git a/zzz_generated/pump-controller-app/zap-generated/endpoint_config.h b/zzz_generated/pump-controller-app/zap-generated/endpoint_config.h index 163467fed6b615..606e1a055dbfc6 100644 --- a/zzz_generated/pump-controller-app/zap-generated/endpoint_config.h +++ b/zzz_generated/pump-controller-app/zap-generated/endpoint_config.h @@ -618,7 +618,8 @@ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ \ /* Endpoint: 0, Cluster: Basic (server) */ \ - { 0x00000000, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(SINGLETON), ZAP_SIMPLE_DEFAULT(10) }, /* DataModelRevision */ \ + { 0x00000000, ZAP_TYPE(INT16U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(SINGLETON), \ + ZAP_EMPTY_DEFAULT() }, /* DataModelRevision */ \ { 0x00000001, ZAP_TYPE(CHAR_STRING), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(SINGLETON), \ ZAP_EMPTY_DEFAULT() }, /* VendorName */ \ { 0x00000002, ZAP_TYPE(VENDOR_ID), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(SINGLETON), \ @@ -1047,7 +1048,7 @@ .clusterId = 0x00000028, \ .attributes = ZAP_ATTRIBUTE_INDEX(20), \ .attributeCount = 22, \ - .clusterSize = 43, \ + .clusterSize = 41, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ .functions = chipFuncArrayBasicServer, \ .acceptedCommandList = nullptr ,\ @@ -1306,7 +1307,7 @@ // This is an array of EmberAfEndpointType structures. #define GENERATED_ENDPOINT_TYPES \ { \ - { ZAP_CLUSTER_INDEX(0), 21, 539 }, { ZAP_CLUSTER_INDEX(21), 6, 4 }, \ + { ZAP_CLUSTER_INDEX(0), 21, 537 }, { ZAP_CLUSTER_INDEX(21), 6, 4 }, \ } // Largest attribute size is needed for various buffers @@ -1315,10 +1316,10 @@ static_assert(ATTRIBUTE_LARGEST <= CHIP_CONFIG_MAX_ATTRIBUTE_STORE_ELEMENT_SIZE, "ATTRIBUTE_LARGEST larger than expected"); // Total size of singleton attributes -#define ATTRIBUTE_SINGLETONS_SIZE (43) +#define ATTRIBUTE_SINGLETONS_SIZE (41) // Total size of attribute storage -#define ATTRIBUTE_MAX_SIZE (543) +#define ATTRIBUTE_MAX_SIZE (541) // Number of fixed endpoints #define FIXED_ENDPOINT_COUNT (2) diff --git a/zzz_generated/temperature-measurement-app/zap-generated/endpoint_config.h b/zzz_generated/temperature-measurement-app/zap-generated/endpoint_config.h index 2a28234d1b8331..c9b103ae061ad0 100644 --- a/zzz_generated/temperature-measurement-app/zap-generated/endpoint_config.h +++ b/zzz_generated/temperature-measurement-app/zap-generated/endpoint_config.h @@ -102,25 +102,7 @@ \ /* Endpoint: 0, Cluster: Ethernet Network Diagnostics (server), big-endian */ \ \ - /* 98 - PacketRxCount, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 106 - PacketTxCount, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 114 - TxErrCount, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 122 - CollisionCount, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 130 - OverrunCount, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 138 - TimeSinceReset, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 146 - FeatureMap, */ \ + /* 98 - FeatureMap, */ \ 0x00, 0x00, 0x00, 0x03, \ } @@ -201,31 +183,13 @@ \ /* Endpoint: 0, Cluster: Ethernet Network Diagnostics (server), little-endian */ \ \ - /* 98 - PacketRxCount, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 106 - PacketTxCount, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 114 - TxErrCount, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 122 - CollisionCount, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 130 - OverrunCount, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 138 - TimeSinceReset, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 146 - FeatureMap, */ \ + /* 98 - FeatureMap, */ \ 0x03, 0x00, 0x00, 0x00, \ } #endif // BIGENDIAN_CPU -#define GENERATED_DEFAULTS_COUNT (26) +#define GENERATED_DEFAULTS_COUNT (20) #define ZAP_TYPE(type) ZCL_##type##_ATTRIBUTE_TYPE #define ZAP_LONG_DEFAULTS_INDEX(index) \ @@ -283,7 +247,8 @@ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ \ /* Endpoint: 0, Cluster: Basic (server) */ \ - { 0x00000000, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(SINGLETON), ZAP_SIMPLE_DEFAULT(10) }, /* DataModelRevision */ \ + { 0x00000000, ZAP_TYPE(INT16U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(SINGLETON), \ + ZAP_EMPTY_DEFAULT() }, /* DataModelRevision */ \ { 0x00000001, ZAP_TYPE(CHAR_STRING), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(SINGLETON), \ ZAP_EMPTY_DEFAULT() }, /* VendorName */ \ { 0x00000002, ZAP_TYPE(VENDOR_ID), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(SINGLETON), \ @@ -407,17 +372,20 @@ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ \ /* Endpoint: 0, Cluster: Ethernet Network Diagnostics (server) */ \ - { 0x00000000, ZAP_TYPE(ENUM8), 1, ZAP_ATTRIBUTE_MASK(NULLABLE), ZAP_EMPTY_DEFAULT() }, /* PHYRate */ \ - { 0x00000001, ZAP_TYPE(BOOLEAN), 1, ZAP_ATTRIBUTE_MASK(NULLABLE), ZAP_SIMPLE_DEFAULT(0x00) }, /* FullDuplex */ \ - { 0x00000002, ZAP_TYPE(INT64U), 8, 0, ZAP_LONG_DEFAULTS_INDEX(98) }, /* PacketRxCount */ \ - { 0x00000003, ZAP_TYPE(INT64U), 8, 0, ZAP_LONG_DEFAULTS_INDEX(106) }, /* PacketTxCount */ \ - { 0x00000004, ZAP_TYPE(INT64U), 8, 0, ZAP_LONG_DEFAULTS_INDEX(114) }, /* TxErrCount */ \ - { 0x00000005, ZAP_TYPE(INT64U), 8, 0, ZAP_LONG_DEFAULTS_INDEX(122) }, /* CollisionCount */ \ - { 0x00000006, ZAP_TYPE(INT64U), 8, 0, ZAP_LONG_DEFAULTS_INDEX(130) }, /* OverrunCount */ \ - { 0x00000007, ZAP_TYPE(BOOLEAN), 1, ZAP_ATTRIBUTE_MASK(NULLABLE), ZAP_SIMPLE_DEFAULT(0x00) }, /* CarrierDetect */ \ - { 0x00000008, ZAP_TYPE(INT64U), 8, 0, ZAP_LONG_DEFAULTS_INDEX(138) }, /* TimeSinceReset */ \ - { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(146) }, /* FeatureMap */ \ - { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ + { 0x00000000, ZAP_TYPE(ENUM8), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ + ZAP_EMPTY_DEFAULT() }, /* PHYRate */ \ + { 0x00000001, ZAP_TYPE(BOOLEAN), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ + ZAP_EMPTY_DEFAULT() }, /* FullDuplex */ \ + { 0x00000002, ZAP_TYPE(INT64U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* PacketRxCount */ \ + { 0x00000003, ZAP_TYPE(INT64U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* PacketTxCount */ \ + { 0x00000004, ZAP_TYPE(INT64U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* TxErrCount */ \ + { 0x00000005, ZAP_TYPE(INT64U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* CollisionCount */ \ + { 0x00000006, ZAP_TYPE(INT64U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* OverrunCount */ \ + { 0x00000007, ZAP_TYPE(BOOLEAN), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ + ZAP_EMPTY_DEFAULT() }, /* CarrierDetect */ \ + { 0x00000008, ZAP_TYPE(INT64U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* TimeSinceReset */ \ + { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(98) }, /* FeatureMap */ \ + { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ \ /* Endpoint: 0, Cluster: AdministratorCommissioning (server) */ \ { 0x00000000, ZAP_TYPE(INT8U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* WindowStatus */ \ @@ -575,7 +543,7 @@ .clusterId = 0x00000028, \ .attributes = ZAP_ATTRIBUTE_INDEX(11), \ .attributeCount = 21, \ - .clusterSize = 39, \ + .clusterSize = 37, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ .functions = chipFuncArrayBasicServer, \ .acceptedCommandList = nullptr ,\ @@ -685,7 +653,7 @@ .clusterId = 0x00000037, \ .attributes = ZAP_ATTRIBUTE_INDEX(86), \ .attributeCount = 11, \ - .clusterSize = 57, \ + .clusterSize = 6, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ .functions = NULL, \ .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 20 ) ,\ @@ -768,7 +736,7 @@ // This is an array of EmberAfEndpointType structures. #define GENERATED_ENDPOINT_TYPES \ { \ - { ZAP_CLUSTER_INDEX(0), 17, 310 }, { ZAP_CLUSTER_INDEX(17), 2, 8 }, \ + { ZAP_CLUSTER_INDEX(0), 17, 257 }, { ZAP_CLUSTER_INDEX(17), 2, 8 }, \ } // Largest attribute size is needed for various buffers @@ -777,10 +745,10 @@ static_assert(ATTRIBUTE_LARGEST <= CHIP_CONFIG_MAX_ATTRIBUTE_STORE_ELEMENT_SIZE, "ATTRIBUTE_LARGEST larger than expected"); // Total size of singleton attributes -#define ATTRIBUTE_SINGLETONS_SIZE (39) +#define ATTRIBUTE_SINGLETONS_SIZE (37) // Total size of attribute storage -#define ATTRIBUTE_MAX_SIZE (318) +#define ATTRIBUTE_MAX_SIZE (265) // Number of fixed endpoints #define FIXED_ENDPOINT_COUNT (2) diff --git a/zzz_generated/thermostat/zap-generated/endpoint_config.h b/zzz_generated/thermostat/zap-generated/endpoint_config.h index 4e78bad92af829..2d637bdbbff088 100644 --- a/zzz_generated/thermostat/zap-generated/endpoint_config.h +++ b/zzz_generated/thermostat/zap-generated/endpoint_config.h @@ -239,30 +239,12 @@ \ /* Endpoint: 0, Cluster: Ethernet Network Diagnostics (server), big-endian */ \ \ - /* 303 - PacketRxCount, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 311 - PacketTxCount, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 319 - TxErrCount, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 327 - CollisionCount, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 335 - OverrunCount, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 343 - TimeSinceReset, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 351 - FeatureMap, */ \ + /* 303 - FeatureMap, */ \ 0x00, 0x00, 0x00, 0x03, \ \ /* Endpoint: 1, Cluster: Thermostat (server), big-endian */ \ \ - /* 355 - FeatureMap, */ \ + /* 307 - FeatureMap, */ \ 0x00, 0x00, 0x00, 0x0B, \ } @@ -480,36 +462,18 @@ \ /* Endpoint: 0, Cluster: Ethernet Network Diagnostics (server), little-endian */ \ \ - /* 303 - PacketRxCount, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 311 - PacketTxCount, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 319 - TxErrCount, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 327 - CollisionCount, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 335 - OverrunCount, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 343 - TimeSinceReset, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 351 - FeatureMap, */ \ + /* 303 - FeatureMap, */ \ 0x03, 0x00, 0x00, 0x00, \ \ /* Endpoint: 1, Cluster: Thermostat (server), little-endian */ \ \ - /* 355 - FeatureMap, */ \ + /* 307 - FeatureMap, */ \ 0x0B, 0x00, 0x00, 0x00, \ } #endif // BIGENDIAN_CPU -#define GENERATED_DEFAULTS_COUNT (72) +#define GENERATED_DEFAULTS_COUNT (66) #define ZAP_TYPE(type) ZCL_##type##_ATTRIBUTE_TYPE #define ZAP_LONG_DEFAULTS_INDEX(index) \ @@ -585,7 +549,8 @@ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ \ /* Endpoint: 0, Cluster: Basic (server) */ \ - { 0x00000000, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(SINGLETON), ZAP_SIMPLE_DEFAULT(10) }, /* DataModelRevision */ \ + { 0x00000000, ZAP_TYPE(INT16U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(SINGLETON), \ + ZAP_EMPTY_DEFAULT() }, /* DataModelRevision */ \ { 0x00000001, ZAP_TYPE(CHAR_STRING), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(SINGLETON), \ ZAP_EMPTY_DEFAULT() }, /* VendorName */ \ { 0x00000002, ZAP_TYPE(VENDOR_ID), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(SINGLETON), \ @@ -784,17 +749,20 @@ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ \ /* Endpoint: 0, Cluster: Ethernet Network Diagnostics (server) */ \ - { 0x00000000, ZAP_TYPE(ENUM8), 1, ZAP_ATTRIBUTE_MASK(NULLABLE), ZAP_EMPTY_DEFAULT() }, /* PHYRate */ \ - { 0x00000001, ZAP_TYPE(BOOLEAN), 1, ZAP_ATTRIBUTE_MASK(NULLABLE), ZAP_SIMPLE_DEFAULT(0x00) }, /* FullDuplex */ \ - { 0x00000002, ZAP_TYPE(INT64U), 8, 0, ZAP_LONG_DEFAULTS_INDEX(303) }, /* PacketRxCount */ \ - { 0x00000003, ZAP_TYPE(INT64U), 8, 0, ZAP_LONG_DEFAULTS_INDEX(311) }, /* PacketTxCount */ \ - { 0x00000004, ZAP_TYPE(INT64U), 8, 0, ZAP_LONG_DEFAULTS_INDEX(319) }, /* TxErrCount */ \ - { 0x00000005, ZAP_TYPE(INT64U), 8, 0, ZAP_LONG_DEFAULTS_INDEX(327) }, /* CollisionCount */ \ - { 0x00000006, ZAP_TYPE(INT64U), 8, 0, ZAP_LONG_DEFAULTS_INDEX(335) }, /* OverrunCount */ \ - { 0x00000007, ZAP_TYPE(BOOLEAN), 1, ZAP_ATTRIBUTE_MASK(NULLABLE), ZAP_SIMPLE_DEFAULT(0x00) }, /* CarrierDetect */ \ - { 0x00000008, ZAP_TYPE(INT64U), 8, 0, ZAP_LONG_DEFAULTS_INDEX(343) }, /* TimeSinceReset */ \ - { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(351) }, /* FeatureMap */ \ - { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ + { 0x00000000, ZAP_TYPE(ENUM8), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ + ZAP_EMPTY_DEFAULT() }, /* PHYRate */ \ + { 0x00000001, ZAP_TYPE(BOOLEAN), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ + ZAP_EMPTY_DEFAULT() }, /* FullDuplex */ \ + { 0x00000002, ZAP_TYPE(INT64U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* PacketRxCount */ \ + { 0x00000003, ZAP_TYPE(INT64U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* PacketTxCount */ \ + { 0x00000004, ZAP_TYPE(INT64U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* TxErrCount */ \ + { 0x00000005, ZAP_TYPE(INT64U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* CollisionCount */ \ + { 0x00000006, ZAP_TYPE(INT64U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* OverrunCount */ \ + { 0x00000007, ZAP_TYPE(BOOLEAN), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ + ZAP_EMPTY_DEFAULT() }, /* CarrierDetect */ \ + { 0x00000008, ZAP_TYPE(INT64U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* TimeSinceReset */ \ + { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(303) }, /* FeatureMap */ \ + { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ \ /* Endpoint: 0, Cluster: AdministratorCommissioning (server) */ \ { 0x00000000, ZAP_TYPE(INT8U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* WindowStatus */ \ @@ -847,7 +815,8 @@ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(4) }, /* ClusterRevision */ \ \ /* Endpoint: 1, Cluster: Basic (server) */ \ - { 0x00000000, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(SINGLETON), ZAP_SIMPLE_DEFAULT(10) }, /* DataModelRevision */ \ + { 0x00000000, ZAP_TYPE(INT16U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(SINGLETON), \ + ZAP_EMPTY_DEFAULT() }, /* DataModelRevision */ \ { 0x00000001, ZAP_TYPE(CHAR_STRING), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(SINGLETON), \ ZAP_EMPTY_DEFAULT() }, /* VendorName */ \ { 0x00000002, ZAP_TYPE(VENDOR_ID), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(SINGLETON), \ @@ -916,7 +885,7 @@ { 0x00000020, ZAP_TYPE(ENUM8), 1, 0, ZAP_SIMPLE_DEFAULT(0) }, /* start of week */ \ { 0x00000021, ZAP_TYPE(INT8U), 1, 0, ZAP_SIMPLE_DEFAULT(7) }, /* number of weekly transitions */ \ { 0x00000022, ZAP_TYPE(INT8U), 1, 0, ZAP_SIMPLE_DEFAULT(4) }, /* number of daily transitions */ \ - { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(355) }, /* FeatureMap */ \ + { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(307) }, /* FeatureMap */ \ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(5) }, /* ClusterRevision */ \ } @@ -1141,7 +1110,7 @@ .clusterId = 0x00000028, \ .attributes = ZAP_ATTRIBUTE_INDEX(15), \ .attributeCount = 21, \ - .clusterSize = 39, \ + .clusterSize = 37, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ .functions = chipFuncArrayBasicServer, \ .acceptedCommandList = nullptr ,\ @@ -1273,7 +1242,7 @@ .clusterId = 0x00000037, \ .attributes = ZAP_ATTRIBUTE_INDEX(159), \ .attributeCount = 11, \ - .clusterSize = 57, \ + .clusterSize = 6, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ .functions = NULL, \ .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 34 ) ,\ @@ -1383,7 +1352,7 @@ .clusterId = 0x00000028, \ .attributes = ZAP_ATTRIBUTE_INDEX(199), \ .attributeCount = 21, \ - .clusterSize = 39, \ + .clusterSize = 37, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ .functions = chipFuncArrayBasicServer, \ .acceptedCommandList = nullptr ,\ @@ -1411,7 +1380,7 @@ // This is an array of EmberAfEndpointType structures. #define GENERATED_ENDPOINT_TYPES \ { \ - { ZAP_CLUSTER_INDEX(0), 22, 583 }, { ZAP_CLUSTER_INDEX(22), 6, 89 }, \ + { ZAP_CLUSTER_INDEX(0), 22, 530 }, { ZAP_CLUSTER_INDEX(22), 6, 87 }, \ } // Largest attribute size is needed for various buffers @@ -1420,10 +1389,10 @@ static_assert(ATTRIBUTE_LARGEST <= CHIP_CONFIG_MAX_ATTRIBUTE_STORE_ELEMENT_SIZE, "ATTRIBUTE_LARGEST larger than expected"); // Total size of singleton attributes -#define ATTRIBUTE_SINGLETONS_SIZE (78) +#define ATTRIBUTE_SINGLETONS_SIZE (74) // Total size of attribute storage -#define ATTRIBUTE_MAX_SIZE (672) +#define ATTRIBUTE_MAX_SIZE (617) // Number of fixed endpoints #define FIXED_ENDPOINT_COUNT (2) diff --git a/zzz_generated/tv-app/zap-generated/endpoint_config.h b/zzz_generated/tv-app/zap-generated/endpoint_config.h index 41fb169b3b6c89..c661158f5a53d9 100644 --- a/zzz_generated/tv-app/zap-generated/endpoint_config.h +++ b/zzz_generated/tv-app/zap-generated/endpoint_config.h @@ -239,95 +239,77 @@ \ /* Endpoint: 0, Cluster: Ethernet Network Diagnostics (server), big-endian */ \ \ - /* 303 - PacketRxCount, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 311 - PacketTxCount, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 319 - TxErrCount, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 327 - CollisionCount, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 335 - OverrunCount, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 343 - TimeSinceReset, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 351 - FeatureMap, */ \ + /* 303 - FeatureMap, */ \ 0x00, 0x00, 0x00, 0x03, \ \ /* Endpoint: 1, Cluster: Channel (server), big-endian */ \ \ - /* 355 - FeatureMap, */ \ + /* 307 - FeatureMap, */ \ 0x00, 0x00, 0x00, 0x01, \ \ /* Endpoint: 1, Cluster: Target Navigator (server), big-endian */ \ \ - /* 359 - FeatureMap, */ \ + /* 311 - FeatureMap, */ \ 0x00, 0x00, 0x00, 0x01, \ \ /* Endpoint: 1, Cluster: Media Input (server), big-endian */ \ \ - /* 363 - FeatureMap, */ \ + /* 315 - FeatureMap, */ \ 0x00, 0x00, 0x00, 0x01, \ \ /* Endpoint: 1, Cluster: Keypad Input (server), big-endian */ \ \ - /* 367 - FeatureMap, */ \ + /* 319 - FeatureMap, */ \ 0x00, 0x00, 0x00, 0x01, \ \ /* Endpoint: 1, Cluster: Content Launcher (server), big-endian */ \ \ - /* 371 - SupportedStreamingProtocols, */ \ + /* 323 - SupportedStreamingProtocols, */ \ 0x00, 0x00, 0x00, 0x00, \ \ /* Endpoint: 1, Cluster: Application Launcher (server), big-endian */ \ \ - /* 375 - FeatureMap, */ \ + /* 327 - FeatureMap, */ \ 0x00, 0x00, 0x00, 0x01, \ \ /* Endpoint: 2, Cluster: Level Control (server), big-endian */ \ \ - /* 379 - FeatureMap, */ \ + /* 331 - FeatureMap, */ \ 0x00, 0x00, 0x00, 0x01, \ \ /* Endpoint: 2, Cluster: Audio Output (server), big-endian */ \ \ - /* 383 - FeatureMap, */ \ + /* 335 - FeatureMap, */ \ 0x00, 0x00, 0x00, 0x01, \ \ /* Endpoint: 3, Cluster: Media Playback (server), big-endian */ \ \ - /* 387 - StartTime, */ \ + /* 339 - StartTime, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, \ \ - /* 395 - Duration, */ \ + /* 347 - Duration, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 403 - PlaybackSpeed, */ \ + /* 355 - PlaybackSpeed, */ \ 0x00, 0x00, 0x00, 0x00, \ \ - /* 407 - SeekRangeEnd, */ \ + /* 359 - SeekRangeEnd, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 415 - SeekRangeStart, */ \ + /* 367 - SeekRangeStart, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ /* Endpoint: 3, Cluster: Content Launcher (server), big-endian */ \ \ - /* 423 - SupportedStreamingProtocols, */ \ + /* 375 - SupportedStreamingProtocols, */ \ 0x00, 0x00, 0x00, 0x00, \ \ - /* 427 - FeatureMap, */ \ + /* 379 - FeatureMap, */ \ 0x00, 0x00, 0x00, 0x01, \ \ /* Endpoint: 4, Cluster: Content Launcher (server), big-endian */ \ \ - /* 431 - SupportedStreamingProtocols, */ \ + /* 383 - SupportedStreamingProtocols, */ \ 0x00, 0x00, 0x00, 0x00, \ } @@ -545,101 +527,83 @@ \ /* Endpoint: 0, Cluster: Ethernet Network Diagnostics (server), little-endian */ \ \ - /* 303 - PacketRxCount, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 311 - PacketTxCount, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 319 - TxErrCount, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 327 - CollisionCount, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 335 - OverrunCount, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 343 - TimeSinceReset, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 351 - FeatureMap, */ \ + /* 303 - FeatureMap, */ \ 0x03, 0x00, 0x00, 0x00, \ \ /* Endpoint: 1, Cluster: Channel (server), little-endian */ \ \ - /* 355 - FeatureMap, */ \ + /* 307 - FeatureMap, */ \ 0x01, 0x00, 0x00, 0x00, \ \ /* Endpoint: 1, Cluster: Target Navigator (server), little-endian */ \ \ - /* 359 - FeatureMap, */ \ + /* 311 - FeatureMap, */ \ 0x01, 0x00, 0x00, 0x00, \ \ /* Endpoint: 1, Cluster: Media Input (server), little-endian */ \ \ - /* 363 - FeatureMap, */ \ + /* 315 - FeatureMap, */ \ 0x01, 0x00, 0x00, 0x00, \ \ /* Endpoint: 1, Cluster: Keypad Input (server), little-endian */ \ \ - /* 367 - FeatureMap, */ \ + /* 319 - FeatureMap, */ \ 0x01, 0x00, 0x00, 0x00, \ \ /* Endpoint: 1, Cluster: Content Launcher (server), little-endian */ \ \ - /* 371 - SupportedStreamingProtocols, */ \ + /* 323 - SupportedStreamingProtocols, */ \ 0x00, 0x00, 0x00, 0x00, \ \ /* Endpoint: 1, Cluster: Application Launcher (server), little-endian */ \ \ - /* 375 - FeatureMap, */ \ + /* 327 - FeatureMap, */ \ 0x01, 0x00, 0x00, 0x00, \ \ /* Endpoint: 2, Cluster: Level Control (server), little-endian */ \ \ - /* 379 - FeatureMap, */ \ + /* 331 - FeatureMap, */ \ 0x01, 0x00, 0x00, 0x00, \ \ /* Endpoint: 2, Cluster: Audio Output (server), little-endian */ \ \ - /* 383 - FeatureMap, */ \ + /* 335 - FeatureMap, */ \ 0x01, 0x00, 0x00, 0x00, \ \ /* Endpoint: 3, Cluster: Media Playback (server), little-endian */ \ \ - /* 387 - StartTime, */ \ + /* 339 - StartTime, */ \ 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 395 - Duration, */ \ + /* 347 - Duration, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 403 - PlaybackSpeed, */ \ + /* 355 - PlaybackSpeed, */ \ 0x00, 0x00, 0x00, 0x00, \ \ - /* 407 - SeekRangeEnd, */ \ + /* 359 - SeekRangeEnd, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 415 - SeekRangeStart, */ \ + /* 367 - SeekRangeStart, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ /* Endpoint: 3, Cluster: Content Launcher (server), little-endian */ \ \ - /* 423 - SupportedStreamingProtocols, */ \ + /* 375 - SupportedStreamingProtocols, */ \ 0x00, 0x00, 0x00, 0x00, \ \ - /* 427 - FeatureMap, */ \ + /* 379 - FeatureMap, */ \ 0x01, 0x00, 0x00, 0x00, \ \ /* Endpoint: 4, Cluster: Content Launcher (server), little-endian */ \ \ - /* 431 - SupportedStreamingProtocols, */ \ + /* 383 - SupportedStreamingProtocols, */ \ 0x00, 0x00, 0x00, 0x00, \ } #endif // BIGENDIAN_CPU -#define GENERATED_DEFAULTS_COUNT (87) +#define GENERATED_DEFAULTS_COUNT (81) #define ZAP_TYPE(type) ZCL_##type##_ATTRIBUTE_TYPE #define ZAP_LONG_DEFAULTS_INDEX(index) \ @@ -702,7 +666,8 @@ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ \ /* Endpoint: 0, Cluster: Basic (server) */ \ - { 0x00000000, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(SINGLETON), ZAP_SIMPLE_DEFAULT(10) }, /* DataModelRevision */ \ + { 0x00000000, ZAP_TYPE(INT16U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(SINGLETON), \ + ZAP_EMPTY_DEFAULT() }, /* DataModelRevision */ \ { 0x00000001, ZAP_TYPE(CHAR_STRING), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(SINGLETON), \ ZAP_EMPTY_DEFAULT() }, /* VendorName */ \ { 0x00000002, ZAP_TYPE(VENDOR_ID), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(SINGLETON), \ @@ -901,17 +866,20 @@ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ \ /* Endpoint: 0, Cluster: Ethernet Network Diagnostics (server) */ \ - { 0x00000000, ZAP_TYPE(ENUM8), 1, ZAP_ATTRIBUTE_MASK(NULLABLE), ZAP_EMPTY_DEFAULT() }, /* PHYRate */ \ - { 0x00000001, ZAP_TYPE(BOOLEAN), 1, ZAP_ATTRIBUTE_MASK(NULLABLE), ZAP_SIMPLE_DEFAULT(0x00) }, /* FullDuplex */ \ - { 0x00000002, ZAP_TYPE(INT64U), 8, 0, ZAP_LONG_DEFAULTS_INDEX(303) }, /* PacketRxCount */ \ - { 0x00000003, ZAP_TYPE(INT64U), 8, 0, ZAP_LONG_DEFAULTS_INDEX(311) }, /* PacketTxCount */ \ - { 0x00000004, ZAP_TYPE(INT64U), 8, 0, ZAP_LONG_DEFAULTS_INDEX(319) }, /* TxErrCount */ \ - { 0x00000005, ZAP_TYPE(INT64U), 8, 0, ZAP_LONG_DEFAULTS_INDEX(327) }, /* CollisionCount */ \ - { 0x00000006, ZAP_TYPE(INT64U), 8, 0, ZAP_LONG_DEFAULTS_INDEX(335) }, /* OverrunCount */ \ - { 0x00000007, ZAP_TYPE(BOOLEAN), 1, ZAP_ATTRIBUTE_MASK(NULLABLE), ZAP_SIMPLE_DEFAULT(0x00) }, /* CarrierDetect */ \ - { 0x00000008, ZAP_TYPE(INT64U), 8, 0, ZAP_LONG_DEFAULTS_INDEX(343) }, /* TimeSinceReset */ \ - { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(351) }, /* FeatureMap */ \ - { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ + { 0x00000000, ZAP_TYPE(ENUM8), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ + ZAP_EMPTY_DEFAULT() }, /* PHYRate */ \ + { 0x00000001, ZAP_TYPE(BOOLEAN), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ + ZAP_EMPTY_DEFAULT() }, /* FullDuplex */ \ + { 0x00000002, ZAP_TYPE(INT64U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* PacketRxCount */ \ + { 0x00000003, ZAP_TYPE(INT64U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* PacketTxCount */ \ + { 0x00000004, ZAP_TYPE(INT64U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* TxErrCount */ \ + { 0x00000005, ZAP_TYPE(INT64U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* CollisionCount */ \ + { 0x00000006, ZAP_TYPE(INT64U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* OverrunCount */ \ + { 0x00000007, ZAP_TYPE(BOOLEAN), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ + ZAP_EMPTY_DEFAULT() }, /* CarrierDetect */ \ + { 0x00000008, ZAP_TYPE(INT64U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* TimeSinceReset */ \ + { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(303) }, /* FeatureMap */ \ + { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ \ /* Endpoint: 0, Cluster: AdministratorCommissioning (server) */ \ { 0x00000000, ZAP_TYPE(INT8U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* WindowStatus */ \ @@ -973,32 +941,32 @@ ZAP_EMPTY_DEFAULT() }, /* Lineup */ \ { 0x00000002, ZAP_TYPE(STRUCT), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ ZAP_EMPTY_DEFAULT() }, /* CurrentChannel */ \ - { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(355) }, /* FeatureMap */ \ + { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(307) }, /* FeatureMap */ \ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ \ /* Endpoint: 1, Cluster: Target Navigator (server) */ \ { 0x00000000, ZAP_TYPE(ARRAY), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* TargetList */ \ { 0x00000001, ZAP_TYPE(INT8U), 1, 0, ZAP_SIMPLE_DEFAULT(0) }, /* CurrentTarget */ \ - { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(359) }, /* FeatureMap */ \ + { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(311) }, /* FeatureMap */ \ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ \ /* Endpoint: 1, Cluster: Media Input (server) */ \ { 0x00000000, ZAP_TYPE(ARRAY), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* InputList */ \ { 0x00000001, ZAP_TYPE(INT8U), 1, 0, ZAP_SIMPLE_DEFAULT(0x00) }, /* CurrentInput */ \ - { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(363) }, /* FeatureMap */ \ + { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(315) }, /* FeatureMap */ \ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ \ /* Endpoint: 1, Cluster: Low Power (server) */ \ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ \ /* Endpoint: 1, Cluster: Keypad Input (server) */ \ - { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(367) }, /* FeatureMap */ \ + { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(319) }, /* FeatureMap */ \ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ \ /* Endpoint: 1, Cluster: Content Launcher (server) */ \ { 0x00000000, ZAP_TYPE(ARRAY), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* AcceptHeader */ \ { 0x00000001, ZAP_TYPE(BITMAP32), 4, ZAP_ATTRIBUTE_MASK(WRITABLE), \ - ZAP_LONG_DEFAULTS_INDEX(371) }, /* SupportedStreamingProtocols */ \ + ZAP_LONG_DEFAULTS_INDEX(323) }, /* SupportedStreamingProtocols */ \ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ \ /* Endpoint: 1, Cluster: Application Launcher (server) */ \ @@ -1006,7 +974,7 @@ { 0x00000001, ZAP_TYPE(STRUCT), 0, \ ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ ZAP_EMPTY_DEFAULT() }, /* CurrentApp */ \ - { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(375) }, /* FeatureMap */ \ + { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(327) }, /* FeatureMap */ \ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ \ /* Endpoint: 2, Cluster: On/Off (server) */ \ @@ -1036,7 +1004,7 @@ { 0x00004000, ZAP_TYPE(INT8U), 1, \ ZAP_ATTRIBUTE_MASK(TOKENIZE) | ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ ZAP_SIMPLE_DEFAULT(255) }, /* start up current level */ \ - { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(379) }, /* FeatureMap */ \ + { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(331) }, /* FeatureMap */ \ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(5) }, /* ClusterRevision */ \ \ /* Endpoint: 2, Cluster: Descriptor (server) */ \ @@ -1049,7 +1017,7 @@ /* Endpoint: 2, Cluster: Audio Output (server) */ \ { 0x00000000, ZAP_TYPE(ARRAY), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* OutputList */ \ { 0x00000001, ZAP_TYPE(INT8U), 1, 0, ZAP_SIMPLE_DEFAULT(0x00) }, /* CurrentOutput */ \ - { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(383) }, /* FeatureMap */ \ + { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(335) }, /* FeatureMap */ \ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ \ /* Endpoint: 3, Cluster: Descriptor (server) */ \ @@ -1061,20 +1029,20 @@ \ /* Endpoint: 3, Cluster: Media Playback (server) */ \ { 0x00000000, ZAP_TYPE(ENUM8), 1, 0, ZAP_SIMPLE_DEFAULT(0x00) }, /* CurrentState */ \ - { 0x00000001, ZAP_TYPE(EPOCH_US), 8, ZAP_ATTRIBUTE_MASK(NULLABLE), ZAP_LONG_DEFAULTS_INDEX(387) }, /* StartTime */ \ - { 0x00000002, ZAP_TYPE(INT64U), 8, ZAP_ATTRIBUTE_MASK(NULLABLE), ZAP_LONG_DEFAULTS_INDEX(395) }, /* Duration */ \ + { 0x00000001, ZAP_TYPE(EPOCH_US), 8, ZAP_ATTRIBUTE_MASK(NULLABLE), ZAP_LONG_DEFAULTS_INDEX(339) }, /* StartTime */ \ + { 0x00000002, ZAP_TYPE(INT64U), 8, ZAP_ATTRIBUTE_MASK(NULLABLE), ZAP_LONG_DEFAULTS_INDEX(347) }, /* Duration */ \ { 0x00000003, ZAP_TYPE(STRUCT), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ ZAP_EMPTY_DEFAULT() }, /* SampledPosition */ \ - { 0x00000004, ZAP_TYPE(SINGLE), 4, 0, ZAP_LONG_DEFAULTS_INDEX(403) }, /* PlaybackSpeed */ \ - { 0x00000005, ZAP_TYPE(INT64U), 8, ZAP_ATTRIBUTE_MASK(NULLABLE), ZAP_LONG_DEFAULTS_INDEX(407) }, /* SeekRangeEnd */ \ - { 0x00000006, ZAP_TYPE(INT64U), 8, ZAP_ATTRIBUTE_MASK(NULLABLE), ZAP_LONG_DEFAULTS_INDEX(415) }, /* SeekRangeStart */ \ + { 0x00000004, ZAP_TYPE(SINGLE), 4, 0, ZAP_LONG_DEFAULTS_INDEX(355) }, /* PlaybackSpeed */ \ + { 0x00000005, ZAP_TYPE(INT64U), 8, ZAP_ATTRIBUTE_MASK(NULLABLE), ZAP_LONG_DEFAULTS_INDEX(359) }, /* SeekRangeEnd */ \ + { 0x00000006, ZAP_TYPE(INT64U), 8, ZAP_ATTRIBUTE_MASK(NULLABLE), ZAP_LONG_DEFAULTS_INDEX(367) }, /* SeekRangeStart */ \ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ \ /* Endpoint: 3, Cluster: Content Launcher (server) */ \ { 0x00000000, ZAP_TYPE(ARRAY), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* AcceptHeader */ \ { 0x00000001, ZAP_TYPE(BITMAP32), 4, ZAP_ATTRIBUTE_MASK(WRITABLE), \ - ZAP_LONG_DEFAULTS_INDEX(423) }, /* SupportedStreamingProtocols */ \ - { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(427) }, /* FeatureMap */ \ + ZAP_LONG_DEFAULTS_INDEX(375) }, /* SupportedStreamingProtocols */ \ + { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(379) }, /* FeatureMap */ \ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ \ /* Endpoint: 3, Cluster: Application Basic (server) */ \ @@ -1101,7 +1069,7 @@ /* Endpoint: 4, Cluster: Content Launcher (server) */ \ { 0x00000000, ZAP_TYPE(ARRAY), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* AcceptHeader */ \ { 0x00000001, ZAP_TYPE(BITMAP32), 4, ZAP_ATTRIBUTE_MASK(WRITABLE), \ - ZAP_LONG_DEFAULTS_INDEX(431) }, /* SupportedStreamingProtocols */ \ + ZAP_LONG_DEFAULTS_INDEX(383) }, /* SupportedStreamingProtocols */ \ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ \ /* Endpoint: 4, Cluster: Application Basic (server) */ \ @@ -1407,7 +1375,7 @@ .clusterId = 0x00000028, \ .attributes = ZAP_ATTRIBUTE_INDEX(13), \ .attributeCount = 21, \ - .clusterSize = 39, \ + .clusterSize = 37, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ .functions = chipFuncArrayBasicServer, \ .acceptedCommandList = nullptr ,\ @@ -1561,7 +1529,7 @@ .clusterId = 0x00000037, \ .attributes = ZAP_ATTRIBUTE_INDEX(157), \ .attributeCount = 11, \ - .clusterSize = 57, \ + .clusterSize = 6, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ .functions = NULL, \ .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 30 ) ,\ @@ -1919,7 +1887,7 @@ // This is an array of EmberAfEndpointType structures. #define GENERATED_ENDPOINT_TYPES \ { \ - { ZAP_CLUSTER_INDEX(0), 26, 587 }, { ZAP_CLUSTER_INDEX(26), 10, 78 }, { ZAP_CLUSTER_INDEX(36), 4, 37 }, \ + { ZAP_CLUSTER_INDEX(0), 26, 534 }, { ZAP_CLUSTER_INDEX(26), 10, 78 }, { ZAP_CLUSTER_INDEX(36), 4, 37 }, \ { ZAP_CLUSTER_INDEX(40), 5, 157 }, { ZAP_CLUSTER_INDEX(45), 3, 112 }, { ZAP_CLUSTER_INDEX(48), 2, 106 }, \ } @@ -1929,10 +1897,10 @@ static_assert(ATTRIBUTE_LARGEST <= CHIP_CONFIG_MAX_ATTRIBUTE_STORE_ELEMENT_SIZE, "ATTRIBUTE_LARGEST larger than expected"); // Total size of singleton attributes -#define ATTRIBUTE_SINGLETONS_SIZE (39) +#define ATTRIBUTE_SINGLETONS_SIZE (37) // Total size of attribute storage -#define ATTRIBUTE_MAX_SIZE (1077) +#define ATTRIBUTE_MAX_SIZE (1024) // Number of fixed endpoints #define FIXED_ENDPOINT_COUNT (6) diff --git a/zzz_generated/tv-casting-app/zap-generated/endpoint_config.h b/zzz_generated/tv-casting-app/zap-generated/endpoint_config.h index 41632729fe8286..1411c197de7df1 100644 --- a/zzz_generated/tv-casting-app/zap-generated/endpoint_config.h +++ b/zzz_generated/tv-casting-app/zap-generated/endpoint_config.h @@ -239,55 +239,37 @@ \ /* Endpoint: 0, Cluster: Ethernet Network Diagnostics (server), big-endian */ \ \ - /* 303 - PacketRxCount, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 311 - PacketTxCount, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 319 - TxErrCount, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 327 - CollisionCount, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 335 - OverrunCount, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 343 - TimeSinceReset, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 351 - FeatureMap, */ \ + /* 303 - FeatureMap, */ \ 0x00, 0x00, 0x00, 0x03, \ \ /* Endpoint: 1, Cluster: On/Off (server), big-endian */ \ \ - /* 355 - FeatureMap, */ \ + /* 307 - FeatureMap, */ \ 0x00, 0x00, 0x00, 0x00, \ \ /* Endpoint: 1, Cluster: IAS Zone (server), big-endian */ \ \ - /* 359 - IAS CIE address, */ \ + /* 311 - IAS CIE address, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ /* Endpoint: 1, Cluster: Test Cluster (server), big-endian */ \ \ - /* 367 - bitmap32, */ \ + /* 319 - bitmap32, */ \ 0x00, 0x00, 0x00, 0x00, \ \ - /* 371 - bitmap64, */ \ + /* 323 - bitmap64, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 379 - int32u, */ \ + /* 331 - int32u, */ \ 0x00, 0x00, 0x00, 0x00, \ \ - /* 383 - int64u, */ \ + /* 335 - int64u, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 391 - int32s, */ \ + /* 343 - int32s, */ \ 0x00, 0x00, 0x00, 0x00, \ \ - /* 395 - int64s, */ \ + /* 347 - int64s, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ } @@ -505,61 +487,43 @@ \ /* Endpoint: 0, Cluster: Ethernet Network Diagnostics (server), little-endian */ \ \ - /* 303 - PacketRxCount, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 311 - PacketTxCount, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 319 - TxErrCount, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 327 - CollisionCount, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 335 - OverrunCount, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 343 - TimeSinceReset, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 351 - FeatureMap, */ \ + /* 303 - FeatureMap, */ \ 0x03, 0x00, 0x00, 0x00, \ \ /* Endpoint: 1, Cluster: On/Off (server), little-endian */ \ \ - /* 355 - FeatureMap, */ \ + /* 307 - FeatureMap, */ \ 0x00, 0x00, 0x00, 0x00, \ \ /* Endpoint: 1, Cluster: IAS Zone (server), little-endian */ \ \ - /* 359 - IAS CIE address, */ \ + /* 311 - IAS CIE address, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ /* Endpoint: 1, Cluster: Test Cluster (server), little-endian */ \ \ - /* 367 - bitmap32, */ \ + /* 319 - bitmap32, */ \ 0x00, 0x00, 0x00, 0x00, \ \ - /* 371 - bitmap64, */ \ + /* 323 - bitmap64, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 379 - int32u, */ \ + /* 331 - int32u, */ \ 0x00, 0x00, 0x00, 0x00, \ \ - /* 383 - int64u, */ \ + /* 335 - int64u, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 391 - int32s, */ \ + /* 343 - int32s, */ \ 0x00, 0x00, 0x00, 0x00, \ \ - /* 395 - int64s, */ \ + /* 347 - int64s, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ } #endif // BIGENDIAN_CPU -#define GENERATED_DEFAULTS_COUNT (79) +#define GENERATED_DEFAULTS_COUNT (73) #define ZAP_TYPE(type) ZCL_##type##_ATTRIBUTE_TYPE #define ZAP_LONG_DEFAULTS_INDEX(index) \ @@ -631,7 +595,8 @@ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ \ /* Endpoint: 0, Cluster: Basic (server) */ \ - { 0x00000000, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(SINGLETON), ZAP_SIMPLE_DEFAULT(10) }, /* DataModelRevision */ \ + { 0x00000000, ZAP_TYPE(INT16U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(SINGLETON), \ + ZAP_EMPTY_DEFAULT() }, /* DataModelRevision */ \ { 0x00000001, ZAP_TYPE(CHAR_STRING), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(SINGLETON), \ ZAP_EMPTY_DEFAULT() }, /* VendorName */ \ { 0x00000002, ZAP_TYPE(VENDOR_ID), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(SINGLETON), \ @@ -830,17 +795,20 @@ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ \ /* Endpoint: 0, Cluster: Ethernet Network Diagnostics (server) */ \ - { 0x00000000, ZAP_TYPE(ENUM8), 1, ZAP_ATTRIBUTE_MASK(NULLABLE), ZAP_EMPTY_DEFAULT() }, /* PHYRate */ \ - { 0x00000001, ZAP_TYPE(BOOLEAN), 1, ZAP_ATTRIBUTE_MASK(NULLABLE), ZAP_SIMPLE_DEFAULT(0x00) }, /* FullDuplex */ \ - { 0x00000002, ZAP_TYPE(INT64U), 8, 0, ZAP_LONG_DEFAULTS_INDEX(303) }, /* PacketRxCount */ \ - { 0x00000003, ZAP_TYPE(INT64U), 8, 0, ZAP_LONG_DEFAULTS_INDEX(311) }, /* PacketTxCount */ \ - { 0x00000004, ZAP_TYPE(INT64U), 8, 0, ZAP_LONG_DEFAULTS_INDEX(319) }, /* TxErrCount */ \ - { 0x00000005, ZAP_TYPE(INT64U), 8, 0, ZAP_LONG_DEFAULTS_INDEX(327) }, /* CollisionCount */ \ - { 0x00000006, ZAP_TYPE(INT64U), 8, 0, ZAP_LONG_DEFAULTS_INDEX(335) }, /* OverrunCount */ \ - { 0x00000007, ZAP_TYPE(BOOLEAN), 1, ZAP_ATTRIBUTE_MASK(NULLABLE), ZAP_SIMPLE_DEFAULT(0x00) }, /* CarrierDetect */ \ - { 0x00000008, ZAP_TYPE(INT64U), 8, 0, ZAP_LONG_DEFAULTS_INDEX(343) }, /* TimeSinceReset */ \ - { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(351) }, /* FeatureMap */ \ - { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ + { 0x00000000, ZAP_TYPE(ENUM8), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ + ZAP_EMPTY_DEFAULT() }, /* PHYRate */ \ + { 0x00000001, ZAP_TYPE(BOOLEAN), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ + ZAP_EMPTY_DEFAULT() }, /* FullDuplex */ \ + { 0x00000002, ZAP_TYPE(INT64U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* PacketRxCount */ \ + { 0x00000003, ZAP_TYPE(INT64U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* PacketTxCount */ \ + { 0x00000004, ZAP_TYPE(INT64U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* TxErrCount */ \ + { 0x00000005, ZAP_TYPE(INT64U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* CollisionCount */ \ + { 0x00000006, ZAP_TYPE(INT64U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* OverrunCount */ \ + { 0x00000007, ZAP_TYPE(BOOLEAN), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ + ZAP_EMPTY_DEFAULT() }, /* CarrierDetect */ \ + { 0x00000008, ZAP_TYPE(INT64U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* TimeSinceReset */ \ + { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(303) }, /* FeatureMap */ \ + { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ \ /* Endpoint: 0, Cluster: AdministratorCommissioning (server) */ \ { 0x00000000, ZAP_TYPE(INT8U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* WindowStatus */ \ @@ -899,7 +867,7 @@ { 0x00004003, ZAP_TYPE(ENUM8), 1, \ ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ ZAP_MIN_MAX_DEFAULTS_INDEX(1) }, /* StartUpOnOff */ \ - { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(355) }, /* FeatureMap */ \ + { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(307) }, /* FeatureMap */ \ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(4) }, /* ClusterRevision */ \ \ /* Endpoint: 1, Cluster: Level Control (server) */ \ @@ -967,7 +935,7 @@ { 0x00000001, ZAP_TYPE(ENUM16), 2, 0, ZAP_EMPTY_DEFAULT() }, /* zone type */ \ { 0x00000002, ZAP_TYPE(BITMAP16), 2, 0, ZAP_SIMPLE_DEFAULT(0x0000) }, /* zone status */ \ { 0x00000010, ZAP_TYPE(NODE_ID), 8, ZAP_ATTRIBUTE_MASK(WRITABLE), \ - ZAP_LONG_DEFAULTS_INDEX(359) }, /* IAS CIE address */ \ + ZAP_LONG_DEFAULTS_INDEX(311) }, /* IAS CIE address */ \ { 0x00000011, ZAP_TYPE(INT8U), 1, 0, ZAP_SIMPLE_DEFAULT(0xff) }, /* Zone ID */ \ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(2) }, /* ClusterRevision */ \ \ @@ -979,16 +947,16 @@ { 0x00000000, ZAP_TYPE(BOOLEAN), 1, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_SIMPLE_DEFAULT(false) }, /* boolean */ \ { 0x00000001, ZAP_TYPE(BITMAP8), 1, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_SIMPLE_DEFAULT(0) }, /* bitmap8 */ \ { 0x00000002, ZAP_TYPE(BITMAP16), 2, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_SIMPLE_DEFAULT(0) }, /* bitmap16 */ \ - { 0x00000003, ZAP_TYPE(BITMAP32), 4, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_LONG_DEFAULTS_INDEX(367) }, /* bitmap32 */ \ - { 0x00000004, ZAP_TYPE(BITMAP64), 8, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_LONG_DEFAULTS_INDEX(371) }, /* bitmap64 */ \ + { 0x00000003, ZAP_TYPE(BITMAP32), 4, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_LONG_DEFAULTS_INDEX(319) }, /* bitmap32 */ \ + { 0x00000004, ZAP_TYPE(BITMAP64), 8, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_LONG_DEFAULTS_INDEX(323) }, /* bitmap64 */ \ { 0x00000005, ZAP_TYPE(INT8U), 1, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_SIMPLE_DEFAULT(0) }, /* int8u */ \ { 0x00000006, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_SIMPLE_DEFAULT(0) }, /* int16u */ \ - { 0x00000008, ZAP_TYPE(INT32U), 4, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_LONG_DEFAULTS_INDEX(379) }, /* int32u */ \ - { 0x0000000C, ZAP_TYPE(INT64U), 8, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_LONG_DEFAULTS_INDEX(383) }, /* int64u */ \ + { 0x00000008, ZAP_TYPE(INT32U), 4, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_LONG_DEFAULTS_INDEX(331) }, /* int32u */ \ + { 0x0000000C, ZAP_TYPE(INT64U), 8, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_LONG_DEFAULTS_INDEX(335) }, /* int64u */ \ { 0x0000000D, ZAP_TYPE(INT8S), 1, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_SIMPLE_DEFAULT(0) }, /* int8s */ \ { 0x0000000E, ZAP_TYPE(INT16S), 2, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_SIMPLE_DEFAULT(0) }, /* int16s */ \ - { 0x00000010, ZAP_TYPE(INT32S), 4, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_LONG_DEFAULTS_INDEX(391) }, /* int32s */ \ - { 0x00000014, ZAP_TYPE(INT64S), 8, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_LONG_DEFAULTS_INDEX(395) }, /* int64s */ \ + { 0x00000010, ZAP_TYPE(INT32S), 4, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_LONG_DEFAULTS_INDEX(343) }, /* int32s */ \ + { 0x00000014, ZAP_TYPE(INT64S), 8, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_LONG_DEFAULTS_INDEX(347) }, /* int64s */ \ { 0x00000015, ZAP_TYPE(ENUM8), 1, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_SIMPLE_DEFAULT(0) }, /* enum8 */ \ { 0x00000016, ZAP_TYPE(ENUM16), 2, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_SIMPLE_DEFAULT(0) }, /* enum16 */ \ { 0x00000019, ZAP_TYPE(OCTET_STRING), 11, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_EMPTY_DEFAULT() }, /* octet_string */ \ @@ -1258,7 +1226,7 @@ .clusterId = 0x00000028, \ .attributes = ZAP_ATTRIBUTE_INDEX(13), \ .attributeCount = 21, \ - .clusterSize = 39, \ + .clusterSize = 37, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ .functions = chipFuncArrayBasicServer, \ .acceptedCommandList = nullptr ,\ @@ -1390,7 +1358,7 @@ .clusterId = 0x00000037, \ .attributes = ZAP_ATTRIBUTE_INDEX(157), \ .attributeCount = 11, \ - .clusterSize = 57, \ + .clusterSize = 6, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ .functions = NULL, \ .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 29 ) ,\ @@ -1781,7 +1749,7 @@ // This is an array of EmberAfEndpointType structures. #define GENERATED_ENDPOINT_TYPES \ { \ - { ZAP_CLUSTER_INDEX(0), 21, 579 }, { ZAP_CLUSTER_INDEX(21), 27, 1186 }, { ZAP_CLUSTER_INDEX(48), 2, 3 }, \ + { ZAP_CLUSTER_INDEX(0), 21, 526 }, { ZAP_CLUSTER_INDEX(21), 27, 1186 }, { ZAP_CLUSTER_INDEX(48), 2, 3 }, \ } // Largest attribute size is needed for various buffers @@ -1790,10 +1758,10 @@ static_assert(ATTRIBUTE_LARGEST <= CHIP_CONFIG_MAX_ATTRIBUTE_STORE_ELEMENT_SIZE, "ATTRIBUTE_LARGEST larger than expected"); // Total size of singleton attributes -#define ATTRIBUTE_SINGLETONS_SIZE (39) +#define ATTRIBUTE_SINGLETONS_SIZE (37) // Total size of attribute storage -#define ATTRIBUTE_MAX_SIZE (1768) +#define ATTRIBUTE_MAX_SIZE (1715) // Number of fixed endpoints #define FIXED_ENDPOINT_COUNT (3) diff --git a/zzz_generated/window-app/zap-generated/endpoint_config.h b/zzz_generated/window-app/zap-generated/endpoint_config.h index 4c75f9e59dff72..2b8d2f79abccf3 100644 --- a/zzz_generated/window-app/zap-generated/endpoint_config.h +++ b/zzz_generated/window-app/zap-generated/endpoint_config.h @@ -250,35 +250,17 @@ \ /* Endpoint: 0, Cluster: Ethernet Network Diagnostics (server), big-endian */ \ \ - /* 315 - PacketRxCount, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 323 - PacketTxCount, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 331 - TxErrCount, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 339 - CollisionCount, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 347 - OverrunCount, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 355 - TimeSinceReset, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 363 - FeatureMap, */ \ + /* 315 - FeatureMap, */ \ 0x00, 0x00, 0x00, 0x03, \ \ /* Endpoint: 1, Cluster: Window Covering (server), big-endian */ \ \ - /* 367 - FeatureMap, */ \ + /* 319 - FeatureMap, */ \ 0x00, 0x00, 0x00, 0x17, \ \ /* Endpoint: 2, Cluster: Window Covering (server), big-endian */ \ \ - /* 371 - FeatureMap, */ \ + /* 323 - FeatureMap, */ \ 0x00, 0x00, 0x00, 0x17, \ } @@ -507,41 +489,23 @@ \ /* Endpoint: 0, Cluster: Ethernet Network Diagnostics (server), little-endian */ \ \ - /* 315 - PacketRxCount, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 323 - PacketTxCount, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 331 - TxErrCount, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 339 - CollisionCount, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 347 - OverrunCount, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 355 - TimeSinceReset, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - \ - /* 363 - FeatureMap, */ \ + /* 315 - FeatureMap, */ \ 0x03, 0x00, 0x00, 0x00, \ \ /* Endpoint: 1, Cluster: Window Covering (server), little-endian */ \ \ - /* 367 - FeatureMap, */ \ + /* 319 - FeatureMap, */ \ 0x17, 0x00, 0x00, 0x00, \ \ /* Endpoint: 2, Cluster: Window Covering (server), little-endian */ \ \ - /* 371 - FeatureMap, */ \ + /* 323 - FeatureMap, */ \ 0x17, 0x00, 0x00, 0x00, \ } #endif // BIGENDIAN_CPU -#define GENERATED_DEFAULTS_COUNT (76) +#define GENERATED_DEFAULTS_COUNT (70) #define ZAP_TYPE(type) ZCL_##type##_ATTRIBUTE_TYPE #define ZAP_LONG_DEFAULTS_INDEX(index) \ @@ -602,7 +566,8 @@ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ \ /* Endpoint: 0, Cluster: Basic (server) */ \ - { 0x00000000, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(SINGLETON), ZAP_SIMPLE_DEFAULT(10) }, /* DataModelRevision */ \ + { 0x00000000, ZAP_TYPE(INT16U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(SINGLETON), \ + ZAP_EMPTY_DEFAULT() }, /* DataModelRevision */ \ { 0x00000001, ZAP_TYPE(CHAR_STRING), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(SINGLETON), \ ZAP_EMPTY_DEFAULT() }, /* VendorName */ \ { 0x00000002, ZAP_TYPE(VENDOR_ID), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(SINGLETON), \ @@ -816,17 +781,20 @@ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ \ /* Endpoint: 0, Cluster: Ethernet Network Diagnostics (server) */ \ - { 0x00000000, ZAP_TYPE(ENUM8), 1, ZAP_ATTRIBUTE_MASK(NULLABLE), ZAP_EMPTY_DEFAULT() }, /* PHYRate */ \ - { 0x00000001, ZAP_TYPE(BOOLEAN), 1, ZAP_ATTRIBUTE_MASK(NULLABLE), ZAP_SIMPLE_DEFAULT(0x00) }, /* FullDuplex */ \ - { 0x00000002, ZAP_TYPE(INT64U), 8, 0, ZAP_LONG_DEFAULTS_INDEX(315) }, /* PacketRxCount */ \ - { 0x00000003, ZAP_TYPE(INT64U), 8, 0, ZAP_LONG_DEFAULTS_INDEX(323) }, /* PacketTxCount */ \ - { 0x00000004, ZAP_TYPE(INT64U), 8, 0, ZAP_LONG_DEFAULTS_INDEX(331) }, /* TxErrCount */ \ - { 0x00000005, ZAP_TYPE(INT64U), 8, 0, ZAP_LONG_DEFAULTS_INDEX(339) }, /* CollisionCount */ \ - { 0x00000006, ZAP_TYPE(INT64U), 8, 0, ZAP_LONG_DEFAULTS_INDEX(347) }, /* OverrunCount */ \ - { 0x00000007, ZAP_TYPE(BOOLEAN), 1, ZAP_ATTRIBUTE_MASK(NULLABLE), ZAP_SIMPLE_DEFAULT(0x00) }, /* CarrierDetect */ \ - { 0x00000008, ZAP_TYPE(INT64U), 8, 0, ZAP_LONG_DEFAULTS_INDEX(355) }, /* TimeSinceReset */ \ - { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(363) }, /* FeatureMap */ \ - { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ + { 0x00000000, ZAP_TYPE(ENUM8), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ + ZAP_EMPTY_DEFAULT() }, /* PHYRate */ \ + { 0x00000001, ZAP_TYPE(BOOLEAN), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ + ZAP_EMPTY_DEFAULT() }, /* FullDuplex */ \ + { 0x00000002, ZAP_TYPE(INT64U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* PacketRxCount */ \ + { 0x00000003, ZAP_TYPE(INT64U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* PacketTxCount */ \ + { 0x00000004, ZAP_TYPE(INT64U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* TxErrCount */ \ + { 0x00000005, ZAP_TYPE(INT64U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* CollisionCount */ \ + { 0x00000006, ZAP_TYPE(INT64U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* OverrunCount */ \ + { 0x00000007, ZAP_TYPE(BOOLEAN), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ + ZAP_EMPTY_DEFAULT() }, /* CarrierDetect */ \ + { 0x00000008, ZAP_TYPE(INT64U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* TimeSinceReset */ \ + { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(315) }, /* FeatureMap */ \ + { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ \ /* Endpoint: 0, Cluster: AdministratorCommissioning (server) */ \ { 0x00000000, ZAP_TYPE(INT8U), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* WindowStatus */ \ @@ -908,7 +876,7 @@ ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(TOKENIZE) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ ZAP_MIN_MAX_DEFAULTS_INDEX(1) }, /* Mode */ \ { 0x0000001A, ZAP_TYPE(BITMAP16), 2, 0, ZAP_SIMPLE_DEFAULT(0x0000) }, /* SafetyStatus */ \ - { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(367) }, /* FeatureMap */ \ + { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(319) }, /* FeatureMap */ \ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(5) }, /* ClusterRevision */ \ \ /* Endpoint: 2, Cluster: Descriptor (server) */ \ @@ -951,7 +919,7 @@ ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(TOKENIZE) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ ZAP_MIN_MAX_DEFAULTS_INDEX(2) }, /* Mode */ \ { 0x0000001A, ZAP_TYPE(BITMAP16), 2, 0, ZAP_SIMPLE_DEFAULT(0x0000) }, /* SafetyStatus */ \ - { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(371) }, /* FeatureMap */ \ + { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(323) }, /* FeatureMap */ \ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(5) }, /* ClusterRevision */ \ } @@ -1122,7 +1090,7 @@ .clusterId = 0x00000028, \ .attributes = ZAP_ATTRIBUTE_INDEX(11), \ .attributeCount = 21, \ - .clusterSize = 39, \ + .clusterSize = 37, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ .functions = chipFuncArrayBasicServer, \ .acceptedCommandList = nullptr ,\ @@ -1265,7 +1233,7 @@ .clusterId = 0x00000037, \ .attributes = ZAP_ATTRIBUTE_INDEX(168), \ .attributeCount = 11, \ - .clusterSize = 57, \ + .clusterSize = 6, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ .functions = NULL, \ .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 23 ) ,\ @@ -1392,7 +1360,7 @@ // This is an array of EmberAfEndpointType structures. #define GENERATED_ENDPOINT_TYPES \ { \ - { ZAP_CLUSTER_INDEX(0), 21, 663 }, { ZAP_CLUSTER_INDEX(21), 3, 40 }, { ZAP_CLUSTER_INDEX(24), 2, 35 }, \ + { ZAP_CLUSTER_INDEX(0), 21, 610 }, { ZAP_CLUSTER_INDEX(21), 3, 40 }, { ZAP_CLUSTER_INDEX(24), 2, 35 }, \ } // Largest attribute size is needed for various buffers @@ -1401,10 +1369,10 @@ static_assert(ATTRIBUTE_LARGEST <= CHIP_CONFIG_MAX_ATTRIBUTE_STORE_ELEMENT_SIZE, "ATTRIBUTE_LARGEST larger than expected"); // Total size of singleton attributes -#define ATTRIBUTE_SINGLETONS_SIZE (39) +#define ATTRIBUTE_SINGLETONS_SIZE (37) // Total size of attribute storage -#define ATTRIBUTE_MAX_SIZE (738) +#define ATTRIBUTE_MAX_SIZE (685) // Number of fixed endpoints #define FIXED_ENDPOINT_COUNT (3) From 5ecc0b3c13db872e8415384d727314751c23bf88 Mon Sep 17 00:00:00 2001 From: Tennessee Carmel-Veilleux Date: Mon, 25 Apr 2022 16:27:45 -0400 Subject: [PATCH 12/25] Fix bridge-app init (#17694) * Fix bridge-app init - Bridge app did not have proper CommissionableDataProvider init and nobody caught it until some testing weeks later. - This PR adds the necessary init calls and also refactors elements of the bridge app structure to prevent this from happening again. Fixes #15134 Testing done: - All unit tests pass - Cert tests pass - chip-bridge-app works and is commissionablen by chip-tool and chip-repl * Fix CI --- examples/bridge-app/linux/BUILD.gn | 2 +- examples/bridge-app/linux/Options.cpp | 83 -------------- examples/bridge-app/linux/include/Options.h | 40 ------- examples/bridge-app/linux/main.cpp | 47 ++++++-- examples/platform/linux/AppMain.cpp | 102 +++-------------- examples/platform/linux/BUILD.gn | 2 + .../platform/linux/CommissionableInit.cpp | 106 ++++++++++++++++++ examples/platform/linux/CommissionableInit.h | 51 +++++++++ 8 files changed, 211 insertions(+), 222 deletions(-) delete mode 100644 examples/bridge-app/linux/Options.cpp delete mode 100644 examples/bridge-app/linux/include/Options.h create mode 100644 examples/platform/linux/CommissionableInit.cpp create mode 100644 examples/platform/linux/CommissionableInit.h diff --git a/examples/bridge-app/linux/BUILD.gn b/examples/bridge-app/linux/BUILD.gn index 0f27218e003c55..eac94b9712c3db 100644 --- a/examples/bridge-app/linux/BUILD.gn +++ b/examples/bridge-app/linux/BUILD.gn @@ -22,13 +22,13 @@ executable("chip-bridge-app") { sources = [ "${chip_root}/examples/tv-app/tv-common/include/CHIPProjectAppConfig.h", "Device.cpp", - "Options.cpp", "include/Device.h", "main.cpp", ] deps = [ "${chip_root}/examples/bridge-app/bridge-common", + "${chip_root}/examples/platform/linux:app-main", "${chip_root}/src/lib", ] diff --git a/examples/bridge-app/linux/Options.cpp b/examples/bridge-app/linux/Options.cpp deleted file mode 100644 index e88133e45d86f7..00000000000000 --- a/examples/bridge-app/linux/Options.cpp +++ /dev/null @@ -1,83 +0,0 @@ -/* - * - * Copyright (c) 2021 Project CHIP Authors - * All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "Options.h" - -#include -#include - -using namespace chip; -using namespace chip::ArgParser; - -namespace { -LinuxDeviceOptions gDeviceOptions; - -// Follow the code style of command line arguments in case we need to add more options in the future. -enum -{ - kDeviceOption_BleDevice = 0x1000, -}; - -OptionDef sDeviceOptionDefs[] = { { "ble-device", kArgumentRequired, kDeviceOption_BleDevice }, {} }; - -const char * sDeviceOptionHelp = " --ble-device \n" - " The device number for CHIPoBLE, without 'hci' prefix, can be found by hciconfig.\n" - "\n"; - -bool HandleOption(const char * aProgram, OptionSet * aOptions, int aIdentifier, const char * aName, const char * aValue) -{ - bool retval = true; - - switch (aIdentifier) - { - - case kDeviceOption_BleDevice: - if (!ParseInt(aValue, LinuxDeviceOptions::GetInstance().mBleDevice)) - { - PrintArgError("%s: invalid value specified for ble device number: %s\n", aProgram, aValue); - retval = false; - } - break; - - default: - PrintArgError("%s: INTERNAL ERROR: Unhandled option: %s\n", aProgram, aName); - retval = false; - break; - } - - return (retval); -} - -OptionSet sDeviceOptions = { HandleOption, sDeviceOptionDefs, "GENERAL OPTIONS", sDeviceOptionHelp }; - -OptionSet * sLinuxDeviceOptionSets[] = { &sDeviceOptions, nullptr }; -} // namespace - -CHIP_ERROR ParseArguments(int argc, char * argv[]) -{ - if (!ParseArgs(argv[0], argc, argv, sLinuxDeviceOptionSets)) - { - return CHIP_ERROR_INVALID_ARGUMENT; - } - return CHIP_NO_ERROR; -} - -LinuxDeviceOptions & LinuxDeviceOptions::GetInstance() -{ - return gDeviceOptions; -} diff --git a/examples/bridge-app/linux/include/Options.h b/examples/bridge-app/linux/include/Options.h deleted file mode 100644 index 6d1d5165caeb82..00000000000000 --- a/examples/bridge-app/linux/include/Options.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * - * Copyright (c) 2020 Project CHIP Authors - * All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @file - * Support functions for parsing command-line arguments. - * - */ - -#pragma once - -#include - -#include -#include - -struct LinuxDeviceOptions -{ - chip::SetupPayload payload; - uint32_t mBleDevice = 0; - - static LinuxDeviceOptions & GetInstance(); -}; - -CHIP_ERROR ParseArguments(int argc, char * argv[]); diff --git a/examples/bridge-app/linux/main.cpp b/examples/bridge-app/linux/main.cpp index 02e92e87146693..a5ba5eb83f74c9 100644 --- a/examples/bridge-app/linux/main.cpp +++ b/examples/bridge-app/linux/main.cpp @@ -38,6 +38,7 @@ #include #include +#include "CommissionableInit.h" #include "Device.h" #include "Options.h" #include @@ -51,16 +52,21 @@ using namespace chip::Inet; using namespace chip::Transport; using namespace chip::DeviceLayer; -static const int kNodeLabelSize = 32; +namespace { + +const int kNodeLabelSize = 32; // Current ZCL implementation of Struct uses a max-size array of 254 bytes -static const int kDescriptorAttributeArraySize = 254; -static const int kFixedLabelAttributeArraySize = 254; +const int kDescriptorAttributeArraySize = 254; +const int kFixedLabelAttributeArraySize = 254; // Four attributes in descriptor cluster: DeviceTypeList, ServerList, ClientList, PartsList -static const int kFixedLabelElementsOctetStringSize = 16; +const int kFixedLabelElementsOctetStringSize = 16; + +EndpointId gCurrentEndpointId; +EndpointId gFirstDynamicEndpointId; +Device * gDevices[CHIP_DEVICE_CONFIG_DYNAMIC_ENDPOINT_COUNT]; -static EndpointId gCurrentEndpointId; -static EndpointId gFirstDynamicEndpointId; -static Device * gDevices[CHIP_DEVICE_CONFIG_DYNAMIC_ENDPOINT_COUNT]; +// To hold SPAKE2+ verifier, discriminator, passcode +LinuxCommissionableDataProvider gCommissionableDataProvider; // ENDPOINT DEFINITIONS: // ================================================================================= @@ -194,6 +200,8 @@ DECLARE_DYNAMIC_ENDPOINT(bridgedSwitchEndpoint, bridgedSwitchClusters); DataVersion gSwitch1DataVersions[ArraySize(bridgedSwitchClusters)]; DataVersion gSwitch2DataVersions[ArraySize(bridgedSwitchClusters)]; +} // namespace + // REVISION DEFINITIONS: // ================================================================================= @@ -653,22 +661,37 @@ int main(int argc, char * argv[]) err = chip::DeviceLayer::PlatformMgr().InitChipStack(); SuccessOrExit(err); + // Init the commissionable data provider based on command line options + // to handle custom verifiers, discriminators, etc. + err = chip::examples::InitCommissionableDataProvider(gCommissionableDataProvider, LinuxDeviceOptions::GetInstance()); + SuccessOrExit(err); + DeviceLayer::SetCommissionableDataProvider(&gCommissionableDataProvider); + + err = chip::examples::InitConfigurationManager(reinterpret_cast(ConfigurationMgr()), + LinuxDeviceOptions::GetInstance()); + SuccessOrExit(err); + err = PrintQRCodeContent(); SuccessOrExit(err); chip::DeviceLayer::PlatformMgrImpl().AddEventHandler(EventHandler, 0); - chip::DeviceLayer::ConnectivityMgr().SetBLEDeviceName(nullptr); // Use default device name (CHIP-XXXX) - #if CONFIG_NETWORK_LAYER_BLE + chip::DeviceLayer::ConnectivityMgr().SetBLEDeviceName(nullptr); // Use default device name (CHIP-XXXX) chip::DeviceLayer::Internal::BLEMgrImpl().ConfigureBle(LinuxDeviceOptions::GetInstance().mBleDevice, false); -#endif - chip::DeviceLayer::ConnectivityMgr().SetBLEAdvertisingEnabled(true); +#endif - // Init ZCL Data Model and CHIP App Server + // Init Data Model and CHIP App Server static chip::CommonCaseDeviceServerInitParams initParams; (void) initParams.InitializeStaticResourcesBeforeServerInit(); + +#if CHIP_DEVICE_ENABLE_PORT_PARAMS + // use a different service port to make testing possible with other sample devices running on same host + initParams.operationalServicePort = LinuxDeviceOptions::GetInstance().securedDevicePort; +#endif + + initParams.interfaceId = LinuxDeviceOptions::GetInstance().interfaceId; chip::Server::GetInstance().Init(initParams); // Initialize device attestation config diff --git a/examples/platform/linux/AppMain.cpp b/examples/platform/linux/AppMain.cpp index 0ada93be2049a9..08892c7afe4b2a 100644 --- a/examples/platform/linux/AppMain.cpp +++ b/examples/platform/linux/AppMain.cpp @@ -40,8 +40,6 @@ #include #include -#include -#include #if CHIP_DEVICE_CONFIG_ENABLE_BOTH_COMMISSIONER_AND_COMMISSIONEE #include "CommissionerMain.h" @@ -69,7 +67,7 @@ #include #include "AppMain.h" -#include "LinuxCommissionableDataProvider.h" +#include "CommissionableInit.h" using namespace chip; using namespace chip::ArgParser; @@ -162,80 +160,6 @@ void SetupSignalHandlers() signal(SIGINT, OnSignalHandler); } -CHIP_ERROR InitCommissionableDataProvider(LinuxCommissionableDataProvider & provider, LinuxDeviceOptions & options) -{ - chip::Optional setupPasscode; - - if (options.payload.setUpPINCode != 0) - { - setupPasscode.SetValue(options.payload.setUpPINCode); - } - else if (!options.spake2pVerifier.HasValue()) - { - uint32_t defaultTestPasscode = 0; - chip::DeviceLayer::TestOnlyCommissionableDataProvider TestOnlyCommissionableDataProvider; - VerifyOrDie(TestOnlyCommissionableDataProvider.GetSetupPasscode(defaultTestPasscode) == CHIP_NO_ERROR); - - ChipLogError(Support, - "*** WARNING: Using temporary passcode %u due to no neither --passcode or --spake2p-verifier-base64 " - "given on command line. This is temporary and will disappear. Please update your scripts " - "to explicitly configure onboarding credentials. ***", - static_cast(defaultTestPasscode)); - setupPasscode.SetValue(defaultTestPasscode); - options.payload.setUpPINCode = defaultTestPasscode; - } - else - { - // Passcode is 0, so will be ignored, and verifier will take over. Onboarding payload - // printed for debug will be invalid, but if the onboarding payload had been given - // properly to the commissioner later, PASE will succeed. - } - - if (options.discriminator.HasValue()) - { - options.payload.discriminator = options.discriminator.Value(); - } - else - { - uint16_t defaultTestDiscriminator = 0; - chip::DeviceLayer::TestOnlyCommissionableDataProvider TestOnlyCommissionableDataProvider; - VerifyOrDie(TestOnlyCommissionableDataProvider.GetSetupDiscriminator(defaultTestDiscriminator) == CHIP_NO_ERROR); - - ChipLogError(Support, - "*** WARNING: Using temporary test discriminator %u due to --discriminator not " - "given on command line. This is temporary and will disappear. Please update your scripts " - "to explicitly configure discriminator. ***", - static_cast(defaultTestDiscriminator)); - options.payload.discriminator = defaultTestDiscriminator; - } - - // Default to minimum PBKDF iterations - uint32_t spake2pIterationCount = chip::Crypto::kSpake2p_Min_PBKDF_Iterations; - if (options.spake2pIterations != 0) - { - spake2pIterationCount = options.spake2pIterations; - } - ChipLogError(Support, "PASE PBKDF iterations set to %u", static_cast(spake2pIterationCount)); - - return provider.Init(options.spake2pVerifier, options.spake2pSalt, spake2pIterationCount, setupPasscode, - options.payload.discriminator); -} - -CHIP_ERROR InitConfigurationManager(ConfigurationManagerImpl & configManager, LinuxDeviceOptions & options) -{ - if (options.payload.vendorID != 0) - { - configManager.StoreVendorId(options.payload.vendorID); - } - - if (options.payload.productID != 0) - { - configManager.StoreProductId(options.payload.productID); - } - - return CHIP_NO_ERROR; -} - void Cleanup() { #if CHIP_CONFIG_TRANSPORT_TRACE_ENABLED @@ -305,12 +229,12 @@ int ChipLinuxAppInit(int argc, char ** argv, OptionSet * customOptions) // Init the commissionable data provider based on command line options // to handle custom verifiers, discriminators, etc. - err = InitCommissionableDataProvider(gCommissionableDataProvider, LinuxDeviceOptions::GetInstance()); + err = chip::examples::InitCommissionableDataProvider(gCommissionableDataProvider, LinuxDeviceOptions::GetInstance()); SuccessOrExit(err); DeviceLayer::SetCommissionableDataProvider(&gCommissionableDataProvider); - err = InitConfigurationManager(reinterpret_cast(ConfigurationMgr()), - LinuxDeviceOptions::GetInstance()); + err = chip::examples::InitConfigurationManager(reinterpret_cast(ConfigurationMgr()), + LinuxDeviceOptions::GetInstance()); SuccessOrExit(err); err = GetSetupPayload(LinuxDeviceOptions::GetInstance().payload, rendezvousFlags); @@ -318,15 +242,21 @@ int ChipLinuxAppInit(int argc, char ** argv, OptionSet * customOptions) ConfigurationMgr().LogDeviceConfig(); - PrintOnboardingCodes(LinuxDeviceOptions::GetInstance().payload); + { + ChipLogProgress(NotSpecified, "==== Onboarding payload for Standard Commissioning Flow ===="); + PrintOnboardingCodes(LinuxDeviceOptions::GetInstance().payload); + } - // For testing of manual pairing code with custom commissioning flow - err = GetSetupPayload(LinuxDeviceOptions::GetInstance().payload, rendezvousFlags); - SuccessOrExit(err); + { + // For testing of manual pairing code with custom commissioning flow + ChipLogProgress(NotSpecified, "==== Onboarding payload for Custom Commissioning Flows ===="); + err = GetSetupPayload(LinuxDeviceOptions::GetInstance().payload, rendezvousFlags); + SuccessOrExit(err); - LinuxDeviceOptions::GetInstance().payload.commissioningFlow = chip::CommissioningFlow::kCustom; + LinuxDeviceOptions::GetInstance().payload.commissioningFlow = chip::CommissioningFlow::kCustom; - PrintOnboardingCodes(LinuxDeviceOptions::GetInstance().payload); + PrintOnboardingCodes(LinuxDeviceOptions::GetInstance().payload); + } #if defined(PW_RPC_ENABLED) rpc::Init(); diff --git a/examples/platform/linux/BUILD.gn b/examples/platform/linux/BUILD.gn index 4cb3655e74ee51..d1be2f256b53a5 100644 --- a/examples/platform/linux/BUILD.gn +++ b/examples/platform/linux/BUILD.gn @@ -27,6 +27,8 @@ source_set("app-main") { sources = [ "AppMain.cpp", "AppMain.h", + "CommissionableInit.cpp", + "CommissionableInit.h", "CommissioneeShellCommands.cpp", "CommissioneeShellCommands.h", "CommissionerMain.cpp", diff --git a/examples/platform/linux/CommissionableInit.cpp b/examples/platform/linux/CommissionableInit.cpp new file mode 100644 index 00000000000000..8bb9ed90f42924 --- /dev/null +++ b/examples/platform/linux/CommissionableInit.cpp @@ -0,0 +1,106 @@ +/* + * + * Copyright (c) 2022 Project CHIP Authors + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include +#include +#include + +#include "CommissionableInit.h" + +namespace chip { +namespace examples { + +using namespace chip::DeviceLayer; + +CHIP_ERROR InitCommissionableDataProvider(LinuxCommissionableDataProvider & provider, LinuxDeviceOptions & options) +{ + chip::Optional setupPasscode; + + if (options.payload.setUpPINCode != 0) + { + setupPasscode.SetValue(options.payload.setUpPINCode); + } + else if (!options.spake2pVerifier.HasValue()) + { + uint32_t defaultTestPasscode = 0; + chip::DeviceLayer::TestOnlyCommissionableDataProvider TestOnlyCommissionableDataProvider; + VerifyOrDie(TestOnlyCommissionableDataProvider.GetSetupPasscode(defaultTestPasscode) == CHIP_NO_ERROR); + + ChipLogError(Support, + "*** WARNING: Using temporary passcode %u due to no neither --passcode or --spake2p-verifier-base64 " + "given on command line. This is temporary and will disappear. Please update your scripts " + "to explicitly configure onboarding credentials. ***", + static_cast(defaultTestPasscode)); + setupPasscode.SetValue(defaultTestPasscode); + options.payload.setUpPINCode = defaultTestPasscode; + } + else + { + // Passcode is 0, so will be ignored, and verifier will take over. Onboarding payload + // printed for debug will be invalid, but if the onboarding payload had been given + // properly to the commissioner later, PASE will succeed. + } + + if (options.discriminator.HasValue()) + { + options.payload.discriminator = options.discriminator.Value(); + } + else + { + uint16_t defaultTestDiscriminator = 0; + chip::DeviceLayer::TestOnlyCommissionableDataProvider TestOnlyCommissionableDataProvider; + VerifyOrDie(TestOnlyCommissionableDataProvider.GetSetupDiscriminator(defaultTestDiscriminator) == CHIP_NO_ERROR); + + ChipLogError(Support, + "*** WARNING: Using temporary test discriminator %u due to --discriminator not " + "given on command line. This is temporary and will disappear. Please update your scripts " + "to explicitly configure discriminator. ***", + static_cast(defaultTestDiscriminator)); + options.payload.discriminator = defaultTestDiscriminator; + } + + // Default to minimum PBKDF iterations + uint32_t spake2pIterationCount = chip::Crypto::kSpake2p_Min_PBKDF_Iterations; + if (options.spake2pIterations != 0) + { + spake2pIterationCount = options.spake2pIterations; + } + ChipLogError(Support, "PASE PBKDF iterations set to %u", static_cast(spake2pIterationCount)); + + return provider.Init(options.spake2pVerifier, options.spake2pSalt, spake2pIterationCount, setupPasscode, + options.payload.discriminator); +} + +CHIP_ERROR InitConfigurationManager(ConfigurationManagerImpl & configManager, LinuxDeviceOptions & options) +{ + if (options.payload.vendorID != 0) + { + configManager.StoreVendorId(options.payload.vendorID); + } + + if (options.payload.productID != 0) + { + configManager.StoreProductId(options.payload.productID); + } + + return CHIP_NO_ERROR; +} + +} // namespace examples +} // namespace chip diff --git a/examples/platform/linux/CommissionableInit.h b/examples/platform/linux/CommissionableInit.h new file mode 100644 index 00000000000000..61d63e42dcce60 --- /dev/null +++ b/examples/platform/linux/CommissionableInit.h @@ -0,0 +1,51 @@ +/* + * + * Copyright (c) 2022 Project CHIP Authors + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include "LinuxCommissionableDataProvider.h" +#include "Options.h" +#include +#include +#include + +namespace chip { +namespace examples { + +/** + * @brief Initialize a LinuxCommissionableDataProvider from Linux common command-line + * options. Handles verifier, passcode, discriminator, etc. + * + * @param provider - provider to initialize from command line arguments + * @param options - LinuxDeviceOptions instance configured via command-line parsing + * @return CHIP_NO_ERROR on success or another CHIP_ERROR value on internal validation errors (likely fatal) + */ +CHIP_ERROR InitCommissionableDataProvider(LinuxCommissionableDataProvider & provider, LinuxDeviceOptions & options); + +/** + * @brief Initialize a Linux ConfigurationManagerImpl to reflect some command-line configured + * values such as VendorID/ProductID + * + * @param configManager - Linux-specific configuration manager to update + * @param options - LinuxDeviceOptions instance configured via command-line parsing + * @return CHIP_NO_ERROR on success or another CHIP_ERROR value on internal validation errors (likely fatal) + */ +CHIP_ERROR InitConfigurationManager(chip::DeviceLayer::ConfigurationManagerImpl & configManager, LinuxDeviceOptions & options); + +} // namespace examples +} // namespace chip From 736f4b3e1c574b3b50fd640325c0dcd761dba630 Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Mon, 25 Apr 2022 16:59:25 -0400 Subject: [PATCH 13/25] Set up a network commissioning cluster in linux lock-app. (#17663) * Set up a network commissioning cluster in linux lock-app. If we have thread or wifi, use them to set up a network commissioning cluster. * Address review comments --- examples/lock-app/linux/main.cpp | 40 +++++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) diff --git a/examples/lock-app/linux/main.cpp b/examples/lock-app/linux/main.cpp index 5f7f27c7d9d96e..ecb712e74e20dd 100644 --- a/examples/lock-app/linux/main.cpp +++ b/examples/lock-app/linux/main.cpp @@ -17,8 +17,46 @@ */ #include "AppMain.h" +#include +#include -void ApplicationInit() {} +using namespace chip; +using namespace chip::app; + +namespace { +// We support either thread or wi-fi commissioning, not both. Prefer thread if +// both are available. +#if CHIP_DEVICE_LAYER_TARGET_LINUX && CHIP_DEVICE_CONFIG_ENABLE_THREAD +DeviceLayer::NetworkCommissioning::LinuxThreadDriver sNetworkCommissioningDriver; +Clusters::NetworkCommissioning::Instance sNetworkCommissioningInstance(0, &sNetworkCommissioningDriver); + +void InitNetworkCommissioning() +{ + sNetworkCommissioningInstance.Init(); +} + +#elif CHIP_DEVICE_CONFIG_ENABLE_WPA + +DeviceLayer::NetworkCommissioning::LinuxWiFiDriver sNetworkCommissioningDriver; +Clusters::NetworkCommissioning::Instance sNetworkCommissioningInstance(0, &sNetworkCommissioningDriver); + +void InitNetworkCommissioning() +{ + sNetworkCommissioningInstance.Init(); +} + +#else // !CHIP_DEVICE_CONFIG_ENABLE_WPA && !(CHIP_DEVICE_LAYER_TARGET_LINUX && CHIP_DEVICE_CONFIG_ENABLE_THREAD) + +void InitNetworkCommissioning() {} + +#endif // (CHIP_DEVICE_LAYER_TARGET_LINUX && CHIP_DEVICE_CONFIG_ENABLE_THREAD) || CHIP_DEVICE_CONFIG_ENABLE_WPA + +} // anonymous namespace + +void ApplicationInit() +{ + InitNetworkCommissioning(); +} int main(int argc, char * argv[]) { From f4a1e92350f7647e6664922761a59df9220499de Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Mon, 25 Apr 2022 17:23:54 -0400 Subject: [PATCH 14/25] Align commissionable instance name behavior between minimal and platform advertising. (#17703) * Align commissionable instance name behavior between minimal and platform advertising. Before this change, platform dns-sd generated a commissionable instance name once, at boot. If you then commissioned the device and opened a new commissioning window it would keep advertising the instance name it advertised originally. On the other hand, minimal dns-sd generated a new instance name any time we updated anything about advertising. In particular, a failed commissioning attempt would lead to advertising with a different instance name, as part of the same commissioning window. After these changes we create a new instance name at init time, and whenever the commissioning window is opened (whether automatically or via the administrator commissioning commands). * Address review comment. --- src/app/server/CommissioningWindowManager.cpp | 2 ++ src/lib/dnssd/Advertiser.h | 9 +++++- src/lib/dnssd/Advertiser_ImplMinimalMdns.cpp | 28 ++++++++++++++++--- src/lib/dnssd/Discovery_ImplPlatform.cpp | 13 +++++++-- src/lib/dnssd/Discovery_ImplPlatform.h | 3 +- 5 files changed, 46 insertions(+), 9 deletions(-) diff --git a/src/app/server/CommissioningWindowManager.cpp b/src/app/server/CommissioningWindowManager.cpp index 8e9d6627f847b6..455337c5de8d9a 100644 --- a/src/app/server/CommissioningWindowManager.cpp +++ b/src/app/server/CommissioningWindowManager.cpp @@ -188,6 +188,8 @@ CHIP_ERROR CommissioningWindowManager::OpenCommissioningWindow(Seconds16 commiss DeviceLayer::FailSafeContext & failSafeContext = DeviceLayer::DeviceControlServer::DeviceControlSvr().GetFailSafeContext(); VerifyOrReturnError(!failSafeContext.IsFailSafeArmed(), CHIP_ERROR_INCORRECT_STATE); + ReturnErrorOnFailure(Dnssd::ServiceAdvertiser::Instance().UpdateCommissionableInstanceName()); + ReturnErrorOnFailure(DeviceLayer::SystemLayer().StartTimer(commissioningTimeout, HandleCommissioningWindowTimeout, this)); mCommissioningTimeoutTimerArmed = true; diff --git a/src/lib/dnssd/Advertiser.h b/src/lib/dnssd/Advertiser.h index bf6900acdda5b2..d99d4864ec1302 100644 --- a/src/lib/dnssd/Advertiser.h +++ b/src/lib/dnssd/Advertiser.h @@ -333,7 +333,14 @@ class ServiceAdvertiser /** * Returns the commissionable node service instance name formatted as hex string. */ - virtual CHIP_ERROR GetCommissionableInstanceName(char * instanceName, size_t maxLength) = 0; + virtual CHIP_ERROR GetCommissionableInstanceName(char * instanceName, size_t maxLength) const = 0; + + /** + * Generates an updated commissionable instance name. This happens + * automatically when Init() is called, but may be needed at other times as + * well. + */ + virtual CHIP_ERROR UpdateCommissionableInstanceName() = 0; /// Provides the system-wide implementation of the service advertiser static ServiceAdvertiser & Instance(); diff --git a/src/lib/dnssd/Advertiser_ImplMinimalMdns.cpp b/src/lib/dnssd/Advertiser_ImplMinimalMdns.cpp index 3f9d5a433a08e6..7a27f8738ba8dc 100644 --- a/src/lib/dnssd/Advertiser_ImplMinimalMdns.cpp +++ b/src/lib/dnssd/Advertiser_ImplMinimalMdns.cpp @@ -178,7 +178,8 @@ class AdvertiserMinMdns : public ServiceAdvertiser, CHIP_ERROR Advertise(const OperationalAdvertisingParameters & params) override; CHIP_ERROR Advertise(const CommissionAdvertisingParameters & params) override; CHIP_ERROR FinalizeServiceUpdate() override { return CHIP_NO_ERROR; } - CHIP_ERROR GetCommissionableInstanceName(char * instanceName, size_t maxLength) override; + CHIP_ERROR GetCommissionableInstanceName(char * instanceName, size_t maxLength) const override; + CHIP_ERROR UpdateCommissionableInstanceName() override; // MdnsPacketDelegate void OnMdnsPacketData(const BytesRange & data, const chip::Inet::IPPacketInfo * info) override; @@ -275,6 +276,8 @@ class AdvertiserMinMdns : public ServiceAdvertiser, ResponseSender mResponseSender; uint8_t mCommissionableInstanceName[sizeof(uint64_t)]; + bool mIsInitialized = false; + // current request handling const chip::Inet::IPPacketInfo * mCurrentSource = nullptr; uint32_t mMessageId = 0; @@ -319,10 +322,16 @@ void AdvertiserMinMdns::OnQuery(const QueryData & data) CHIP_ERROR AdvertiserMinMdns::Init(chip::Inet::EndPointManager * udpEndPointManager) { + // TODO: Per API documentation, Init() should be a no-op if mIsInitialized + // is true. But we don't handle updates to our set of interfaces right now, + // so rely on the logic in this function to shut down and restart the + // GlobalMinimalMdnsServer to handle that. GlobalMinimalMdnsServer::Server().Shutdown(); - uint64_t random_instance_name = chip::Crypto::GetRandU64(); - memcpy(&mCommissionableInstanceName[0], &random_instance_name, sizeof(mCommissionableInstanceName)); + if (!mIsInitialized) + { + UpdateCommissionableInstanceName(); + } // Re-set the server in the response sender in case this has been swapped in the // GlobalMinimalMdnsServer (used for testing). @@ -334,12 +343,15 @@ CHIP_ERROR AdvertiserMinMdns::Init(chip::Inet::EndPointManager Date: Mon, 25 Apr 2022 17:24:48 -0400 Subject: [PATCH 15/25] Use the stored on off attribute state to initialize led state (#17704) --- examples/lighting-app/efr32/src/AppTask.cpp | 2 -- .../lighting-app/efr32/src/LightingManager.cpp | 13 ++++++++++++- src/app/clusters/on-off-server/on-off-server.cpp | 14 ++++++++++++++ src/app/clusters/on-off-server/on-off-server.h | 1 + 4 files changed, 27 insertions(+), 3 deletions(-) diff --git a/examples/lighting-app/efr32/src/AppTask.cpp b/examples/lighting-app/efr32/src/AppTask.cpp index 21f47ad76072e4..c61198b6954ce9 100644 --- a/examples/lighting-app/efr32/src/AppTask.cpp +++ b/examples/lighting-app/efr32/src/AppTask.cpp @@ -279,8 +279,6 @@ CHIP_ERROR AppTask::Init() sLightLED.Init(LIGHT_LED); sLightLED.Set(LightMgr().IsLightOn()); - chip::DeviceLayer::PlatformMgr().ScheduleWork(UpdateClusterState, reinterpret_cast(nullptr)); - ConfigurationMgr().LogDeviceConfig(); // Print setup info on LCD if available diff --git a/examples/lighting-app/efr32/src/LightingManager.cpp b/examples/lighting-app/efr32/src/LightingManager.cpp index 7b206fd1ab6f37..3857a0d50e7fe5 100644 --- a/examples/lighting-app/efr32/src/LightingManager.cpp +++ b/examples/lighting-app/efr32/src/LightingManager.cpp @@ -23,6 +23,11 @@ #include "AppTask.h" #include +#include + +using namespace chip; +using namespace ::chip::DeviceLayer; + LightingManager LightingManager::sLight; TimerHandle_t sLightTimer; @@ -43,7 +48,13 @@ CHIP_ERROR LightingManager::Init() return APP_ERROR_CREATE_TIMER_FAILED; } - mState = kState_OffCompleted; + bool currentLedState; + // read current on/off value on endpoint one. + chip::DeviceLayer::PlatformMgr().LockChipStack(); + OnOffServer::Instance().getOnOffValue(1, ¤tLedState); + chip::DeviceLayer::PlatformMgr().UnlockChipStack(); + + mState = currentLedState ? kState_OnCompleted : kState_OffCompleted; mAutoTurnOffTimerArmed = false; mAutoTurnOff = false; mAutoTurnOffDuration = 0; diff --git a/src/app/clusters/on-off-server/on-off-server.cpp b/src/app/clusters/on-off-server/on-off-server.cpp index 54eafddc6cf118..96ccf644d89e2e 100644 --- a/src/app/clusters/on-off-server/on-off-server.cpp +++ b/src/app/clusters/on-off-server/on-off-server.cpp @@ -86,6 +86,20 @@ bool OnOffServer::HasFeature(chip::EndpointId endpoint, OnOffFeature feature) return success ? ((featureMap & to_underlying(feature)) != 0) : false; } +EmberAfStatus OnOffServer::getOnOffValue(chip::EndpointId endpoint, bool * currentOnOffValue) +{ + // read current on/off value + EmberAfStatus status = Attributes::OnOff::Get(endpoint, currentOnOffValue); + if (status != EMBER_ZCL_STATUS_SUCCESS) + { + emberAfOnOffClusterPrintln("ERR: reading on/off %x", status); + } + + emberAfOnOffClusterPrintln("On/Off ep%d value: %d", endpoint, *currentOnOffValue); + + return status; +} + /** @brief On/off Cluster Set Value * * This function is called when the on/off value needs to be set, either through diff --git a/src/app/clusters/on-off-server/on-off-server.h b/src/app/clusters/on-off-server/on-off-server.h index 0bab9ea4df97d8..a91588015bca9a 100644 --- a/src/app/clusters/on-off-server/on-off-server.h +++ b/src/app/clusters/on-off-server/on-off-server.h @@ -58,6 +58,7 @@ class OnOffServer bool OnWithTimedOffCommand(const chip::app::ConcreteCommandPath & commandPath, const chip::app::Clusters::OnOff::Commands::OnWithTimedOff::DecodableType & commandData); void updateOnOffTimeCommand(chip::EndpointId endpoint); + EmberAfStatus getOnOffValue(chip::EndpointId endpoint, bool * currentOnOffValue); EmberAfStatus setOnOffValue(chip::EndpointId endpoint, uint8_t command, bool initiatedByLevelChange); EmberAfStatus getOnOffValueForStartUp(chip::EndpointId endpoint, bool & onOffValueForStartUp); From 1520662ed867adee06163857fc3480d403ae7344 Mon Sep 17 00:00:00 2001 From: Michael Spang Date: Mon, 25 Apr 2022 17:57:28 -0400 Subject: [PATCH 16/25] Remove TI_SIMPLELINK_SDK_ROOT from persistent-storage docs (#17709) This variable is not used since bbbf7cec7 ("Add CC13X2_26X2 to github C/I (#16638)"). Remove it from the readme. --- examples/persistent-storage/cc13x2x7_26x2x7/README.md | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/examples/persistent-storage/cc13x2x7_26x2x7/README.md b/examples/persistent-storage/cc13x2x7_26x2x7/README.md index c07fd6b3864f54..dc97d434c0deea 100644 --- a/examples/persistent-storage/cc13x2x7_26x2x7/README.md +++ b/examples/persistent-storage/cc13x2x7_26x2x7/README.md @@ -141,16 +141,14 @@ Ninja to build the executable. - Run the build to produce a default executable. By default on Linux both the TI SimpleLink SDK and Sysconfig are located in a `ti` folder in the user's home directory, and you must provide the absolute path to them. For example - `/home/username/ti/simplelink_cc13xx_cc26xx_sdk_5_30_03_01_eng` and - `/home/username/ti/sysconfig_1.10.0`. On Windows the default directory is + `/home/username/ti/sysconfig_1.11.0`. On Windows the default directory is `C:\ti`. Take note of this install path, as it will be used in the next step. ``` $ cd ~/connectedhomeip/examples/lock-app/cc13x2x7_26x2x7 - $ export TI_SIMPLELINK_SDK_ROOT=$HOME/ti/simplelink_cc13xx_cc26xx_sdk_5_30_03_01_eng $ export TI_SYSCONFIG_ROOT=$HOME/ti/sysconfig_1.10.0 - $ gn gen out/debug --args="ti_simplelink_sdk_root=\"${TI_SIMPLELINK_SDK_ROOT}\" ti_sysconfig_root=\"${TI_SYSCONFIG_ROOT}\"" + $ gn gen out/debug --args="ti_sysconfig_root=\"${TI_SYSCONFIG_ROOT}\"" $ ninja -C out/debug ``` From 5ab3439e1809199c844fb35e46736a82daf2ea56 Mon Sep 17 00:00:00 2001 From: Jeff Tung <100387939+jtung-apple@users.noreply.github.com> Date: Mon, 25 Apr 2022 16:55:44 -0700 Subject: [PATCH 17/25] Darwin framework: add replacement subscribe method that includes event report (#17436) * Issue 16691 - implement event subscription for darwin * Address handlers nullability and subscriptionEstablished comment clarity --- .../Framework/CHIP.xcodeproj/project.pbxproj | 8 + src/darwin/Framework/CHIP/BUILD.gn | 1 + src/darwin/Framework/CHIP/CHIPDevice.h | 66 +- src/darwin/Framework/CHIP/CHIPDevice.mm | 204 +- .../CHIP/CHIPEventTLVValueDecoder_Internal.h | 32 + .../CHIPEventTLVValueDecoder-src.zapt | 69 + .../CHIP/templates/CHIPStructsObjc-src.zapt | 16 + .../CHIP/templates/CHIPStructsObjc.zapt | 11 + .../Framework/CHIP/templates/templates.json | 5 + .../zap-generated/CHIPEventTLVValueDecoder.mm | 2171 +++++++++++++++++ .../CHIP/zap-generated/CHIPStructsObjc.h | 251 ++ .../CHIP/zap-generated/CHIPStructsObjc.mm | 1106 +++++++-- 12 files changed, 3691 insertions(+), 249 deletions(-) create mode 100644 src/darwin/Framework/CHIP/CHIPEventTLVValueDecoder_Internal.h create mode 100644 src/darwin/Framework/CHIP/templates/CHIPEventTLVValueDecoder-src.zapt create mode 100644 src/darwin/Framework/CHIP/zap-generated/CHIPEventTLVValueDecoder.mm diff --git a/src/darwin/Framework/CHIP.xcodeproj/project.pbxproj b/src/darwin/Framework/CHIP.xcodeproj/project.pbxproj index bdb0dd574dff34..3b397fba31441e 100644 --- a/src/darwin/Framework/CHIP.xcodeproj/project.pbxproj +++ b/src/darwin/Framework/CHIP.xcodeproj/project.pbxproj @@ -67,6 +67,8 @@ 5ACDDD7D27CD16D200EFD68A /* CHIPAttributeCacheContainer.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5ACDDD7C27CD16D200EFD68A /* CHIPAttributeCacheContainer.mm */; }; 5ACDDD7E27CD3F3A00EFD68A /* CHIPAttributeCacheContainer_Internal.h in Headers */ = {isa = PBXBuildFile; fileRef = 5ACDDD7B27CD14AF00EFD68A /* CHIPAttributeCacheContainer_Internal.h */; }; 5AE6D4E427A99041001F2493 /* CHIPDeviceTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 5AE6D4E327A99041001F2493 /* CHIPDeviceTests.m */; }; + 754F3DF427FBB94B00E60580 /* CHIPEventTLVValueDecoder_Internal.h in Headers */ = {isa = PBXBuildFile; fileRef = 754F3DF327FBB94B00E60580 /* CHIPEventTLVValueDecoder_Internal.h */; }; + 7560FD1C27FBBD3F005E85B3 /* CHIPEventTLVValueDecoder.mm in Sources */ = {isa = PBXBuildFile; fileRef = 7560FD1B27FBBD3F005E85B3 /* CHIPEventTLVValueDecoder.mm */; }; 88EBF8CE27FABDD500686BC1 /* CHIPDeviceAttestationDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 88EBF8CB27FABDD500686BC1 /* CHIPDeviceAttestationDelegate.h */; settings = {ATTRIBUTES = (Public, ); }; }; 88EBF8CF27FABDD500686BC1 /* CHIPDeviceAttestationDelegateBridge.mm in Sources */ = {isa = PBXBuildFile; fileRef = 88EBF8CC27FABDD500686BC1 /* CHIPDeviceAttestationDelegateBridge.mm */; }; 88EBF8D027FABDD500686BC1 /* CHIPDeviceAttestationDelegateBridge.h in Headers */ = {isa = PBXBuildFile; fileRef = 88EBF8CD27FABDD500686BC1 /* CHIPDeviceAttestationDelegateBridge.h */; }; @@ -170,6 +172,8 @@ 5ACDDD7B27CD14AF00EFD68A /* CHIPAttributeCacheContainer_Internal.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CHIPAttributeCacheContainer_Internal.h; sourceTree = ""; }; 5ACDDD7C27CD16D200EFD68A /* CHIPAttributeCacheContainer.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = CHIPAttributeCacheContainer.mm; sourceTree = ""; }; 5AE6D4E327A99041001F2493 /* CHIPDeviceTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CHIPDeviceTests.m; sourceTree = ""; }; + 754F3DF327FBB94B00E60580 /* CHIPEventTLVValueDecoder_Internal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CHIPEventTLVValueDecoder_Internal.h; sourceTree = ""; }; + 7560FD1B27FBBD3F005E85B3 /* CHIPEventTLVValueDecoder.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = CHIPEventTLVValueDecoder.mm; path = "zap-generated/CHIPEventTLVValueDecoder.mm"; sourceTree = ""; }; 88EBF8CB27FABDD500686BC1 /* CHIPDeviceAttestationDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CHIPDeviceAttestationDelegate.h; sourceTree = ""; }; 88EBF8CC27FABDD500686BC1 /* CHIPDeviceAttestationDelegateBridge.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = CHIPDeviceAttestationDelegateBridge.mm; sourceTree = ""; }; 88EBF8CD27FABDD500686BC1 /* CHIPDeviceAttestationDelegateBridge.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CHIPDeviceAttestationDelegateBridge.h; sourceTree = ""; }; @@ -240,6 +244,7 @@ isa = PBXGroup; children = ( 513DDB892761F6F900DAA01A /* CHIPAttributeTLVValueDecoder.mm */, + 7560FD1B27FBBD3F005E85B3 /* CHIPEventTLVValueDecoder.mm */, 51B22C292740CB47008D5055 /* CHIPCommandPayloadsObjc.mm */, 51B22C252740CB32008D5055 /* CHIPStructsObjc.mm */, 51B22C212740CB1D008D5055 /* CHIPCommandPayloadsObjc.h */, @@ -285,6 +290,7 @@ 88EBF8CD27FABDD500686BC1 /* CHIPDeviceAttestationDelegateBridge.h */, 88EBF8CC27FABDD500686BC1 /* CHIPDeviceAttestationDelegateBridge.mm */, 513DDB852761F69300DAA01A /* CHIPAttributeTLVValueDecoder_Internal.h */, + 754F3DF327FBB94B00E60580 /* CHIPEventTLVValueDecoder_Internal.h */, 1ED276E326C5832500547A89 /* CHIPCluster.h */, 1ED276E126C5812A00547A89 /* CHIPCluster.mm */, 2C5EEEF4268A85C400CAE3D3 /* CHIPDeviceConnectionBridge.h */, @@ -399,6 +405,7 @@ 88EBF8CE27FABDD500686BC1 /* CHIPDeviceAttestationDelegate.h in Headers */, 2C222AD0255C620600E446B9 /* CHIPDevice.h in Headers */, 991DC0842475F45400C13860 /* CHIPDeviceController.h in Headers */, + 754F3DF427FBB94B00E60580 /* CHIPEventTLVValueDecoder_Internal.h in Headers */, B2E0D7B2245B0B5C003C5B48 /* CHIPManualSetupPayloadParser.h in Headers */, B2E0D7B1245B0B5C003C5B48 /* CHIP.h in Headers */, B2E0D7B8245B0B5C003C5B48 /* CHIPSetupPayload.h in Headers */, @@ -577,6 +584,7 @@ 5A6FEC9027B563D900F25F42 /* CHIPDeviceControllerOverXPC.m in Sources */, B289D4222639C0D300D4E314 /* CHIPOnboardingPayloadParser.m in Sources */, 2C1B027A2641DB4E00780EF1 /* CHIPOperationalCredentialsDelegate.mm in Sources */, + 7560FD1C27FBBD3F005E85B3 /* CHIPEventTLVValueDecoder.mm in Sources */, B2E0D7B9245B0B5C003C5B48 /* CHIPSetupPayload.mm in Sources */, B2E0D7B6245B0B5C003C5B48 /* CHIPManualSetupPayloadParser.mm in Sources */, 88EBF8CF27FABDD500686BC1 /* CHIPDeviceAttestationDelegateBridge.mm in Sources */, diff --git a/src/darwin/Framework/CHIP/BUILD.gn b/src/darwin/Framework/CHIP/BUILD.gn index 6bef8a79a0bb66..78074c7cefe257 100644 --- a/src/darwin/Framework/CHIP/BUILD.gn +++ b/src/darwin/Framework/CHIP/BUILD.gn @@ -72,6 +72,7 @@ static_library("framework") { "zap-generated/CHIPClustersObjc.mm", "zap-generated/CHIPCommandPayloadsObjc.h", "zap-generated/CHIPCommandPayloadsObjc.mm", + "zap-generated/CHIPEventTLVValueDecoder.mm", "zap-generated/CHIPStructsObjc.h", "zap-generated/CHIPStructsObjc.mm", ] diff --git a/src/darwin/Framework/CHIP/CHIPDevice.h b/src/darwin/Framework/CHIP/CHIPDevice.h index f321beb9287246..83bd6b2d4d2c2f 100644 --- a/src/darwin/Framework/CHIP/CHIPDevice.h +++ b/src/darwin/Framework/CHIP/CHIPDevice.h @@ -121,7 +121,7 @@ extern NSString * const kCHIPArrayValueType; * to reportHandler. Note that if the CHIPSubscribeParams are set to * automatically resubscribe this can end up being called more than once. * - * TODO: The "all events" part does not work yet. + * TODO: Remove this once the replacement below is adopted */ - (void)subscribeWithQueue:(dispatch_queue_t)queue minInterval:(uint16_t)minInterval @@ -131,6 +131,47 @@ extern NSString * const kCHIPArrayValueType; reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler subscriptionEstablished:(nullable void (^)(void))subscriptionEstablishedHandler; +/** + * Subscribe to receive attribute reports for everything (all endpoints, all + * clusters, all attributes, all events) on the device. + * + * A non-nil attribute cache container will cache attribute values, retrievable + * through the designated attribute cache container. + * + * attributeReportHandler will be called any time a data update is available (with a + * non-nil "value") + * + * The array passed to attributeReportHandler will contain CHIPAttributeReport + * instances. Errors for specific paths, not the whole subscription, will be + * reported via those objects. + * + * eventReportHandler will be called any time an event is reported (with a + * non-nil "value") + * + * The array passed to eventReportHandler will contain CHIPEventReport + * instances. Errors for specific paths, not the whole subscription, will be + * reported via those objects. + * + * errorHandler will be called any time there is an error for the + * entire subscription (with a non-nil "error"), and terminate the subscription. + * + * Both report handlers are not supported over XPC at the moment. + * + * subscriptionEstablished block, if not nil, will be called once the + * subscription is established. This will be _after_ the first (priming) call + * to both report handlers. Note that if the CHIPSubscribeParams are set to + * automatically resubscribe this can end up being called more than once. + */ +- (void)subscribeWithQueue:(dispatch_queue_t)queue + minInterval:(uint16_t)minInterval + maxInterval:(uint16_t)maxInterval + params:(nullable CHIPSubscribeParams *)params + cacheContainer:(CHIPAttributeCacheContainer * _Nullable)attributeCacheContainer + attributeReportHandler:(void (^)(NSArray * value))attributeReportHandler + eventReportHandler:(void (^)(NSArray * value))eventReportHandler + errorHandler:(void (^)(NSError * error))errorHandler + subscriptionEstablished:(nullable void (^)(void))subscriptionEstablishedHandler; + /** * Read attribute in a designated attribute path */ @@ -219,6 +260,17 @@ extern NSString * const kCHIPArrayValueType; + (instancetype)new NS_UNAVAILABLE; @end +@interface CHIPEventPath : NSObject +@property (nonatomic, readonly, strong, nonnull) NSNumber * endpoint; +@property (nonatomic, readonly, strong, nonnull) NSNumber * cluster; +@property (nonatomic, readonly, strong, nonnull) NSNumber * event; + ++ (instancetype)eventPathWithEndpointId:(NSNumber *)endpoint clusterId:(NSNumber *)clusterId eventId:(NSNumber *)eventId; + +- (instancetype)init NS_UNAVAILABLE; ++ (instancetype)new NS_UNAVAILABLE; +@end + @interface CHIPCommandPath : NSObject @property (nonatomic, readonly, strong, nonnull) NSNumber * endpoint; @property (nonatomic, readonly, strong, nonnull) NSNumber * cluster; @@ -240,6 +292,18 @@ extern NSString * const kCHIPArrayValueType; @property (nonatomic, readonly, strong, nullable) NSError * error; @end +@interface CHIPEventReport : NSObject +@property (nonatomic, readonly, strong, nonnull) CHIPEventPath * path; +@property (nonatomic, readonly, strong, nonnull) NSNumber * eventNumber; // chip::EventNumber type (uint64_t) +@property (nonatomic, readonly, strong, nonnull) NSNumber * priority; // chip::app::PriorityLevel type (uint8_t) +@property (nonatomic, readonly, strong, nonnull) NSNumber * timestamp; // chip::app::Timestamp.mValue type (uint64_t) +@property (nonatomic, readonly, strong, nullable) id value; +// If this specific path resulted in an error, the error (in the +// MatterInteractionErrorDomain or CHIPErrorDomain) that corresponds to this +// path. +@property (nonatomic, readonly, strong, nullable) NSError * error; +@end + NS_ASSUME_NONNULL_END #endif /* CHIP_DEVICE_H */ diff --git a/src/darwin/Framework/CHIP/CHIPDevice.mm b/src/darwin/Framework/CHIP/CHIPDevice.mm index b8800aca7d2f6d..ad578503b914c8 100644 --- a/src/darwin/Framework/CHIP/CHIPDevice.mm +++ b/src/darwin/Framework/CHIP/CHIPDevice.mm @@ -21,6 +21,7 @@ #import "CHIPCluster.h" #import "CHIPDevice_Internal.h" #import "CHIPError_Internal.h" +#import "CHIPEventTLVValueDecoder_Internal.h" #import "CHIPLogging.h" #include "app/ConcreteAttributePath.h" #include "app/ConcreteCommandPath.h" @@ -76,6 +77,15 @@ @interface CHIPAttributeReport () - (instancetype)initWithPath:(const ConcreteDataAttributePath &)path value:(nullable id)value error:(nullable NSError *)error; @end +@interface CHIPEventReport () +- (instancetype)initWithPath:(const ConcreteEventPath &)path + eventNumber:(NSNumber *)eventNumber + priority:(NSNumber *)priority + timestamp:(NSNumber *)timestamp + value:(nullable id)value + error:(nullable NSError *)error; +@end + @interface CHIPReadClientContainer : NSObject @property (nonatomic, readwrite) app::ReadClient * readClientPtr; @property (nonatomic, readwrite) app::AttributePathParams * pathParams; @@ -235,24 +245,31 @@ - (instancetype)initWithDevice:(chip::DeviceProxy *)device } typedef void (^ReportCallback)(NSArray * _Nullable value, NSError * _Nullable error); +typedef void (^DataReportCallback)(NSArray * value); +typedef void (^ErrorCallback)(NSError * error); namespace { class SubscriptionCallback final : public ClusterStateCache::Callback { public: - SubscriptionCallback(dispatch_queue_t queue, ReportCallback reportCallback, - SubscriptionEstablishedHandler _Nullable subscriptionEstablishedHandler) + SubscriptionCallback(dispatch_queue_t queue, DataReportCallback attributeReportCallback, DataReportCallback eventReportCallback, + ErrorCallback errorCallback, SubscriptionEstablishedHandler _Nullable subscriptionEstablishedHandler) : mQueue(queue) - , mReportCallback(reportCallback) + , mAttributeReportCallback(attributeReportCallback) + , mEventReportCallback(eventReportCallback) + , mErrorCallback(errorCallback) , mSubscriptionEstablishedHandler(subscriptionEstablishedHandler) , mBufferedReadAdapter(*this) { } - SubscriptionCallback(dispatch_queue_t queue, ReportCallback reportCallback, - SubscriptionEstablishedHandler _Nullable subscriptionEstablishedHandler, void (^onDoneHandler)(void)) + SubscriptionCallback(dispatch_queue_t queue, DataReportCallback attributeReportCallback, DataReportCallback eventReportCallback, + ErrorCallback errorCallback, SubscriptionEstablishedHandler _Nullable subscriptionEstablishedHandler, + void (^onDoneHandler)(void)) : mQueue(queue) - , mReportCallback(reportCallback) + , mAttributeReportCallback(attributeReportCallback) + , mEventReportCallback(eventReportCallback) + , mErrorCallback(errorCallback) , mSubscriptionEstablishedHandler(subscriptionEstablishedHandler) , mBufferedReadAdapter(*this) , mOnDoneHandler(onDoneHandler) @@ -270,6 +287,8 @@ - (instancetype)initWithDevice:(chip::DeviceProxy *)device void OnReportEnd() override; + void OnEventData(const EventHeader & aEventHeader, TLV::TLVReader * apData, const StatusIB * apStatus) override; + void OnAttributeData(const ConcreteDataAttributePath & aPath, TLV::TLVReader * apData, const StatusIB & aStatus) override; void OnError(CHIP_ERROR aError) override; @@ -286,12 +305,15 @@ - (instancetype)initWithDevice:(chip::DeviceProxy *)device private: dispatch_queue_t mQueue; - // We set mReportCallback to nil when queueing error reports, so we + DataReportCallback _Nullable mAttributeReportCallback = nil; + DataReportCallback _Nullable mEventReportCallback = nil; + // We set mErrorCallback to nil when queueing error reports, so we // make sure to only report one error. - ReportCallback _Nullable mReportCallback = nil; + ErrorCallback _Nullable mErrorCallback = nil; SubscriptionEstablishedHandler _Nullable mSubscriptionEstablishedHandler; BufferedReadCallback mBufferedReadAdapter; - NSMutableArray * _Nullable mReports = nil; + NSMutableArray * _Nullable mAttributeReports = nil; + NSMutableArray * _Nullable mEventReports = nil; // Our lifetime management is a little complicated. On error we // attempt to delete the ReadClient, but asynchronously. While @@ -301,7 +323,7 @@ - (instancetype)initWithDevice:(chip::DeviceProxy *)device // // To handle this, enforce the following rules: // - // 1) We guarantee that mReportCallback is only invoked with an error once. + // 1) We guarantee that mErrorCallback is only invoked with an error once. // 2) We ensure that we delete ourselves and the passed in ReadClient only from OnDone or a queued-up // error callback, but not both, by tracking whether we have a queued-up // deletion. @@ -320,22 +342,52 @@ - (void)subscribeWithQueue:(dispatch_queue_t)queue cacheContainer:(CHIPAttributeCacheContainer * _Nullable)attributeCacheContainer reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler subscriptionEstablished:(nullable void (^)(void))subscriptionEstablishedHandler +{ + [self subscribeWithQueue:queue + minInterval:minInterval + maxInterval:maxInterval + params:params + cacheContainer:attributeCacheContainer + attributeReportHandler:^(NSArray * _Nullable value) { + reportHandler(value, nil); + } + eventReportHandler:^(NSArray * _Nullable value) { + ; // do nothing + } + errorHandler:^(NSError * _Nullable error) { + reportHandler(nil, error); + } + subscriptionEstablished:subscriptionEstablishedHandler]; +} + +- (void)subscribeWithQueue:(dispatch_queue_t)queue + minInterval:(uint16_t)minInterval + maxInterval:(uint16_t)maxInterval + params:(nullable CHIPSubscribeParams *)params + cacheContainer:(CHIPAttributeCacheContainer * _Nullable)attributeCacheContainer + attributeReportHandler:(void (^)(NSArray * value))attributeReportHandler + eventReportHandler:(void (^)(NSArray * value))eventReportHandler + errorHandler:(void (^)(NSError * error))errorHandler + subscriptionEstablished:(nullable void (^)(void))subscriptionEstablishedHandler { DeviceProxy * device = [self internalDevice]; if (!device) { dispatch_async(queue, ^{ - reportHandler(nil, [CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]); + errorHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]); }); return; } - // Wildcard endpoint, cluster, attribute. + // Wildcard endpoint, cluster, attribute, event. auto attributePath = std::make_unique(); + auto eventPath = std::make_unique(); ReadPrepareParams readParams(device->GetSecureSession().Value()); readParams.mMinIntervalFloorSeconds = minInterval; readParams.mMaxIntervalCeilingSeconds = maxInterval; readParams.mpAttributePathParamsList = attributePath.get(); readParams.mAttributePathParamsListSize = 1; + readParams.mpEventPathParamsList = eventPath.get(); + readParams.mEventPathParamsListSize = 1; readParams.mKeepSubscriptions = (params != nil) && (params.keepPreviousSubscriptions != nil) && [params.keepPreviousSubscriptions boolValue]; @@ -344,17 +396,19 @@ - (void)subscribeWithQueue:(dispatch_queue_t)queue std::unique_ptr attributeCache; if (attributeCacheContainer) { __weak CHIPAttributeCacheContainer * weakPtr = attributeCacheContainer; - callback = std::make_unique(queue, reportHandler, subscriptionEstablishedHandler, ^{ - CHIPAttributeCacheContainer * container = weakPtr; - if (container) { - container.cppAttributeCache = nullptr; - } - }); + callback = std::make_unique( + queue, attributeReportHandler, eventReportHandler, errorHandler, subscriptionEstablishedHandler, ^{ + CHIPAttributeCacheContainer * container = weakPtr; + if (container) { + container.cppAttributeCache = nullptr; + } + }); attributeCache = std::make_unique(*callback.get()); readClient = std::make_unique(InteractionModelEngine::GetInstance(), device->GetExchangeManager(), attributeCache->GetBufferedCallback(), ReadClient::InteractionType::Subscribe); } else { - callback = std::make_unique(queue, reportHandler, subscriptionEstablishedHandler); + callback = std::make_unique( + queue, attributeReportHandler, eventReportHandler, errorHandler, subscriptionEstablishedHandler); readClient = std::make_unique(InteractionModelEngine::GetInstance(), device->GetExchangeManager(), callback->GetBufferedCallback(), ReadClient::InteractionType::Subscribe); } @@ -365,12 +419,13 @@ - (void)subscribeWithQueue:(dispatch_queue_t)queue } else { // SendAutoResubscribeRequest cleans up the params, even on failure. attributePath.release(); + eventPath.release(); err = readClient->SendAutoResubscribeRequest(std::move(readParams)); } if (err != CHIP_NO_ERROR) { dispatch_async(queue, ^{ - reportHandler(nil, [CHIPError errorForCHIPErrorCode:err]); + errorHandler([CHIPError errorForCHIPErrorCode:err]); }); return; @@ -1259,6 +1314,26 @@ ConcreteDataAttributePath path(static_cast([endpoint unsignedS } @end +@implementation CHIPEventPath +- (instancetype)initWithPath:(const ConcreteEventPath &)path +{ + if (self = [super init]) { + _endpoint = @(path.mEndpointId); + _cluster = @(path.mClusterId); + _event = @(path.mEventId); + } + return self; +} + ++ (instancetype)eventPathWithEndpointId:(NSNumber *)endpoint clusterId:(NSNumber *)clusterId eventId:(NSNumber *)eventId +{ + ConcreteEventPath path(static_cast([endpoint unsignedShortValue]), + static_cast([clusterId unsignedLongValue]), static_cast([eventId unsignedLongValue])); + + return [[CHIPEventPath alloc] initWithPath:path]; +} +@end + @implementation CHIPCommandPath - (instancetype)initWithPath:(const ConcreteCommandPath &)path { @@ -1291,21 +1366,88 @@ - (instancetype)initWithPath:(const ConcreteDataAttributePath &)path value:(null } @end +@implementation CHIPEventReport +- (instancetype)initWithPath:(const ConcreteEventPath &)path + eventNumber:(NSNumber *)eventNumber + priority:(NSNumber *)priority + timestamp:(NSNumber *)timestamp + value:(nullable id)value + error:(nullable NSError *)error +{ + if (self = [super init]) { + _path = [[CHIPEventPath alloc] initWithPath:path]; + _eventNumber = eventNumber; + _priority = priority; + _timestamp = timestamp; + _value = value; + _error = error; + } + return self; +} +@end + namespace { -void SubscriptionCallback::OnReportBegin() { mReports = [NSMutableArray new]; } +void SubscriptionCallback::OnReportBegin() +{ + mAttributeReports = [NSMutableArray new]; + mEventReports = [NSMutableArray new]; +} void SubscriptionCallback::OnReportEnd() { - __block NSArray * reports = mReports; - mReports = nil; - if (mReportCallback) { + __block NSArray * attributeReports = mAttributeReports; + mAttributeReports = nil; + __block NSArray * eventReports = mEventReports; + mEventReports = nil; + if (mAttributeReportCallback && attributeReports.count) { dispatch_async(mQueue, ^{ - mReportCallback(reports, nil); + mAttributeReportCallback(attributeReports); + }); + } + if (mEventReportCallback && eventReports.count) { + dispatch_async(mQueue, ^{ + mEventReportCallback(eventReports); }); } // Else we have a pending error already. } +void SubscriptionCallback::OnEventData(const EventHeader & aEventHeader, TLV::TLVReader * apData, const StatusIB * apStatus) +{ + id _Nullable value = nil; + NSError * _Nullable error = nil; + if (apStatus != nullptr) { + error = [CHIPError errorForIMStatus:*apStatus]; + } else if (apData == nullptr) { + error = [CHIPError errorForCHIPErrorCode:CHIP_ERROR_INVALID_ARGUMENT]; + } else { + CHIP_ERROR err; + value = CHIPDecodeEventPayload(aEventHeader.mPath, *apData, &err); + if (err == CHIP_ERROR_IM_MALFORMED_EVENT_PATH) { + // We don't know this event; just skip it. + return; + } + + if (err != CHIP_NO_ERROR) { + value = nil; + error = [CHIPError errorForCHIPErrorCode:err]; + } + } + + if (mEventReports == nil) { + // Never got a OnReportBegin? Not much to do other than tear things down. + ReportError(CHIP_ERROR_INCORRECT_STATE); + return; + } + + [mEventReports addObject:[[CHIPEventReport alloc] initWithPath:aEventHeader.mPath + eventNumber:@(aEventHeader.mEventNumber) + priority:@((uint8_t) aEventHeader.mPriorityLevel) + timestamp:@(aEventHeader.mTimestamp.mValue) + value:value + error:error]]; +} + void SubscriptionCallback::OnAttributeData( const ConcreteDataAttributePath & aPath, TLV::TLVReader * apData, const StatusIB & aStatus) { @@ -1334,13 +1476,13 @@ - (instancetype)initWithPath:(const ConcreteDataAttributePath &)path value:(null } } - if (mReports == nil) { + if (mAttributeReports == nil) { // Never got a OnReportBegin? Not much to do other than tear things down. ReportError(CHIP_ERROR_INCORRECT_STATE); return; } - [mReports addObject:[[CHIPAttributeReport alloc] initWithPath:aPath value:value error:error]]; + [mAttributeReports addObject:[[CHIPAttributeReport alloc] initWithPath:aPath value:value error:error]]; } void SubscriptionCallback::OnError(CHIP_ERROR aError) { ReportError([CHIPError errorForCHIPErrorCode:aError]); } @@ -1401,13 +1543,15 @@ - (instancetype)initWithPath:(const ConcreteDataAttributePath &)path value:(null return; } - __block ReportCallback callback = mReportCallback; + __block ErrorCallback callback = mErrorCallback; __block auto * myself = this; - mReportCallback = nil; + mErrorCallback = nil; + mAttributeReportCallback = nil; + mEventReportCallback = nil; __auto_type onDoneHandler = mOnDoneHandler; mOnDoneHandler = nil; dispatch_async(mQueue, ^{ - callback(nil, err); + callback(err); if (onDoneHandler) { onDoneHandler(); } diff --git a/src/darwin/Framework/CHIP/CHIPEventTLVValueDecoder_Internal.h b/src/darwin/Framework/CHIP/CHIPEventTLVValueDecoder_Internal.h new file mode 100644 index 00000000000000..91f0c7a798e924 --- /dev/null +++ b/src/darwin/Framework/CHIP/CHIPEventTLVValueDecoder_Internal.h @@ -0,0 +1,32 @@ +/* + * + * Copyright (c) 2021 Project CHIP Authors + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#import + +#include +#include +#include +#include + +NS_ASSUME_NONNULL_BEGIN + +id CHIPDecodeEventPayload(const chip::app::ConcreteEventPath & aPath, chip::TLV::TLVReader & aReader, CHIP_ERROR * aError); + +NS_ASSUME_NONNULL_END diff --git a/src/darwin/Framework/CHIP/templates/CHIPEventTLVValueDecoder-src.zapt b/src/darwin/Framework/CHIP/templates/CHIPEventTLVValueDecoder-src.zapt new file mode 100644 index 00000000000000..b3676bf41e9167 --- /dev/null +++ b/src/darwin/Framework/CHIP/templates/CHIPEventTLVValueDecoder-src.zapt @@ -0,0 +1,69 @@ +{{> header}} + +#import "CHIPEventTLVValueDecoder_Internal.h" + +#import "CHIPStructsObjc.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace chip; +using namespace chip::app; + +id CHIPDecodeEventPayload(const ConcreteEventPath & aPath, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + switch (aPath.mClusterId) + { + {{#chip_client_clusters}} + case Clusters::{{asUpperCamelCase name}}::Id: { + using namespace Clusters::{{asUpperCamelCase name}}; + switch (aPath.mEventId) + { + {{#zcl_events}} + {{#zcl_event_fields}} + {{/zcl_event_fields}} + + case Events::{{asUpperCamelCase name}}::Id: { + Events::{{asUpperCamelCase name}}::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) + { + return nil; + } + + CHIP{{asUpperCamelCase parent.name}}Cluster{{asUpperCamelCase name}}Event *value = [CHIP{{asUpperCamelCase parent.name}}Cluster{{asUpperCamelCase name}}Event new]; + + {{#zcl_event_fields}} + do { + {{asObjectiveCType type parent.parent.name}} memberValue; + {{>decode_value target="memberValue" source=(concat "cppValue." (asLowerCamelCase name)) cluster=parent.parent.name errorCode="*aError = err; return nil;" depth=0}} + value.{{asStructPropertyName name}} = memberValue; + } while(0); + {{/zcl_event_fields}} + + return value; + } + + {{/zcl_events}} + + default: + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH; + break; + } + break; + } + {{/chip_client_clusters}} + default: { + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH; + break; + } + } + return nil; +} diff --git a/src/darwin/Framework/CHIP/templates/CHIPStructsObjc-src.zapt b/src/darwin/Framework/CHIP/templates/CHIPStructsObjc-src.zapt index d5d4c5ceed3ff3..8467b429ad650e 100644 --- a/src/darwin/Framework/CHIP/templates/CHIPStructsObjc-src.zapt +++ b/src/darwin/Framework/CHIP/templates/CHIPStructsObjc-src.zapt @@ -19,6 +19,22 @@ NS_ASSUME_NONNULL_BEGIN @end {{/zcl_structs}} + +{{#zcl_events}} +@implementation CHIP{{asUpperCamelCase parent.name}}Cluster{{asUpperCamelCase name}}Event +- (instancetype)init +{ + if (self = [super init]) { + {{#zcl_event_fields}} + {{>init_struct_member label=name type=type cluster=parent.parent.name}} + {{/zcl_event_fields}} + } + return self; +} +@end + +{{/zcl_events}} + {{/zcl_clusters}} NS_ASSUME_NONNULL_END diff --git a/src/darwin/Framework/CHIP/templates/CHIPStructsObjc.zapt b/src/darwin/Framework/CHIP/templates/CHIPStructsObjc.zapt index 92c7b7fef07a01..edf1bd35e402c6 100644 --- a/src/darwin/Framework/CHIP/templates/CHIPStructsObjc.zapt +++ b/src/darwin/Framework/CHIP/templates/CHIPStructsObjc.zapt @@ -19,6 +19,17 @@ NS_ASSUME_NONNULL_BEGIN @end {{/zcl_structs}} + +{{#zcl_events}} +@interface CHIP{{asUpperCamelCase parent.name}}Cluster{{asUpperCamelCase name}}Event : NSObject +{{#zcl_event_fields}} +@property (strong, nonatomic{{#unless (isStrEqual (asGetterName name) (asStructPropertyName name))}}, getter={{asGetterName name}}{{/unless}}) {{asObjectiveCType type parent.parent.name}} {{asStructPropertyName name}}; +{{/zcl_event_fields}} +@end + +{{/zcl_events}} + + {{/zcl_clusters}} NS_ASSUME_NONNULL_END diff --git a/src/darwin/Framework/CHIP/templates/templates.json b/src/darwin/Framework/CHIP/templates/templates.json index 3c5ff6bc85f91f..88c738ce8d2a19 100644 --- a/src/darwin/Framework/CHIP/templates/templates.json +++ b/src/darwin/Framework/CHIP/templates/templates.json @@ -101,6 +101,11 @@ "path": "CHIPAttributeTLVValueDecoder-src.zapt", "name": "Decode TLV attribute values into Objc objects", "output": "src/darwin/Framework/CHIP/zap-generated/CHIPAttributeTLVValueDecoder.mm" + }, + { + "path": "CHIPEventTLVValueDecoder-src.zapt", + "name": "Decode TLV event values into Objc objects", + "output": "src/darwin/Framework/CHIP/zap-generated/CHIPEventTLVValueDecoder.mm" } ] } diff --git a/src/darwin/Framework/CHIP/zap-generated/CHIPEventTLVValueDecoder.mm b/src/darwin/Framework/CHIP/zap-generated/CHIPEventTLVValueDecoder.mm new file mode 100644 index 00000000000000..5d3c55fe6103d5 --- /dev/null +++ b/src/darwin/Framework/CHIP/zap-generated/CHIPEventTLVValueDecoder.mm @@ -0,0 +1,2171 @@ +/* + * + * Copyright (c) 2022 Project CHIP Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// THIS FILE IS GENERATED BY ZAP + +#import "CHIPEventTLVValueDecoder_Internal.h" + +#import "CHIPStructsObjc.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace chip; +using namespace chip::app; + +id CHIPDecodeEventPayload(const ConcreteEventPath & aPath, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + switch (aPath.mClusterId) { + case Clusters::AccessControl::Id: { + using namespace Clusters::AccessControl; + switch (aPath.mEventId) { + + case Events::AccessControlEntryChanged::Id: { + Events::AccessControlEntryChanged::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + + CHIPAccessControlClusterAccessControlEntryChangedEvent * value = + [CHIPAccessControlClusterAccessControlEntryChangedEvent new]; + + do { + NSNumber * _Nullable memberValue; + if (cppValue.adminNodeID.IsNull()) { + memberValue = nil; + } else { + memberValue = [NSNumber numberWithUnsignedLongLong:cppValue.adminNodeID.Value()]; + } + value.adminNodeID = memberValue; + } while (0); + do { + NSNumber * _Nullable memberValue; + if (cppValue.adminPasscodeID.IsNull()) { + memberValue = nil; + } else { + memberValue = [NSNumber numberWithUnsignedShort:cppValue.adminPasscodeID.Value()]; + } + value.adminPasscodeID = memberValue; + } while (0); + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.changeType)]; + value.changeType = memberValue; + } while (0); + do { + CHIPAccessControlClusterAccessControlEntry * _Nullable memberValue; + if (cppValue.latestValue.IsNull()) { + memberValue = nil; + } else { + memberValue = [CHIPAccessControlClusterAccessControlEntry new]; + memberValue.privilege = + [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.latestValue.Value().privilege)]; + memberValue.authMode = + [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.latestValue.Value().authMode)]; + if (cppValue.latestValue.Value().subjects.IsNull()) { + memberValue.subjects = nil; + } else { + { // Scope for our temporary variables + auto * array_3 = [NSMutableArray new]; + auto iter_3 = cppValue.latestValue.Value().subjects.Value().begin(); + while (iter_3.Next()) { + auto & entry_3 = iter_3.GetValue(); + NSNumber * newElement_3; + newElement_3 = [NSNumber numberWithUnsignedLongLong:entry_3]; + [array_3 addObject:newElement_3]; + } + CHIP_ERROR err = iter_3.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + memberValue.subjects = array_3; + } + } + if (cppValue.latestValue.Value().targets.IsNull()) { + memberValue.targets = nil; + } else { + { // Scope for our temporary variables + auto * array_3 = [NSMutableArray new]; + auto iter_3 = cppValue.latestValue.Value().targets.Value().begin(); + while (iter_3.Next()) { + auto & entry_3 = iter_3.GetValue(); + CHIPAccessControlClusterTarget * newElement_3; + newElement_3 = [CHIPAccessControlClusterTarget new]; + if (entry_3.cluster.IsNull()) { + newElement_3.cluster = nil; + } else { + newElement_3.cluster = [NSNumber numberWithUnsignedInt:entry_3.cluster.Value()]; + } + if (entry_3.endpoint.IsNull()) { + newElement_3.endpoint = nil; + } else { + newElement_3.endpoint = [NSNumber numberWithUnsignedShort:entry_3.endpoint.Value()]; + } + if (entry_3.deviceType.IsNull()) { + newElement_3.deviceType = nil; + } else { + newElement_3.deviceType = [NSNumber numberWithUnsignedInt:entry_3.deviceType.Value()]; + } + [array_3 addObject:newElement_3]; + } + CHIP_ERROR err = iter_3.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + memberValue.targets = array_3; + } + } + memberValue.fabricIndex = [NSNumber numberWithUnsignedChar:cppValue.latestValue.Value().fabricIndex]; + } + value.latestValue = memberValue; + } while (0); + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedChar:cppValue.adminFabricIndex]; + value.adminFabricIndex = memberValue; + } while (0); + + return value; + } + + case Events::AccessControlExtensionChanged::Id: { + Events::AccessControlExtensionChanged::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + + CHIPAccessControlClusterAccessControlExtensionChangedEvent * value = + [CHIPAccessControlClusterAccessControlExtensionChangedEvent new]; + + do { + NSNumber * _Nullable memberValue; + if (cppValue.adminNodeID.IsNull()) { + memberValue = nil; + } else { + memberValue = [NSNumber numberWithUnsignedLongLong:cppValue.adminNodeID.Value()]; + } + value.adminNodeID = memberValue; + } while (0); + do { + NSNumber * _Nullable memberValue; + if (cppValue.adminPasscodeID.IsNull()) { + memberValue = nil; + } else { + memberValue = [NSNumber numberWithUnsignedShort:cppValue.adminPasscodeID.Value()]; + } + value.adminPasscodeID = memberValue; + } while (0); + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.changeType)]; + value.changeType = memberValue; + } while (0); + do { + CHIPAccessControlClusterExtensionEntry * _Nullable memberValue; + if (cppValue.latestValue.IsNull()) { + memberValue = nil; + } else { + memberValue = [CHIPAccessControlClusterExtensionEntry new]; + memberValue.data = [NSData dataWithBytes:cppValue.latestValue.Value().data.data() + length:cppValue.latestValue.Value().data.size()]; + memberValue.fabricIndex = [NSNumber numberWithUnsignedChar:cppValue.latestValue.Value().fabricIndex]; + } + value.latestValue = memberValue; + } while (0); + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedChar:cppValue.adminFabricIndex]; + value.adminFabricIndex = memberValue; + } while (0); + + return value; + } + + default: + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH; + break; + } + break; + } + case Clusters::AccountLogin::Id: { + using namespace Clusters::AccountLogin; + switch (aPath.mEventId) { + + default: + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH; + break; + } + break; + } + case Clusters::AdministratorCommissioning::Id: { + using namespace Clusters::AdministratorCommissioning; + switch (aPath.mEventId) { + + default: + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH; + break; + } + break; + } + case Clusters::ApplicationBasic::Id: { + using namespace Clusters::ApplicationBasic; + switch (aPath.mEventId) { + + default: + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH; + break; + } + break; + } + case Clusters::ApplicationLauncher::Id: { + using namespace Clusters::ApplicationLauncher; + switch (aPath.mEventId) { + + default: + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH; + break; + } + break; + } + case Clusters::AudioOutput::Id: { + using namespace Clusters::AudioOutput; + switch (aPath.mEventId) { + + default: + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH; + break; + } + break; + } + case Clusters::BarrierControl::Id: { + using namespace Clusters::BarrierControl; + switch (aPath.mEventId) { + + default: + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH; + break; + } + break; + } + case Clusters::Basic::Id: { + using namespace Clusters::Basic; + switch (aPath.mEventId) { + + case Events::StartUp::Id: { + Events::StartUp::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + + CHIPBasicClusterStartUpEvent * value = [CHIPBasicClusterStartUpEvent new]; + + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedInt:cppValue.softwareVersion]; + value.softwareVersion = memberValue; + } while (0); + + return value; + } + + case Events::ShutDown::Id: { + Events::ShutDown::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + + CHIPBasicClusterShutDownEvent * value = [CHIPBasicClusterShutDownEvent new]; + + return value; + } + + case Events::Leave::Id: { + Events::Leave::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + + CHIPBasicClusterLeaveEvent * value = [CHIPBasicClusterLeaveEvent new]; + + return value; + } + + case Events::ReachableChanged::Id: { + Events::ReachableChanged::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + + CHIPBasicClusterReachableChangedEvent * value = [CHIPBasicClusterReachableChangedEvent new]; + + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithBool:cppValue.reachableNewValue]; + value.reachableNewValue = memberValue; + } while (0); + + return value; + } + + default: + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH; + break; + } + break; + } + case Clusters::BinaryInputBasic::Id: { + using namespace Clusters::BinaryInputBasic; + switch (aPath.mEventId) { + + default: + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH; + break; + } + break; + } + case Clusters::Binding::Id: { + using namespace Clusters::Binding; + switch (aPath.mEventId) { + + default: + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH; + break; + } + break; + } + case Clusters::BooleanState::Id: { + using namespace Clusters::BooleanState; + switch (aPath.mEventId) { + + case Events::StateChange::Id: { + Events::StateChange::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + + CHIPBooleanStateClusterStateChangeEvent * value = [CHIPBooleanStateClusterStateChangeEvent new]; + + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithBool:cppValue.stateValue]; + value.stateValue = memberValue; + } while (0); + + return value; + } + + default: + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH; + break; + } + break; + } + case Clusters::BridgedActions::Id: { + using namespace Clusters::BridgedActions; + switch (aPath.mEventId) { + + case Events::StateChanged::Id: { + Events::StateChanged::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + + CHIPBridgedActionsClusterStateChangedEvent * value = [CHIPBridgedActionsClusterStateChangedEvent new]; + + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedShort:cppValue.actionID]; + value.actionID = memberValue; + } while (0); + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedInt:cppValue.invokeID]; + value.invokeID = memberValue; + } while (0); + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.newState)]; + value.newState = memberValue; + } while (0); + + return value; + } + + case Events::ActionFailed::Id: { + Events::ActionFailed::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + + CHIPBridgedActionsClusterActionFailedEvent * value = [CHIPBridgedActionsClusterActionFailedEvent new]; + + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedShort:cppValue.actionID]; + value.actionID = memberValue; + } while (0); + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedInt:cppValue.invokeID]; + value.invokeID = memberValue; + } while (0); + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.newState)]; + value.newState = memberValue; + } while (0); + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.error)]; + value.error = memberValue; + } while (0); + + return value; + } + + default: + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH; + break; + } + break; + } + case Clusters::BridgedDeviceBasic::Id: { + using namespace Clusters::BridgedDeviceBasic; + switch (aPath.mEventId) { + + case Events::StartUp::Id: { + Events::StartUp::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + + CHIPBridgedDeviceBasicClusterStartUpEvent * value = [CHIPBridgedDeviceBasicClusterStartUpEvent new]; + + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedInt:cppValue.softwareVersion]; + value.softwareVersion = memberValue; + } while (0); + + return value; + } + + case Events::ShutDown::Id: { + Events::ShutDown::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + + CHIPBridgedDeviceBasicClusterShutDownEvent * value = [CHIPBridgedDeviceBasicClusterShutDownEvent new]; + + return value; + } + + case Events::Leave::Id: { + Events::Leave::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + + CHIPBridgedDeviceBasicClusterLeaveEvent * value = [CHIPBridgedDeviceBasicClusterLeaveEvent new]; + + return value; + } + + case Events::ReachableChanged::Id: { + Events::ReachableChanged::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + + CHIPBridgedDeviceBasicClusterReachableChangedEvent * value = [CHIPBridgedDeviceBasicClusterReachableChangedEvent new]; + + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithBool:cppValue.reachableNewValue]; + value.reachableNewValue = memberValue; + } while (0); + + return value; + } + + default: + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH; + break; + } + break; + } + case Clusters::Channel::Id: { + using namespace Clusters::Channel; + switch (aPath.mEventId) { + + default: + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH; + break; + } + break; + } + case Clusters::ColorControl::Id: { + using namespace Clusters::ColorControl; + switch (aPath.mEventId) { + + default: + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH; + break; + } + break; + } + case Clusters::ContentLauncher::Id: { + using namespace Clusters::ContentLauncher; + switch (aPath.mEventId) { + + default: + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH; + break; + } + break; + } + case Clusters::Descriptor::Id: { + using namespace Clusters::Descriptor; + switch (aPath.mEventId) { + + default: + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH; + break; + } + break; + } + case Clusters::DiagnosticLogs::Id: { + using namespace Clusters::DiagnosticLogs; + switch (aPath.mEventId) { + + default: + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH; + break; + } + break; + } + case Clusters::DoorLock::Id: { + using namespace Clusters::DoorLock; + switch (aPath.mEventId) { + + case Events::DoorLockAlarm::Id: { + Events::DoorLockAlarm::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + + CHIPDoorLockClusterDoorLockAlarmEvent * value = [CHIPDoorLockClusterDoorLockAlarmEvent new]; + + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.alarmCode)]; + value.alarmCode = memberValue; + } while (0); + + return value; + } + + case Events::DoorStateChange::Id: { + Events::DoorStateChange::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + + CHIPDoorLockClusterDoorStateChangeEvent * value = [CHIPDoorLockClusterDoorStateChangeEvent new]; + + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.doorState)]; + value.doorState = memberValue; + } while (0); + + return value; + } + + case Events::LockOperation::Id: { + Events::LockOperation::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + + CHIPDoorLockClusterLockOperationEvent * value = [CHIPDoorLockClusterLockOperationEvent new]; + + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.lockOperationType)]; + value.lockOperationType = memberValue; + } while (0); + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.operationSource)]; + value.operationSource = memberValue; + } while (0); + do { + NSNumber * _Nullable memberValue; + if (cppValue.userIndex.IsNull()) { + memberValue = nil; + } else { + memberValue = [NSNumber numberWithUnsignedShort:cppValue.userIndex.Value()]; + } + value.userIndex = memberValue; + } while (0); + do { + NSNumber * _Nullable memberValue; + if (cppValue.fabricIndex.IsNull()) { + memberValue = nil; + } else { + memberValue = [NSNumber numberWithUnsignedChar:cppValue.fabricIndex.Value()]; + } + value.fabricIndex = memberValue; + } while (0); + do { + NSNumber * _Nullable memberValue; + if (cppValue.sourceNode.IsNull()) { + memberValue = nil; + } else { + memberValue = [NSNumber numberWithUnsignedLongLong:cppValue.sourceNode.Value()]; + } + value.sourceNode = memberValue; + } while (0); + do { + NSArray * _Nullable memberValue; + if (cppValue.credentials.HasValue()) { + if (cppValue.credentials.Value().IsNull()) { + memberValue = nil; + } else { + { // Scope for our temporary variables + auto * array_2 = [NSMutableArray new]; + auto iter_2 = cppValue.credentials.Value().Value().begin(); + while (iter_2.Next()) { + auto & entry_2 = iter_2.GetValue(); + CHIPDoorLockClusterDlCredential * newElement_2; + newElement_2 = [CHIPDoorLockClusterDlCredential new]; + newElement_2.credentialType = + [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_2.credentialType)]; + newElement_2.credentialIndex = [NSNumber numberWithUnsignedShort:entry_2.credentialIndex]; + [array_2 addObject:newElement_2]; + } + CHIP_ERROR err = iter_2.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + memberValue = array_2; + } + } + } else { + memberValue = nil; + } + value.credentials = memberValue; + } while (0); + + return value; + } + + case Events::LockOperationError::Id: { + Events::LockOperationError::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + + CHIPDoorLockClusterLockOperationErrorEvent * value = [CHIPDoorLockClusterLockOperationErrorEvent new]; + + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.lockOperationType)]; + value.lockOperationType = memberValue; + } while (0); + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.operationSource)]; + value.operationSource = memberValue; + } while (0); + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.operationError)]; + value.operationError = memberValue; + } while (0); + do { + NSNumber * _Nullable memberValue; + if (cppValue.userIndex.IsNull()) { + memberValue = nil; + } else { + memberValue = [NSNumber numberWithUnsignedShort:cppValue.userIndex.Value()]; + } + value.userIndex = memberValue; + } while (0); + do { + NSNumber * _Nullable memberValue; + if (cppValue.fabricIndex.IsNull()) { + memberValue = nil; + } else { + memberValue = [NSNumber numberWithUnsignedChar:cppValue.fabricIndex.Value()]; + } + value.fabricIndex = memberValue; + } while (0); + do { + NSNumber * _Nullable memberValue; + if (cppValue.sourceNode.IsNull()) { + memberValue = nil; + } else { + memberValue = [NSNumber numberWithUnsignedLongLong:cppValue.sourceNode.Value()]; + } + value.sourceNode = memberValue; + } while (0); + do { + NSArray * _Nullable memberValue; + if (cppValue.credentials.HasValue()) { + if (cppValue.credentials.Value().IsNull()) { + memberValue = nil; + } else { + { // Scope for our temporary variables + auto * array_2 = [NSMutableArray new]; + auto iter_2 = cppValue.credentials.Value().Value().begin(); + while (iter_2.Next()) { + auto & entry_2 = iter_2.GetValue(); + CHIPDoorLockClusterDlCredential * newElement_2; + newElement_2 = [CHIPDoorLockClusterDlCredential new]; + newElement_2.credentialType = + [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_2.credentialType)]; + newElement_2.credentialIndex = [NSNumber numberWithUnsignedShort:entry_2.credentialIndex]; + [array_2 addObject:newElement_2]; + } + CHIP_ERROR err = iter_2.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + memberValue = array_2; + } + } + } else { + memberValue = nil; + } + value.credentials = memberValue; + } while (0); + + return value; + } + + case Events::LockUserChange::Id: { + Events::LockUserChange::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + + CHIPDoorLockClusterLockUserChangeEvent * value = [CHIPDoorLockClusterLockUserChangeEvent new]; + + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.lockDataType)]; + value.lockDataType = memberValue; + } while (0); + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.dataOperationType)]; + value.dataOperationType = memberValue; + } while (0); + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.operationSource)]; + value.operationSource = memberValue; + } while (0); + do { + NSNumber * _Nullable memberValue; + if (cppValue.userIndex.IsNull()) { + memberValue = nil; + } else { + memberValue = [NSNumber numberWithUnsignedShort:cppValue.userIndex.Value()]; + } + value.userIndex = memberValue; + } while (0); + do { + NSNumber * _Nullable memberValue; + if (cppValue.fabricIndex.IsNull()) { + memberValue = nil; + } else { + memberValue = [NSNumber numberWithUnsignedChar:cppValue.fabricIndex.Value()]; + } + value.fabricIndex = memberValue; + } while (0); + do { + NSNumber * _Nullable memberValue; + if (cppValue.sourceNode.IsNull()) { + memberValue = nil; + } else { + memberValue = [NSNumber numberWithUnsignedLongLong:cppValue.sourceNode.Value()]; + } + value.sourceNode = memberValue; + } while (0); + do { + NSNumber * _Nullable memberValue; + if (cppValue.dataIndex.IsNull()) { + memberValue = nil; + } else { + memberValue = [NSNumber numberWithUnsignedShort:cppValue.dataIndex.Value()]; + } + value.dataIndex = memberValue; + } while (0); + + return value; + } + + default: + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH; + break; + } + break; + } + case Clusters::ElectricalMeasurement::Id: { + using namespace Clusters::ElectricalMeasurement; + switch (aPath.mEventId) { + + default: + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH; + break; + } + break; + } + case Clusters::EthernetNetworkDiagnostics::Id: { + using namespace Clusters::EthernetNetworkDiagnostics; + switch (aPath.mEventId) { + + default: + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH; + break; + } + break; + } + case Clusters::FanControl::Id: { + using namespace Clusters::FanControl; + switch (aPath.mEventId) { + + default: + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH; + break; + } + break; + } + case Clusters::FixedLabel::Id: { + using namespace Clusters::FixedLabel; + switch (aPath.mEventId) { + + default: + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH; + break; + } + break; + } + case Clusters::FlowMeasurement::Id: { + using namespace Clusters::FlowMeasurement; + switch (aPath.mEventId) { + + default: + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH; + break; + } + break; + } + case Clusters::GeneralCommissioning::Id: { + using namespace Clusters::GeneralCommissioning; + switch (aPath.mEventId) { + + default: + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH; + break; + } + break; + } + case Clusters::GeneralDiagnostics::Id: { + using namespace Clusters::GeneralDiagnostics; + switch (aPath.mEventId) { + + case Events::HardwareFaultChange::Id: { + Events::HardwareFaultChange::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + + CHIPGeneralDiagnosticsClusterHardwareFaultChangeEvent * value = + [CHIPGeneralDiagnosticsClusterHardwareFaultChangeEvent new]; + + do { + NSArray * _Nonnull memberValue; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.current.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0)]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + memberValue = array_0; + } + value.current = memberValue; + } while (0); + do { + NSArray * _Nonnull memberValue; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.previous.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0)]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + memberValue = array_0; + } + value.previous = memberValue; + } while (0); + + return value; + } + + case Events::RadioFaultChange::Id: { + Events::RadioFaultChange::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + + CHIPGeneralDiagnosticsClusterRadioFaultChangeEvent * value = [CHIPGeneralDiagnosticsClusterRadioFaultChangeEvent new]; + + do { + NSArray * _Nonnull memberValue; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.current.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0)]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + memberValue = array_0; + } + value.current = memberValue; + } while (0); + do { + NSArray * _Nonnull memberValue; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.previous.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0)]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + memberValue = array_0; + } + value.previous = memberValue; + } while (0); + + return value; + } + + case Events::NetworkFaultChange::Id: { + Events::NetworkFaultChange::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + + CHIPGeneralDiagnosticsClusterNetworkFaultChangeEvent * value = + [CHIPGeneralDiagnosticsClusterNetworkFaultChangeEvent new]; + + do { + NSArray * _Nonnull memberValue; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.current.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0)]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + memberValue = array_0; + } + value.current = memberValue; + } while (0); + do { + NSArray * _Nonnull memberValue; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.previous.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0)]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + memberValue = array_0; + } + value.previous = memberValue; + } while (0); + + return value; + } + + case Events::BootReason::Id: { + Events::BootReason::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + + CHIPGeneralDiagnosticsClusterBootReasonEvent * value = [CHIPGeneralDiagnosticsClusterBootReasonEvent new]; + + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.bootReason)]; + value.bootReason = memberValue; + } while (0); + + return value; + } + + default: + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH; + break; + } + break; + } + case Clusters::GroupKeyManagement::Id: { + using namespace Clusters::GroupKeyManagement; + switch (aPath.mEventId) { + + default: + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH; + break; + } + break; + } + case Clusters::Groups::Id: { + using namespace Clusters::Groups; + switch (aPath.mEventId) { + + default: + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH; + break; + } + break; + } + case Clusters::Identify::Id: { + using namespace Clusters::Identify; + switch (aPath.mEventId) { + + default: + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH; + break; + } + break; + } + case Clusters::IlluminanceMeasurement::Id: { + using namespace Clusters::IlluminanceMeasurement; + switch (aPath.mEventId) { + + default: + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH; + break; + } + break; + } + case Clusters::KeypadInput::Id: { + using namespace Clusters::KeypadInput; + switch (aPath.mEventId) { + + default: + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH; + break; + } + break; + } + case Clusters::LevelControl::Id: { + using namespace Clusters::LevelControl; + switch (aPath.mEventId) { + + default: + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH; + break; + } + break; + } + case Clusters::LocalizationConfiguration::Id: { + using namespace Clusters::LocalizationConfiguration; + switch (aPath.mEventId) { + + default: + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH; + break; + } + break; + } + case Clusters::LowPower::Id: { + using namespace Clusters::LowPower; + switch (aPath.mEventId) { + + default: + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH; + break; + } + break; + } + case Clusters::MediaInput::Id: { + using namespace Clusters::MediaInput; + switch (aPath.mEventId) { + + default: + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH; + break; + } + break; + } + case Clusters::MediaPlayback::Id: { + using namespace Clusters::MediaPlayback; + switch (aPath.mEventId) { + + default: + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH; + break; + } + break; + } + case Clusters::ModeSelect::Id: { + using namespace Clusters::ModeSelect; + switch (aPath.mEventId) { + + default: + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH; + break; + } + break; + } + case Clusters::NetworkCommissioning::Id: { + using namespace Clusters::NetworkCommissioning; + switch (aPath.mEventId) { + + default: + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH; + break; + } + break; + } + case Clusters::OtaSoftwareUpdateProvider::Id: { + using namespace Clusters::OtaSoftwareUpdateProvider; + switch (aPath.mEventId) { + + default: + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH; + break; + } + break; + } + case Clusters::OtaSoftwareUpdateRequestor::Id: { + using namespace Clusters::OtaSoftwareUpdateRequestor; + switch (aPath.mEventId) { + + case Events::StateTransition::Id: { + Events::StateTransition::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + + CHIPOtaSoftwareUpdateRequestorClusterStateTransitionEvent * value = + [CHIPOtaSoftwareUpdateRequestorClusterStateTransitionEvent new]; + + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.previousState)]; + value.previousState = memberValue; + } while (0); + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.newState)]; + value.newState = memberValue; + } while (0); + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.reason)]; + value.reason = memberValue; + } while (0); + do { + NSNumber * _Nullable memberValue; + if (cppValue.targetSoftwareVersion.IsNull()) { + memberValue = nil; + } else { + memberValue = [NSNumber numberWithUnsignedInt:cppValue.targetSoftwareVersion.Value()]; + } + value.targetSoftwareVersion = memberValue; + } while (0); + + return value; + } + + case Events::VersionApplied::Id: { + Events::VersionApplied::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + + CHIPOtaSoftwareUpdateRequestorClusterVersionAppliedEvent * value = + [CHIPOtaSoftwareUpdateRequestorClusterVersionAppliedEvent new]; + + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedInt:cppValue.softwareVersion]; + value.softwareVersion = memberValue; + } while (0); + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedShort:cppValue.productID]; + value.productID = memberValue; + } while (0); + + return value; + } + + case Events::DownloadError::Id: { + Events::DownloadError::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + + CHIPOtaSoftwareUpdateRequestorClusterDownloadErrorEvent * value = + [CHIPOtaSoftwareUpdateRequestorClusterDownloadErrorEvent new]; + + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedInt:cppValue.softwareVersion]; + value.softwareVersion = memberValue; + } while (0); + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedLongLong:cppValue.bytesDownloaded]; + value.bytesDownloaded = memberValue; + } while (0); + do { + NSNumber * _Nullable memberValue; + if (cppValue.progressPercent.IsNull()) { + memberValue = nil; + } else { + memberValue = [NSNumber numberWithUnsignedChar:cppValue.progressPercent.Value()]; + } + value.progressPercent = memberValue; + } while (0); + do { + NSNumber * _Nullable memberValue; + if (cppValue.platformCode.IsNull()) { + memberValue = nil; + } else { + memberValue = [NSNumber numberWithLongLong:cppValue.platformCode.Value()]; + } + value.platformCode = memberValue; + } while (0); + + return value; + } + + default: + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH; + break; + } + break; + } + case Clusters::OccupancySensing::Id: { + using namespace Clusters::OccupancySensing; + switch (aPath.mEventId) { + + default: + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH; + break; + } + break; + } + case Clusters::OnOff::Id: { + using namespace Clusters::OnOff; + switch (aPath.mEventId) { + + default: + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH; + break; + } + break; + } + case Clusters::OnOffSwitchConfiguration::Id: { + using namespace Clusters::OnOffSwitchConfiguration; + switch (aPath.mEventId) { + + default: + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH; + break; + } + break; + } + case Clusters::OperationalCredentials::Id: { + using namespace Clusters::OperationalCredentials; + switch (aPath.mEventId) { + + default: + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH; + break; + } + break; + } + case Clusters::PowerSource::Id: { + using namespace Clusters::PowerSource; + switch (aPath.mEventId) { + + default: + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH; + break; + } + break; + } + case Clusters::PowerSourceConfiguration::Id: { + using namespace Clusters::PowerSourceConfiguration; + switch (aPath.mEventId) { + + default: + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH; + break; + } + break; + } + case Clusters::PressureMeasurement::Id: { + using namespace Clusters::PressureMeasurement; + switch (aPath.mEventId) { + + default: + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH; + break; + } + break; + } + case Clusters::PumpConfigurationAndControl::Id: { + using namespace Clusters::PumpConfigurationAndControl; + switch (aPath.mEventId) { + + case Events::SupplyVoltageLow::Id: { + Events::SupplyVoltageLow::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + + CHIPPumpConfigurationAndControlClusterSupplyVoltageLowEvent * value = + [CHIPPumpConfigurationAndControlClusterSupplyVoltageLowEvent new]; + + return value; + } + + case Events::SupplyVoltageHigh::Id: { + Events::SupplyVoltageHigh::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + + CHIPPumpConfigurationAndControlClusterSupplyVoltageHighEvent * value = + [CHIPPumpConfigurationAndControlClusterSupplyVoltageHighEvent new]; + + return value; + } + + case Events::PowerMissingPhase::Id: { + Events::PowerMissingPhase::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + + CHIPPumpConfigurationAndControlClusterPowerMissingPhaseEvent * value = + [CHIPPumpConfigurationAndControlClusterPowerMissingPhaseEvent new]; + + return value; + } + + case Events::SystemPressureLow::Id: { + Events::SystemPressureLow::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + + CHIPPumpConfigurationAndControlClusterSystemPressureLowEvent * value = + [CHIPPumpConfigurationAndControlClusterSystemPressureLowEvent new]; + + return value; + } + + case Events::SystemPressureHigh::Id: { + Events::SystemPressureHigh::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + + CHIPPumpConfigurationAndControlClusterSystemPressureHighEvent * value = + [CHIPPumpConfigurationAndControlClusterSystemPressureHighEvent new]; + + return value; + } + + case Events::DryRunning::Id: { + Events::DryRunning::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + + CHIPPumpConfigurationAndControlClusterDryRunningEvent * value = + [CHIPPumpConfigurationAndControlClusterDryRunningEvent new]; + + return value; + } + + case Events::MotorTemperatureHigh::Id: { + Events::MotorTemperatureHigh::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + + CHIPPumpConfigurationAndControlClusterMotorTemperatureHighEvent * value = + [CHIPPumpConfigurationAndControlClusterMotorTemperatureHighEvent new]; + + return value; + } + + case Events::PumpMotorFatalFailure::Id: { + Events::PumpMotorFatalFailure::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + + CHIPPumpConfigurationAndControlClusterPumpMotorFatalFailureEvent * value = + [CHIPPumpConfigurationAndControlClusterPumpMotorFatalFailureEvent new]; + + return value; + } + + case Events::ElectronicTemperatureHigh::Id: { + Events::ElectronicTemperatureHigh::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + + CHIPPumpConfigurationAndControlClusterElectronicTemperatureHighEvent * value = + [CHIPPumpConfigurationAndControlClusterElectronicTemperatureHighEvent new]; + + return value; + } + + case Events::PumpBlocked::Id: { + Events::PumpBlocked::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + + CHIPPumpConfigurationAndControlClusterPumpBlockedEvent * value = + [CHIPPumpConfigurationAndControlClusterPumpBlockedEvent new]; + + return value; + } + + case Events::SensorFailure::Id: { + Events::SensorFailure::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + + CHIPPumpConfigurationAndControlClusterSensorFailureEvent * value = + [CHIPPumpConfigurationAndControlClusterSensorFailureEvent new]; + + return value; + } + + case Events::ElectronicNonFatalFailure::Id: { + Events::ElectronicNonFatalFailure::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + + CHIPPumpConfigurationAndControlClusterElectronicNonFatalFailureEvent * value = + [CHIPPumpConfigurationAndControlClusterElectronicNonFatalFailureEvent new]; + + return value; + } + + case Events::ElectronicFatalFailure::Id: { + Events::ElectronicFatalFailure::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + + CHIPPumpConfigurationAndControlClusterElectronicFatalFailureEvent * value = + [CHIPPumpConfigurationAndControlClusterElectronicFatalFailureEvent new]; + + return value; + } + + case Events::GeneralFault::Id: { + Events::GeneralFault::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + + CHIPPumpConfigurationAndControlClusterGeneralFaultEvent * value = + [CHIPPumpConfigurationAndControlClusterGeneralFaultEvent new]; + + return value; + } + + case Events::Leakage::Id: { + Events::Leakage::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + + CHIPPumpConfigurationAndControlClusterLeakageEvent * value = [CHIPPumpConfigurationAndControlClusterLeakageEvent new]; + + return value; + } + + case Events::AirDetection::Id: { + Events::AirDetection::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + + CHIPPumpConfigurationAndControlClusterAirDetectionEvent * value = + [CHIPPumpConfigurationAndControlClusterAirDetectionEvent new]; + + return value; + } + + case Events::TurbineOperation::Id: { + Events::TurbineOperation::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + + CHIPPumpConfigurationAndControlClusterTurbineOperationEvent * value = + [CHIPPumpConfigurationAndControlClusterTurbineOperationEvent new]; + + return value; + } + + default: + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH; + break; + } + break; + } + case Clusters::RelativeHumidityMeasurement::Id: { + using namespace Clusters::RelativeHumidityMeasurement; + switch (aPath.mEventId) { + + default: + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH; + break; + } + break; + } + case Clusters::Scenes::Id: { + using namespace Clusters::Scenes; + switch (aPath.mEventId) { + + default: + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH; + break; + } + break; + } + case Clusters::SoftwareDiagnostics::Id: { + using namespace Clusters::SoftwareDiagnostics; + switch (aPath.mEventId) { + + case Events::SoftwareFault::Id: { + Events::SoftwareFault::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + + CHIPSoftwareDiagnosticsClusterSoftwareFaultEvent * value = [CHIPSoftwareDiagnosticsClusterSoftwareFaultEvent new]; + + do { + CHIPSoftwareDiagnosticsClusterSoftwareFaultStruct * _Nonnull memberValue; + memberValue = [CHIPSoftwareDiagnosticsClusterSoftwareFaultStruct new]; + memberValue.id = [NSNumber numberWithUnsignedLongLong:cppValue.softwareFault.id]; + memberValue.name = [[NSString alloc] initWithBytes:cppValue.softwareFault.name.data() + length:cppValue.softwareFault.name.size() + encoding:NSUTF8StringEncoding]; + memberValue.faultRecording = [NSData dataWithBytes:cppValue.softwareFault.faultRecording.data() + length:cppValue.softwareFault.faultRecording.size()]; + value.softwareFault = memberValue; + } while (0); + + return value; + } + + default: + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH; + break; + } + break; + } + case Clusters::Switch::Id: { + using namespace Clusters::Switch; + switch (aPath.mEventId) { + + case Events::SwitchLatched::Id: { + Events::SwitchLatched::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + + CHIPSwitchClusterSwitchLatchedEvent * value = [CHIPSwitchClusterSwitchLatchedEvent new]; + + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedChar:cppValue.newPosition]; + value.newPosition = memberValue; + } while (0); + + return value; + } + + case Events::InitialPress::Id: { + Events::InitialPress::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + + CHIPSwitchClusterInitialPressEvent * value = [CHIPSwitchClusterInitialPressEvent new]; + + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedChar:cppValue.newPosition]; + value.newPosition = memberValue; + } while (0); + + return value; + } + + case Events::LongPress::Id: { + Events::LongPress::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + + CHIPSwitchClusterLongPressEvent * value = [CHIPSwitchClusterLongPressEvent new]; + + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedChar:cppValue.newPosition]; + value.newPosition = memberValue; + } while (0); + + return value; + } + + case Events::ShortRelease::Id: { + Events::ShortRelease::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + + CHIPSwitchClusterShortReleaseEvent * value = [CHIPSwitchClusterShortReleaseEvent new]; + + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedChar:cppValue.previousPosition]; + value.previousPosition = memberValue; + } while (0); + + return value; + } + + case Events::LongRelease::Id: { + Events::LongRelease::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + + CHIPSwitchClusterLongReleaseEvent * value = [CHIPSwitchClusterLongReleaseEvent new]; + + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedChar:cppValue.previousPosition]; + value.previousPosition = memberValue; + } while (0); + + return value; + } + + case Events::MultiPressOngoing::Id: { + Events::MultiPressOngoing::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + + CHIPSwitchClusterMultiPressOngoingEvent * value = [CHIPSwitchClusterMultiPressOngoingEvent new]; + + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedChar:cppValue.newPosition]; + value.newPosition = memberValue; + } while (0); + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedChar:cppValue.currentNumberOfPressesCounted]; + value.currentNumberOfPressesCounted = memberValue; + } while (0); + + return value; + } + + case Events::MultiPressComplete::Id: { + Events::MultiPressComplete::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + + CHIPSwitchClusterMultiPressCompleteEvent * value = [CHIPSwitchClusterMultiPressCompleteEvent new]; + + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedChar:cppValue.newPosition]; + value.newPosition = memberValue; + } while (0); + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedChar:cppValue.totalNumberOfPressesCounted]; + value.totalNumberOfPressesCounted = memberValue; + } while (0); + + return value; + } + + default: + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH; + break; + } + break; + } + case Clusters::TargetNavigator::Id: { + using namespace Clusters::TargetNavigator; + switch (aPath.mEventId) { + + default: + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH; + break; + } + break; + } + case Clusters::TemperatureMeasurement::Id: { + using namespace Clusters::TemperatureMeasurement; + switch (aPath.mEventId) { + + default: + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH; + break; + } + break; + } + case Clusters::TestCluster::Id: { + using namespace Clusters::TestCluster; + switch (aPath.mEventId) { + + case Events::TestEvent::Id: { + Events::TestEvent::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + + CHIPTestClusterClusterTestEventEvent * value = [CHIPTestClusterClusterTestEventEvent new]; + + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedChar:cppValue.arg1]; + value.arg1 = memberValue; + } while (0); + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.arg2)]; + value.arg2 = memberValue; + } while (0); + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithBool:cppValue.arg3]; + value.arg3 = memberValue; + } while (0); + do { + CHIPTestClusterClusterSimpleStruct * _Nonnull memberValue; + memberValue = [CHIPTestClusterClusterSimpleStruct new]; + memberValue.a = [NSNumber numberWithUnsignedChar:cppValue.arg4.a]; + memberValue.b = [NSNumber numberWithBool:cppValue.arg4.b]; + memberValue.c = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.arg4.c)]; + memberValue.d = [NSData dataWithBytes:cppValue.arg4.d.data() length:cppValue.arg4.d.size()]; + memberValue.e = [[NSString alloc] initWithBytes:cppValue.arg4.e.data() + length:cppValue.arg4.e.size() + encoding:NSUTF8StringEncoding]; + memberValue.f = [NSNumber numberWithUnsignedChar:cppValue.arg4.f.Raw()]; + memberValue.g = [NSNumber numberWithFloat:cppValue.arg4.g]; + memberValue.h = [NSNumber numberWithDouble:cppValue.arg4.h]; + value.arg4 = memberValue; + } while (0); + do { + NSArray * _Nonnull memberValue; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.arg5.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + CHIPTestClusterClusterSimpleStruct * newElement_0; + newElement_0 = [CHIPTestClusterClusterSimpleStruct new]; + newElement_0.a = [NSNumber numberWithUnsignedChar:entry_0.a]; + newElement_0.b = [NSNumber numberWithBool:entry_0.b]; + newElement_0.c = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0.c)]; + newElement_0.d = [NSData dataWithBytes:entry_0.d.data() length:entry_0.d.size()]; + newElement_0.e = [[NSString alloc] initWithBytes:entry_0.e.data() + length:entry_0.e.size() + encoding:NSUTF8StringEncoding]; + newElement_0.f = [NSNumber numberWithUnsignedChar:entry_0.f.Raw()]; + newElement_0.g = [NSNumber numberWithFloat:entry_0.g]; + newElement_0.h = [NSNumber numberWithDouble:entry_0.h]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + memberValue = array_0; + } + value.arg5 = memberValue; + } while (0); + do { + NSArray * _Nonnull memberValue; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.arg6.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0)]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + memberValue = array_0; + } + value.arg6 = memberValue; + } while (0); + + return value; + } + + case Events::TestFabricScopedEvent::Id: { + Events::TestFabricScopedEvent::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + + CHIPTestClusterClusterTestFabricScopedEventEvent * value = [CHIPTestClusterClusterTestFabricScopedEventEvent new]; + + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedChar:cppValue.arg1]; + value.arg1 = memberValue; + } while (0); + + return value; + } + + default: + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH; + break; + } + break; + } + case Clusters::Thermostat::Id: { + using namespace Clusters::Thermostat; + switch (aPath.mEventId) { + + default: + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH; + break; + } + break; + } + case Clusters::ThermostatUserInterfaceConfiguration::Id: { + using namespace Clusters::ThermostatUserInterfaceConfiguration; + switch (aPath.mEventId) { + + default: + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH; + break; + } + break; + } + case Clusters::ThreadNetworkDiagnostics::Id: { + using namespace Clusters::ThreadNetworkDiagnostics; + switch (aPath.mEventId) { + + case Events::ConnectionStatus::Id: { + Events::ConnectionStatus::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + + CHIPThreadNetworkDiagnosticsClusterConnectionStatusEvent * value = + [CHIPThreadNetworkDiagnosticsClusterConnectionStatusEvent new]; + + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.connectionStatus)]; + value.connectionStatus = memberValue; + } while (0); + + return value; + } + + default: + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH; + break; + } + break; + } + case Clusters::TimeFormatLocalization::Id: { + using namespace Clusters::TimeFormatLocalization; + switch (aPath.mEventId) { + + default: + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH; + break; + } + break; + } + case Clusters::UnitLocalization::Id: { + using namespace Clusters::UnitLocalization; + switch (aPath.mEventId) { + + default: + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH; + break; + } + break; + } + case Clusters::UserLabel::Id: { + using namespace Clusters::UserLabel; + switch (aPath.mEventId) { + + default: + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH; + break; + } + break; + } + case Clusters::WakeOnLan::Id: { + using namespace Clusters::WakeOnLan; + switch (aPath.mEventId) { + + default: + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH; + break; + } + break; + } + case Clusters::WiFiNetworkDiagnostics::Id: { + using namespace Clusters::WiFiNetworkDiagnostics; + switch (aPath.mEventId) { + + case Events::Disconnection::Id: { + Events::Disconnection::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + + CHIPWiFiNetworkDiagnosticsClusterDisconnectionEvent * value = [CHIPWiFiNetworkDiagnosticsClusterDisconnectionEvent new]; + + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedShort:cppValue.reasonCode]; + value.reasonCode = memberValue; + } while (0); + + return value; + } + + case Events::AssociationFailure::Id: { + Events::AssociationFailure::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + + CHIPWiFiNetworkDiagnosticsClusterAssociationFailureEvent * value = + [CHIPWiFiNetworkDiagnosticsClusterAssociationFailureEvent new]; + + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.associationFailure)]; + value.associationFailure = memberValue; + } while (0); + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedShort:cppValue.status]; + value.status = memberValue; + } while (0); + + return value; + } + + case Events::ConnectionStatus::Id: { + Events::ConnectionStatus::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + + CHIPWiFiNetworkDiagnosticsClusterConnectionStatusEvent * value = + [CHIPWiFiNetworkDiagnosticsClusterConnectionStatusEvent new]; + + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.connectionStatus)]; + value.connectionStatus = memberValue; + } while (0); + + return value; + } + + default: + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH; + break; + } + break; + } + case Clusters::WindowCovering::Id: { + using namespace Clusters::WindowCovering; + switch (aPath.mEventId) { + + default: + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH; + break; + } + break; + } + default: { + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH; + break; + } + } + return nil; +} diff --git a/src/darwin/Framework/CHIP/zap-generated/CHIPStructsObjc.h b/src/darwin/Framework/CHIP/zap-generated/CHIPStructsObjc.h index 810f4d056d77e6..cabe67a4a335a8 100644 --- a/src/darwin/Framework/CHIP/zap-generated/CHIPStructsObjc.h +++ b/src/darwin/Framework/CHIP/zap-generated/CHIPStructsObjc.h @@ -92,6 +92,22 @@ NS_ASSUME_NONNULL_BEGIN - (instancetype)init; @end +@interface CHIPAccessControlClusterAccessControlEntryChangedEvent : NSObject +@property (strong, nonatomic) NSNumber * _Nullable adminNodeID; +@property (strong, nonatomic) NSNumber * _Nullable adminPasscodeID; +@property (strong, nonatomic) NSNumber * _Nonnull changeType; +@property (strong, nonatomic) CHIPAccessControlClusterAccessControlEntry * _Nullable latestValue; +@property (strong, nonatomic) NSNumber * _Nonnull adminFabricIndex; +@end + +@interface CHIPAccessControlClusterAccessControlExtensionChangedEvent : NSObject +@property (strong, nonatomic) NSNumber * _Nullable adminNodeID; +@property (strong, nonatomic) NSNumber * _Nullable adminPasscodeID; +@property (strong, nonatomic) NSNumber * _Nonnull changeType; +@property (strong, nonatomic) CHIPAccessControlClusterExtensionEntry * _Nullable latestValue; +@property (strong, nonatomic) NSNumber * _Nonnull adminFabricIndex; +@end + @interface CHIPBridgedActionsClusterActionStruct : NSObject @property (strong, nonatomic) NSNumber * _Nonnull actionID; @property (strong, nonatomic) NSString * _Nonnull name; @@ -110,12 +126,39 @@ NS_ASSUME_NONNULL_BEGIN - (instancetype)init; @end +@interface CHIPBridgedActionsClusterStateChangedEvent : NSObject +@property (strong, nonatomic) NSNumber * _Nonnull actionID; +@property (strong, nonatomic) NSNumber * _Nonnull invokeID; +@property (strong, nonatomic, getter=getNewState) NSNumber * _Nonnull newState; +@end + +@interface CHIPBridgedActionsClusterActionFailedEvent : NSObject +@property (strong, nonatomic) NSNumber * _Nonnull actionID; +@property (strong, nonatomic) NSNumber * _Nonnull invokeID; +@property (strong, nonatomic, getter=getNewState) NSNumber * _Nonnull newState; +@property (strong, nonatomic) NSNumber * _Nonnull error; +@end + @interface CHIPBasicClusterCapabilityMinimaStruct : NSObject @property (strong, nonatomic) NSNumber * _Nonnull caseSessionsPerFabric; @property (strong, nonatomic) NSNumber * _Nonnull subscriptionsPerFabric; - (instancetype)init; @end +@interface CHIPBasicClusterStartUpEvent : NSObject +@property (strong, nonatomic) NSNumber * _Nonnull softwareVersion; +@end + +@interface CHIPBasicClusterShutDownEvent : NSObject +@end + +@interface CHIPBasicClusterLeaveEvent : NSObject +@end + +@interface CHIPBasicClusterReachableChangedEvent : NSObject +@property (strong, nonatomic) NSNumber * _Nonnull reachableNewValue; +@end + @interface CHIPOtaSoftwareUpdateRequestorClusterProviderLocation : NSObject @property (strong, nonatomic) NSNumber * _Nonnull providerNodeID; @property (strong, nonatomic) NSNumber * _Nonnull endpoint; @@ -123,6 +166,25 @@ NS_ASSUME_NONNULL_BEGIN - (instancetype)init; @end +@interface CHIPOtaSoftwareUpdateRequestorClusterStateTransitionEvent : NSObject +@property (strong, nonatomic) NSNumber * _Nonnull previousState; +@property (strong, nonatomic, getter=getNewState) NSNumber * _Nonnull newState; +@property (strong, nonatomic) NSNumber * _Nonnull reason; +@property (strong, nonatomic) NSNumber * _Nullable targetSoftwareVersion; +@end + +@interface CHIPOtaSoftwareUpdateRequestorClusterVersionAppliedEvent : NSObject +@property (strong, nonatomic) NSNumber * _Nonnull softwareVersion; +@property (strong, nonatomic) NSNumber * _Nonnull productID; +@end + +@interface CHIPOtaSoftwareUpdateRequestorClusterDownloadErrorEvent : NSObject +@property (strong, nonatomic) NSNumber * _Nonnull softwareVersion; +@property (strong, nonatomic) NSNumber * _Nonnull bytesDownloaded; +@property (strong, nonatomic) NSNumber * _Nullable progressPercent; +@property (strong, nonatomic) NSNumber * _Nullable platformCode; +@end + @interface CHIPPowerSourceClusterBatChargeFaultChangeType : NSObject @property (strong, nonatomic) NSArray * _Nonnull current; @property (strong, nonatomic) NSArray * _Nonnull previous; @@ -186,6 +248,25 @@ NS_ASSUME_NONNULL_BEGIN - (instancetype)init; @end +@interface CHIPGeneralDiagnosticsClusterHardwareFaultChangeEvent : NSObject +@property (strong, nonatomic) NSArray * _Nonnull current; +@property (strong, nonatomic) NSArray * _Nonnull previous; +@end + +@interface CHIPGeneralDiagnosticsClusterRadioFaultChangeEvent : NSObject +@property (strong, nonatomic) NSArray * _Nonnull current; +@property (strong, nonatomic) NSArray * _Nonnull previous; +@end + +@interface CHIPGeneralDiagnosticsClusterNetworkFaultChangeEvent : NSObject +@property (strong, nonatomic) NSArray * _Nonnull current; +@property (strong, nonatomic) NSArray * _Nonnull previous; +@end + +@interface CHIPGeneralDiagnosticsClusterBootReasonEvent : NSObject +@property (strong, nonatomic) NSNumber * _Nonnull bootReason; +@end + @interface CHIPSoftwareDiagnosticsClusterSoftwareFaultStruct : NSObject @property (strong, nonatomic) NSNumber * _Nonnull id; @property (strong, nonatomic) NSString * _Nonnull name; @@ -202,6 +283,10 @@ NS_ASSUME_NONNULL_BEGIN - (instancetype)init; @end +@interface CHIPSoftwareDiagnosticsClusterSoftwareFaultEvent : NSObject +@property (strong, nonatomic) CHIPSoftwareDiagnosticsClusterSoftwareFaultStruct * _Nonnull softwareFault; +@end + @interface CHIPThreadNetworkDiagnosticsClusterNeighborTable : NSObject @property (strong, nonatomic) NSNumber * _Nonnull extAddress; @property (strong, nonatomic) NSNumber * _Nonnull age; @@ -256,6 +341,67 @@ NS_ASSUME_NONNULL_BEGIN - (instancetype)init; @end +@interface CHIPThreadNetworkDiagnosticsClusterConnectionStatusEvent : NSObject +@property (strong, nonatomic) NSNumber * _Nonnull connectionStatus; +@end + +@interface CHIPWiFiNetworkDiagnosticsClusterDisconnectionEvent : NSObject +@property (strong, nonatomic) NSNumber * _Nonnull reasonCode; +@end + +@interface CHIPWiFiNetworkDiagnosticsClusterAssociationFailureEvent : NSObject +@property (strong, nonatomic) NSNumber * _Nonnull associationFailure; +@property (strong, nonatomic) NSNumber * _Nonnull status; +@end + +@interface CHIPWiFiNetworkDiagnosticsClusterConnectionStatusEvent : NSObject +@property (strong, nonatomic) NSNumber * _Nonnull connectionStatus; +@end + +@interface CHIPBridgedDeviceBasicClusterStartUpEvent : NSObject +@property (strong, nonatomic) NSNumber * _Nonnull softwareVersion; +@end + +@interface CHIPBridgedDeviceBasicClusterShutDownEvent : NSObject +@end + +@interface CHIPBridgedDeviceBasicClusterLeaveEvent : NSObject +@end + +@interface CHIPBridgedDeviceBasicClusterReachableChangedEvent : NSObject +@property (strong, nonatomic) NSNumber * _Nonnull reachableNewValue; +@end + +@interface CHIPSwitchClusterSwitchLatchedEvent : NSObject +@property (strong, nonatomic, getter=getNewPosition) NSNumber * _Nonnull newPosition; +@end + +@interface CHIPSwitchClusterInitialPressEvent : NSObject +@property (strong, nonatomic, getter=getNewPosition) NSNumber * _Nonnull newPosition; +@end + +@interface CHIPSwitchClusterLongPressEvent : NSObject +@property (strong, nonatomic, getter=getNewPosition) NSNumber * _Nonnull newPosition; +@end + +@interface CHIPSwitchClusterShortReleaseEvent : NSObject +@property (strong, nonatomic) NSNumber * _Nonnull previousPosition; +@end + +@interface CHIPSwitchClusterLongReleaseEvent : NSObject +@property (strong, nonatomic) NSNumber * _Nonnull previousPosition; +@end + +@interface CHIPSwitchClusterMultiPressOngoingEvent : NSObject +@property (strong, nonatomic, getter=getNewPosition) NSNumber * _Nonnull newPosition; +@property (strong, nonatomic) NSNumber * _Nonnull currentNumberOfPressesCounted; +@end + +@interface CHIPSwitchClusterMultiPressCompleteEvent : NSObject +@property (strong, nonatomic, getter=getNewPosition) NSNumber * _Nonnull newPosition; +@property (strong, nonatomic) NSNumber * _Nonnull totalNumberOfPressesCounted; +@end + @interface CHIPOperationalCredentialsClusterFabricDescriptor : NSObject @property (strong, nonatomic) NSData * _Nonnull rootPublicKey; @property (strong, nonatomic) NSNumber * _Nonnull vendorId; @@ -312,6 +458,10 @@ NS_ASSUME_NONNULL_BEGIN - (instancetype)init; @end +@interface CHIPBooleanStateClusterStateChangeEvent : NSObject +@property (strong, nonatomic) NSNumber * _Nonnull stateValue; +@end + @interface CHIPModeSelectClusterModeOptionStruct : NSObject @property (strong, nonatomic) NSString * _Nonnull label; @property (strong, nonatomic) NSNumber * _Nonnull mode; @@ -331,6 +481,94 @@ NS_ASSUME_NONNULL_BEGIN - (instancetype)init; @end +@interface CHIPDoorLockClusterDoorLockAlarmEvent : NSObject +@property (strong, nonatomic) NSNumber * _Nonnull alarmCode; +@end + +@interface CHIPDoorLockClusterDoorStateChangeEvent : NSObject +@property (strong, nonatomic) NSNumber * _Nonnull doorState; +@end + +@interface CHIPDoorLockClusterLockOperationEvent : NSObject +@property (strong, nonatomic) NSNumber * _Nonnull lockOperationType; +@property (strong, nonatomic) NSNumber * _Nonnull operationSource; +@property (strong, nonatomic) NSNumber * _Nullable userIndex; +@property (strong, nonatomic) NSNumber * _Nullable fabricIndex; +@property (strong, nonatomic) NSNumber * _Nullable sourceNode; +@property (strong, nonatomic) NSArray * _Nullable credentials; +@end + +@interface CHIPDoorLockClusterLockOperationErrorEvent : NSObject +@property (strong, nonatomic) NSNumber * _Nonnull lockOperationType; +@property (strong, nonatomic) NSNumber * _Nonnull operationSource; +@property (strong, nonatomic) NSNumber * _Nonnull operationError; +@property (strong, nonatomic) NSNumber * _Nullable userIndex; +@property (strong, nonatomic) NSNumber * _Nullable fabricIndex; +@property (strong, nonatomic) NSNumber * _Nullable sourceNode; +@property (strong, nonatomic) NSArray * _Nullable credentials; +@end + +@interface CHIPDoorLockClusterLockUserChangeEvent : NSObject +@property (strong, nonatomic) NSNumber * _Nonnull lockDataType; +@property (strong, nonatomic) NSNumber * _Nonnull dataOperationType; +@property (strong, nonatomic) NSNumber * _Nonnull operationSource; +@property (strong, nonatomic) NSNumber * _Nullable userIndex; +@property (strong, nonatomic) NSNumber * _Nullable fabricIndex; +@property (strong, nonatomic) NSNumber * _Nullable sourceNode; +@property (strong, nonatomic) NSNumber * _Nullable dataIndex; +@end + +@interface CHIPPumpConfigurationAndControlClusterSupplyVoltageLowEvent : NSObject +@end + +@interface CHIPPumpConfigurationAndControlClusterSupplyVoltageHighEvent : NSObject +@end + +@interface CHIPPumpConfigurationAndControlClusterPowerMissingPhaseEvent : NSObject +@end + +@interface CHIPPumpConfigurationAndControlClusterSystemPressureLowEvent : NSObject +@end + +@interface CHIPPumpConfigurationAndControlClusterSystemPressureHighEvent : NSObject +@end + +@interface CHIPPumpConfigurationAndControlClusterDryRunningEvent : NSObject +@end + +@interface CHIPPumpConfigurationAndControlClusterMotorTemperatureHighEvent : NSObject +@end + +@interface CHIPPumpConfigurationAndControlClusterPumpMotorFatalFailureEvent : NSObject +@end + +@interface CHIPPumpConfigurationAndControlClusterElectronicTemperatureHighEvent : NSObject +@end + +@interface CHIPPumpConfigurationAndControlClusterPumpBlockedEvent : NSObject +@end + +@interface CHIPPumpConfigurationAndControlClusterSensorFailureEvent : NSObject +@end + +@interface CHIPPumpConfigurationAndControlClusterElectronicNonFatalFailureEvent : NSObject +@end + +@interface CHIPPumpConfigurationAndControlClusterElectronicFatalFailureEvent : NSObject +@end + +@interface CHIPPumpConfigurationAndControlClusterGeneralFaultEvent : NSObject +@end + +@interface CHIPPumpConfigurationAndControlClusterLeakageEvent : NSObject +@end + +@interface CHIPPumpConfigurationAndControlClusterAirDetectionEvent : NSObject +@end + +@interface CHIPPumpConfigurationAndControlClusterTurbineOperationEvent : NSObject +@end + @interface CHIPIasAceClusterIasAceZoneStatusResult : NSObject @property (strong, nonatomic) NSNumber * _Nonnull zoneId; @property (strong, nonatomic) NSNumber * _Nonnull zoneStatus; @@ -510,6 +748,19 @@ NS_ASSUME_NONNULL_BEGIN - (instancetype)init; @end +@interface CHIPTestClusterClusterTestEventEvent : NSObject +@property (strong, nonatomic) NSNumber * _Nonnull arg1; +@property (strong, nonatomic) NSNumber * _Nonnull arg2; +@property (strong, nonatomic) NSNumber * _Nonnull arg3; +@property (strong, nonatomic) CHIPTestClusterClusterSimpleStruct * _Nonnull arg4; +@property (strong, nonatomic) NSArray * _Nonnull arg5; +@property (strong, nonatomic) NSArray * _Nonnull arg6; +@end + +@interface CHIPTestClusterClusterTestFabricScopedEventEvent : NSObject +@property (strong, nonatomic) NSNumber * _Nonnull arg1; +@end + NS_ASSUME_NONNULL_END #endif /* CHIP_STRUCTS_H */ diff --git a/src/darwin/Framework/CHIP/zap-generated/CHIPStructsObjc.mm b/src/darwin/Framework/CHIP/zap-generated/CHIPStructsObjc.mm index e41d800b36d887..6ef49cf6be1102 100644 --- a/src/darwin/Framework/CHIP/zap-generated/CHIPStructsObjc.mm +++ b/src/darwin/Framework/CHIP/zap-generated/CHIPStructsObjc.mm @@ -166,6 +166,44 @@ - (instancetype)init } @end +@implementation CHIPAccessControlClusterAccessControlEntryChangedEvent +- (instancetype)init +{ + if (self = [super init]) { + + _adminNodeID = nil; + + _adminPasscodeID = nil; + + _changeType = @(0); + + _latestValue = nil; + + _adminFabricIndex = @(0); + } + return self; +} +@end + +@implementation CHIPAccessControlClusterAccessControlExtensionChangedEvent +- (instancetype)init +{ + if (self = [super init]) { + + _adminNodeID = nil; + + _adminPasscodeID = nil; + + _changeType = @(0); + + _latestValue = nil; + + _adminFabricIndex = @(0); + } + return self; +} +@end + @implementation CHIPBridgedActionsClusterActionStruct - (instancetype)init { @@ -204,6 +242,38 @@ - (instancetype)init } @end +@implementation CHIPBridgedActionsClusterStateChangedEvent +- (instancetype)init +{ + if (self = [super init]) { + + _actionID = @(0); + + _invokeID = @(0); + + _newState = @(0); + } + return self; +} +@end + +@implementation CHIPBridgedActionsClusterActionFailedEvent +- (instancetype)init +{ + if (self = [super init]) { + + _actionID = @(0); + + _invokeID = @(0); + + _newState = @(0); + + _error = @(0); + } + return self; +} +@end + @implementation CHIPBasicClusterCapabilityMinimaStruct - (instancetype)init { @@ -217,6 +287,46 @@ - (instancetype)init } @end +@implementation CHIPBasicClusterStartUpEvent +- (instancetype)init +{ + if (self = [super init]) { + + _softwareVersion = @(0); + } + return self; +} +@end + +@implementation CHIPBasicClusterShutDownEvent +- (instancetype)init +{ + if (self = [super init]) { + } + return self; +} +@end + +@implementation CHIPBasicClusterLeaveEvent +- (instancetype)init +{ + if (self = [super init]) { + } + return self; +} +@end + +@implementation CHIPBasicClusterReachableChangedEvent +- (instancetype)init +{ + if (self = [super init]) { + + _reachableNewValue = @(0); + } + return self; +} +@end + @implementation CHIPOtaSoftwareUpdateRequestorClusterProviderLocation - (instancetype)init { @@ -232,6 +342,53 @@ - (instancetype)init } @end +@implementation CHIPOtaSoftwareUpdateRequestorClusterStateTransitionEvent +- (instancetype)init +{ + if (self = [super init]) { + + _previousState = @(0); + + _newState = @(0); + + _reason = @(0); + + _targetSoftwareVersion = nil; + } + return self; +} +@end + +@implementation CHIPOtaSoftwareUpdateRequestorClusterVersionAppliedEvent +- (instancetype)init +{ + if (self = [super init]) { + + _softwareVersion = @(0); + + _productID = @(0); + } + return self; +} +@end + +@implementation CHIPOtaSoftwareUpdateRequestorClusterDownloadErrorEvent +- (instancetype)init +{ + if (self = [super init]) { + + _softwareVersion = @(0); + + _bytesDownloaded = @(0); + + _progressPercent = nil; + + _platformCode = nil; + } + return self; +} +@end + @implementation CHIPPowerSourceClusterBatChargeFaultChangeType - (instancetype)init { @@ -239,434 +396,915 @@ - (instancetype)init _current = [NSArray array]; - _previous = [NSArray array]; + _previous = [NSArray array]; + } + return self; +} +@end + +@implementation CHIPPowerSourceClusterBatFaultChangeType +- (instancetype)init +{ + if (self = [super init]) { + + _current = [NSArray array]; + + _previous = [NSArray array]; + } + return self; +} +@end + +@implementation CHIPPowerSourceClusterWiredFaultChangeType +- (instancetype)init +{ + if (self = [super init]) { + + _current = [NSArray array]; + + _previous = [NSArray array]; + } + return self; +} +@end + +@implementation CHIPGeneralCommissioningClusterBasicCommissioningInfo +- (instancetype)init +{ + if (self = [super init]) { + + _failSafeExpiryLengthSeconds = @(0); + } + return self; +} +@end + +@implementation CHIPNetworkCommissioningClusterNetworkInfo +- (instancetype)init +{ + if (self = [super init]) { + + _networkID = [NSData data]; + + _connected = @(0); + } + return self; +} +@end + +@implementation CHIPNetworkCommissioningClusterThreadInterfaceScanResult +- (instancetype)init +{ + if (self = [super init]) { + + _panId = @(0); + + _extendedPanId = @(0); + + _networkName = @""; + + _channel = @(0); + + _version = @(0); + + _extendedAddress = [NSData data]; + + _rssi = @(0); + + _lqi = @(0); + } + return self; +} +@end + +@implementation CHIPNetworkCommissioningClusterWiFiInterfaceScanResult +- (instancetype)init +{ + if (self = [super init]) { + + _security = @(0); + + _ssid = [NSData data]; + + _bssid = [NSData data]; + + _channel = @(0); + + _wiFiBand = @(0); + + _rssi = @(0); + } + return self; +} +@end + +@implementation CHIPGeneralDiagnosticsClusterNetworkInterfaceType +- (instancetype)init +{ + if (self = [super init]) { + + _name = @""; + + _isOperational = @(0); + + _offPremiseServicesReachableIPv4 = nil; + + _offPremiseServicesReachableIPv6 = nil; + + _hardwareAddress = [NSData data]; + + _iPv4Addresses = [NSArray array]; + + _iPv6Addresses = [NSArray array]; + + _type = @(0); + } + return self; +} +@end + +@implementation CHIPGeneralDiagnosticsClusterHardwareFaultChangeEvent +- (instancetype)init +{ + if (self = [super init]) { + + _current = [NSArray array]; + + _previous = [NSArray array]; + } + return self; +} +@end + +@implementation CHIPGeneralDiagnosticsClusterRadioFaultChangeEvent +- (instancetype)init +{ + if (self = [super init]) { + + _current = [NSArray array]; + + _previous = [NSArray array]; + } + return self; +} +@end + +@implementation CHIPGeneralDiagnosticsClusterNetworkFaultChangeEvent +- (instancetype)init +{ + if (self = [super init]) { + + _current = [NSArray array]; + + _previous = [NSArray array]; + } + return self; +} +@end + +@implementation CHIPGeneralDiagnosticsClusterBootReasonEvent +- (instancetype)init +{ + if (self = [super init]) { + + _bootReason = @(0); + } + return self; +} +@end + +@implementation CHIPSoftwareDiagnosticsClusterSoftwareFaultStruct +- (instancetype)init +{ + if (self = [super init]) { + + _id = @(0); + + _name = @""; + + _faultRecording = [NSData data]; + } + return self; +} +@end + +@implementation CHIPSoftwareDiagnosticsClusterThreadMetrics +- (instancetype)init +{ + if (self = [super init]) { + + _id = @(0); + + _name = @""; + + _stackFreeCurrent = @(0); + + _stackFreeMinimum = @(0); + + _stackSize = @(0); + } + return self; +} +@end + +@implementation CHIPSoftwareDiagnosticsClusterSoftwareFaultEvent +- (instancetype)init +{ + if (self = [super init]) { + + _softwareFault = [CHIPSoftwareDiagnosticsClusterSoftwareFaultStruct new]; + } + return self; +} +@end + +@implementation CHIPThreadNetworkDiagnosticsClusterNeighborTable +- (instancetype)init +{ + if (self = [super init]) { + + _extAddress = @(0); + + _age = @(0); + + _rloc16 = @(0); + + _linkFrameCounter = @(0); + + _mleFrameCounter = @(0); + + _lqi = @(0); + + _averageRssi = @(0); + + _lastRssi = @(0); + + _frameErrorRate = @(0); + + _messageErrorRate = @(0); + + _rxOnWhenIdle = @(0); + + _fullThreadDevice = @(0); + + _fullNetworkData = @(0); + + _isChild = @(0); + } + return self; +} +@end + +@implementation CHIPThreadNetworkDiagnosticsClusterOperationalDatasetComponents +- (instancetype)init +{ + if (self = [super init]) { + + _activeTimestampPresent = @(0); + + _pendingTimestampPresent = @(0); + + _masterKeyPresent = @(0); + + _networkNamePresent = @(0); + + _extendedPanIdPresent = @(0); + + _meshLocalPrefixPresent = @(0); + + _delayPresent = @(0); + + _panIdPresent = @(0); + + _channelPresent = @(0); + + _pskcPresent = @(0); + + _securityPolicyPresent = @(0); + + _channelMaskPresent = @(0); + } + return self; +} +@end + +@implementation CHIPThreadNetworkDiagnosticsClusterRouteTable +- (instancetype)init +{ + if (self = [super init]) { + + _extAddress = @(0); + + _rloc16 = @(0); + + _routerId = @(0); + + _nextHop = @(0); + + _pathCost = @(0); + + _lqiIn = @(0); + + _lqiOut = @(0); + + _age = @(0); + + _allocated = @(0); + + _linkEstablished = @(0); + } + return self; +} +@end + +@implementation CHIPThreadNetworkDiagnosticsClusterSecurityPolicy +- (instancetype)init +{ + if (self = [super init]) { + + _rotationTime = @(0); + + _flags = @(0); + } + return self; +} +@end + +@implementation CHIPThreadNetworkDiagnosticsClusterConnectionStatusEvent +- (instancetype)init +{ + if (self = [super init]) { + + _connectionStatus = @(0); + } + return self; +} +@end + +@implementation CHIPWiFiNetworkDiagnosticsClusterDisconnectionEvent +- (instancetype)init +{ + if (self = [super init]) { + + _reasonCode = @(0); + } + return self; +} +@end + +@implementation CHIPWiFiNetworkDiagnosticsClusterAssociationFailureEvent +- (instancetype)init +{ + if (self = [super init]) { + + _associationFailure = @(0); + + _status = @(0); + } + return self; +} +@end + +@implementation CHIPWiFiNetworkDiagnosticsClusterConnectionStatusEvent +- (instancetype)init +{ + if (self = [super init]) { + + _connectionStatus = @(0); + } + return self; +} +@end + +@implementation CHIPBridgedDeviceBasicClusterStartUpEvent +- (instancetype)init +{ + if (self = [super init]) { + + _softwareVersion = @(0); + } + return self; +} +@end + +@implementation CHIPBridgedDeviceBasicClusterShutDownEvent +- (instancetype)init +{ + if (self = [super init]) { + } + return self; +} +@end + +@implementation CHIPBridgedDeviceBasicClusterLeaveEvent +- (instancetype)init +{ + if (self = [super init]) { + } + return self; +} +@end + +@implementation CHIPBridgedDeviceBasicClusterReachableChangedEvent +- (instancetype)init +{ + if (self = [super init]) { + + _reachableNewValue = @(0); + } + return self; +} +@end + +@implementation CHIPSwitchClusterSwitchLatchedEvent +- (instancetype)init +{ + if (self = [super init]) { + + _newPosition = @(0); + } + return self; +} +@end + +@implementation CHIPSwitchClusterInitialPressEvent +- (instancetype)init +{ + if (self = [super init]) { + + _newPosition = @(0); + } + return self; +} +@end + +@implementation CHIPSwitchClusterLongPressEvent +- (instancetype)init +{ + if (self = [super init]) { + + _newPosition = @(0); + } + return self; +} +@end + +@implementation CHIPSwitchClusterShortReleaseEvent +- (instancetype)init +{ + if (self = [super init]) { + + _previousPosition = @(0); + } + return self; +} +@end + +@implementation CHIPSwitchClusterLongReleaseEvent +- (instancetype)init +{ + if (self = [super init]) { + + _previousPosition = @(0); + } + return self; +} +@end + +@implementation CHIPSwitchClusterMultiPressOngoingEvent +- (instancetype)init +{ + if (self = [super init]) { + + _newPosition = @(0); + + _currentNumberOfPressesCounted = @(0); + } + return self; +} +@end + +@implementation CHIPSwitchClusterMultiPressCompleteEvent +- (instancetype)init +{ + if (self = [super init]) { + + _newPosition = @(0); + + _totalNumberOfPressesCounted = @(0); + } + return self; +} +@end + +@implementation CHIPOperationalCredentialsClusterFabricDescriptor +- (instancetype)init +{ + if (self = [super init]) { + + _rootPublicKey = [NSData data]; + + _vendorId = @(0); + + _fabricId = @(0); + + _nodeId = @(0); + + _label = @""; + + _fabricIndex = @(0); + } + return self; +} +@end + +@implementation CHIPOperationalCredentialsClusterNOCStruct +- (instancetype)init +{ + if (self = [super init]) { + + _noc = [NSData data]; + + _icac = nil; + + _fabricIndex = @(0); + } + return self; +} +@end + +@implementation CHIPGroupKeyManagementClusterGroupInfoMapStruct +- (instancetype)init +{ + if (self = [super init]) { + + _groupId = @(0); + + _endpoints = [NSArray array]; + + _groupName = nil; + + _fabricIndex = @(0); + } + return self; +} +@end + +@implementation CHIPGroupKeyManagementClusterGroupKeyMapStruct +- (instancetype)init +{ + if (self = [super init]) { + + _groupId = @(0); + + _groupKeySetID = @(0); + + _fabricIndex = @(0); + } + return self; +} +@end + +@implementation CHIPGroupKeyManagementClusterGroupKeySetStruct +- (instancetype)init +{ + if (self = [super init]) { + + _groupKeySetID = @(0); + + _groupKeySecurityPolicy = @(0); + + _epochKey0 = nil; + + _epochStartTime0 = nil; + + _epochKey1 = nil; + + _epochStartTime1 = nil; + + _epochKey2 = nil; + + _epochStartTime2 = nil; + } + return self; +} +@end + +@implementation CHIPFixedLabelClusterLabelStruct +- (instancetype)init +{ + if (self = [super init]) { + + _label = @""; + + _value = @""; + } + return self; +} +@end + +@implementation CHIPUserLabelClusterLabelStruct +- (instancetype)init +{ + if (self = [super init]) { + + _label = @""; + + _value = @""; + } + return self; +} +@end + +@implementation CHIPBooleanStateClusterStateChangeEvent +- (instancetype)init +{ + if (self = [super init]) { + + _stateValue = @(0); + } + return self; +} +@end + +@implementation CHIPModeSelectClusterModeOptionStruct +- (instancetype)init +{ + if (self = [super init]) { + + _label = @""; + + _mode = @(0); + + _semanticTag = @(0); } return self; } @end -@implementation CHIPPowerSourceClusterBatFaultChangeType +@implementation CHIPModeSelectClusterSemanticTag - (instancetype)init { if (self = [super init]) { - _current = [NSArray array]; + _mfgCode = @(0); - _previous = [NSArray array]; + _value = @(0); } return self; } @end -@implementation CHIPPowerSourceClusterWiredFaultChangeType +@implementation CHIPDoorLockClusterDlCredential - (instancetype)init { if (self = [super init]) { - _current = [NSArray array]; + _credentialType = @(0); - _previous = [NSArray array]; + _credentialIndex = @(0); } return self; } @end -@implementation CHIPGeneralCommissioningClusterBasicCommissioningInfo +@implementation CHIPDoorLockClusterDoorLockAlarmEvent - (instancetype)init { if (self = [super init]) { - _failSafeExpiryLengthSeconds = @(0); + _alarmCode = @(0); } return self; } @end -@implementation CHIPNetworkCommissioningClusterNetworkInfo +@implementation CHIPDoorLockClusterDoorStateChangeEvent - (instancetype)init { if (self = [super init]) { - _networkID = [NSData data]; - - _connected = @(0); + _doorState = @(0); } return self; } @end -@implementation CHIPNetworkCommissioningClusterThreadInterfaceScanResult +@implementation CHIPDoorLockClusterLockOperationEvent - (instancetype)init { if (self = [super init]) { - _panId = @(0); - - _extendedPanId = @(0); - - _networkName = @""; + _lockOperationType = @(0); - _channel = @(0); + _operationSource = @(0); - _version = @(0); + _userIndex = nil; - _extendedAddress = [NSData data]; + _fabricIndex = nil; - _rssi = @(0); + _sourceNode = nil; - _lqi = @(0); + _credentials = nil; } return self; } @end -@implementation CHIPNetworkCommissioningClusterWiFiInterfaceScanResult +@implementation CHIPDoorLockClusterLockOperationErrorEvent - (instancetype)init { if (self = [super init]) { - _security = @(0); + _lockOperationType = @(0); - _ssid = [NSData data]; + _operationSource = @(0); - _bssid = [NSData data]; + _operationError = @(0); - _channel = @(0); + _userIndex = nil; - _wiFiBand = @(0); + _fabricIndex = nil; - _rssi = @(0); + _sourceNode = nil; + + _credentials = nil; } return self; } @end -@implementation CHIPGeneralDiagnosticsClusterNetworkInterfaceType +@implementation CHIPDoorLockClusterLockUserChangeEvent - (instancetype)init { if (self = [super init]) { - _name = @""; - - _isOperational = @(0); + _lockDataType = @(0); - _offPremiseServicesReachableIPv4 = nil; + _dataOperationType = @(0); - _offPremiseServicesReachableIPv6 = nil; + _operationSource = @(0); - _hardwareAddress = [NSData data]; + _userIndex = nil; - _iPv4Addresses = [NSArray array]; + _fabricIndex = nil; - _iPv6Addresses = [NSArray array]; + _sourceNode = nil; - _type = @(0); + _dataIndex = nil; } return self; } @end -@implementation CHIPSoftwareDiagnosticsClusterSoftwareFaultStruct +@implementation CHIPPumpConfigurationAndControlClusterSupplyVoltageLowEvent - (instancetype)init { if (self = [super init]) { - - _id = @(0); - - _name = @""; - - _faultRecording = [NSData data]; } return self; } @end -@implementation CHIPSoftwareDiagnosticsClusterThreadMetrics +@implementation CHIPPumpConfigurationAndControlClusterSupplyVoltageHighEvent - (instancetype)init { if (self = [super init]) { - - _id = @(0); - - _name = @""; - - _stackFreeCurrent = @(0); - - _stackFreeMinimum = @(0); - - _stackSize = @(0); } return self; } @end -@implementation CHIPThreadNetworkDiagnosticsClusterNeighborTable +@implementation CHIPPumpConfigurationAndControlClusterPowerMissingPhaseEvent - (instancetype)init { if (self = [super init]) { - - _extAddress = @(0); - - _age = @(0); - - _rloc16 = @(0); - - _linkFrameCounter = @(0); - - _mleFrameCounter = @(0); - - _lqi = @(0); - - _averageRssi = @(0); - - _lastRssi = @(0); - - _frameErrorRate = @(0); - - _messageErrorRate = @(0); - - _rxOnWhenIdle = @(0); - - _fullThreadDevice = @(0); - - _fullNetworkData = @(0); - - _isChild = @(0); } return self; } @end -@implementation CHIPThreadNetworkDiagnosticsClusterOperationalDatasetComponents +@implementation CHIPPumpConfigurationAndControlClusterSystemPressureLowEvent - (instancetype)init { if (self = [super init]) { - - _activeTimestampPresent = @(0); - - _pendingTimestampPresent = @(0); - - _masterKeyPresent = @(0); - - _networkNamePresent = @(0); - - _extendedPanIdPresent = @(0); - - _meshLocalPrefixPresent = @(0); - - _delayPresent = @(0); - - _panIdPresent = @(0); - - _channelPresent = @(0); - - _pskcPresent = @(0); - - _securityPolicyPresent = @(0); - - _channelMaskPresent = @(0); } return self; } @end -@implementation CHIPThreadNetworkDiagnosticsClusterRouteTable +@implementation CHIPPumpConfigurationAndControlClusterSystemPressureHighEvent - (instancetype)init { if (self = [super init]) { - - _extAddress = @(0); - - _rloc16 = @(0); - - _routerId = @(0); - - _nextHop = @(0); - - _pathCost = @(0); - - _lqiIn = @(0); - - _lqiOut = @(0); - - _age = @(0); - - _allocated = @(0); - - _linkEstablished = @(0); } return self; } @end -@implementation CHIPThreadNetworkDiagnosticsClusterSecurityPolicy +@implementation CHIPPumpConfigurationAndControlClusterDryRunningEvent - (instancetype)init { if (self = [super init]) { - - _rotationTime = @(0); - - _flags = @(0); } return self; } @end -@implementation CHIPOperationalCredentialsClusterFabricDescriptor +@implementation CHIPPumpConfigurationAndControlClusterMotorTemperatureHighEvent - (instancetype)init { if (self = [super init]) { - - _rootPublicKey = [NSData data]; - - _vendorId = @(0); - - _fabricId = @(0); - - _nodeId = @(0); - - _label = @""; - - _fabricIndex = @(0); } return self; } @end -@implementation CHIPOperationalCredentialsClusterNOCStruct +@implementation CHIPPumpConfigurationAndControlClusterPumpMotorFatalFailureEvent - (instancetype)init { if (self = [super init]) { - - _noc = [NSData data]; - - _icac = nil; - - _fabricIndex = @(0); } return self; } @end -@implementation CHIPGroupKeyManagementClusterGroupInfoMapStruct +@implementation CHIPPumpConfigurationAndControlClusterElectronicTemperatureHighEvent - (instancetype)init { if (self = [super init]) { - - _groupId = @(0); - - _endpoints = [NSArray array]; - - _groupName = nil; - - _fabricIndex = @(0); } return self; } @end -@implementation CHIPGroupKeyManagementClusterGroupKeyMapStruct +@implementation CHIPPumpConfigurationAndControlClusterPumpBlockedEvent - (instancetype)init { if (self = [super init]) { - - _groupId = @(0); - - _groupKeySetID = @(0); - - _fabricIndex = @(0); } return self; } @end -@implementation CHIPGroupKeyManagementClusterGroupKeySetStruct +@implementation CHIPPumpConfigurationAndControlClusterSensorFailureEvent - (instancetype)init { if (self = [super init]) { - - _groupKeySetID = @(0); - - _groupKeySecurityPolicy = @(0); - - _epochKey0 = nil; - - _epochStartTime0 = nil; - - _epochKey1 = nil; - - _epochStartTime1 = nil; - - _epochKey2 = nil; - - _epochStartTime2 = nil; } return self; } @end -@implementation CHIPFixedLabelClusterLabelStruct +@implementation CHIPPumpConfigurationAndControlClusterElectronicNonFatalFailureEvent - (instancetype)init { if (self = [super init]) { - - _label = @""; - - _value = @""; } return self; } @end -@implementation CHIPUserLabelClusterLabelStruct +@implementation CHIPPumpConfigurationAndControlClusterElectronicFatalFailureEvent - (instancetype)init { if (self = [super init]) { - - _label = @""; - - _value = @""; } return self; } @end -@implementation CHIPModeSelectClusterModeOptionStruct +@implementation CHIPPumpConfigurationAndControlClusterGeneralFaultEvent - (instancetype)init { if (self = [super init]) { - - _label = @""; - - _mode = @(0); - - _semanticTag = @(0); } return self; } @end -@implementation CHIPModeSelectClusterSemanticTag +@implementation CHIPPumpConfigurationAndControlClusterLeakageEvent - (instancetype)init { if (self = [super init]) { - - _mfgCode = @(0); - - _value = @(0); } return self; } @end -@implementation CHIPDoorLockClusterDlCredential +@implementation CHIPPumpConfigurationAndControlClusterAirDetectionEvent - (instancetype)init { if (self = [super init]) { + } + return self; +} +@end - _credentialType = @(0); - - _credentialIndex = @(0); +@implementation CHIPPumpConfigurationAndControlClusterTurbineOperationEvent +- (instancetype)init +{ + if (self = [super init]) { } return self; } @@ -1053,4 +1691,36 @@ - (instancetype)init } @end +@implementation CHIPTestClusterClusterTestEventEvent +- (instancetype)init +{ + if (self = [super init]) { + + _arg1 = @(0); + + _arg2 = @(0); + + _arg3 = @(0); + + _arg4 = [CHIPTestClusterClusterSimpleStruct new]; + + _arg5 = [NSArray array]; + + _arg6 = [NSArray array]; + } + return self; +} +@end + +@implementation CHIPTestClusterClusterTestFabricScopedEventEvent +- (instancetype)init +{ + if (self = [super init]) { + + _arg1 = @(0); + } + return self; +} +@end + NS_ASSUME_NONNULL_END From 923b996cafc91506113fdc427e17de96e9ec8f2f Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Mon, 25 Apr 2022 20:26:19 -0400 Subject: [PATCH 18/25] Fix build on NRFConnect. (#17714) Looks like that has started using Advertiser_ImplNone. --- src/lib/dnssd/Advertiser_ImplNone.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/lib/dnssd/Advertiser_ImplNone.cpp b/src/lib/dnssd/Advertiser_ImplNone.cpp index a3cc54ab2bd3af..bc3e70a214b0c4 100644 --- a/src/lib/dnssd/Advertiser_ImplNone.cpp +++ b/src/lib/dnssd/Advertiser_ImplNone.cpp @@ -58,11 +58,17 @@ class NoneAdvertiser : public ServiceAdvertiser return CHIP_ERROR_NOT_IMPLEMENTED; } - CHIP_ERROR GetCommissionableInstanceName(char * instanceName, size_t maxLength) override + CHIP_ERROR GetCommissionableInstanceName(char * instanceName, size_t maxLength) const override { ChipLogError(Discovery, "DNS-SD advertising not available. DNS-SD GetCommissionableInstanceName not available."); return CHIP_ERROR_NOT_IMPLEMENTED; } + + CHIP_ERROR UpdateCommissionableInstanceName() override + { + ChipLogError(Discovery, "DNS-SD advertising not available. Can't update DNS-SD commissionable instance name."); + return CHIP_ERROR_NOT_IMPLEMENTED; + } }; NoneAdvertiser gAdvertiser; From 03b709bc3a5a0e85ca58f1caee0743a138491ff0 Mon Sep 17 00:00:00 2001 From: Evgeny Margolis Date: Mon, 25 Apr 2022 19:04:02 -0700 Subject: [PATCH 19/25] Updated ASN1Reader::GetInteger() Implementation to Fix Clang tidy Error (#17718) The Clang tidy clang-analyzer-core.UndefinedBinaryOperatorResult check was enabled in PR #17649. The original ASN1Reader::GetInteger() was correct but to silent the error the implementation was update. I hope it is now also more user readable --- src/lib/asn1/ASN1Reader.cpp | 24 ++++++++++++++---------- src/lib/asn1/ASN1Writer.cpp | 2 +- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/src/lib/asn1/ASN1Reader.cpp b/src/lib/asn1/ASN1Reader.cpp index 286a22e14b01e4..9309dc53448721 100644 --- a/src/lib/asn1/ASN1Reader.cpp +++ b/src/lib/asn1/ASN1Reader.cpp @@ -30,11 +30,14 @@ #include #include +#include #include namespace chip { namespace ASN1 { +using namespace chip::Encoding; + void ASN1Reader::Init(const uint8_t * buf, size_t len) { ResetElementState(); @@ -142,23 +145,24 @@ bool ASN1Reader::IsContained() const CHIP_ERROR ASN1Reader::GetInteger(int64_t & val) { + uint8_t encodedVal[sizeof(int64_t)] = { 0 }; + size_t valPaddingLen = sizeof(int64_t) - ValueLen; + ReturnErrorCodeIf(Value == nullptr, ASN1_ERROR_INVALID_STATE); ReturnErrorCodeIf(ValueLen < 1, ASN1_ERROR_INVALID_ENCODING); ReturnErrorCodeIf(ValueLen > sizeof(int64_t), ASN1_ERROR_VALUE_OVERFLOW); ReturnErrorCodeIf(mElemStart + mHeadLen + ValueLen > mContainerEnd, ASN1_ERROR_UNDERRUN); - // NOLINTBEGIN(clang-analyzer-core.UndefinedBinaryOperatorResult) - // - // TODO: clang-tidy says that if val is -1, then (val << 8) is not defined. - // added above supression to keep clang-tidy validating the rest of the files, however - // this complain likely needs fixing. - const uint8_t * p = Value; - val = ((*p & 0x80) == 0) ? 0 : -1; - for (uint32_t i = ValueLen; i > 0; i--, p++) + if ((*Value & 0x80) == 0x80) { - val = (val << 8) | *p; + for (size_t i = 0; i < valPaddingLen; i++) + { + encodedVal[i] = 0xFF; + } } - // NOLINTEND(clang-analyzer-core.UndefinedBinaryOperatorResult) + memcpy(&encodedVal[valPaddingLen], Value, ValueLen); + + val = static_cast(BigEndian::Get64(encodedVal)); return CHIP_NO_ERROR; } diff --git a/src/lib/asn1/ASN1Writer.cpp b/src/lib/asn1/ASN1Writer.cpp index 6b3d313e825456..a67ca0e041e7c2 100644 --- a/src/lib/asn1/ASN1Writer.cpp +++ b/src/lib/asn1/ASN1Writer.cpp @@ -75,7 +75,7 @@ size_t ASN1Writer::GetLengthWritten() const CHIP_ERROR ASN1Writer::PutInteger(int64_t val) { - uint8_t encodedVal[8]; + uint8_t encodedVal[sizeof(int64_t)]; uint8_t valStart, valLen; BigEndian::Put64(encodedVal, static_cast(val)); From 3a7f03a0a1c58c4f6cf69ea7e6b808feff3b6636 Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Mon, 25 Apr 2022 22:47:16 -0400 Subject: [PATCH 20/25] Ensure that read attribute paths are valid paths. (#17664) Disallow out-of-range attribute ids and wildcard cluster with non-wildcard non-global attribute. Fixes https://github.com/project-chip/connectedhomeip/issues/14026 --- .../all-clusters-app.matter | 66 ++--- .../all-clusters-common/all-clusters-app.zap | 66 ++--- src/app/InteractionModelEngine.cpp | 7 +- src/app/MessageDef/StatusIB.cpp | 2 +- src/app/MessageDef/StatusResponseMessage.cpp | 7 +- src/app/ReadHandler.cpp | 38 ++- src/app/tests/TestReadInteraction.cpp | 3 +- src/app/util/mock/Constants.h | 3 +- .../zcl/data-model/chip/test-cluster.xml | 66 ++--- .../data_model/controller-clusters.matter | 66 ++--- .../data_model/controller-clusters.zap | 66 ++--- .../chip/devicecontroller/ChipIdLookup.java | 66 ++--- .../python/chip/clusters/CHIPClusters.py | 132 ++++----- .../python/chip/clusters/Objects.py | 132 ++++----- src/lib/core/DataModelTypes.h | 45 ++- .../zap-generated/endpoint_config.h | 66 ++--- .../app-common/zap-generated/attribute-id.h | 66 ++--- .../app-common/zap-generated/ids/Attributes.h | 66 ++--- .../zap-generated/cluster/Commands.h | 264 +++++++++--------- .../zap-generated/cluster/Commands.h | 198 ++++++------- 20 files changed, 738 insertions(+), 687 deletions(-) diff --git a/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter b/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter index 071bc21949112d..a2755ad226afd3 100644 --- a/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter +++ b/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter @@ -3109,39 +3109,39 @@ server cluster TestCluster = 1295 { attribute boolean timedWriteBoolean = 48; attribute boolean generalErrorBoolean = 49; attribute boolean clusterErrorBoolean = 50; - attribute nullable boolean nullableBoolean = 32768; - attribute nullable Bitmap8MaskMap nullableBitmap8 = 32769; - attribute nullable Bitmap16MaskMap nullableBitmap16 = 32770; - attribute nullable Bitmap32MaskMap nullableBitmap32 = 32771; - attribute nullable Bitmap64MaskMap nullableBitmap64 = 32772; - attribute nullable int8u nullableInt8u = 32773; - attribute nullable int16u nullableInt16u = 32774; - attribute nullable int24u nullableInt24u = 32775; - attribute nullable int32u nullableInt32u = 32776; - attribute nullable int40u nullableInt40u = 32777; - attribute nullable int48u nullableInt48u = 32778; - attribute nullable int56u nullableInt56u = 32779; - attribute nullable int64u nullableInt64u = 32780; - attribute nullable int8s nullableInt8s = 32781; - attribute nullable int16s nullableInt16s = 32782; - attribute nullable int24s nullableInt24s = 32783; - attribute nullable int32s nullableInt32s = 32784; - attribute nullable int40s nullableInt40s = 32785; - attribute nullable int48s nullableInt48s = 32786; - attribute nullable int56s nullableInt56s = 32787; - attribute nullable int64s nullableInt64s = 32788; - attribute nullable enum8 nullableEnum8 = 32789; - attribute nullable enum16 nullableEnum16 = 32790; - attribute nullable single nullableFloatSingle = 32791; - attribute nullable double nullableFloatDouble = 32792; - attribute nullable octet_string<10> nullableOctetString = 32793; - attribute nullable char_string<10> nullableCharString = 32798; - attribute nullable SimpleEnum nullableEnumAttr = 32804; - attribute nullable SimpleStruct nullableStruct = 32805; - attribute nullable int8u nullableRangeRestrictedInt8u = 32806; - attribute nullable int8s nullableRangeRestrictedInt8s = 32807; - attribute nullable int16u nullableRangeRestrictedInt16u = 32808; - attribute nullable int16s nullableRangeRestrictedInt16s = 32809; + attribute nullable boolean nullableBoolean = 16384; + attribute nullable Bitmap8MaskMap nullableBitmap8 = 16385; + attribute nullable Bitmap16MaskMap nullableBitmap16 = 16386; + attribute nullable Bitmap32MaskMap nullableBitmap32 = 16387; + attribute nullable Bitmap64MaskMap nullableBitmap64 = 16388; + attribute nullable int8u nullableInt8u = 16389; + attribute nullable int16u nullableInt16u = 16390; + attribute nullable int24u nullableInt24u = 16391; + attribute nullable int32u nullableInt32u = 16392; + attribute nullable int40u nullableInt40u = 16393; + attribute nullable int48u nullableInt48u = 16394; + attribute nullable int56u nullableInt56u = 16395; + attribute nullable int64u nullableInt64u = 16396; + attribute nullable int8s nullableInt8s = 16397; + attribute nullable int16s nullableInt16s = 16398; + attribute nullable int24s nullableInt24s = 16399; + attribute nullable int32s nullableInt32s = 16400; + attribute nullable int40s nullableInt40s = 16401; + attribute nullable int48s nullableInt48s = 16402; + attribute nullable int56s nullableInt56s = 16403; + attribute nullable int64s nullableInt64s = 16404; + attribute nullable enum8 nullableEnum8 = 16405; + attribute nullable enum16 nullableEnum16 = 16406; + attribute nullable single nullableFloatSingle = 16407; + attribute nullable double nullableFloatDouble = 16408; + attribute nullable octet_string<10> nullableOctetString = 16409; + attribute nullable char_string<10> nullableCharString = 16414; + attribute nullable SimpleEnum nullableEnumAttr = 16420; + attribute nullable SimpleStruct nullableStruct = 16421; + attribute nullable int8u nullableRangeRestrictedInt8u = 16422; + attribute nullable int8s nullableRangeRestrictedInt8s = 16423; + attribute nullable int16u nullableRangeRestrictedInt16u = 16424; + attribute nullable int16s nullableRangeRestrictedInt16s = 16425; readonly attribute int16u clusterRevision = 65533; request struct TestAddArgumentsRequest { diff --git a/examples/all-clusters-app/all-clusters-common/all-clusters-app.zap b/examples/all-clusters-app/all-clusters-common/all-clusters-app.zap index 1520949f5cb900..f17df8f6086378 100644 --- a/examples/all-clusters-app/all-clusters-common/all-clusters-app.zap +++ b/examples/all-clusters-app/all-clusters-common/all-clusters-app.zap @@ -17613,7 +17613,7 @@ }, { "name": "nullable_boolean", - "code": 32768, + "code": 16384, "mfgCode": null, "side": "server", "included": 1, @@ -17628,7 +17628,7 @@ }, { "name": "nullable_bitmap8", - "code": 32769, + "code": 16385, "mfgCode": null, "side": "server", "included": 1, @@ -17643,7 +17643,7 @@ }, { "name": "nullable_bitmap16", - "code": 32770, + "code": 16386, "mfgCode": null, "side": "server", "included": 1, @@ -17658,7 +17658,7 @@ }, { "name": "nullable_bitmap32", - "code": 32771, + "code": 16387, "mfgCode": null, "side": "server", "included": 1, @@ -17673,7 +17673,7 @@ }, { "name": "nullable_bitmap64", - "code": 32772, + "code": 16388, "mfgCode": null, "side": "server", "included": 1, @@ -17688,7 +17688,7 @@ }, { "name": "nullable_int8u", - "code": 32773, + "code": 16389, "mfgCode": null, "side": "server", "included": 1, @@ -17703,7 +17703,7 @@ }, { "name": "nullable_int16u", - "code": 32774, + "code": 16390, "mfgCode": null, "side": "server", "included": 1, @@ -17718,7 +17718,7 @@ }, { "name": "nullable_int24u", - "code": 32775, + "code": 16391, "mfgCode": null, "side": "server", "included": 1, @@ -17733,7 +17733,7 @@ }, { "name": "nullable_int32u", - "code": 32776, + "code": 16392, "mfgCode": null, "side": "server", "included": 1, @@ -17748,7 +17748,7 @@ }, { "name": "nullable_int40u", - "code": 32777, + "code": 16393, "mfgCode": null, "side": "server", "included": 1, @@ -17763,7 +17763,7 @@ }, { "name": "nullable_int48u", - "code": 32778, + "code": 16394, "mfgCode": null, "side": "server", "included": 1, @@ -17778,7 +17778,7 @@ }, { "name": "nullable_int56u", - "code": 32779, + "code": 16395, "mfgCode": null, "side": "server", "included": 1, @@ -17793,7 +17793,7 @@ }, { "name": "nullable_int64u", - "code": 32780, + "code": 16396, "mfgCode": null, "side": "server", "included": 1, @@ -17808,7 +17808,7 @@ }, { "name": "nullable_int8s", - "code": 32781, + "code": 16397, "mfgCode": null, "side": "server", "included": 1, @@ -17823,7 +17823,7 @@ }, { "name": "nullable_int16s", - "code": 32782, + "code": 16398, "mfgCode": null, "side": "server", "included": 1, @@ -17838,7 +17838,7 @@ }, { "name": "nullable_int24s", - "code": 32783, + "code": 16399, "mfgCode": null, "side": "server", "included": 1, @@ -17853,7 +17853,7 @@ }, { "name": "nullable_int32s", - "code": 32784, + "code": 16400, "mfgCode": null, "side": "server", "included": 1, @@ -17868,7 +17868,7 @@ }, { "name": "nullable_int40s", - "code": 32785, + "code": 16401, "mfgCode": null, "side": "server", "included": 1, @@ -17883,7 +17883,7 @@ }, { "name": "nullable_int48s", - "code": 32786, + "code": 16402, "mfgCode": null, "side": "server", "included": 1, @@ -17898,7 +17898,7 @@ }, { "name": "nullable_int56s", - "code": 32787, + "code": 16403, "mfgCode": null, "side": "server", "included": 1, @@ -17913,7 +17913,7 @@ }, { "name": "nullable_int64s", - "code": 32788, + "code": 16404, "mfgCode": null, "side": "server", "included": 1, @@ -17928,7 +17928,7 @@ }, { "name": "nullable_enum8", - "code": 32789, + "code": 16405, "mfgCode": null, "side": "server", "included": 1, @@ -17943,7 +17943,7 @@ }, { "name": "nullable_enum16", - "code": 32790, + "code": 16406, "mfgCode": null, "side": "server", "included": 1, @@ -17958,7 +17958,7 @@ }, { "name": "nullable_float_single", - "code": 32791, + "code": 16407, "mfgCode": null, "side": "server", "included": 1, @@ -17973,7 +17973,7 @@ }, { "name": "nullable_float_double", - "code": 32792, + "code": 16408, "mfgCode": null, "side": "server", "included": 1, @@ -17988,7 +17988,7 @@ }, { "name": "nullable_octet_string", - "code": 32793, + "code": 16409, "mfgCode": null, "side": "server", "included": 1, @@ -18003,7 +18003,7 @@ }, { "name": "nullable_char_string", - "code": 32798, + "code": 16414, "mfgCode": null, "side": "server", "included": 1, @@ -18018,7 +18018,7 @@ }, { "name": "nullable_enum_attr", - "code": 32804, + "code": 16420, "mfgCode": null, "side": "server", "included": 1, @@ -18033,7 +18033,7 @@ }, { "name": "nullable_struct", - "code": 32805, + "code": 16421, "mfgCode": null, "side": "server", "included": 1, @@ -18048,7 +18048,7 @@ }, { "name": "nullable_range_restricted_int8u", - "code": 32806, + "code": 16422, "mfgCode": null, "side": "server", "included": 1, @@ -18063,7 +18063,7 @@ }, { "name": "nullable_range_restricted_int8s", - "code": 32807, + "code": 16423, "mfgCode": null, "side": "server", "included": 1, @@ -18078,7 +18078,7 @@ }, { "name": "nullable_range_restricted_int16u", - "code": 32808, + "code": 16424, "mfgCode": null, "side": "server", "included": 1, @@ -18093,7 +18093,7 @@ }, { "name": "nullable_range_restricted_int16s", - "code": 32809, + "code": 16425, "mfgCode": null, "side": "server", "included": 1, diff --git a/src/app/InteractionModelEngine.cpp b/src/app/InteractionModelEngine.cpp index 166c86456521f9..f0f4d3925e32de 100644 --- a/src/app/InteractionModelEngine.cpp +++ b/src/app/InteractionModelEngine.cpp @@ -389,14 +389,11 @@ CHIP_ERROR InteractionModelEngine::OnReadInitialRequest(Messaging::ExchangeConte { aStatus = Protocols::InteractionModel::Status::ResourceExhausted; } - else if (err.IsIMStatus()) + else { aStatus = StatusIB(err).mStatus; } - ReturnErrorOnFailure(err); - - aStatus = Protocols::InteractionModel::Status::Success; - return CHIP_NO_ERROR; + return err; } ChipLogProgress(InteractionModel, "no resource for %s interaction", diff --git a/src/app/MessageDef/StatusIB.cpp b/src/app/MessageDef/StatusIB.cpp index 3e956f9246b36e..37fbca49cab78b 100644 --- a/src/app/MessageDef/StatusIB.cpp +++ b/src/app/MessageDef/StatusIB.cpp @@ -82,7 +82,7 @@ CHIP_ERROR StatusIB::Parser::CheckSchemaValidity() const #if CHIP_DETAIL_LOGGING { - uint16_t status; + uint8_t status; ReturnErrorOnFailure(reader.Get(status)); PRETTY_PRINT("\tstatus = " ChipLogFormatIMStatus ",", ChipLogValueIMStatus(static_cast(status))); } diff --git a/src/app/MessageDef/StatusResponseMessage.cpp b/src/app/MessageDef/StatusResponseMessage.cpp index e68d727dd247c0..d0a605e1c47d98 100644 --- a/src/app/MessageDef/StatusResponseMessage.cpp +++ b/src/app/MessageDef/StatusResponseMessage.cpp @@ -16,6 +16,9 @@ #include "StatusResponseMessage.h" #include "MessageDefHelper.h" +#include "protocols/interaction_model/Constants.h" + +using namespace chip::Protocols::InteractionModel; namespace chip { namespace app { @@ -42,9 +45,9 @@ CHIP_ERROR StatusResponseMessage::Parser::CheckSchemaValidity() const VerifyOrReturnError(TLV::kTLVType_UnsignedInteger == reader.GetType(), CHIP_ERROR_WRONG_TLV_TYPE); #if CHIP_DETAIL_LOGGING { - uint16_t status; + uint8_t status; ReturnErrorOnFailure(reader.Get(status)); - PRETTY_PRINT("\tStatus = 0x%x,", status); + PRETTY_PRINT("\tStatus = " ChipLogFormatIMStatus ",", ChipLogValueIMStatus(static_cast(status))); } #endif // CHIP_DETAIL_LOGGING break; diff --git a/src/app/ReadHandler.cpp b/src/app/ReadHandler.cpp index f2ab53d7da2de2..9c4d38748faf30 100644 --- a/src/app/ReadHandler.cpp +++ b/src/app/ReadHandler.cpp @@ -332,7 +332,14 @@ CHIP_ERROR ReadHandler::ProcessReadRequest(System::PacketBufferHandle && aPayloa ReturnErrorOnFailure(readRequestParser.Init(reader)); #if CHIP_CONFIG_IM_ENABLE_SCHEMA_CHECK - ReturnErrorOnFailure(readRequestParser.CheckSchemaValidity()); + err = readRequestParser.CheckSchemaValidity(); + if (err != CHIP_NO_ERROR) + { + // The actual error we want to return to our consumer is an IM "invalid + // action" error, not whatever internal error CheckSchemaValidity + // happens to come up with. + return CHIP_IM_GLOBAL_STATUS(InvalidAction); + } #endif err = readRequestParser.GetAttributeRequests(&attributePathListParser); @@ -405,46 +412,55 @@ CHIP_ERROR ReadHandler::ProcessAttributePathList(AttributePathIBs::Parser & aAtt AttributePathIB::Parser path; err = path.Init(reader); SuccessOrExit(err); - // TODO: MEIs (ClusterId and AttributeId) have a invalid pattern instead of a single invalid value, need to add separate - // functions for checking if we have received valid values. - // TODO: Wildcard cluster id with non-global attributes or wildcard attribute paths should be rejected. + err = path.GetEndpoint(&(attribute.mEndpointId)); if (err == CHIP_NO_ERROR) { - VerifyOrExit(!attribute.HasWildcardEndpointId(), err = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH); + VerifyOrExit(!attribute.HasWildcardEndpointId(), err = CHIP_IM_GLOBAL_STATUS(InvalidAction)); } else if (err == CHIP_END_OF_TLV) { err = CHIP_NO_ERROR; } SuccessOrExit(err); - err = path.GetCluster(&(attribute.mClusterId)); + + ClusterId clusterId = kInvalidClusterId; + err = path.GetCluster(&clusterId); if (err == CHIP_NO_ERROR) { - VerifyOrExit(!attribute.HasWildcardClusterId(), err = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH); + VerifyOrExit(IsValidClusterId(clusterId), err = CHIP_IM_GLOBAL_STATUS(InvalidAction)); + attribute.mClusterId = clusterId; } else if (err == CHIP_END_OF_TLV) { err = CHIP_NO_ERROR; } - SuccessOrExit(err); - err = path.GetAttribute(&(attribute.mAttributeId)); + + AttributeId attributeId = kInvalidAttributeId; + err = path.GetAttribute(&attributeId); if (CHIP_END_OF_TLV == err) { err = CHIP_NO_ERROR; } else if (err == CHIP_NO_ERROR) { - VerifyOrExit(!attribute.HasWildcardAttributeId(), err = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH); + VerifyOrExit(IsValidAttributeId(attributeId), err = CHIP_IM_GLOBAL_STATUS(InvalidAction)); + attribute.mAttributeId = attributeId; } SuccessOrExit(err); + // A wildcard cluster requires that the attribute path either be + // wildcard or a global attribute. + VerifyOrExit(!attribute.HasWildcardClusterId() || attribute.HasWildcardAttributeId() || + IsGlobalAttribute(attribute.mAttributeId), + err = CHIP_IM_GLOBAL_STATUS(InvalidAction)); + err = path.GetListIndex(&(attribute.mListIndex)); if (CHIP_NO_ERROR == err) { VerifyOrExit(!attribute.HasWildcardAttributeId() && !attribute.HasWildcardListIndex(), - err = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH); + err = CHIP_IM_GLOBAL_STATUS(InvalidAction)); } else if (CHIP_END_OF_TLV == err) { diff --git a/src/app/tests/TestReadInteraction.cpp b/src/app/tests/TestReadInteraction.cpp index 38a6ad998aa2d9..ad0c3c7a2343a3 100644 --- a/src/app/tests/TestReadInteraction.cpp +++ b/src/app/tests/TestReadInteraction.cpp @@ -40,6 +40,7 @@ #include #include #include +#include #include @@ -597,7 +598,7 @@ void TestReadInteraction::TestReadHandlerInvalidAttributePath(nlTestSuite * apSu NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); err = readHandler.OnInitialRequest(std::move(readRequestbuf)); - NL_TEST_ASSERT(apSuite, err == CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH); + NL_TEST_ASSERT(apSuite, err == CHIP_IM_GLOBAL_STATUS(InvalidAction)); // // In the call above to OnInitialRequest, the handler will not actually close out the EC since diff --git a/src/app/util/mock/Constants.h b/src/app/util/mock/Constants.h index 26abe2fc6649a0..e1f38dd09913ca 100644 --- a/src/app/util/mock/Constants.h +++ b/src/app/util/mock/Constants.h @@ -42,7 +42,8 @@ constexpr AttributeId MockAttributeId(const uint16_t & id) constexpr ClusterId MockClusterId(const uint16_t & id) { - return (0xFFF1'0000 | id); + // Vendor-specific cluster ids must be at least 0xFC00 + return (0xFFF1'0000 | (0xFC00 + id)); } constexpr EventId MockEventId(const uint16_t & id) diff --git a/src/app/zap-templates/zcl/data-model/chip/test-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/test-cluster.xml index b5649c56da6d2a..587c282fef8be9 100644 --- a/src/app/zap-templates/zcl/data-model/chip/test-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/test-cluster.xml @@ -199,39 +199,39 @@ limitations under the License. cluster_error_boolean - nullable_boolean - nullable_bitmap8 - nullable_bitmap16 - nullable_bitmap32 - nullable_bitmap64 - nullable_int8u - nullable_int16u - nullable_int24u - nullable_int32u - nullable_int40u - nullable_int48u - nullable_int56u - nullable_int64u - nullable_int8s - nullable_int16s - nullable_int24s - nullable_int32s - nullable_int40s - nullable_int48s - nullable_int56s - nullable_int64s - nullable_enum8 - nullable_enum16 - nullable_float_single - nullable_float_double - nullable_octet_string - nullable_char_string - nullable_enum_attr - nullable_struct - nullable_range_restricted_int8u - nullable_range_restricted_int8s - nullable_range_restricted_int16u - nullable_range_restricted_int16s + nullable_boolean + nullable_bitmap8 + nullable_bitmap16 + nullable_bitmap32 + nullable_bitmap64 + nullable_int8u + nullable_int16u + nullable_int24u + nullable_int32u + nullable_int40u + nullable_int48u + nullable_int56u + nullable_int64u + nullable_int8s + nullable_int16s + nullable_int24s + nullable_int32s + nullable_int40s + nullable_int48s + nullable_int56s + nullable_int64s + nullable_enum8 + nullable_enum16 + nullable_float_single + nullable_float_double + nullable_octet_string + nullable_char_string + nullable_enum_attr + nullable_struct + nullable_range_restricted_int8u + nullable_range_restricted_int8s + nullable_range_restricted_int16u + nullable_range_restricted_int16s unsupported diff --git a/src/controller/data_model/controller-clusters.matter b/src/controller/data_model/controller-clusters.matter index dd4d783bb1f491..d95b250f5a6373 100644 --- a/src/controller/data_model/controller-clusters.matter +++ b/src/controller/data_model/controller-clusters.matter @@ -3559,39 +3559,39 @@ client cluster TestCluster = 1295 { attribute boolean generalErrorBoolean = 49; attribute boolean clusterErrorBoolean = 50; attribute boolean unsupported = 255; - attribute nullable boolean nullableBoolean = 32768; - attribute nullable Bitmap8MaskMap nullableBitmap8 = 32769; - attribute nullable Bitmap16MaskMap nullableBitmap16 = 32770; - attribute nullable Bitmap32MaskMap nullableBitmap32 = 32771; - attribute nullable Bitmap64MaskMap nullableBitmap64 = 32772; - attribute nullable int8u nullableInt8u = 32773; - attribute nullable int16u nullableInt16u = 32774; - attribute nullable int24u nullableInt24u = 32775; - attribute nullable int32u nullableInt32u = 32776; - attribute nullable int40u nullableInt40u = 32777; - attribute nullable int48u nullableInt48u = 32778; - attribute nullable int56u nullableInt56u = 32779; - attribute nullable int64u nullableInt64u = 32780; - attribute nullable int8s nullableInt8s = 32781; - attribute nullable int16s nullableInt16s = 32782; - attribute nullable int24s nullableInt24s = 32783; - attribute nullable int32s nullableInt32s = 32784; - attribute nullable int40s nullableInt40s = 32785; - attribute nullable int48s nullableInt48s = 32786; - attribute nullable int56s nullableInt56s = 32787; - attribute nullable int64s nullableInt64s = 32788; - attribute nullable enum8 nullableEnum8 = 32789; - attribute nullable enum16 nullableEnum16 = 32790; - attribute nullable single nullableFloatSingle = 32791; - attribute nullable double nullableFloatDouble = 32792; - attribute nullable octet_string<10> nullableOctetString = 32793; - attribute nullable char_string<10> nullableCharString = 32798; - attribute nullable SimpleEnum nullableEnumAttr = 32804; - attribute nullable SimpleStruct nullableStruct = 32805; - attribute nullable int8u nullableRangeRestrictedInt8u = 32806; - attribute nullable int8s nullableRangeRestrictedInt8s = 32807; - attribute nullable int16u nullableRangeRestrictedInt16u = 32808; - attribute nullable int16s nullableRangeRestrictedInt16s = 32809; + attribute nullable boolean nullableBoolean = 16384; + attribute nullable Bitmap8MaskMap nullableBitmap8 = 16385; + attribute nullable Bitmap16MaskMap nullableBitmap16 = 16386; + attribute nullable Bitmap32MaskMap nullableBitmap32 = 16387; + attribute nullable Bitmap64MaskMap nullableBitmap64 = 16388; + attribute nullable int8u nullableInt8u = 16389; + attribute nullable int16u nullableInt16u = 16390; + attribute nullable int24u nullableInt24u = 16391; + attribute nullable int32u nullableInt32u = 16392; + attribute nullable int40u nullableInt40u = 16393; + attribute nullable int48u nullableInt48u = 16394; + attribute nullable int56u nullableInt56u = 16395; + attribute nullable int64u nullableInt64u = 16396; + attribute nullable int8s nullableInt8s = 16397; + attribute nullable int16s nullableInt16s = 16398; + attribute nullable int24s nullableInt24s = 16399; + attribute nullable int32s nullableInt32s = 16400; + attribute nullable int40s nullableInt40s = 16401; + attribute nullable int48s nullableInt48s = 16402; + attribute nullable int56s nullableInt56s = 16403; + attribute nullable int64s nullableInt64s = 16404; + attribute nullable enum8 nullableEnum8 = 16405; + attribute nullable enum16 nullableEnum16 = 16406; + attribute nullable single nullableFloatSingle = 16407; + attribute nullable double nullableFloatDouble = 16408; + attribute nullable octet_string<10> nullableOctetString = 16409; + attribute nullable char_string<10> nullableCharString = 16414; + attribute nullable SimpleEnum nullableEnumAttr = 16420; + attribute nullable SimpleStruct nullableStruct = 16421; + attribute nullable int8u nullableRangeRestrictedInt8u = 16422; + attribute nullable int8s nullableRangeRestrictedInt8s = 16423; + attribute nullable int16u nullableRangeRestrictedInt16u = 16424; + attribute nullable int16s nullableRangeRestrictedInt16s = 16425; readonly attribute command_id generatedCommandList[] = 65528; readonly attribute command_id acceptedCommandList[] = 65529; readonly attribute attrib_id attributeList[] = 65531; diff --git a/src/controller/data_model/controller-clusters.zap b/src/controller/data_model/controller-clusters.zap index ac36c06d0a47cb..ba507ae79d68d9 100644 --- a/src/controller/data_model/controller-clusters.zap +++ b/src/controller/data_model/controller-clusters.zap @@ -17466,7 +17466,7 @@ }, { "name": "nullable_boolean", - "code": 32768, + "code": 16384, "mfgCode": null, "side": "server", "included": 1, @@ -17481,7 +17481,7 @@ }, { "name": "nullable_bitmap8", - "code": 32769, + "code": 16385, "mfgCode": null, "side": "server", "included": 1, @@ -17496,7 +17496,7 @@ }, { "name": "nullable_bitmap16", - "code": 32770, + "code": 16386, "mfgCode": null, "side": "server", "included": 1, @@ -17511,7 +17511,7 @@ }, { "name": "nullable_bitmap32", - "code": 32771, + "code": 16387, "mfgCode": null, "side": "server", "included": 1, @@ -17526,7 +17526,7 @@ }, { "name": "nullable_bitmap64", - "code": 32772, + "code": 16388, "mfgCode": null, "side": "server", "included": 1, @@ -17541,7 +17541,7 @@ }, { "name": "nullable_int8u", - "code": 32773, + "code": 16389, "mfgCode": null, "side": "server", "included": 1, @@ -17556,7 +17556,7 @@ }, { "name": "nullable_int16u", - "code": 32774, + "code": 16390, "mfgCode": null, "side": "server", "included": 1, @@ -17571,7 +17571,7 @@ }, { "name": "nullable_int24u", - "code": 32775, + "code": 16391, "mfgCode": null, "side": "server", "included": 1, @@ -17586,7 +17586,7 @@ }, { "name": "nullable_int32u", - "code": 32776, + "code": 16392, "mfgCode": null, "side": "server", "included": 1, @@ -17601,7 +17601,7 @@ }, { "name": "nullable_int40u", - "code": 32777, + "code": 16393, "mfgCode": null, "side": "server", "included": 1, @@ -17616,7 +17616,7 @@ }, { "name": "nullable_int48u", - "code": 32778, + "code": 16394, "mfgCode": null, "side": "server", "included": 1, @@ -17631,7 +17631,7 @@ }, { "name": "nullable_int56u", - "code": 32779, + "code": 16395, "mfgCode": null, "side": "server", "included": 1, @@ -17646,7 +17646,7 @@ }, { "name": "nullable_int64u", - "code": 32780, + "code": 16396, "mfgCode": null, "side": "server", "included": 1, @@ -17661,7 +17661,7 @@ }, { "name": "nullable_int8s", - "code": 32781, + "code": 16397, "mfgCode": null, "side": "server", "included": 1, @@ -17676,7 +17676,7 @@ }, { "name": "nullable_int16s", - "code": 32782, + "code": 16398, "mfgCode": null, "side": "server", "included": 1, @@ -17691,7 +17691,7 @@ }, { "name": "nullable_int24s", - "code": 32783, + "code": 16399, "mfgCode": null, "side": "server", "included": 1, @@ -17706,7 +17706,7 @@ }, { "name": "nullable_int32s", - "code": 32784, + "code": 16400, "mfgCode": null, "side": "server", "included": 1, @@ -17721,7 +17721,7 @@ }, { "name": "nullable_int40s", - "code": 32785, + "code": 16401, "mfgCode": null, "side": "server", "included": 1, @@ -17736,7 +17736,7 @@ }, { "name": "nullable_int48s", - "code": 32786, + "code": 16402, "mfgCode": null, "side": "server", "included": 1, @@ -17751,7 +17751,7 @@ }, { "name": "nullable_int56s", - "code": 32787, + "code": 16403, "mfgCode": null, "side": "server", "included": 1, @@ -17766,7 +17766,7 @@ }, { "name": "nullable_int64s", - "code": 32788, + "code": 16404, "mfgCode": null, "side": "server", "included": 1, @@ -17781,7 +17781,7 @@ }, { "name": "nullable_enum8", - "code": 32789, + "code": 16405, "mfgCode": null, "side": "server", "included": 1, @@ -17796,7 +17796,7 @@ }, { "name": "nullable_enum16", - "code": 32790, + "code": 16406, "mfgCode": null, "side": "server", "included": 1, @@ -17811,7 +17811,7 @@ }, { "name": "nullable_float_single", - "code": 32791, + "code": 16407, "mfgCode": null, "side": "server", "included": 1, @@ -17826,7 +17826,7 @@ }, { "name": "nullable_float_double", - "code": 32792, + "code": 16408, "mfgCode": null, "side": "server", "included": 1, @@ -17841,7 +17841,7 @@ }, { "name": "nullable_octet_string", - "code": 32793, + "code": 16409, "mfgCode": null, "side": "server", "included": 1, @@ -17856,7 +17856,7 @@ }, { "name": "nullable_char_string", - "code": 32798, + "code": 16414, "mfgCode": null, "side": "server", "included": 1, @@ -17871,7 +17871,7 @@ }, { "name": "nullable_enum_attr", - "code": 32804, + "code": 16420, "mfgCode": null, "side": "server", "included": 1, @@ -17886,7 +17886,7 @@ }, { "name": "nullable_struct", - "code": 32805, + "code": 16421, "mfgCode": null, "side": "server", "included": 1, @@ -17901,7 +17901,7 @@ }, { "name": "nullable_range_restricted_int8u", - "code": 32806, + "code": 16422, "mfgCode": null, "side": "server", "included": 1, @@ -17916,7 +17916,7 @@ }, { "name": "nullable_range_restricted_int8s", - "code": 32807, + "code": 16423, "mfgCode": null, "side": "server", "included": 1, @@ -17931,7 +17931,7 @@ }, { "name": "nullable_range_restricted_int16u", - "code": 32808, + "code": 16424, "mfgCode": null, "side": "server", "included": 1, @@ -17946,7 +17946,7 @@ }, { "name": "nullable_range_restricted_int16s", - "code": 32809, + "code": 16425, "mfgCode": null, "side": "server", "included": 1, diff --git a/src/controller/java/zap-generated/chip/devicecontroller/ChipIdLookup.java b/src/controller/java/zap-generated/chip/devicecontroller/ChipIdLookup.java index 749f497366904b..fde320d1f4339f 100644 --- a/src/controller/java/zap-generated/chip/devicecontroller/ChipIdLookup.java +++ b/src/controller/java/zap-generated/chip/devicecontroller/ChipIdLookup.java @@ -2170,103 +2170,103 @@ public static String attributeIdToName(long clusterId, long attributeId) { if (attributeId == 255L) { return "Unsupported"; } - if (attributeId == 32768L) { + if (attributeId == 16384L) { return "NullableBoolean"; } - if (attributeId == 32769L) { + if (attributeId == 16385L) { return "NullableBitmap8"; } - if (attributeId == 32770L) { + if (attributeId == 16386L) { return "NullableBitmap16"; } - if (attributeId == 32771L) { + if (attributeId == 16387L) { return "NullableBitmap32"; } - if (attributeId == 32772L) { + if (attributeId == 16388L) { return "NullableBitmap64"; } - if (attributeId == 32773L) { + if (attributeId == 16389L) { return "NullableInt8u"; } - if (attributeId == 32774L) { + if (attributeId == 16390L) { return "NullableInt16u"; } - if (attributeId == 32775L) { + if (attributeId == 16391L) { return "NullableInt24u"; } - if (attributeId == 32776L) { + if (attributeId == 16392L) { return "NullableInt32u"; } - if (attributeId == 32777L) { + if (attributeId == 16393L) { return "NullableInt40u"; } - if (attributeId == 32778L) { + if (attributeId == 16394L) { return "NullableInt48u"; } - if (attributeId == 32779L) { + if (attributeId == 16395L) { return "NullableInt56u"; } - if (attributeId == 32780L) { + if (attributeId == 16396L) { return "NullableInt64u"; } - if (attributeId == 32781L) { + if (attributeId == 16397L) { return "NullableInt8s"; } - if (attributeId == 32782L) { + if (attributeId == 16398L) { return "NullableInt16s"; } - if (attributeId == 32783L) { + if (attributeId == 16399L) { return "NullableInt24s"; } - if (attributeId == 32784L) { + if (attributeId == 16400L) { return "NullableInt32s"; } - if (attributeId == 32785L) { + if (attributeId == 16401L) { return "NullableInt40s"; } - if (attributeId == 32786L) { + if (attributeId == 16402L) { return "NullableInt48s"; } - if (attributeId == 32787L) { + if (attributeId == 16403L) { return "NullableInt56s"; } - if (attributeId == 32788L) { + if (attributeId == 16404L) { return "NullableInt64s"; } - if (attributeId == 32789L) { + if (attributeId == 16405L) { return "NullableEnum8"; } - if (attributeId == 32790L) { + if (attributeId == 16406L) { return "NullableEnum16"; } - if (attributeId == 32791L) { + if (attributeId == 16407L) { return "NullableFloatSingle"; } - if (attributeId == 32792L) { + if (attributeId == 16408L) { return "NullableFloatDouble"; } - if (attributeId == 32793L) { + if (attributeId == 16409L) { return "NullableOctetString"; } - if (attributeId == 32798L) { + if (attributeId == 16414L) { return "NullableCharString"; } - if (attributeId == 32804L) { + if (attributeId == 16420L) { return "NullableEnumAttr"; } - if (attributeId == 32805L) { + if (attributeId == 16421L) { return "NullableStruct"; } - if (attributeId == 32806L) { + if (attributeId == 16422L) { return "NullableRangeRestrictedInt8u"; } - if (attributeId == 32807L) { + if (attributeId == 16423L) { return "NullableRangeRestrictedInt8s"; } - if (attributeId == 32808L) { + if (attributeId == 16424L) { return "NullableRangeRestrictedInt16u"; } - if (attributeId == 32809L) { + if (attributeId == 16425L) { return "NullableRangeRestrictedInt16s"; } if (attributeId == 65528L) { diff --git a/src/controller/python/chip/clusters/CHIPClusters.py b/src/controller/python/chip/clusters/CHIPClusters.py index 4876bfd7054a34..6287afcd15ca3d 100644 --- a/src/controller/python/chip/clusters/CHIPClusters.py +++ b/src/controller/python/chip/clusters/CHIPClusters.py @@ -5503,233 +5503,233 @@ class ChipClusters: "reportable": True, "writable": True, }, - 0x00008000: { + 0x00004000: { "attributeName": "NullableBoolean", - "attributeId": 0x00008000, + "attributeId": 0x00004000, "type": "bool", "reportable": True, "writable": True, }, - 0x00008001: { + 0x00004001: { "attributeName": "NullableBitmap8", - "attributeId": 0x00008001, + "attributeId": 0x00004001, "type": "int", "reportable": True, "writable": True, }, - 0x00008002: { + 0x00004002: { "attributeName": "NullableBitmap16", - "attributeId": 0x00008002, + "attributeId": 0x00004002, "type": "int", "reportable": True, "writable": True, }, - 0x00008003: { + 0x00004003: { "attributeName": "NullableBitmap32", - "attributeId": 0x00008003, + "attributeId": 0x00004003, "type": "int", "reportable": True, "writable": True, }, - 0x00008004: { + 0x00004004: { "attributeName": "NullableBitmap64", - "attributeId": 0x00008004, + "attributeId": 0x00004004, "type": "int", "reportable": True, "writable": True, }, - 0x00008005: { + 0x00004005: { "attributeName": "NullableInt8u", - "attributeId": 0x00008005, + "attributeId": 0x00004005, "type": "int", "reportable": True, "writable": True, }, - 0x00008006: { + 0x00004006: { "attributeName": "NullableInt16u", - "attributeId": 0x00008006, + "attributeId": 0x00004006, "type": "int", "reportable": True, "writable": True, }, - 0x00008007: { + 0x00004007: { "attributeName": "NullableInt24u", - "attributeId": 0x00008007, + "attributeId": 0x00004007, "type": "int", "reportable": True, "writable": True, }, - 0x00008008: { + 0x00004008: { "attributeName": "NullableInt32u", - "attributeId": 0x00008008, + "attributeId": 0x00004008, "type": "int", "reportable": True, "writable": True, }, - 0x00008009: { + 0x00004009: { "attributeName": "NullableInt40u", - "attributeId": 0x00008009, + "attributeId": 0x00004009, "type": "int", "reportable": True, "writable": True, }, - 0x0000800A: { + 0x0000400A: { "attributeName": "NullableInt48u", - "attributeId": 0x0000800A, + "attributeId": 0x0000400A, "type": "int", "reportable": True, "writable": True, }, - 0x0000800B: { + 0x0000400B: { "attributeName": "NullableInt56u", - "attributeId": 0x0000800B, + "attributeId": 0x0000400B, "type": "int", "reportable": True, "writable": True, }, - 0x0000800C: { + 0x0000400C: { "attributeName": "NullableInt64u", - "attributeId": 0x0000800C, + "attributeId": 0x0000400C, "type": "int", "reportable": True, "writable": True, }, - 0x0000800D: { + 0x0000400D: { "attributeName": "NullableInt8s", - "attributeId": 0x0000800D, + "attributeId": 0x0000400D, "type": "int", "reportable": True, "writable": True, }, - 0x0000800E: { + 0x0000400E: { "attributeName": "NullableInt16s", - "attributeId": 0x0000800E, + "attributeId": 0x0000400E, "type": "int", "reportable": True, "writable": True, }, - 0x0000800F: { + 0x0000400F: { "attributeName": "NullableInt24s", - "attributeId": 0x0000800F, + "attributeId": 0x0000400F, "type": "int", "reportable": True, "writable": True, }, - 0x00008010: { + 0x00004010: { "attributeName": "NullableInt32s", - "attributeId": 0x00008010, + "attributeId": 0x00004010, "type": "int", "reportable": True, "writable": True, }, - 0x00008011: { + 0x00004011: { "attributeName": "NullableInt40s", - "attributeId": 0x00008011, + "attributeId": 0x00004011, "type": "int", "reportable": True, "writable": True, }, - 0x00008012: { + 0x00004012: { "attributeName": "NullableInt48s", - "attributeId": 0x00008012, + "attributeId": 0x00004012, "type": "int", "reportable": True, "writable": True, }, - 0x00008013: { + 0x00004013: { "attributeName": "NullableInt56s", - "attributeId": 0x00008013, + "attributeId": 0x00004013, "type": "int", "reportable": True, "writable": True, }, - 0x00008014: { + 0x00004014: { "attributeName": "NullableInt64s", - "attributeId": 0x00008014, + "attributeId": 0x00004014, "type": "int", "reportable": True, "writable": True, }, - 0x00008015: { + 0x00004015: { "attributeName": "NullableEnum8", - "attributeId": 0x00008015, + "attributeId": 0x00004015, "type": "int", "reportable": True, "writable": True, }, - 0x00008016: { + 0x00004016: { "attributeName": "NullableEnum16", - "attributeId": 0x00008016, + "attributeId": 0x00004016, "type": "int", "reportable": True, "writable": True, }, - 0x00008017: { + 0x00004017: { "attributeName": "NullableFloatSingle", - "attributeId": 0x00008017, + "attributeId": 0x00004017, "type": "", "reportable": True, "writable": True, }, - 0x00008018: { + 0x00004018: { "attributeName": "NullableFloatDouble", - "attributeId": 0x00008018, + "attributeId": 0x00004018, "type": "", "reportable": True, "writable": True, }, - 0x00008019: { + 0x00004019: { "attributeName": "NullableOctetString", - "attributeId": 0x00008019, + "attributeId": 0x00004019, "type": "bytes", "reportable": True, "writable": True, }, - 0x0000801E: { + 0x0000401E: { "attributeName": "NullableCharString", - "attributeId": 0x0000801E, + "attributeId": 0x0000401E, "type": "str", "reportable": True, "writable": True, }, - 0x00008024: { + 0x00004024: { "attributeName": "NullableEnumAttr", - "attributeId": 0x00008024, + "attributeId": 0x00004024, "type": "int", "reportable": True, "writable": True, }, - 0x00008025: { + 0x00004025: { "attributeName": "NullableStruct", - "attributeId": 0x00008025, + "attributeId": 0x00004025, "type": "", "reportable": True, "writable": True, }, - 0x00008026: { + 0x00004026: { "attributeName": "NullableRangeRestrictedInt8u", - "attributeId": 0x00008026, + "attributeId": 0x00004026, "type": "int", "reportable": True, "writable": True, }, - 0x00008027: { + 0x00004027: { "attributeName": "NullableRangeRestrictedInt8s", - "attributeId": 0x00008027, + "attributeId": 0x00004027, "type": "int", "reportable": True, "writable": True, }, - 0x00008028: { + 0x00004028: { "attributeName": "NullableRangeRestrictedInt16u", - "attributeId": 0x00008028, + "attributeId": 0x00004028, "type": "int", "reportable": True, "writable": True, }, - 0x00008029: { + 0x00004029: { "attributeName": "NullableRangeRestrictedInt16s", - "attributeId": 0x00008029, + "attributeId": 0x00004029, "type": "int", "reportable": True, "writable": True, diff --git a/src/controller/python/chip/clusters/Objects.py b/src/controller/python/chip/clusters/Objects.py index fecb96a7c3f08e..39d7e506a157eb 100644 --- a/src/controller/python/chip/clusters/Objects.py +++ b/src/controller/python/chip/clusters/Objects.py @@ -34424,39 +34424,39 @@ def descriptor(cls) -> ClusterObjectDescriptor: ClusterObjectFieldDescriptor(Label="generalErrorBoolean", Tag=0x00000031, Type=bool), ClusterObjectFieldDescriptor(Label="clusterErrorBoolean", Tag=0x00000032, Type=bool), ClusterObjectFieldDescriptor(Label="unsupported", Tag=0x000000FF, Type=bool), - ClusterObjectFieldDescriptor(Label="nullableBoolean", Tag=0x00008000, Type=typing.Union[Nullable, bool]), - ClusterObjectFieldDescriptor(Label="nullableBitmap8", Tag=0x00008001, Type=typing.Union[Nullable, uint]), - ClusterObjectFieldDescriptor(Label="nullableBitmap16", Tag=0x00008002, Type=typing.Union[Nullable, uint]), - ClusterObjectFieldDescriptor(Label="nullableBitmap32", Tag=0x00008003, Type=typing.Union[Nullable, uint]), - ClusterObjectFieldDescriptor(Label="nullableBitmap64", Tag=0x00008004, Type=typing.Union[Nullable, uint]), - ClusterObjectFieldDescriptor(Label="nullableInt8u", Tag=0x00008005, Type=typing.Union[Nullable, uint]), - ClusterObjectFieldDescriptor(Label="nullableInt16u", Tag=0x00008006, Type=typing.Union[Nullable, uint]), - ClusterObjectFieldDescriptor(Label="nullableInt24u", Tag=0x00008007, Type=typing.Union[Nullable, uint]), - ClusterObjectFieldDescriptor(Label="nullableInt32u", Tag=0x00008008, Type=typing.Union[Nullable, uint]), - ClusterObjectFieldDescriptor(Label="nullableInt40u", Tag=0x00008009, Type=typing.Union[Nullable, uint]), - ClusterObjectFieldDescriptor(Label="nullableInt48u", Tag=0x0000800A, Type=typing.Union[Nullable, uint]), - ClusterObjectFieldDescriptor(Label="nullableInt56u", Tag=0x0000800B, Type=typing.Union[Nullable, uint]), - ClusterObjectFieldDescriptor(Label="nullableInt64u", Tag=0x0000800C, Type=typing.Union[Nullable, uint]), - ClusterObjectFieldDescriptor(Label="nullableInt8s", Tag=0x0000800D, Type=typing.Union[Nullable, int]), - ClusterObjectFieldDescriptor(Label="nullableInt16s", Tag=0x0000800E, Type=typing.Union[Nullable, int]), - ClusterObjectFieldDescriptor(Label="nullableInt24s", Tag=0x0000800F, Type=typing.Union[Nullable, int]), - ClusterObjectFieldDescriptor(Label="nullableInt32s", Tag=0x00008010, Type=typing.Union[Nullable, int]), - ClusterObjectFieldDescriptor(Label="nullableInt40s", Tag=0x00008011, Type=typing.Union[Nullable, int]), - ClusterObjectFieldDescriptor(Label="nullableInt48s", Tag=0x00008012, Type=typing.Union[Nullable, int]), - ClusterObjectFieldDescriptor(Label="nullableInt56s", Tag=0x00008013, Type=typing.Union[Nullable, int]), - ClusterObjectFieldDescriptor(Label="nullableInt64s", Tag=0x00008014, Type=typing.Union[Nullable, int]), - ClusterObjectFieldDescriptor(Label="nullableEnum8", Tag=0x00008015, Type=typing.Union[Nullable, uint]), - ClusterObjectFieldDescriptor(Label="nullableEnum16", Tag=0x00008016, Type=typing.Union[Nullable, uint]), - ClusterObjectFieldDescriptor(Label="nullableFloatSingle", Tag=0x00008017, Type=typing.Union[Nullable, float32]), - ClusterObjectFieldDescriptor(Label="nullableFloatDouble", Tag=0x00008018, Type=typing.Union[Nullable, float]), - ClusterObjectFieldDescriptor(Label="nullableOctetString", Tag=0x00008019, Type=typing.Union[Nullable, bytes]), - ClusterObjectFieldDescriptor(Label="nullableCharString", Tag=0x0000801E, Type=typing.Union[Nullable, str]), - ClusterObjectFieldDescriptor(Label="nullableEnumAttr", Tag=0x00008024, Type=typing.Union[Nullable, TestCluster.Enums.SimpleEnum]), - ClusterObjectFieldDescriptor(Label="nullableStruct", Tag=0x00008025, Type=typing.Union[Nullable, TestCluster.Structs.SimpleStruct]), - ClusterObjectFieldDescriptor(Label="nullableRangeRestrictedInt8u", Tag=0x00008026, Type=typing.Union[Nullable, uint]), - ClusterObjectFieldDescriptor(Label="nullableRangeRestrictedInt8s", Tag=0x00008027, Type=typing.Union[Nullable, int]), - ClusterObjectFieldDescriptor(Label="nullableRangeRestrictedInt16u", Tag=0x00008028, Type=typing.Union[Nullable, uint]), - ClusterObjectFieldDescriptor(Label="nullableRangeRestrictedInt16s", Tag=0x00008029, Type=typing.Union[Nullable, int]), + ClusterObjectFieldDescriptor(Label="nullableBoolean", Tag=0x00004000, Type=typing.Union[Nullable, bool]), + ClusterObjectFieldDescriptor(Label="nullableBitmap8", Tag=0x00004001, Type=typing.Union[Nullable, uint]), + ClusterObjectFieldDescriptor(Label="nullableBitmap16", Tag=0x00004002, Type=typing.Union[Nullable, uint]), + ClusterObjectFieldDescriptor(Label="nullableBitmap32", Tag=0x00004003, Type=typing.Union[Nullable, uint]), + ClusterObjectFieldDescriptor(Label="nullableBitmap64", Tag=0x00004004, Type=typing.Union[Nullable, uint]), + ClusterObjectFieldDescriptor(Label="nullableInt8u", Tag=0x00004005, Type=typing.Union[Nullable, uint]), + ClusterObjectFieldDescriptor(Label="nullableInt16u", Tag=0x00004006, Type=typing.Union[Nullable, uint]), + ClusterObjectFieldDescriptor(Label="nullableInt24u", Tag=0x00004007, Type=typing.Union[Nullable, uint]), + ClusterObjectFieldDescriptor(Label="nullableInt32u", Tag=0x00004008, Type=typing.Union[Nullable, uint]), + ClusterObjectFieldDescriptor(Label="nullableInt40u", Tag=0x00004009, Type=typing.Union[Nullable, uint]), + ClusterObjectFieldDescriptor(Label="nullableInt48u", Tag=0x0000400A, Type=typing.Union[Nullable, uint]), + ClusterObjectFieldDescriptor(Label="nullableInt56u", Tag=0x0000400B, Type=typing.Union[Nullable, uint]), + ClusterObjectFieldDescriptor(Label="nullableInt64u", Tag=0x0000400C, Type=typing.Union[Nullable, uint]), + ClusterObjectFieldDescriptor(Label="nullableInt8s", Tag=0x0000400D, Type=typing.Union[Nullable, int]), + ClusterObjectFieldDescriptor(Label="nullableInt16s", Tag=0x0000400E, Type=typing.Union[Nullable, int]), + ClusterObjectFieldDescriptor(Label="nullableInt24s", Tag=0x0000400F, Type=typing.Union[Nullable, int]), + ClusterObjectFieldDescriptor(Label="nullableInt32s", Tag=0x00004010, Type=typing.Union[Nullable, int]), + ClusterObjectFieldDescriptor(Label="nullableInt40s", Tag=0x00004011, Type=typing.Union[Nullable, int]), + ClusterObjectFieldDescriptor(Label="nullableInt48s", Tag=0x00004012, Type=typing.Union[Nullable, int]), + ClusterObjectFieldDescriptor(Label="nullableInt56s", Tag=0x00004013, Type=typing.Union[Nullable, int]), + ClusterObjectFieldDescriptor(Label="nullableInt64s", Tag=0x00004014, Type=typing.Union[Nullable, int]), + ClusterObjectFieldDescriptor(Label="nullableEnum8", Tag=0x00004015, Type=typing.Union[Nullable, uint]), + ClusterObjectFieldDescriptor(Label="nullableEnum16", Tag=0x00004016, Type=typing.Union[Nullable, uint]), + ClusterObjectFieldDescriptor(Label="nullableFloatSingle", Tag=0x00004017, Type=typing.Union[Nullable, float32]), + ClusterObjectFieldDescriptor(Label="nullableFloatDouble", Tag=0x00004018, Type=typing.Union[Nullable, float]), + ClusterObjectFieldDescriptor(Label="nullableOctetString", Tag=0x00004019, Type=typing.Union[Nullable, bytes]), + ClusterObjectFieldDescriptor(Label="nullableCharString", Tag=0x0000401E, Type=typing.Union[Nullable, str]), + ClusterObjectFieldDescriptor(Label="nullableEnumAttr", Tag=0x00004024, Type=typing.Union[Nullable, TestCluster.Enums.SimpleEnum]), + ClusterObjectFieldDescriptor(Label="nullableStruct", Tag=0x00004025, Type=typing.Union[Nullable, TestCluster.Structs.SimpleStruct]), + ClusterObjectFieldDescriptor(Label="nullableRangeRestrictedInt8u", Tag=0x00004026, Type=typing.Union[Nullable, uint]), + ClusterObjectFieldDescriptor(Label="nullableRangeRestrictedInt8s", Tag=0x00004027, Type=typing.Union[Nullable, int]), + ClusterObjectFieldDescriptor(Label="nullableRangeRestrictedInt16u", Tag=0x00004028, Type=typing.Union[Nullable, uint]), + ClusterObjectFieldDescriptor(Label="nullableRangeRestrictedInt16s", Tag=0x00004029, Type=typing.Union[Nullable, int]), ClusterObjectFieldDescriptor(Label="generatedCommandList", Tag=0x0000FFF8, Type=typing.List[uint]), ClusterObjectFieldDescriptor(Label="acceptedCommandList", Tag=0x0000FFF9, Type=typing.List[uint]), ClusterObjectFieldDescriptor(Label="attributeList", Tag=0x0000FFFB, Type=typing.List[uint]), @@ -36106,7 +36106,7 @@ def cluster_id(cls) -> int: @ChipUtility.classproperty def attribute_id(cls) -> int: - return 0x00008000 + return 0x00004000 @ChipUtility.classproperty def attribute_type(cls) -> ClusterObjectFieldDescriptor: @@ -36122,7 +36122,7 @@ def cluster_id(cls) -> int: @ChipUtility.classproperty def attribute_id(cls) -> int: - return 0x00008001 + return 0x00004001 @ChipUtility.classproperty def attribute_type(cls) -> ClusterObjectFieldDescriptor: @@ -36138,7 +36138,7 @@ def cluster_id(cls) -> int: @ChipUtility.classproperty def attribute_id(cls) -> int: - return 0x00008002 + return 0x00004002 @ChipUtility.classproperty def attribute_type(cls) -> ClusterObjectFieldDescriptor: @@ -36154,7 +36154,7 @@ def cluster_id(cls) -> int: @ChipUtility.classproperty def attribute_id(cls) -> int: - return 0x00008003 + return 0x00004003 @ChipUtility.classproperty def attribute_type(cls) -> ClusterObjectFieldDescriptor: @@ -36170,7 +36170,7 @@ def cluster_id(cls) -> int: @ChipUtility.classproperty def attribute_id(cls) -> int: - return 0x00008004 + return 0x00004004 @ChipUtility.classproperty def attribute_type(cls) -> ClusterObjectFieldDescriptor: @@ -36186,7 +36186,7 @@ def cluster_id(cls) -> int: @ChipUtility.classproperty def attribute_id(cls) -> int: - return 0x00008005 + return 0x00004005 @ChipUtility.classproperty def attribute_type(cls) -> ClusterObjectFieldDescriptor: @@ -36202,7 +36202,7 @@ def cluster_id(cls) -> int: @ChipUtility.classproperty def attribute_id(cls) -> int: - return 0x00008006 + return 0x00004006 @ChipUtility.classproperty def attribute_type(cls) -> ClusterObjectFieldDescriptor: @@ -36218,7 +36218,7 @@ def cluster_id(cls) -> int: @ChipUtility.classproperty def attribute_id(cls) -> int: - return 0x00008007 + return 0x00004007 @ChipUtility.classproperty def attribute_type(cls) -> ClusterObjectFieldDescriptor: @@ -36234,7 +36234,7 @@ def cluster_id(cls) -> int: @ChipUtility.classproperty def attribute_id(cls) -> int: - return 0x00008008 + return 0x00004008 @ChipUtility.classproperty def attribute_type(cls) -> ClusterObjectFieldDescriptor: @@ -36250,7 +36250,7 @@ def cluster_id(cls) -> int: @ChipUtility.classproperty def attribute_id(cls) -> int: - return 0x00008009 + return 0x00004009 @ChipUtility.classproperty def attribute_type(cls) -> ClusterObjectFieldDescriptor: @@ -36266,7 +36266,7 @@ def cluster_id(cls) -> int: @ChipUtility.classproperty def attribute_id(cls) -> int: - return 0x0000800A + return 0x0000400A @ChipUtility.classproperty def attribute_type(cls) -> ClusterObjectFieldDescriptor: @@ -36282,7 +36282,7 @@ def cluster_id(cls) -> int: @ChipUtility.classproperty def attribute_id(cls) -> int: - return 0x0000800B + return 0x0000400B @ChipUtility.classproperty def attribute_type(cls) -> ClusterObjectFieldDescriptor: @@ -36298,7 +36298,7 @@ def cluster_id(cls) -> int: @ChipUtility.classproperty def attribute_id(cls) -> int: - return 0x0000800C + return 0x0000400C @ChipUtility.classproperty def attribute_type(cls) -> ClusterObjectFieldDescriptor: @@ -36314,7 +36314,7 @@ def cluster_id(cls) -> int: @ChipUtility.classproperty def attribute_id(cls) -> int: - return 0x0000800D + return 0x0000400D @ChipUtility.classproperty def attribute_type(cls) -> ClusterObjectFieldDescriptor: @@ -36330,7 +36330,7 @@ def cluster_id(cls) -> int: @ChipUtility.classproperty def attribute_id(cls) -> int: - return 0x0000800E + return 0x0000400E @ChipUtility.classproperty def attribute_type(cls) -> ClusterObjectFieldDescriptor: @@ -36346,7 +36346,7 @@ def cluster_id(cls) -> int: @ChipUtility.classproperty def attribute_id(cls) -> int: - return 0x0000800F + return 0x0000400F @ChipUtility.classproperty def attribute_type(cls) -> ClusterObjectFieldDescriptor: @@ -36362,7 +36362,7 @@ def cluster_id(cls) -> int: @ChipUtility.classproperty def attribute_id(cls) -> int: - return 0x00008010 + return 0x00004010 @ChipUtility.classproperty def attribute_type(cls) -> ClusterObjectFieldDescriptor: @@ -36378,7 +36378,7 @@ def cluster_id(cls) -> int: @ChipUtility.classproperty def attribute_id(cls) -> int: - return 0x00008011 + return 0x00004011 @ChipUtility.classproperty def attribute_type(cls) -> ClusterObjectFieldDescriptor: @@ -36394,7 +36394,7 @@ def cluster_id(cls) -> int: @ChipUtility.classproperty def attribute_id(cls) -> int: - return 0x00008012 + return 0x00004012 @ChipUtility.classproperty def attribute_type(cls) -> ClusterObjectFieldDescriptor: @@ -36410,7 +36410,7 @@ def cluster_id(cls) -> int: @ChipUtility.classproperty def attribute_id(cls) -> int: - return 0x00008013 + return 0x00004013 @ChipUtility.classproperty def attribute_type(cls) -> ClusterObjectFieldDescriptor: @@ -36426,7 +36426,7 @@ def cluster_id(cls) -> int: @ChipUtility.classproperty def attribute_id(cls) -> int: - return 0x00008014 + return 0x00004014 @ChipUtility.classproperty def attribute_type(cls) -> ClusterObjectFieldDescriptor: @@ -36442,7 +36442,7 @@ def cluster_id(cls) -> int: @ChipUtility.classproperty def attribute_id(cls) -> int: - return 0x00008015 + return 0x00004015 @ChipUtility.classproperty def attribute_type(cls) -> ClusterObjectFieldDescriptor: @@ -36458,7 +36458,7 @@ def cluster_id(cls) -> int: @ChipUtility.classproperty def attribute_id(cls) -> int: - return 0x00008016 + return 0x00004016 @ChipUtility.classproperty def attribute_type(cls) -> ClusterObjectFieldDescriptor: @@ -36474,7 +36474,7 @@ def cluster_id(cls) -> int: @ChipUtility.classproperty def attribute_id(cls) -> int: - return 0x00008017 + return 0x00004017 @ChipUtility.classproperty def attribute_type(cls) -> ClusterObjectFieldDescriptor: @@ -36490,7 +36490,7 @@ def cluster_id(cls) -> int: @ChipUtility.classproperty def attribute_id(cls) -> int: - return 0x00008018 + return 0x00004018 @ChipUtility.classproperty def attribute_type(cls) -> ClusterObjectFieldDescriptor: @@ -36506,7 +36506,7 @@ def cluster_id(cls) -> int: @ChipUtility.classproperty def attribute_id(cls) -> int: - return 0x00008019 + return 0x00004019 @ChipUtility.classproperty def attribute_type(cls) -> ClusterObjectFieldDescriptor: @@ -36522,7 +36522,7 @@ def cluster_id(cls) -> int: @ChipUtility.classproperty def attribute_id(cls) -> int: - return 0x0000801E + return 0x0000401E @ChipUtility.classproperty def attribute_type(cls) -> ClusterObjectFieldDescriptor: @@ -36538,7 +36538,7 @@ def cluster_id(cls) -> int: @ChipUtility.classproperty def attribute_id(cls) -> int: - return 0x00008024 + return 0x00004024 @ChipUtility.classproperty def attribute_type(cls) -> ClusterObjectFieldDescriptor: @@ -36554,7 +36554,7 @@ def cluster_id(cls) -> int: @ChipUtility.classproperty def attribute_id(cls) -> int: - return 0x00008025 + return 0x00004025 @ChipUtility.classproperty def attribute_type(cls) -> ClusterObjectFieldDescriptor: @@ -36570,7 +36570,7 @@ def cluster_id(cls) -> int: @ChipUtility.classproperty def attribute_id(cls) -> int: - return 0x00008026 + return 0x00004026 @ChipUtility.classproperty def attribute_type(cls) -> ClusterObjectFieldDescriptor: @@ -36586,7 +36586,7 @@ def cluster_id(cls) -> int: @ChipUtility.classproperty def attribute_id(cls) -> int: - return 0x00008027 + return 0x00004027 @ChipUtility.classproperty def attribute_type(cls) -> ClusterObjectFieldDescriptor: @@ -36602,7 +36602,7 @@ def cluster_id(cls) -> int: @ChipUtility.classproperty def attribute_id(cls) -> int: - return 0x00008028 + return 0x00004028 @ChipUtility.classproperty def attribute_type(cls) -> ClusterObjectFieldDescriptor: @@ -36618,7 +36618,7 @@ def cluster_id(cls) -> int: @ChipUtility.classproperty def attribute_id(cls) -> int: - return 0x00008029 + return 0x00004029 @ChipUtility.classproperty def attribute_type(cls) -> ClusterObjectFieldDescriptor: diff --git a/src/lib/core/DataModelTypes.h b/src/lib/core/DataModelTypes.h index 3dccb05932e64a..a2aca450784c4f 100644 --- a/src/lib/core/DataModelTypes.h +++ b/src/lib/core/DataModelTypes.h @@ -57,14 +57,47 @@ static constexpr CommandId kInvalidCommandId = 0xFFFF'FFFF; static constexpr EventId kInvalidEventId = 0xFFFF'FFFF; static constexpr FieldId kInvalidFieldId = 0xFFFF'FFFF; +static constexpr uint16_t ExtractIdFromMEI(uint32_t aMEI) +{ + constexpr uint32_t kIdMask = 0x0000'FFFF; + return static_cast(aMEI & kIdMask); +} + +static constexpr uint16_t ExtractVendorFromMEI(uint32_t aMEI) +{ + constexpr uint32_t kVendorMask = 0xFFFF'0000; + constexpr uint32_t kVendorShift = 16; + return static_cast((aMEI & kVendorMask) >> kVendorShift); +} + constexpr bool IsValidClusterId(ClusterId aClusterId) { - const ClusterId kIdMask = 0x0000'FFFF; - const ClusterId kVendorMask = 0xFFFF'0000; - const auto id = aClusterId & kIdMask; - const auto vendor = aClusterId & kVendorMask; - return (vendor == 0x0000'0000 && id <= 0x7FFF) || - (vendor >= 0x0001'0000 && vendor <= 0xFFFE'0000 && id >= 0xFC00 && id <= 0xFFFE); + const auto id = ExtractIdFromMEI(aClusterId); + const auto vendor = ExtractVendorFromMEI(aClusterId); + // Cluster id suffixes in the range 0x0000 to 0x7FFF indicate a standard + // cluster. + // + // Cluster id suffixes in the range 0xFC00 to 0xFFFE indicate an MS cluster. + return (vendor == 0x0000 && id <= 0x7FFF) || (vendor >= 0x0001 && vendor <= 0xFFFE && id >= 0xFC00 && id <= 0xFFFE); +} + +constexpr bool IsGlobalAttribute(AttributeId aAttributeId) +{ + const auto id = ExtractIdFromMEI(aAttributeId); + const auto vendor = ExtractVendorFromMEI(aAttributeId); + // Attribute id suffixes in the range 0xF000 to 0xFFFE indicate a standard + // global attribute. + return (vendor == 0x0000 && id >= 0xF000 && id <= 0xFFFE); +} + +constexpr bool IsValidAttributeId(AttributeId aAttributeId) +{ + const auto id = ExtractIdFromMEI(aAttributeId); + const auto vendor = ExtractVendorFromMEI(aAttributeId); + // Attribute id suffixes in the range 0x0000 to 0x4FFF indicate a non-global + // attribute (standard or MS). The vendor id must not be wildcard in this + // case. + return (id <= 0x4FFF && vendor != 0xFFFF) || IsGlobalAttribute(aAttributeId); } constexpr bool IsValidDeviceTypeId(DeviceTypeId aDeviceTypeId) diff --git a/zzz_generated/all-clusters-app/zap-generated/endpoint_config.h b/zzz_generated/all-clusters-app/zap-generated/endpoint_config.h index 19d836bb6fb652..eed4701085b38b 100644 --- a/zzz_generated/all-clusters-app/zap-generated/endpoint_config.h +++ b/zzz_generated/all-clusters-app/zap-generated/endpoint_config.h @@ -1877,75 +1877,75 @@ ZAP_EMPTY_DEFAULT() }, /* general_error_boolean */ \ { 0x00000032, ZAP_TYPE(BOOLEAN), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ ZAP_EMPTY_DEFAULT() }, /* cluster_error_boolean */ \ - { 0x00008000, ZAP_TYPE(BOOLEAN), 1, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ + { 0x00004000, ZAP_TYPE(BOOLEAN), 1, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ ZAP_SIMPLE_DEFAULT(false) }, /* nullable_boolean */ \ - { 0x00008001, ZAP_TYPE(BITMAP8), 1, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ + { 0x00004001, ZAP_TYPE(BITMAP8), 1, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ ZAP_SIMPLE_DEFAULT(0) }, /* nullable_bitmap8 */ \ - { 0x00008002, ZAP_TYPE(BITMAP16), 2, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ + { 0x00004002, ZAP_TYPE(BITMAP16), 2, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ ZAP_SIMPLE_DEFAULT(0) }, /* nullable_bitmap16 */ \ - { 0x00008003, ZAP_TYPE(BITMAP32), 4, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ + { 0x00004003, ZAP_TYPE(BITMAP32), 4, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ ZAP_LONG_DEFAULTS_INDEX(541) }, /* nullable_bitmap32 */ \ - { 0x00008004, ZAP_TYPE(BITMAP64), 8, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ + { 0x00004004, ZAP_TYPE(BITMAP64), 8, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ ZAP_LONG_DEFAULTS_INDEX(545) }, /* nullable_bitmap64 */ \ - { 0x00008005, ZAP_TYPE(INT8U), 1, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ + { 0x00004005, ZAP_TYPE(INT8U), 1, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ ZAP_SIMPLE_DEFAULT(0) }, /* nullable_int8u */ \ - { 0x00008006, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ + { 0x00004006, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ ZAP_SIMPLE_DEFAULT(0) }, /* nullable_int16u */ \ - { 0x00008007, ZAP_TYPE(INT24U), 3, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ + { 0x00004007, ZAP_TYPE(INT24U), 3, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ ZAP_LONG_DEFAULTS_INDEX(553) }, /* nullable_int24u */ \ - { 0x00008008, ZAP_TYPE(INT32U), 4, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ + { 0x00004008, ZAP_TYPE(INT32U), 4, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ ZAP_LONG_DEFAULTS_INDEX(556) }, /* nullable_int32u */ \ - { 0x00008009, ZAP_TYPE(INT40U), 5, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ + { 0x00004009, ZAP_TYPE(INT40U), 5, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ ZAP_LONG_DEFAULTS_INDEX(560) }, /* nullable_int40u */ \ - { 0x0000800A, ZAP_TYPE(INT48U), 6, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ + { 0x0000400A, ZAP_TYPE(INT48U), 6, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ ZAP_LONG_DEFAULTS_INDEX(565) }, /* nullable_int48u */ \ - { 0x0000800B, ZAP_TYPE(INT56U), 7, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ + { 0x0000400B, ZAP_TYPE(INT56U), 7, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ ZAP_LONG_DEFAULTS_INDEX(571) }, /* nullable_int56u */ \ - { 0x0000800C, ZAP_TYPE(INT64U), 8, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ + { 0x0000400C, ZAP_TYPE(INT64U), 8, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ ZAP_LONG_DEFAULTS_INDEX(578) }, /* nullable_int64u */ \ - { 0x0000800D, ZAP_TYPE(INT8S), 1, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ + { 0x0000400D, ZAP_TYPE(INT8S), 1, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ ZAP_SIMPLE_DEFAULT(0) }, /* nullable_int8s */ \ - { 0x0000800E, ZAP_TYPE(INT16S), 2, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ + { 0x0000400E, ZAP_TYPE(INT16S), 2, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ ZAP_SIMPLE_DEFAULT(0) }, /* nullable_int16s */ \ - { 0x0000800F, ZAP_TYPE(INT24S), 3, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ + { 0x0000400F, ZAP_TYPE(INT24S), 3, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ ZAP_LONG_DEFAULTS_INDEX(586) }, /* nullable_int24s */ \ - { 0x00008010, ZAP_TYPE(INT32S), 4, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ + { 0x00004010, ZAP_TYPE(INT32S), 4, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ ZAP_LONG_DEFAULTS_INDEX(589) }, /* nullable_int32s */ \ - { 0x00008011, ZAP_TYPE(INT40S), 5, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ + { 0x00004011, ZAP_TYPE(INT40S), 5, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ ZAP_LONG_DEFAULTS_INDEX(593) }, /* nullable_int40s */ \ - { 0x00008012, ZAP_TYPE(INT48S), 6, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ + { 0x00004012, ZAP_TYPE(INT48S), 6, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ ZAP_LONG_DEFAULTS_INDEX(598) }, /* nullable_int48s */ \ - { 0x00008013, ZAP_TYPE(INT56S), 7, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ + { 0x00004013, ZAP_TYPE(INT56S), 7, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ ZAP_LONG_DEFAULTS_INDEX(604) }, /* nullable_int56s */ \ - { 0x00008014, ZAP_TYPE(INT64S), 8, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ + { 0x00004014, ZAP_TYPE(INT64S), 8, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ ZAP_LONG_DEFAULTS_INDEX(611) }, /* nullable_int64s */ \ - { 0x00008015, ZAP_TYPE(ENUM8), 1, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ + { 0x00004015, ZAP_TYPE(ENUM8), 1, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ ZAP_SIMPLE_DEFAULT(0) }, /* nullable_enum8 */ \ - { 0x00008016, ZAP_TYPE(ENUM16), 2, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ + { 0x00004016, ZAP_TYPE(ENUM16), 2, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ ZAP_SIMPLE_DEFAULT(0) }, /* nullable_enum16 */ \ - { 0x00008017, ZAP_TYPE(SINGLE), 4, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ + { 0x00004017, ZAP_TYPE(SINGLE), 4, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ ZAP_LONG_DEFAULTS_INDEX(619) }, /* nullable_float_single */ \ - { 0x00008018, ZAP_TYPE(DOUBLE), 8, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ + { 0x00004018, ZAP_TYPE(DOUBLE), 8, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ ZAP_LONG_DEFAULTS_INDEX(623) }, /* nullable_float_double */ \ - { 0x00008019, ZAP_TYPE(OCTET_STRING), 11, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ + { 0x00004019, ZAP_TYPE(OCTET_STRING), 11, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ ZAP_EMPTY_DEFAULT() }, /* nullable_octet_string */ \ - { 0x0000801E, ZAP_TYPE(CHAR_STRING), 11, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ + { 0x0000401E, ZAP_TYPE(CHAR_STRING), 11, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ ZAP_EMPTY_DEFAULT() }, /* nullable_char_string */ \ - { 0x00008024, ZAP_TYPE(ENUM8), 1, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ + { 0x00004024, ZAP_TYPE(ENUM8), 1, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ ZAP_EMPTY_DEFAULT() }, /* nullable_enum_attr */ \ - { 0x00008025, ZAP_TYPE(STRUCT), 0, \ + { 0x00004025, ZAP_TYPE(STRUCT), 0, \ ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ ZAP_EMPTY_DEFAULT() }, /* nullable_struct */ \ - { 0x00008026, ZAP_TYPE(INT8U), 1, \ + { 0x00004026, ZAP_TYPE(INT8U), 1, \ ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ ZAP_MIN_MAX_DEFAULTS_INDEX(39) }, /* nullable_range_restricted_int8u */ \ - { 0x00008027, ZAP_TYPE(INT8S), 1, \ + { 0x00004027, ZAP_TYPE(INT8S), 1, \ ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ ZAP_MIN_MAX_DEFAULTS_INDEX(40) }, /* nullable_range_restricted_int8s */ \ - { 0x00008028, ZAP_TYPE(INT16U), 2, \ + { 0x00004028, ZAP_TYPE(INT16U), 2, \ ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ ZAP_MIN_MAX_DEFAULTS_INDEX(41) }, /* nullable_range_restricted_int16u */ \ - { 0x00008029, ZAP_TYPE(INT16S), 2, \ + { 0x00004029, ZAP_TYPE(INT16S), 2, \ ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ ZAP_MIN_MAX_DEFAULTS_INDEX(42) }, /* nullable_range_restricted_int16s */ \ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ diff --git a/zzz_generated/app-common/app-common/zap-generated/attribute-id.h b/zzz_generated/app-common/app-common/zap-generated/attribute-id.h index 82d1f64332146b..099f517886e0e0 100644 --- a/zzz_generated/app-common/app-common/zap-generated/attribute-id.h +++ b/zzz_generated/app-common/app-common/zap-generated/attribute-id.h @@ -1532,39 +1532,39 @@ #define ZCL_GENERAL_ERROR_BOOLEAN_ATTRIBUTE_ID (0x0031) #define ZCL_CLUSTER_ERROR_BOOLEAN_ATTRIBUTE_ID (0x0032) #define ZCL_UNSUPPORTED_ATTRIBUTE_ID (0x00FF) -#define ZCL_NULLABLE_BOOLEAN_ATTRIBUTE_ID (0x8000) -#define ZCL_NULLABLE_BITMAP8_ATTRIBUTE_ID (0x8001) -#define ZCL_NULLABLE_BITMAP16_ATTRIBUTE_ID (0x8002) -#define ZCL_NULLABLE_BITMAP32_ATTRIBUTE_ID (0x8003) -#define ZCL_NULLABLE_BITMAP64_ATTRIBUTE_ID (0x8004) -#define ZCL_NULLABLE_INT8_U_ATTRIBUTE_ID (0x8005) -#define ZCL_NULLABLE_INT16_U_ATTRIBUTE_ID (0x8006) -#define ZCL_NULLABLE_INT24_U_ATTRIBUTE_ID (0x8007) -#define ZCL_NULLABLE_INT32_U_ATTRIBUTE_ID (0x8008) -#define ZCL_NULLABLE_INT40_U_ATTRIBUTE_ID (0x8009) -#define ZCL_NULLABLE_INT48_U_ATTRIBUTE_ID (0x800A) -#define ZCL_NULLABLE_INT56_U_ATTRIBUTE_ID (0x800B) -#define ZCL_NULLABLE_INT64_U_ATTRIBUTE_ID (0x800C) -#define ZCL_NULLABLE_INT8_S_ATTRIBUTE_ID (0x800D) -#define ZCL_NULLABLE_INT16_S_ATTRIBUTE_ID (0x800E) -#define ZCL_NULLABLE_INT24_S_ATTRIBUTE_ID (0x800F) -#define ZCL_NULLABLE_INT32_S_ATTRIBUTE_ID (0x8010) -#define ZCL_NULLABLE_INT40_S_ATTRIBUTE_ID (0x8011) -#define ZCL_NULLABLE_INT48_S_ATTRIBUTE_ID (0x8012) -#define ZCL_NULLABLE_INT56_S_ATTRIBUTE_ID (0x8013) -#define ZCL_NULLABLE_INT64_S_ATTRIBUTE_ID (0x8014) -#define ZCL_NULLABLE_ENUM8_ATTRIBUTE_ID (0x8015) -#define ZCL_NULLABLE_ENUM16_ATTRIBUTE_ID (0x8016) -#define ZCL_NULLABLE_FLOAT_SINGLE_ATTRIBUTE_ID (0x8017) -#define ZCL_NULLABLE_FLOAT_DOUBLE_ATTRIBUTE_ID (0x8018) -#define ZCL_NULLABLE_OCTET_STRING_ATTRIBUTE_ID (0x8019) -#define ZCL_NULLABLE_CHAR_STRING_ATTRIBUTE_ID (0x801E) -#define ZCL_NULLABLE_SIMPLE_ENUM_ATTRIBUTE_ID (0x8024) -#define ZCL_NULLABLE_STRUCT_ATTRIBUTE_ID (0x8025) -#define ZCL_NULLABLE_RANGE_RESTRICTED_INT8_U_ATTRIBUTE_ID (0x8026) -#define ZCL_NULLABLE_RANGE_RESTRICTED_INT8S_ATTRIBUTE_ID (0x8027) -#define ZCL_NULLABLE_RANGE_RESTRICTED_INT16_U_ATTRIBUTE_ID (0x8028) -#define ZCL_NULLABLE_RANGE_RESTRICTED_INT16_S_ATTRIBUTE_ID (0x8029) +#define ZCL_NULLABLE_BOOLEAN_ATTRIBUTE_ID (0x4000) +#define ZCL_NULLABLE_BITMAP8_ATTRIBUTE_ID (0x4001) +#define ZCL_NULLABLE_BITMAP16_ATTRIBUTE_ID (0x4002) +#define ZCL_NULLABLE_BITMAP32_ATTRIBUTE_ID (0x4003) +#define ZCL_NULLABLE_BITMAP64_ATTRIBUTE_ID (0x4004) +#define ZCL_NULLABLE_INT8_U_ATTRIBUTE_ID (0x4005) +#define ZCL_NULLABLE_INT16_U_ATTRIBUTE_ID (0x4006) +#define ZCL_NULLABLE_INT24_U_ATTRIBUTE_ID (0x4007) +#define ZCL_NULLABLE_INT32_U_ATTRIBUTE_ID (0x4008) +#define ZCL_NULLABLE_INT40_U_ATTRIBUTE_ID (0x4009) +#define ZCL_NULLABLE_INT48_U_ATTRIBUTE_ID (0x400A) +#define ZCL_NULLABLE_INT56_U_ATTRIBUTE_ID (0x400B) +#define ZCL_NULLABLE_INT64_U_ATTRIBUTE_ID (0x400C) +#define ZCL_NULLABLE_INT8_S_ATTRIBUTE_ID (0x400D) +#define ZCL_NULLABLE_INT16_S_ATTRIBUTE_ID (0x400E) +#define ZCL_NULLABLE_INT24_S_ATTRIBUTE_ID (0x400F) +#define ZCL_NULLABLE_INT32_S_ATTRIBUTE_ID (0x4010) +#define ZCL_NULLABLE_INT40_S_ATTRIBUTE_ID (0x4011) +#define ZCL_NULLABLE_INT48_S_ATTRIBUTE_ID (0x4012) +#define ZCL_NULLABLE_INT56_S_ATTRIBUTE_ID (0x4013) +#define ZCL_NULLABLE_INT64_S_ATTRIBUTE_ID (0x4014) +#define ZCL_NULLABLE_ENUM8_ATTRIBUTE_ID (0x4015) +#define ZCL_NULLABLE_ENUM16_ATTRIBUTE_ID (0x4016) +#define ZCL_NULLABLE_FLOAT_SINGLE_ATTRIBUTE_ID (0x4017) +#define ZCL_NULLABLE_FLOAT_DOUBLE_ATTRIBUTE_ID (0x4018) +#define ZCL_NULLABLE_OCTET_STRING_ATTRIBUTE_ID (0x4019) +#define ZCL_NULLABLE_CHAR_STRING_ATTRIBUTE_ID (0x401E) +#define ZCL_NULLABLE_SIMPLE_ENUM_ATTRIBUTE_ID (0x4024) +#define ZCL_NULLABLE_STRUCT_ATTRIBUTE_ID (0x4025) +#define ZCL_NULLABLE_RANGE_RESTRICTED_INT8_U_ATTRIBUTE_ID (0x4026) +#define ZCL_NULLABLE_RANGE_RESTRICTED_INT8S_ATTRIBUTE_ID (0x4027) +#define ZCL_NULLABLE_RANGE_RESTRICTED_INT16_U_ATTRIBUTE_ID (0x4028) +#define ZCL_NULLABLE_RANGE_RESTRICTED_INT16_S_ATTRIBUTE_ID (0x4029) // Attribute ids for cluster: Messaging diff --git a/zzz_generated/app-common/app-common/zap-generated/ids/Attributes.h b/zzz_generated/app-common/app-common/zap-generated/ids/Attributes.h index d023e14d89f048..07b9b339badc4f 100644 --- a/zzz_generated/app-common/app-common/zap-generated/ids/Attributes.h +++ b/zzz_generated/app-common/app-common/zap-generated/ids/Attributes.h @@ -6267,135 +6267,135 @@ static constexpr AttributeId Id = 0x000000FF; } // namespace Unsupported namespace NullableBoolean { -static constexpr AttributeId Id = 0x00008000; +static constexpr AttributeId Id = 0x00004000; } // namespace NullableBoolean namespace NullableBitmap8 { -static constexpr AttributeId Id = 0x00008001; +static constexpr AttributeId Id = 0x00004001; } // namespace NullableBitmap8 namespace NullableBitmap16 { -static constexpr AttributeId Id = 0x00008002; +static constexpr AttributeId Id = 0x00004002; } // namespace NullableBitmap16 namespace NullableBitmap32 { -static constexpr AttributeId Id = 0x00008003; +static constexpr AttributeId Id = 0x00004003; } // namespace NullableBitmap32 namespace NullableBitmap64 { -static constexpr AttributeId Id = 0x00008004; +static constexpr AttributeId Id = 0x00004004; } // namespace NullableBitmap64 namespace NullableInt8u { -static constexpr AttributeId Id = 0x00008005; +static constexpr AttributeId Id = 0x00004005; } // namespace NullableInt8u namespace NullableInt16u { -static constexpr AttributeId Id = 0x00008006; +static constexpr AttributeId Id = 0x00004006; } // namespace NullableInt16u namespace NullableInt24u { -static constexpr AttributeId Id = 0x00008007; +static constexpr AttributeId Id = 0x00004007; } // namespace NullableInt24u namespace NullableInt32u { -static constexpr AttributeId Id = 0x00008008; +static constexpr AttributeId Id = 0x00004008; } // namespace NullableInt32u namespace NullableInt40u { -static constexpr AttributeId Id = 0x00008009; +static constexpr AttributeId Id = 0x00004009; } // namespace NullableInt40u namespace NullableInt48u { -static constexpr AttributeId Id = 0x0000800A; +static constexpr AttributeId Id = 0x0000400A; } // namespace NullableInt48u namespace NullableInt56u { -static constexpr AttributeId Id = 0x0000800B; +static constexpr AttributeId Id = 0x0000400B; } // namespace NullableInt56u namespace NullableInt64u { -static constexpr AttributeId Id = 0x0000800C; +static constexpr AttributeId Id = 0x0000400C; } // namespace NullableInt64u namespace NullableInt8s { -static constexpr AttributeId Id = 0x0000800D; +static constexpr AttributeId Id = 0x0000400D; } // namespace NullableInt8s namespace NullableInt16s { -static constexpr AttributeId Id = 0x0000800E; +static constexpr AttributeId Id = 0x0000400E; } // namespace NullableInt16s namespace NullableInt24s { -static constexpr AttributeId Id = 0x0000800F; +static constexpr AttributeId Id = 0x0000400F; } // namespace NullableInt24s namespace NullableInt32s { -static constexpr AttributeId Id = 0x00008010; +static constexpr AttributeId Id = 0x00004010; } // namespace NullableInt32s namespace NullableInt40s { -static constexpr AttributeId Id = 0x00008011; +static constexpr AttributeId Id = 0x00004011; } // namespace NullableInt40s namespace NullableInt48s { -static constexpr AttributeId Id = 0x00008012; +static constexpr AttributeId Id = 0x00004012; } // namespace NullableInt48s namespace NullableInt56s { -static constexpr AttributeId Id = 0x00008013; +static constexpr AttributeId Id = 0x00004013; } // namespace NullableInt56s namespace NullableInt64s { -static constexpr AttributeId Id = 0x00008014; +static constexpr AttributeId Id = 0x00004014; } // namespace NullableInt64s namespace NullableEnum8 { -static constexpr AttributeId Id = 0x00008015; +static constexpr AttributeId Id = 0x00004015; } // namespace NullableEnum8 namespace NullableEnum16 { -static constexpr AttributeId Id = 0x00008016; +static constexpr AttributeId Id = 0x00004016; } // namespace NullableEnum16 namespace NullableFloatSingle { -static constexpr AttributeId Id = 0x00008017; +static constexpr AttributeId Id = 0x00004017; } // namespace NullableFloatSingle namespace NullableFloatDouble { -static constexpr AttributeId Id = 0x00008018; +static constexpr AttributeId Id = 0x00004018; } // namespace NullableFloatDouble namespace NullableOctetString { -static constexpr AttributeId Id = 0x00008019; +static constexpr AttributeId Id = 0x00004019; } // namespace NullableOctetString namespace NullableCharString { -static constexpr AttributeId Id = 0x0000801E; +static constexpr AttributeId Id = 0x0000401E; } // namespace NullableCharString namespace NullableEnumAttr { -static constexpr AttributeId Id = 0x00008024; +static constexpr AttributeId Id = 0x00004024; } // namespace NullableEnumAttr namespace NullableStruct { -static constexpr AttributeId Id = 0x00008025; +static constexpr AttributeId Id = 0x00004025; } // namespace NullableStruct namespace NullableRangeRestrictedInt8u { -static constexpr AttributeId Id = 0x00008026; +static constexpr AttributeId Id = 0x00004026; } // namespace NullableRangeRestrictedInt8u namespace NullableRangeRestrictedInt8s { -static constexpr AttributeId Id = 0x00008027; +static constexpr AttributeId Id = 0x00004027; } // namespace NullableRangeRestrictedInt8s namespace NullableRangeRestrictedInt16u { -static constexpr AttributeId Id = 0x00008028; +static constexpr AttributeId Id = 0x00004028; } // namespace NullableRangeRestrictedInt16u namespace NullableRangeRestrictedInt16s { -static constexpr AttributeId Id = 0x00008029; +static constexpr AttributeId Id = 0x00004029; } // namespace NullableRangeRestrictedInt16s namespace GeneratedCommandList { diff --git a/zzz_generated/chip-tool-darwin/zap-generated/cluster/Commands.h b/zzz_generated/chip-tool-darwin/zap-generated/cluster/Commands.h index 4d220130bae0e6..012f45d40bfa7f 100644 --- a/zzz_generated/chip-tool-darwin/zap-generated/cluster/Commands.h +++ b/zzz_generated/chip-tool-darwin/zap-generated/cluster/Commands.h @@ -53570,39 +53570,39 @@ class SubscribeAttributeTemperatureMeasurementClusterRevision : public ModelComm | * GeneralErrorBoolean | 0x0031 | | * ClusterErrorBoolean | 0x0032 | | * Unsupported | 0x00FF | -| * NullableBoolean | 0x8000 | -| * NullableBitmap8 | 0x8001 | -| * NullableBitmap16 | 0x8002 | -| * NullableBitmap32 | 0x8003 | -| * NullableBitmap64 | 0x8004 | -| * NullableInt8u | 0x8005 | -| * NullableInt16u | 0x8006 | -| * NullableInt24u | 0x8007 | -| * NullableInt32u | 0x8008 | -| * NullableInt40u | 0x8009 | -| * NullableInt48u | 0x800A | -| * NullableInt56u | 0x800B | -| * NullableInt64u | 0x800C | -| * NullableInt8s | 0x800D | -| * NullableInt16s | 0x800E | -| * NullableInt24s | 0x800F | -| * NullableInt32s | 0x8010 | -| * NullableInt40s | 0x8011 | -| * NullableInt48s | 0x8012 | -| * NullableInt56s | 0x8013 | -| * NullableInt64s | 0x8014 | -| * NullableEnum8 | 0x8015 | -| * NullableEnum16 | 0x8016 | -| * NullableFloatSingle | 0x8017 | -| * NullableFloatDouble | 0x8018 | -| * NullableOctetString | 0x8019 | -| * NullableCharString | 0x801E | -| * NullableEnumAttr | 0x8024 | -| * NullableStruct | 0x8025 | -| * NullableRangeRestrictedInt8u | 0x8026 | -| * NullableRangeRestrictedInt8s | 0x8027 | -| * NullableRangeRestrictedInt16u | 0x8028 | -| * NullableRangeRestrictedInt16s | 0x8029 | +| * NullableBoolean | 0x4000 | +| * NullableBitmap8 | 0x4001 | +| * NullableBitmap16 | 0x4002 | +| * NullableBitmap32 | 0x4003 | +| * NullableBitmap64 | 0x4004 | +| * NullableInt8u | 0x4005 | +| * NullableInt16u | 0x4006 | +| * NullableInt24u | 0x4007 | +| * NullableInt32u | 0x4008 | +| * NullableInt40u | 0x4009 | +| * NullableInt48u | 0x400A | +| * NullableInt56u | 0x400B | +| * NullableInt64u | 0x400C | +| * NullableInt8s | 0x400D | +| * NullableInt16s | 0x400E | +| * NullableInt24s | 0x400F | +| * NullableInt32s | 0x4010 | +| * NullableInt40s | 0x4011 | +| * NullableInt48s | 0x4012 | +| * NullableInt56s | 0x4013 | +| * NullableInt64s | 0x4014 | +| * NullableEnum8 | 0x4015 | +| * NullableEnum16 | 0x4016 | +| * NullableFloatSingle | 0x4017 | +| * NullableFloatDouble | 0x4018 | +| * NullableOctetString | 0x4019 | +| * NullableCharString | 0x401E | +| * NullableEnumAttr | 0x4024 | +| * NullableStruct | 0x4025 | +| * NullableRangeRestrictedInt8u | 0x4026 | +| * NullableRangeRestrictedInt8s | 0x4027 | +| * NullableRangeRestrictedInt16u | 0x4028 | +| * NullableRangeRestrictedInt16s | 0x4029 | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * AttributeList | 0xFFFB | @@ -60131,7 +60131,7 @@ class ReadTestClusterNullableBoolean : public ModelCommand { CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override { - ChipLogProgress(chipTool, "Sending cluster (0x0000050F) ReadAttribute (0x00008000) on endpoint %u", endpointId); + ChipLogProgress(chipTool, "Sending cluster (0x0000050F) ReadAttribute (0x00004000) on endpoint %u", endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:endpointId queue:callbackQueue]; @@ -60161,7 +60161,7 @@ class WriteTestClusterNullableBoolean : public ModelCommand { CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override { - ChipLogProgress(chipTool, "Sending cluster (0x0000050F) WriteAttribute (0x00008000) on endpoint %u", endpointId); + ChipLogProgress(chipTool, "Sending cluster (0x0000050F) WriteAttribute (0x00004000) on endpoint %u", endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:endpointId queue:callbackQueue]; CHIP_ERROR __block chipError = CHIP_NO_ERROR; @@ -60198,7 +60198,7 @@ class SubscribeAttributeTestClusterNullableBoolean : public ModelCommand { CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override { - ChipLogProgress(chipTool, "Sending cluster (0x0000050F) ReportAttribute (0x00008000) on endpoint %u", endpointId); + ChipLogProgress(chipTool, "Sending cluster (0x0000050F) ReportAttribute (0x00004000) on endpoint %u", endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:endpointId queue:callbackQueue]; CHIPSubscribeParams * params = [[CHIPSubscribeParams alloc] init]; @@ -60243,7 +60243,7 @@ class ReadTestClusterNullableBitmap8 : public ModelCommand { CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override { - ChipLogProgress(chipTool, "Sending cluster (0x0000050F) ReadAttribute (0x00008001) on endpoint %u", endpointId); + ChipLogProgress(chipTool, "Sending cluster (0x0000050F) ReadAttribute (0x00004001) on endpoint %u", endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:endpointId queue:callbackQueue]; @@ -60273,7 +60273,7 @@ class WriteTestClusterNullableBitmap8 : public ModelCommand { CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override { - ChipLogProgress(chipTool, "Sending cluster (0x0000050F) WriteAttribute (0x00008001) on endpoint %u", endpointId); + ChipLogProgress(chipTool, "Sending cluster (0x0000050F) WriteAttribute (0x00004001) on endpoint %u", endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:endpointId queue:callbackQueue]; CHIP_ERROR __block chipError = CHIP_NO_ERROR; @@ -60310,7 +60310,7 @@ class SubscribeAttributeTestClusterNullableBitmap8 : public ModelCommand { CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override { - ChipLogProgress(chipTool, "Sending cluster (0x0000050F) ReportAttribute (0x00008001) on endpoint %u", endpointId); + ChipLogProgress(chipTool, "Sending cluster (0x0000050F) ReportAttribute (0x00004001) on endpoint %u", endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:endpointId queue:callbackQueue]; CHIPSubscribeParams * params = [[CHIPSubscribeParams alloc] init]; @@ -60355,7 +60355,7 @@ class ReadTestClusterNullableBitmap16 : public ModelCommand { CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override { - ChipLogProgress(chipTool, "Sending cluster (0x0000050F) ReadAttribute (0x00008002) on endpoint %u", endpointId); + ChipLogProgress(chipTool, "Sending cluster (0x0000050F) ReadAttribute (0x00004002) on endpoint %u", endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:endpointId queue:callbackQueue]; @@ -60385,7 +60385,7 @@ class WriteTestClusterNullableBitmap16 : public ModelCommand { CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override { - ChipLogProgress(chipTool, "Sending cluster (0x0000050F) WriteAttribute (0x00008002) on endpoint %u", endpointId); + ChipLogProgress(chipTool, "Sending cluster (0x0000050F) WriteAttribute (0x00004002) on endpoint %u", endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:endpointId queue:callbackQueue]; CHIP_ERROR __block chipError = CHIP_NO_ERROR; @@ -60422,7 +60422,7 @@ class SubscribeAttributeTestClusterNullableBitmap16 : public ModelCommand { CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override { - ChipLogProgress(chipTool, "Sending cluster (0x0000050F) ReportAttribute (0x00008002) on endpoint %u", endpointId); + ChipLogProgress(chipTool, "Sending cluster (0x0000050F) ReportAttribute (0x00004002) on endpoint %u", endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:endpointId queue:callbackQueue]; CHIPSubscribeParams * params = [[CHIPSubscribeParams alloc] init]; @@ -60467,7 +60467,7 @@ class ReadTestClusterNullableBitmap32 : public ModelCommand { CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override { - ChipLogProgress(chipTool, "Sending cluster (0x0000050F) ReadAttribute (0x00008003) on endpoint %u", endpointId); + ChipLogProgress(chipTool, "Sending cluster (0x0000050F) ReadAttribute (0x00004003) on endpoint %u", endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:endpointId queue:callbackQueue]; @@ -60497,7 +60497,7 @@ class WriteTestClusterNullableBitmap32 : public ModelCommand { CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override { - ChipLogProgress(chipTool, "Sending cluster (0x0000050F) WriteAttribute (0x00008003) on endpoint %u", endpointId); + ChipLogProgress(chipTool, "Sending cluster (0x0000050F) WriteAttribute (0x00004003) on endpoint %u", endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:endpointId queue:callbackQueue]; CHIP_ERROR __block chipError = CHIP_NO_ERROR; @@ -60534,7 +60534,7 @@ class SubscribeAttributeTestClusterNullableBitmap32 : public ModelCommand { CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override { - ChipLogProgress(chipTool, "Sending cluster (0x0000050F) ReportAttribute (0x00008003) on endpoint %u", endpointId); + ChipLogProgress(chipTool, "Sending cluster (0x0000050F) ReportAttribute (0x00004003) on endpoint %u", endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:endpointId queue:callbackQueue]; CHIPSubscribeParams * params = [[CHIPSubscribeParams alloc] init]; @@ -60579,7 +60579,7 @@ class ReadTestClusterNullableBitmap64 : public ModelCommand { CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override { - ChipLogProgress(chipTool, "Sending cluster (0x0000050F) ReadAttribute (0x00008004) on endpoint %u", endpointId); + ChipLogProgress(chipTool, "Sending cluster (0x0000050F) ReadAttribute (0x00004004) on endpoint %u", endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:endpointId queue:callbackQueue]; @@ -60609,7 +60609,7 @@ class WriteTestClusterNullableBitmap64 : public ModelCommand { CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override { - ChipLogProgress(chipTool, "Sending cluster (0x0000050F) WriteAttribute (0x00008004) on endpoint %u", endpointId); + ChipLogProgress(chipTool, "Sending cluster (0x0000050F) WriteAttribute (0x00004004) on endpoint %u", endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:endpointId queue:callbackQueue]; CHIP_ERROR __block chipError = CHIP_NO_ERROR; @@ -60646,7 +60646,7 @@ class SubscribeAttributeTestClusterNullableBitmap64 : public ModelCommand { CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override { - ChipLogProgress(chipTool, "Sending cluster (0x0000050F) ReportAttribute (0x00008004) on endpoint %u", endpointId); + ChipLogProgress(chipTool, "Sending cluster (0x0000050F) ReportAttribute (0x00004004) on endpoint %u", endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:endpointId queue:callbackQueue]; CHIPSubscribeParams * params = [[CHIPSubscribeParams alloc] init]; @@ -60691,7 +60691,7 @@ class ReadTestClusterNullableInt8u : public ModelCommand { CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override { - ChipLogProgress(chipTool, "Sending cluster (0x0000050F) ReadAttribute (0x00008005) on endpoint %u", endpointId); + ChipLogProgress(chipTool, "Sending cluster (0x0000050F) ReadAttribute (0x00004005) on endpoint %u", endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:endpointId queue:callbackQueue]; @@ -60721,7 +60721,7 @@ class WriteTestClusterNullableInt8u : public ModelCommand { CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override { - ChipLogProgress(chipTool, "Sending cluster (0x0000050F) WriteAttribute (0x00008005) on endpoint %u", endpointId); + ChipLogProgress(chipTool, "Sending cluster (0x0000050F) WriteAttribute (0x00004005) on endpoint %u", endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:endpointId queue:callbackQueue]; CHIP_ERROR __block chipError = CHIP_NO_ERROR; @@ -60757,7 +60757,7 @@ class SubscribeAttributeTestClusterNullableInt8u : public ModelCommand { CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override { - ChipLogProgress(chipTool, "Sending cluster (0x0000050F) ReportAttribute (0x00008005) on endpoint %u", endpointId); + ChipLogProgress(chipTool, "Sending cluster (0x0000050F) ReportAttribute (0x00004005) on endpoint %u", endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:endpointId queue:callbackQueue]; CHIPSubscribeParams * params = [[CHIPSubscribeParams alloc] init]; @@ -60802,7 +60802,7 @@ class ReadTestClusterNullableInt16u : public ModelCommand { CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override { - ChipLogProgress(chipTool, "Sending cluster (0x0000050F) ReadAttribute (0x00008006) on endpoint %u", endpointId); + ChipLogProgress(chipTool, "Sending cluster (0x0000050F) ReadAttribute (0x00004006) on endpoint %u", endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:endpointId queue:callbackQueue]; @@ -60832,7 +60832,7 @@ class WriteTestClusterNullableInt16u : public ModelCommand { CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override { - ChipLogProgress(chipTool, "Sending cluster (0x0000050F) WriteAttribute (0x00008006) on endpoint %u", endpointId); + ChipLogProgress(chipTool, "Sending cluster (0x0000050F) WriteAttribute (0x00004006) on endpoint %u", endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:endpointId queue:callbackQueue]; CHIP_ERROR __block chipError = CHIP_NO_ERROR; @@ -60868,7 +60868,7 @@ class SubscribeAttributeTestClusterNullableInt16u : public ModelCommand { CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override { - ChipLogProgress(chipTool, "Sending cluster (0x0000050F) ReportAttribute (0x00008006) on endpoint %u", endpointId); + ChipLogProgress(chipTool, "Sending cluster (0x0000050F) ReportAttribute (0x00004006) on endpoint %u", endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:endpointId queue:callbackQueue]; CHIPSubscribeParams * params = [[CHIPSubscribeParams alloc] init]; @@ -60913,7 +60913,7 @@ class ReadTestClusterNullableInt24u : public ModelCommand { CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override { - ChipLogProgress(chipTool, "Sending cluster (0x0000050F) ReadAttribute (0x00008007) on endpoint %u", endpointId); + ChipLogProgress(chipTool, "Sending cluster (0x0000050F) ReadAttribute (0x00004007) on endpoint %u", endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:endpointId queue:callbackQueue]; @@ -60943,7 +60943,7 @@ class WriteTestClusterNullableInt24u : public ModelCommand { CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override { - ChipLogProgress(chipTool, "Sending cluster (0x0000050F) WriteAttribute (0x00008007) on endpoint %u", endpointId); + ChipLogProgress(chipTool, "Sending cluster (0x0000050F) WriteAttribute (0x00004007) on endpoint %u", endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:endpointId queue:callbackQueue]; CHIP_ERROR __block chipError = CHIP_NO_ERROR; @@ -60979,7 +60979,7 @@ class SubscribeAttributeTestClusterNullableInt24u : public ModelCommand { CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override { - ChipLogProgress(chipTool, "Sending cluster (0x0000050F) ReportAttribute (0x00008007) on endpoint %u", endpointId); + ChipLogProgress(chipTool, "Sending cluster (0x0000050F) ReportAttribute (0x00004007) on endpoint %u", endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:endpointId queue:callbackQueue]; CHIPSubscribeParams * params = [[CHIPSubscribeParams alloc] init]; @@ -61024,7 +61024,7 @@ class ReadTestClusterNullableInt32u : public ModelCommand { CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override { - ChipLogProgress(chipTool, "Sending cluster (0x0000050F) ReadAttribute (0x00008008) on endpoint %u", endpointId); + ChipLogProgress(chipTool, "Sending cluster (0x0000050F) ReadAttribute (0x00004008) on endpoint %u", endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:endpointId queue:callbackQueue]; @@ -61054,7 +61054,7 @@ class WriteTestClusterNullableInt32u : public ModelCommand { CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override { - ChipLogProgress(chipTool, "Sending cluster (0x0000050F) WriteAttribute (0x00008008) on endpoint %u", endpointId); + ChipLogProgress(chipTool, "Sending cluster (0x0000050F) WriteAttribute (0x00004008) on endpoint %u", endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:endpointId queue:callbackQueue]; CHIP_ERROR __block chipError = CHIP_NO_ERROR; @@ -61090,7 +61090,7 @@ class SubscribeAttributeTestClusterNullableInt32u : public ModelCommand { CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override { - ChipLogProgress(chipTool, "Sending cluster (0x0000050F) ReportAttribute (0x00008008) on endpoint %u", endpointId); + ChipLogProgress(chipTool, "Sending cluster (0x0000050F) ReportAttribute (0x00004008) on endpoint %u", endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:endpointId queue:callbackQueue]; CHIPSubscribeParams * params = [[CHIPSubscribeParams alloc] init]; @@ -61135,7 +61135,7 @@ class ReadTestClusterNullableInt40u : public ModelCommand { CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override { - ChipLogProgress(chipTool, "Sending cluster (0x0000050F) ReadAttribute (0x00008009) on endpoint %u", endpointId); + ChipLogProgress(chipTool, "Sending cluster (0x0000050F) ReadAttribute (0x00004009) on endpoint %u", endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:endpointId queue:callbackQueue]; @@ -61165,7 +61165,7 @@ class WriteTestClusterNullableInt40u : public ModelCommand { CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override { - ChipLogProgress(chipTool, "Sending cluster (0x0000050F) WriteAttribute (0x00008009) on endpoint %u", endpointId); + ChipLogProgress(chipTool, "Sending cluster (0x0000050F) WriteAttribute (0x00004009) on endpoint %u", endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:endpointId queue:callbackQueue]; CHIP_ERROR __block chipError = CHIP_NO_ERROR; @@ -61201,7 +61201,7 @@ class SubscribeAttributeTestClusterNullableInt40u : public ModelCommand { CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override { - ChipLogProgress(chipTool, "Sending cluster (0x0000050F) ReportAttribute (0x00008009) on endpoint %u", endpointId); + ChipLogProgress(chipTool, "Sending cluster (0x0000050F) ReportAttribute (0x00004009) on endpoint %u", endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:endpointId queue:callbackQueue]; CHIPSubscribeParams * params = [[CHIPSubscribeParams alloc] init]; @@ -61246,7 +61246,7 @@ class ReadTestClusterNullableInt48u : public ModelCommand { CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override { - ChipLogProgress(chipTool, "Sending cluster (0x0000050F) ReadAttribute (0x0000800A) on endpoint %u", endpointId); + ChipLogProgress(chipTool, "Sending cluster (0x0000050F) ReadAttribute (0x0000400A) on endpoint %u", endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:endpointId queue:callbackQueue]; @@ -61276,7 +61276,7 @@ class WriteTestClusterNullableInt48u : public ModelCommand { CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override { - ChipLogProgress(chipTool, "Sending cluster (0x0000050F) WriteAttribute (0x0000800A) on endpoint %u", endpointId); + ChipLogProgress(chipTool, "Sending cluster (0x0000050F) WriteAttribute (0x0000400A) on endpoint %u", endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:endpointId queue:callbackQueue]; CHIP_ERROR __block chipError = CHIP_NO_ERROR; @@ -61312,7 +61312,7 @@ class SubscribeAttributeTestClusterNullableInt48u : public ModelCommand { CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override { - ChipLogProgress(chipTool, "Sending cluster (0x0000050F) ReportAttribute (0x0000800A) on endpoint %u", endpointId); + ChipLogProgress(chipTool, "Sending cluster (0x0000050F) ReportAttribute (0x0000400A) on endpoint %u", endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:endpointId queue:callbackQueue]; CHIPSubscribeParams * params = [[CHIPSubscribeParams alloc] init]; @@ -61357,7 +61357,7 @@ class ReadTestClusterNullableInt56u : public ModelCommand { CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override { - ChipLogProgress(chipTool, "Sending cluster (0x0000050F) ReadAttribute (0x0000800B) on endpoint %u", endpointId); + ChipLogProgress(chipTool, "Sending cluster (0x0000050F) ReadAttribute (0x0000400B) on endpoint %u", endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:endpointId queue:callbackQueue]; @@ -61387,7 +61387,7 @@ class WriteTestClusterNullableInt56u : public ModelCommand { CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override { - ChipLogProgress(chipTool, "Sending cluster (0x0000050F) WriteAttribute (0x0000800B) on endpoint %u", endpointId); + ChipLogProgress(chipTool, "Sending cluster (0x0000050F) WriteAttribute (0x0000400B) on endpoint %u", endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:endpointId queue:callbackQueue]; CHIP_ERROR __block chipError = CHIP_NO_ERROR; @@ -61423,7 +61423,7 @@ class SubscribeAttributeTestClusterNullableInt56u : public ModelCommand { CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override { - ChipLogProgress(chipTool, "Sending cluster (0x0000050F) ReportAttribute (0x0000800B) on endpoint %u", endpointId); + ChipLogProgress(chipTool, "Sending cluster (0x0000050F) ReportAttribute (0x0000400B) on endpoint %u", endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:endpointId queue:callbackQueue]; CHIPSubscribeParams * params = [[CHIPSubscribeParams alloc] init]; @@ -61468,7 +61468,7 @@ class ReadTestClusterNullableInt64u : public ModelCommand { CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override { - ChipLogProgress(chipTool, "Sending cluster (0x0000050F) ReadAttribute (0x0000800C) on endpoint %u", endpointId); + ChipLogProgress(chipTool, "Sending cluster (0x0000050F) ReadAttribute (0x0000400C) on endpoint %u", endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:endpointId queue:callbackQueue]; @@ -61498,7 +61498,7 @@ class WriteTestClusterNullableInt64u : public ModelCommand { CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override { - ChipLogProgress(chipTool, "Sending cluster (0x0000050F) WriteAttribute (0x0000800C) on endpoint %u", endpointId); + ChipLogProgress(chipTool, "Sending cluster (0x0000050F) WriteAttribute (0x0000400C) on endpoint %u", endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:endpointId queue:callbackQueue]; CHIP_ERROR __block chipError = CHIP_NO_ERROR; @@ -61534,7 +61534,7 @@ class SubscribeAttributeTestClusterNullableInt64u : public ModelCommand { CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override { - ChipLogProgress(chipTool, "Sending cluster (0x0000050F) ReportAttribute (0x0000800C) on endpoint %u", endpointId); + ChipLogProgress(chipTool, "Sending cluster (0x0000050F) ReportAttribute (0x0000400C) on endpoint %u", endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:endpointId queue:callbackQueue]; CHIPSubscribeParams * params = [[CHIPSubscribeParams alloc] init]; @@ -61579,7 +61579,7 @@ class ReadTestClusterNullableInt8s : public ModelCommand { CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override { - ChipLogProgress(chipTool, "Sending cluster (0x0000050F) ReadAttribute (0x0000800D) on endpoint %u", endpointId); + ChipLogProgress(chipTool, "Sending cluster (0x0000050F) ReadAttribute (0x0000400D) on endpoint %u", endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:endpointId queue:callbackQueue]; @@ -61609,7 +61609,7 @@ class WriteTestClusterNullableInt8s : public ModelCommand { CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override { - ChipLogProgress(chipTool, "Sending cluster (0x0000050F) WriteAttribute (0x0000800D) on endpoint %u", endpointId); + ChipLogProgress(chipTool, "Sending cluster (0x0000050F) WriteAttribute (0x0000400D) on endpoint %u", endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:endpointId queue:callbackQueue]; CHIP_ERROR __block chipError = CHIP_NO_ERROR; @@ -61645,7 +61645,7 @@ class SubscribeAttributeTestClusterNullableInt8s : public ModelCommand { CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override { - ChipLogProgress(chipTool, "Sending cluster (0x0000050F) ReportAttribute (0x0000800D) on endpoint %u", endpointId); + ChipLogProgress(chipTool, "Sending cluster (0x0000050F) ReportAttribute (0x0000400D) on endpoint %u", endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:endpointId queue:callbackQueue]; CHIPSubscribeParams * params = [[CHIPSubscribeParams alloc] init]; @@ -61690,7 +61690,7 @@ class ReadTestClusterNullableInt16s : public ModelCommand { CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override { - ChipLogProgress(chipTool, "Sending cluster (0x0000050F) ReadAttribute (0x0000800E) on endpoint %u", endpointId); + ChipLogProgress(chipTool, "Sending cluster (0x0000050F) ReadAttribute (0x0000400E) on endpoint %u", endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:endpointId queue:callbackQueue]; @@ -61720,7 +61720,7 @@ class WriteTestClusterNullableInt16s : public ModelCommand { CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override { - ChipLogProgress(chipTool, "Sending cluster (0x0000050F) WriteAttribute (0x0000800E) on endpoint %u", endpointId); + ChipLogProgress(chipTool, "Sending cluster (0x0000050F) WriteAttribute (0x0000400E) on endpoint %u", endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:endpointId queue:callbackQueue]; CHIP_ERROR __block chipError = CHIP_NO_ERROR; @@ -61756,7 +61756,7 @@ class SubscribeAttributeTestClusterNullableInt16s : public ModelCommand { CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override { - ChipLogProgress(chipTool, "Sending cluster (0x0000050F) ReportAttribute (0x0000800E) on endpoint %u", endpointId); + ChipLogProgress(chipTool, "Sending cluster (0x0000050F) ReportAttribute (0x0000400E) on endpoint %u", endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:endpointId queue:callbackQueue]; CHIPSubscribeParams * params = [[CHIPSubscribeParams alloc] init]; @@ -61801,7 +61801,7 @@ class ReadTestClusterNullableInt24s : public ModelCommand { CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override { - ChipLogProgress(chipTool, "Sending cluster (0x0000050F) ReadAttribute (0x0000800F) on endpoint %u", endpointId); + ChipLogProgress(chipTool, "Sending cluster (0x0000050F) ReadAttribute (0x0000400F) on endpoint %u", endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:endpointId queue:callbackQueue]; @@ -61831,7 +61831,7 @@ class WriteTestClusterNullableInt24s : public ModelCommand { CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override { - ChipLogProgress(chipTool, "Sending cluster (0x0000050F) WriteAttribute (0x0000800F) on endpoint %u", endpointId); + ChipLogProgress(chipTool, "Sending cluster (0x0000050F) WriteAttribute (0x0000400F) on endpoint %u", endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:endpointId queue:callbackQueue]; CHIP_ERROR __block chipError = CHIP_NO_ERROR; @@ -61867,7 +61867,7 @@ class SubscribeAttributeTestClusterNullableInt24s : public ModelCommand { CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override { - ChipLogProgress(chipTool, "Sending cluster (0x0000050F) ReportAttribute (0x0000800F) on endpoint %u", endpointId); + ChipLogProgress(chipTool, "Sending cluster (0x0000050F) ReportAttribute (0x0000400F) on endpoint %u", endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:endpointId queue:callbackQueue]; CHIPSubscribeParams * params = [[CHIPSubscribeParams alloc] init]; @@ -61912,7 +61912,7 @@ class ReadTestClusterNullableInt32s : public ModelCommand { CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override { - ChipLogProgress(chipTool, "Sending cluster (0x0000050F) ReadAttribute (0x00008010) on endpoint %u", endpointId); + ChipLogProgress(chipTool, "Sending cluster (0x0000050F) ReadAttribute (0x00004010) on endpoint %u", endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:endpointId queue:callbackQueue]; @@ -61942,7 +61942,7 @@ class WriteTestClusterNullableInt32s : public ModelCommand { CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override { - ChipLogProgress(chipTool, "Sending cluster (0x0000050F) WriteAttribute (0x00008010) on endpoint %u", endpointId); + ChipLogProgress(chipTool, "Sending cluster (0x0000050F) WriteAttribute (0x00004010) on endpoint %u", endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:endpointId queue:callbackQueue]; CHIP_ERROR __block chipError = CHIP_NO_ERROR; @@ -61978,7 +61978,7 @@ class SubscribeAttributeTestClusterNullableInt32s : public ModelCommand { CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override { - ChipLogProgress(chipTool, "Sending cluster (0x0000050F) ReportAttribute (0x00008010) on endpoint %u", endpointId); + ChipLogProgress(chipTool, "Sending cluster (0x0000050F) ReportAttribute (0x00004010) on endpoint %u", endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:endpointId queue:callbackQueue]; CHIPSubscribeParams * params = [[CHIPSubscribeParams alloc] init]; @@ -62023,7 +62023,7 @@ class ReadTestClusterNullableInt40s : public ModelCommand { CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override { - ChipLogProgress(chipTool, "Sending cluster (0x0000050F) ReadAttribute (0x00008011) on endpoint %u", endpointId); + ChipLogProgress(chipTool, "Sending cluster (0x0000050F) ReadAttribute (0x00004011) on endpoint %u", endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:endpointId queue:callbackQueue]; @@ -62053,7 +62053,7 @@ class WriteTestClusterNullableInt40s : public ModelCommand { CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override { - ChipLogProgress(chipTool, "Sending cluster (0x0000050F) WriteAttribute (0x00008011) on endpoint %u", endpointId); + ChipLogProgress(chipTool, "Sending cluster (0x0000050F) WriteAttribute (0x00004011) on endpoint %u", endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:endpointId queue:callbackQueue]; CHIP_ERROR __block chipError = CHIP_NO_ERROR; @@ -62089,7 +62089,7 @@ class SubscribeAttributeTestClusterNullableInt40s : public ModelCommand { CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override { - ChipLogProgress(chipTool, "Sending cluster (0x0000050F) ReportAttribute (0x00008011) on endpoint %u", endpointId); + ChipLogProgress(chipTool, "Sending cluster (0x0000050F) ReportAttribute (0x00004011) on endpoint %u", endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:endpointId queue:callbackQueue]; CHIPSubscribeParams * params = [[CHIPSubscribeParams alloc] init]; @@ -62134,7 +62134,7 @@ class ReadTestClusterNullableInt48s : public ModelCommand { CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override { - ChipLogProgress(chipTool, "Sending cluster (0x0000050F) ReadAttribute (0x00008012) on endpoint %u", endpointId); + ChipLogProgress(chipTool, "Sending cluster (0x0000050F) ReadAttribute (0x00004012) on endpoint %u", endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:endpointId queue:callbackQueue]; @@ -62164,7 +62164,7 @@ class WriteTestClusterNullableInt48s : public ModelCommand { CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override { - ChipLogProgress(chipTool, "Sending cluster (0x0000050F) WriteAttribute (0x00008012) on endpoint %u", endpointId); + ChipLogProgress(chipTool, "Sending cluster (0x0000050F) WriteAttribute (0x00004012) on endpoint %u", endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:endpointId queue:callbackQueue]; CHIP_ERROR __block chipError = CHIP_NO_ERROR; @@ -62200,7 +62200,7 @@ class SubscribeAttributeTestClusterNullableInt48s : public ModelCommand { CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override { - ChipLogProgress(chipTool, "Sending cluster (0x0000050F) ReportAttribute (0x00008012) on endpoint %u", endpointId); + ChipLogProgress(chipTool, "Sending cluster (0x0000050F) ReportAttribute (0x00004012) on endpoint %u", endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:endpointId queue:callbackQueue]; CHIPSubscribeParams * params = [[CHIPSubscribeParams alloc] init]; @@ -62245,7 +62245,7 @@ class ReadTestClusterNullableInt56s : public ModelCommand { CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override { - ChipLogProgress(chipTool, "Sending cluster (0x0000050F) ReadAttribute (0x00008013) on endpoint %u", endpointId); + ChipLogProgress(chipTool, "Sending cluster (0x0000050F) ReadAttribute (0x00004013) on endpoint %u", endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:endpointId queue:callbackQueue]; @@ -62275,7 +62275,7 @@ class WriteTestClusterNullableInt56s : public ModelCommand { CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override { - ChipLogProgress(chipTool, "Sending cluster (0x0000050F) WriteAttribute (0x00008013) on endpoint %u", endpointId); + ChipLogProgress(chipTool, "Sending cluster (0x0000050F) WriteAttribute (0x00004013) on endpoint %u", endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:endpointId queue:callbackQueue]; CHIP_ERROR __block chipError = CHIP_NO_ERROR; @@ -62311,7 +62311,7 @@ class SubscribeAttributeTestClusterNullableInt56s : public ModelCommand { CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override { - ChipLogProgress(chipTool, "Sending cluster (0x0000050F) ReportAttribute (0x00008013) on endpoint %u", endpointId); + ChipLogProgress(chipTool, "Sending cluster (0x0000050F) ReportAttribute (0x00004013) on endpoint %u", endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:endpointId queue:callbackQueue]; CHIPSubscribeParams * params = [[CHIPSubscribeParams alloc] init]; @@ -62356,7 +62356,7 @@ class ReadTestClusterNullableInt64s : public ModelCommand { CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override { - ChipLogProgress(chipTool, "Sending cluster (0x0000050F) ReadAttribute (0x00008014) on endpoint %u", endpointId); + ChipLogProgress(chipTool, "Sending cluster (0x0000050F) ReadAttribute (0x00004014) on endpoint %u", endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:endpointId queue:callbackQueue]; @@ -62386,7 +62386,7 @@ class WriteTestClusterNullableInt64s : public ModelCommand { CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override { - ChipLogProgress(chipTool, "Sending cluster (0x0000050F) WriteAttribute (0x00008014) on endpoint %u", endpointId); + ChipLogProgress(chipTool, "Sending cluster (0x0000050F) WriteAttribute (0x00004014) on endpoint %u", endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:endpointId queue:callbackQueue]; CHIP_ERROR __block chipError = CHIP_NO_ERROR; @@ -62422,7 +62422,7 @@ class SubscribeAttributeTestClusterNullableInt64s : public ModelCommand { CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override { - ChipLogProgress(chipTool, "Sending cluster (0x0000050F) ReportAttribute (0x00008014) on endpoint %u", endpointId); + ChipLogProgress(chipTool, "Sending cluster (0x0000050F) ReportAttribute (0x00004014) on endpoint %u", endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:endpointId queue:callbackQueue]; CHIPSubscribeParams * params = [[CHIPSubscribeParams alloc] init]; @@ -62467,7 +62467,7 @@ class ReadTestClusterNullableEnum8 : public ModelCommand { CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override { - ChipLogProgress(chipTool, "Sending cluster (0x0000050F) ReadAttribute (0x00008015) on endpoint %u", endpointId); + ChipLogProgress(chipTool, "Sending cluster (0x0000050F) ReadAttribute (0x00004015) on endpoint %u", endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:endpointId queue:callbackQueue]; @@ -62497,7 +62497,7 @@ class WriteTestClusterNullableEnum8 : public ModelCommand { CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override { - ChipLogProgress(chipTool, "Sending cluster (0x0000050F) WriteAttribute (0x00008015) on endpoint %u", endpointId); + ChipLogProgress(chipTool, "Sending cluster (0x0000050F) WriteAttribute (0x00004015) on endpoint %u", endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:endpointId queue:callbackQueue]; CHIP_ERROR __block chipError = CHIP_NO_ERROR; @@ -62533,7 +62533,7 @@ class SubscribeAttributeTestClusterNullableEnum8 : public ModelCommand { CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override { - ChipLogProgress(chipTool, "Sending cluster (0x0000050F) ReportAttribute (0x00008015) on endpoint %u", endpointId); + ChipLogProgress(chipTool, "Sending cluster (0x0000050F) ReportAttribute (0x00004015) on endpoint %u", endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:endpointId queue:callbackQueue]; CHIPSubscribeParams * params = [[CHIPSubscribeParams alloc] init]; @@ -62578,7 +62578,7 @@ class ReadTestClusterNullableEnum16 : public ModelCommand { CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override { - ChipLogProgress(chipTool, "Sending cluster (0x0000050F) ReadAttribute (0x00008016) on endpoint %u", endpointId); + ChipLogProgress(chipTool, "Sending cluster (0x0000050F) ReadAttribute (0x00004016) on endpoint %u", endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:endpointId queue:callbackQueue]; @@ -62608,7 +62608,7 @@ class WriteTestClusterNullableEnum16 : public ModelCommand { CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override { - ChipLogProgress(chipTool, "Sending cluster (0x0000050F) WriteAttribute (0x00008016) on endpoint %u", endpointId); + ChipLogProgress(chipTool, "Sending cluster (0x0000050F) WriteAttribute (0x00004016) on endpoint %u", endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:endpointId queue:callbackQueue]; CHIP_ERROR __block chipError = CHIP_NO_ERROR; @@ -62644,7 +62644,7 @@ class SubscribeAttributeTestClusterNullableEnum16 : public ModelCommand { CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override { - ChipLogProgress(chipTool, "Sending cluster (0x0000050F) ReportAttribute (0x00008016) on endpoint %u", endpointId); + ChipLogProgress(chipTool, "Sending cluster (0x0000050F) ReportAttribute (0x00004016) on endpoint %u", endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:endpointId queue:callbackQueue]; CHIPSubscribeParams * params = [[CHIPSubscribeParams alloc] init]; @@ -62689,7 +62689,7 @@ class ReadTestClusterNullableFloatSingle : public ModelCommand { CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override { - ChipLogProgress(chipTool, "Sending cluster (0x0000050F) ReadAttribute (0x00008017) on endpoint %u", endpointId); + ChipLogProgress(chipTool, "Sending cluster (0x0000050F) ReadAttribute (0x00004017) on endpoint %u", endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:endpointId queue:callbackQueue]; @@ -62719,7 +62719,7 @@ class WriteTestClusterNullableFloatSingle : public ModelCommand { CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override { - ChipLogProgress(chipTool, "Sending cluster (0x0000050F) WriteAttribute (0x00008017) on endpoint %u", endpointId); + ChipLogProgress(chipTool, "Sending cluster (0x0000050F) WriteAttribute (0x00004017) on endpoint %u", endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:endpointId queue:callbackQueue]; CHIP_ERROR __block chipError = CHIP_NO_ERROR; @@ -62756,7 +62756,7 @@ class SubscribeAttributeTestClusterNullableFloatSingle : public ModelCommand { CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override { - ChipLogProgress(chipTool, "Sending cluster (0x0000050F) ReportAttribute (0x00008017) on endpoint %u", endpointId); + ChipLogProgress(chipTool, "Sending cluster (0x0000050F) ReportAttribute (0x00004017) on endpoint %u", endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:endpointId queue:callbackQueue]; CHIPSubscribeParams * params = [[CHIPSubscribeParams alloc] init]; @@ -62802,7 +62802,7 @@ class ReadTestClusterNullableFloatDouble : public ModelCommand { CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override { - ChipLogProgress(chipTool, "Sending cluster (0x0000050F) ReadAttribute (0x00008018) on endpoint %u", endpointId); + ChipLogProgress(chipTool, "Sending cluster (0x0000050F) ReadAttribute (0x00004018) on endpoint %u", endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:endpointId queue:callbackQueue]; @@ -62832,7 +62832,7 @@ class WriteTestClusterNullableFloatDouble : public ModelCommand { CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override { - ChipLogProgress(chipTool, "Sending cluster (0x0000050F) WriteAttribute (0x00008018) on endpoint %u", endpointId); + ChipLogProgress(chipTool, "Sending cluster (0x0000050F) WriteAttribute (0x00004018) on endpoint %u", endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:endpointId queue:callbackQueue]; CHIP_ERROR __block chipError = CHIP_NO_ERROR; @@ -62869,7 +62869,7 @@ class SubscribeAttributeTestClusterNullableFloatDouble : public ModelCommand { CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override { - ChipLogProgress(chipTool, "Sending cluster (0x0000050F) ReportAttribute (0x00008018) on endpoint %u", endpointId); + ChipLogProgress(chipTool, "Sending cluster (0x0000050F) ReportAttribute (0x00004018) on endpoint %u", endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:endpointId queue:callbackQueue]; CHIPSubscribeParams * params = [[CHIPSubscribeParams alloc] init]; @@ -62915,7 +62915,7 @@ class ReadTestClusterNullableOctetString : public ModelCommand { CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override { - ChipLogProgress(chipTool, "Sending cluster (0x0000050F) ReadAttribute (0x00008019) on endpoint %u", endpointId); + ChipLogProgress(chipTool, "Sending cluster (0x0000050F) ReadAttribute (0x00004019) on endpoint %u", endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:endpointId queue:callbackQueue]; @@ -62945,7 +62945,7 @@ class WriteTestClusterNullableOctetString : public ModelCommand { CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override { - ChipLogProgress(chipTool, "Sending cluster (0x0000050F) WriteAttribute (0x00008019) on endpoint %u", endpointId); + ChipLogProgress(chipTool, "Sending cluster (0x0000050F) WriteAttribute (0x00004019) on endpoint %u", endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:endpointId queue:callbackQueue]; CHIP_ERROR __block chipError = CHIP_NO_ERROR; @@ -62982,7 +62982,7 @@ class SubscribeAttributeTestClusterNullableOctetString : public ModelCommand { CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override { - ChipLogProgress(chipTool, "Sending cluster (0x0000050F) ReportAttribute (0x00008019) on endpoint %u", endpointId); + ChipLogProgress(chipTool, "Sending cluster (0x0000050F) ReportAttribute (0x00004019) on endpoint %u", endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:endpointId queue:callbackQueue]; CHIPSubscribeParams * params = [[CHIPSubscribeParams alloc] init]; @@ -63028,7 +63028,7 @@ class ReadTestClusterNullableCharString : public ModelCommand { CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override { - ChipLogProgress(chipTool, "Sending cluster (0x0000050F) ReadAttribute (0x0000801E) on endpoint %u", endpointId); + ChipLogProgress(chipTool, "Sending cluster (0x0000050F) ReadAttribute (0x0000401E) on endpoint %u", endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:endpointId queue:callbackQueue]; @@ -63058,7 +63058,7 @@ class WriteTestClusterNullableCharString : public ModelCommand { CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override { - ChipLogProgress(chipTool, "Sending cluster (0x0000050F) WriteAttribute (0x0000801E) on endpoint %u", endpointId); + ChipLogProgress(chipTool, "Sending cluster (0x0000050F) WriteAttribute (0x0000401E) on endpoint %u", endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:endpointId queue:callbackQueue]; CHIP_ERROR __block chipError = CHIP_NO_ERROR; @@ -63097,7 +63097,7 @@ class SubscribeAttributeTestClusterNullableCharString : public ModelCommand { CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override { - ChipLogProgress(chipTool, "Sending cluster (0x0000050F) ReportAttribute (0x0000801E) on endpoint %u", endpointId); + ChipLogProgress(chipTool, "Sending cluster (0x0000050F) ReportAttribute (0x0000401E) on endpoint %u", endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:endpointId queue:callbackQueue]; CHIPSubscribeParams * params = [[CHIPSubscribeParams alloc] init]; @@ -63143,7 +63143,7 @@ class ReadTestClusterNullableEnumAttr : public ModelCommand { CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override { - ChipLogProgress(chipTool, "Sending cluster (0x0000050F) ReadAttribute (0x00008024) on endpoint %u", endpointId); + ChipLogProgress(chipTool, "Sending cluster (0x0000050F) ReadAttribute (0x00004024) on endpoint %u", endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:endpointId queue:callbackQueue]; @@ -63173,7 +63173,7 @@ class WriteTestClusterNullableEnumAttr : public ModelCommand { CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override { - ChipLogProgress(chipTool, "Sending cluster (0x0000050F) WriteAttribute (0x00008024) on endpoint %u", endpointId); + ChipLogProgress(chipTool, "Sending cluster (0x0000050F) WriteAttribute (0x00004024) on endpoint %u", endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:endpointId queue:callbackQueue]; CHIP_ERROR __block chipError = CHIP_NO_ERROR; @@ -63210,7 +63210,7 @@ class SubscribeAttributeTestClusterNullableEnumAttr : public ModelCommand { CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override { - ChipLogProgress(chipTool, "Sending cluster (0x0000050F) ReportAttribute (0x00008024) on endpoint %u", endpointId); + ChipLogProgress(chipTool, "Sending cluster (0x0000050F) ReportAttribute (0x00004024) on endpoint %u", endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:endpointId queue:callbackQueue]; CHIPSubscribeParams * params = [[CHIPSubscribeParams alloc] init]; @@ -63255,7 +63255,7 @@ class ReadTestClusterNullableStruct : public ModelCommand { CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override { - ChipLogProgress(chipTool, "Sending cluster (0x0000050F) ReadAttribute (0x00008025) on endpoint %u", endpointId); + ChipLogProgress(chipTool, "Sending cluster (0x0000050F) ReadAttribute (0x00004025) on endpoint %u", endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:endpointId queue:callbackQueue]; @@ -63287,7 +63287,7 @@ class WriteTestClusterNullableStruct : public ModelCommand { CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override { - ChipLogProgress(chipTool, "Sending cluster (0x0000050F) WriteAttribute (0x00008025) on endpoint %u", endpointId); + ChipLogProgress(chipTool, "Sending cluster (0x0000050F) WriteAttribute (0x00004025) on endpoint %u", endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:endpointId queue:callbackQueue]; CHIP_ERROR __block chipError = CHIP_NO_ERROR; @@ -63339,7 +63339,7 @@ class SubscribeAttributeTestClusterNullableStruct : public ModelCommand { CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override { - ChipLogProgress(chipTool, "Sending cluster (0x0000050F) ReportAttribute (0x00008025) on endpoint %u", endpointId); + ChipLogProgress(chipTool, "Sending cluster (0x0000050F) ReportAttribute (0x00004025) on endpoint %u", endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:endpointId queue:callbackQueue]; CHIPSubscribeParams * params = [[CHIPSubscribeParams alloc] init]; @@ -63385,7 +63385,7 @@ class ReadTestClusterNullableRangeRestrictedInt8u : public ModelCommand { CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override { - ChipLogProgress(chipTool, "Sending cluster (0x0000050F) ReadAttribute (0x00008026) on endpoint %u", endpointId); + ChipLogProgress(chipTool, "Sending cluster (0x0000050F) ReadAttribute (0x00004026) on endpoint %u", endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:endpointId queue:callbackQueue]; @@ -63416,7 +63416,7 @@ class WriteTestClusterNullableRangeRestrictedInt8u : public ModelCommand { CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override { - ChipLogProgress(chipTool, "Sending cluster (0x0000050F) WriteAttribute (0x00008026) on endpoint %u", endpointId); + ChipLogProgress(chipTool, "Sending cluster (0x0000050F) WriteAttribute (0x00004026) on endpoint %u", endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:endpointId queue:callbackQueue]; CHIP_ERROR __block chipError = CHIP_NO_ERROR; @@ -63453,7 +63453,7 @@ class SubscribeAttributeTestClusterNullableRangeRestrictedInt8u : public ModelCo CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override { - ChipLogProgress(chipTool, "Sending cluster (0x0000050F) ReportAttribute (0x00008026) on endpoint %u", endpointId); + ChipLogProgress(chipTool, "Sending cluster (0x0000050F) ReportAttribute (0x00004026) on endpoint %u", endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:endpointId queue:callbackQueue]; CHIPSubscribeParams * params = [[CHIPSubscribeParams alloc] init]; @@ -63500,7 +63500,7 @@ class ReadTestClusterNullableRangeRestrictedInt8s : public ModelCommand { CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override { - ChipLogProgress(chipTool, "Sending cluster (0x0000050F) ReadAttribute (0x00008027) on endpoint %u", endpointId); + ChipLogProgress(chipTool, "Sending cluster (0x0000050F) ReadAttribute (0x00004027) on endpoint %u", endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:endpointId queue:callbackQueue]; @@ -63531,7 +63531,7 @@ class WriteTestClusterNullableRangeRestrictedInt8s : public ModelCommand { CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override { - ChipLogProgress(chipTool, "Sending cluster (0x0000050F) WriteAttribute (0x00008027) on endpoint %u", endpointId); + ChipLogProgress(chipTool, "Sending cluster (0x0000050F) WriteAttribute (0x00004027) on endpoint %u", endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:endpointId queue:callbackQueue]; CHIP_ERROR __block chipError = CHIP_NO_ERROR; @@ -63568,7 +63568,7 @@ class SubscribeAttributeTestClusterNullableRangeRestrictedInt8s : public ModelCo CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override { - ChipLogProgress(chipTool, "Sending cluster (0x0000050F) ReportAttribute (0x00008027) on endpoint %u", endpointId); + ChipLogProgress(chipTool, "Sending cluster (0x0000050F) ReportAttribute (0x00004027) on endpoint %u", endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:endpointId queue:callbackQueue]; CHIPSubscribeParams * params = [[CHIPSubscribeParams alloc] init]; @@ -63615,7 +63615,7 @@ class ReadTestClusterNullableRangeRestrictedInt16u : public ModelCommand { CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override { - ChipLogProgress(chipTool, "Sending cluster (0x0000050F) ReadAttribute (0x00008028) on endpoint %u", endpointId); + ChipLogProgress(chipTool, "Sending cluster (0x0000050F) ReadAttribute (0x00004028) on endpoint %u", endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:endpointId queue:callbackQueue]; @@ -63646,7 +63646,7 @@ class WriteTestClusterNullableRangeRestrictedInt16u : public ModelCommand { CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override { - ChipLogProgress(chipTool, "Sending cluster (0x0000050F) WriteAttribute (0x00008028) on endpoint %u", endpointId); + ChipLogProgress(chipTool, "Sending cluster (0x0000050F) WriteAttribute (0x00004028) on endpoint %u", endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:endpointId queue:callbackQueue]; CHIP_ERROR __block chipError = CHIP_NO_ERROR; @@ -63684,7 +63684,7 @@ class SubscribeAttributeTestClusterNullableRangeRestrictedInt16u : public ModelC CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override { - ChipLogProgress(chipTool, "Sending cluster (0x0000050F) ReportAttribute (0x00008028) on endpoint %u", endpointId); + ChipLogProgress(chipTool, "Sending cluster (0x0000050F) ReportAttribute (0x00004028) on endpoint %u", endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:endpointId queue:callbackQueue]; CHIPSubscribeParams * params = [[CHIPSubscribeParams alloc] init]; @@ -63732,7 +63732,7 @@ class ReadTestClusterNullableRangeRestrictedInt16s : public ModelCommand { CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override { - ChipLogProgress(chipTool, "Sending cluster (0x0000050F) ReadAttribute (0x00008029) on endpoint %u", endpointId); + ChipLogProgress(chipTool, "Sending cluster (0x0000050F) ReadAttribute (0x00004029) on endpoint %u", endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:endpointId queue:callbackQueue]; @@ -63763,7 +63763,7 @@ class WriteTestClusterNullableRangeRestrictedInt16s : public ModelCommand { CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override { - ChipLogProgress(chipTool, "Sending cluster (0x0000050F) WriteAttribute (0x00008029) on endpoint %u", endpointId); + ChipLogProgress(chipTool, "Sending cluster (0x0000050F) WriteAttribute (0x00004029) on endpoint %u", endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:endpointId queue:callbackQueue]; CHIP_ERROR __block chipError = CHIP_NO_ERROR; @@ -63801,7 +63801,7 @@ class SubscribeAttributeTestClusterNullableRangeRestrictedInt16s : public ModelC CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override { - ChipLogProgress(chipTool, "Sending cluster (0x0000050F) ReportAttribute (0x00008029) on endpoint %u", endpointId); + ChipLogProgress(chipTool, "Sending cluster (0x0000050F) ReportAttribute (0x00004029) on endpoint %u", endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:endpointId queue:callbackQueue]; CHIPSubscribeParams * params = [[CHIPSubscribeParams alloc] init]; diff --git a/zzz_generated/chip-tool/zap-generated/cluster/Commands.h b/zzz_generated/chip-tool/zap-generated/cluster/Commands.h index 998312228b827f..3d764111bbabc6 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/Commands.h +++ b/zzz_generated/chip-tool/zap-generated/cluster/Commands.h @@ -15475,39 +15475,39 @@ class AccountLoginLogout : public ClusterCommand | * GeneralErrorBoolean | 0x0031 | | * ClusterErrorBoolean | 0x0032 | | * Unsupported | 0x00FF | -| * NullableBoolean | 0x8000 | -| * NullableBitmap8 | 0x8001 | -| * NullableBitmap16 | 0x8002 | -| * NullableBitmap32 | 0x8003 | -| * NullableBitmap64 | 0x8004 | -| * NullableInt8u | 0x8005 | -| * NullableInt16u | 0x8006 | -| * NullableInt24u | 0x8007 | -| * NullableInt32u | 0x8008 | -| * NullableInt40u | 0x8009 | -| * NullableInt48u | 0x800A | -| * NullableInt56u | 0x800B | -| * NullableInt64u | 0x800C | -| * NullableInt8s | 0x800D | -| * NullableInt16s | 0x800E | -| * NullableInt24s | 0x800F | -| * NullableInt32s | 0x8010 | -| * NullableInt40s | 0x8011 | -| * NullableInt48s | 0x8012 | -| * NullableInt56s | 0x8013 | -| * NullableInt64s | 0x8014 | -| * NullableEnum8 | 0x8015 | -| * NullableEnum16 | 0x8016 | -| * NullableFloatSingle | 0x8017 | -| * NullableFloatDouble | 0x8018 | -| * NullableOctetString | 0x8019 | -| * NullableCharString | 0x801E | -| * NullableEnumAttr | 0x8024 | -| * NullableStruct | 0x8025 | -| * NullableRangeRestrictedInt8u | 0x8026 | -| * NullableRangeRestrictedInt8s | 0x8027 | -| * NullableRangeRestrictedInt16u | 0x8028 | -| * NullableRangeRestrictedInt16s | 0x8029 | +| * NullableBoolean | 0x4000 | +| * NullableBitmap8 | 0x4001 | +| * NullableBitmap16 | 0x4002 | +| * NullableBitmap32 | 0x4003 | +| * NullableBitmap64 | 0x4004 | +| * NullableInt8u | 0x4005 | +| * NullableInt16u | 0x4006 | +| * NullableInt24u | 0x4007 | +| * NullableInt32u | 0x4008 | +| * NullableInt40u | 0x4009 | +| * NullableInt48u | 0x400A | +| * NullableInt56u | 0x400B | +| * NullableInt64u | 0x400C | +| * NullableInt8s | 0x400D | +| * NullableInt16s | 0x400E | +| * NullableInt24s | 0x400F | +| * NullableInt32s | 0x4010 | +| * NullableInt40s | 0x4011 | +| * NullableInt48s | 0x4012 | +| * NullableInt56s | 0x4013 | +| * NullableInt64s | 0x4014 | +| * NullableEnum8 | 0x4015 | +| * NullableEnum16 | 0x4016 | +| * NullableFloatSingle | 0x4017 | +| * NullableFloatDouble | 0x4018 | +| * NullableOctetString | 0x4019 | +| * NullableCharString | 0x401E | +| * NullableEnumAttr | 0x4024 | +| * NullableStruct | 0x4025 | +| * NullableRangeRestrictedInt8u | 0x4026 | +| * NullableRangeRestrictedInt8s | 0x4027 | +| * NullableRangeRestrictedInt16u | 0x4028 | +| * NullableRangeRestrictedInt16s | 0x4029 | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * AttributeList | 0xFFFB | @@ -17537,12 +17537,12 @@ class WriteTestClusterNullableBoolean : public WriteAttribute CHIP_ERROR SendCommand(ChipDevice * device, std::vector endpointIds) override { - return WriteAttribute::SendCommand(device, endpointIds.at(0), 0x0000050F, 0x00008000, mValue); + return WriteAttribute::SendCommand(device, endpointIds.at(0), 0x0000050F, 0x00004000, mValue); } CHIP_ERROR SendGroupCommand(chip::GroupId groupId, chip::FabricIndex fabricIndex) override { - return WriteAttribute::SendGroupCommand(groupId, fabricIndex, 0x0000050F, 0x00008000, mValue); + return WriteAttribute::SendGroupCommand(groupId, fabricIndex, 0x0000050F, 0x00004000, mValue); } private: @@ -17564,12 +17564,12 @@ class WriteTestClusterNullableBitmap8 : public WriteAttribute CHIP_ERROR SendCommand(ChipDevice * device, std::vector endpointIds) override { - return WriteAttribute::SendCommand(device, endpointIds.at(0), 0x0000050F, 0x00008001, mValue); + return WriteAttribute::SendCommand(device, endpointIds.at(0), 0x0000050F, 0x00004001, mValue); } CHIP_ERROR SendGroupCommand(chip::GroupId groupId, chip::FabricIndex fabricIndex) override { - return WriteAttribute::SendGroupCommand(groupId, fabricIndex, 0x0000050F, 0x00008001, mValue); + return WriteAttribute::SendGroupCommand(groupId, fabricIndex, 0x0000050F, 0x00004001, mValue); } private: @@ -17591,12 +17591,12 @@ class WriteTestClusterNullableBitmap16 : public WriteAttribute CHIP_ERROR SendCommand(ChipDevice * device, std::vector endpointIds) override { - return WriteAttribute::SendCommand(device, endpointIds.at(0), 0x0000050F, 0x00008002, mValue); + return WriteAttribute::SendCommand(device, endpointIds.at(0), 0x0000050F, 0x00004002, mValue); } CHIP_ERROR SendGroupCommand(chip::GroupId groupId, chip::FabricIndex fabricIndex) override { - return WriteAttribute::SendGroupCommand(groupId, fabricIndex, 0x0000050F, 0x00008002, mValue); + return WriteAttribute::SendGroupCommand(groupId, fabricIndex, 0x0000050F, 0x00004002, mValue); } private: @@ -17618,12 +17618,12 @@ class WriteTestClusterNullableBitmap32 : public WriteAttribute CHIP_ERROR SendCommand(ChipDevice * device, std::vector endpointIds) override { - return WriteAttribute::SendCommand(device, endpointIds.at(0), 0x0000050F, 0x00008003, mValue); + return WriteAttribute::SendCommand(device, endpointIds.at(0), 0x0000050F, 0x00004003, mValue); } CHIP_ERROR SendGroupCommand(chip::GroupId groupId, chip::FabricIndex fabricIndex) override { - return WriteAttribute::SendGroupCommand(groupId, fabricIndex, 0x0000050F, 0x00008003, mValue); + return WriteAttribute::SendGroupCommand(groupId, fabricIndex, 0x0000050F, 0x00004003, mValue); } private: @@ -17645,12 +17645,12 @@ class WriteTestClusterNullableBitmap64 : public WriteAttribute CHIP_ERROR SendCommand(ChipDevice * device, std::vector endpointIds) override { - return WriteAttribute::SendCommand(device, endpointIds.at(0), 0x0000050F, 0x00008004, mValue); + return WriteAttribute::SendCommand(device, endpointIds.at(0), 0x0000050F, 0x00004004, mValue); } CHIP_ERROR SendGroupCommand(chip::GroupId groupId, chip::FabricIndex fabricIndex) override { - return WriteAttribute::SendGroupCommand(groupId, fabricIndex, 0x0000050F, 0x00008004, mValue); + return WriteAttribute::SendGroupCommand(groupId, fabricIndex, 0x0000050F, 0x00004004, mValue); } private: @@ -17671,12 +17671,12 @@ class WriteTestClusterNullableInt8u : public WriteAttribute CHIP_ERROR SendCommand(ChipDevice * device, std::vector endpointIds) override { - return WriteAttribute::SendCommand(device, endpointIds.at(0), 0x0000050F, 0x00008005, mValue); + return WriteAttribute::SendCommand(device, endpointIds.at(0), 0x0000050F, 0x00004005, mValue); } CHIP_ERROR SendGroupCommand(chip::GroupId groupId, chip::FabricIndex fabricIndex) override { - return WriteAttribute::SendGroupCommand(groupId, fabricIndex, 0x0000050F, 0x00008005, mValue); + return WriteAttribute::SendGroupCommand(groupId, fabricIndex, 0x0000050F, 0x00004005, mValue); } private: @@ -17698,12 +17698,12 @@ class WriteTestClusterNullableInt16u : public WriteAttribute CHIP_ERROR SendCommand(ChipDevice * device, std::vector endpointIds) override { - return WriteAttribute::SendCommand(device, endpointIds.at(0), 0x0000050F, 0x00008006, mValue); + return WriteAttribute::SendCommand(device, endpointIds.at(0), 0x0000050F, 0x00004006, mValue); } CHIP_ERROR SendGroupCommand(chip::GroupId groupId, chip::FabricIndex fabricIndex) override { - return WriteAttribute::SendGroupCommand(groupId, fabricIndex, 0x0000050F, 0x00008006, mValue); + return WriteAttribute::SendGroupCommand(groupId, fabricIndex, 0x0000050F, 0x00004006, mValue); } private: @@ -17725,12 +17725,12 @@ class WriteTestClusterNullableInt24u : public WriteAttribute CHIP_ERROR SendCommand(ChipDevice * device, std::vector endpointIds) override { - return WriteAttribute::SendCommand(device, endpointIds.at(0), 0x0000050F, 0x00008007, mValue); + return WriteAttribute::SendCommand(device, endpointIds.at(0), 0x0000050F, 0x00004007, mValue); } CHIP_ERROR SendGroupCommand(chip::GroupId groupId, chip::FabricIndex fabricIndex) override { - return WriteAttribute::SendGroupCommand(groupId, fabricIndex, 0x0000050F, 0x00008007, mValue); + return WriteAttribute::SendGroupCommand(groupId, fabricIndex, 0x0000050F, 0x00004007, mValue); } private: @@ -17752,12 +17752,12 @@ class WriteTestClusterNullableInt32u : public WriteAttribute CHIP_ERROR SendCommand(ChipDevice * device, std::vector endpointIds) override { - return WriteAttribute::SendCommand(device, endpointIds.at(0), 0x0000050F, 0x00008008, mValue); + return WriteAttribute::SendCommand(device, endpointIds.at(0), 0x0000050F, 0x00004008, mValue); } CHIP_ERROR SendGroupCommand(chip::GroupId groupId, chip::FabricIndex fabricIndex) override { - return WriteAttribute::SendGroupCommand(groupId, fabricIndex, 0x0000050F, 0x00008008, mValue); + return WriteAttribute::SendGroupCommand(groupId, fabricIndex, 0x0000050F, 0x00004008, mValue); } private: @@ -17779,12 +17779,12 @@ class WriteTestClusterNullableInt40u : public WriteAttribute CHIP_ERROR SendCommand(ChipDevice * device, std::vector endpointIds) override { - return WriteAttribute::SendCommand(device, endpointIds.at(0), 0x0000050F, 0x00008009, mValue); + return WriteAttribute::SendCommand(device, endpointIds.at(0), 0x0000050F, 0x00004009, mValue); } CHIP_ERROR SendGroupCommand(chip::GroupId groupId, chip::FabricIndex fabricIndex) override { - return WriteAttribute::SendGroupCommand(groupId, fabricIndex, 0x0000050F, 0x00008009, mValue); + return WriteAttribute::SendGroupCommand(groupId, fabricIndex, 0x0000050F, 0x00004009, mValue); } private: @@ -17806,12 +17806,12 @@ class WriteTestClusterNullableInt48u : public WriteAttribute CHIP_ERROR SendCommand(ChipDevice * device, std::vector endpointIds) override { - return WriteAttribute::SendCommand(device, endpointIds.at(0), 0x0000050F, 0x0000800A, mValue); + return WriteAttribute::SendCommand(device, endpointIds.at(0), 0x0000050F, 0x0000400A, mValue); } CHIP_ERROR SendGroupCommand(chip::GroupId groupId, chip::FabricIndex fabricIndex) override { - return WriteAttribute::SendGroupCommand(groupId, fabricIndex, 0x0000050F, 0x0000800A, mValue); + return WriteAttribute::SendGroupCommand(groupId, fabricIndex, 0x0000050F, 0x0000400A, mValue); } private: @@ -17833,12 +17833,12 @@ class WriteTestClusterNullableInt56u : public WriteAttribute CHIP_ERROR SendCommand(ChipDevice * device, std::vector endpointIds) override { - return WriteAttribute::SendCommand(device, endpointIds.at(0), 0x0000050F, 0x0000800B, mValue); + return WriteAttribute::SendCommand(device, endpointIds.at(0), 0x0000050F, 0x0000400B, mValue); } CHIP_ERROR SendGroupCommand(chip::GroupId groupId, chip::FabricIndex fabricIndex) override { - return WriteAttribute::SendGroupCommand(groupId, fabricIndex, 0x0000050F, 0x0000800B, mValue); + return WriteAttribute::SendGroupCommand(groupId, fabricIndex, 0x0000050F, 0x0000400B, mValue); } private: @@ -17860,12 +17860,12 @@ class WriteTestClusterNullableInt64u : public WriteAttribute CHIP_ERROR SendCommand(ChipDevice * device, std::vector endpointIds) override { - return WriteAttribute::SendCommand(device, endpointIds.at(0), 0x0000050F, 0x0000800C, mValue); + return WriteAttribute::SendCommand(device, endpointIds.at(0), 0x0000050F, 0x0000400C, mValue); } CHIP_ERROR SendGroupCommand(chip::GroupId groupId, chip::FabricIndex fabricIndex) override { - return WriteAttribute::SendGroupCommand(groupId, fabricIndex, 0x0000050F, 0x0000800C, mValue); + return WriteAttribute::SendGroupCommand(groupId, fabricIndex, 0x0000050F, 0x0000400C, mValue); } private: @@ -17886,12 +17886,12 @@ class WriteTestClusterNullableInt8s : public WriteAttribute CHIP_ERROR SendCommand(ChipDevice * device, std::vector endpointIds) override { - return WriteAttribute::SendCommand(device, endpointIds.at(0), 0x0000050F, 0x0000800D, mValue); + return WriteAttribute::SendCommand(device, endpointIds.at(0), 0x0000050F, 0x0000400D, mValue); } CHIP_ERROR SendGroupCommand(chip::GroupId groupId, chip::FabricIndex fabricIndex) override { - return WriteAttribute::SendGroupCommand(groupId, fabricIndex, 0x0000050F, 0x0000800D, mValue); + return WriteAttribute::SendGroupCommand(groupId, fabricIndex, 0x0000050F, 0x0000400D, mValue); } private: @@ -17913,12 +17913,12 @@ class WriteTestClusterNullableInt16s : public WriteAttribute CHIP_ERROR SendCommand(ChipDevice * device, std::vector endpointIds) override { - return WriteAttribute::SendCommand(device, endpointIds.at(0), 0x0000050F, 0x0000800E, mValue); + return WriteAttribute::SendCommand(device, endpointIds.at(0), 0x0000050F, 0x0000400E, mValue); } CHIP_ERROR SendGroupCommand(chip::GroupId groupId, chip::FabricIndex fabricIndex) override { - return WriteAttribute::SendGroupCommand(groupId, fabricIndex, 0x0000050F, 0x0000800E, mValue); + return WriteAttribute::SendGroupCommand(groupId, fabricIndex, 0x0000050F, 0x0000400E, mValue); } private: @@ -17940,12 +17940,12 @@ class WriteTestClusterNullableInt24s : public WriteAttribute CHIP_ERROR SendCommand(ChipDevice * device, std::vector endpointIds) override { - return WriteAttribute::SendCommand(device, endpointIds.at(0), 0x0000050F, 0x0000800F, mValue); + return WriteAttribute::SendCommand(device, endpointIds.at(0), 0x0000050F, 0x0000400F, mValue); } CHIP_ERROR SendGroupCommand(chip::GroupId groupId, chip::FabricIndex fabricIndex) override { - return WriteAttribute::SendGroupCommand(groupId, fabricIndex, 0x0000050F, 0x0000800F, mValue); + return WriteAttribute::SendGroupCommand(groupId, fabricIndex, 0x0000050F, 0x0000400F, mValue); } private: @@ -17967,12 +17967,12 @@ class WriteTestClusterNullableInt32s : public WriteAttribute CHIP_ERROR SendCommand(ChipDevice * device, std::vector endpointIds) override { - return WriteAttribute::SendCommand(device, endpointIds.at(0), 0x0000050F, 0x00008010, mValue); + return WriteAttribute::SendCommand(device, endpointIds.at(0), 0x0000050F, 0x00004010, mValue); } CHIP_ERROR SendGroupCommand(chip::GroupId groupId, chip::FabricIndex fabricIndex) override { - return WriteAttribute::SendGroupCommand(groupId, fabricIndex, 0x0000050F, 0x00008010, mValue); + return WriteAttribute::SendGroupCommand(groupId, fabricIndex, 0x0000050F, 0x00004010, mValue); } private: @@ -17994,12 +17994,12 @@ class WriteTestClusterNullableInt40s : public WriteAttribute CHIP_ERROR SendCommand(ChipDevice * device, std::vector endpointIds) override { - return WriteAttribute::SendCommand(device, endpointIds.at(0), 0x0000050F, 0x00008011, mValue); + return WriteAttribute::SendCommand(device, endpointIds.at(0), 0x0000050F, 0x00004011, mValue); } CHIP_ERROR SendGroupCommand(chip::GroupId groupId, chip::FabricIndex fabricIndex) override { - return WriteAttribute::SendGroupCommand(groupId, fabricIndex, 0x0000050F, 0x00008011, mValue); + return WriteAttribute::SendGroupCommand(groupId, fabricIndex, 0x0000050F, 0x00004011, mValue); } private: @@ -18021,12 +18021,12 @@ class WriteTestClusterNullableInt48s : public WriteAttribute CHIP_ERROR SendCommand(ChipDevice * device, std::vector endpointIds) override { - return WriteAttribute::SendCommand(device, endpointIds.at(0), 0x0000050F, 0x00008012, mValue); + return WriteAttribute::SendCommand(device, endpointIds.at(0), 0x0000050F, 0x00004012, mValue); } CHIP_ERROR SendGroupCommand(chip::GroupId groupId, chip::FabricIndex fabricIndex) override { - return WriteAttribute::SendGroupCommand(groupId, fabricIndex, 0x0000050F, 0x00008012, mValue); + return WriteAttribute::SendGroupCommand(groupId, fabricIndex, 0x0000050F, 0x00004012, mValue); } private: @@ -18048,12 +18048,12 @@ class WriteTestClusterNullableInt56s : public WriteAttribute CHIP_ERROR SendCommand(ChipDevice * device, std::vector endpointIds) override { - return WriteAttribute::SendCommand(device, endpointIds.at(0), 0x0000050F, 0x00008013, mValue); + return WriteAttribute::SendCommand(device, endpointIds.at(0), 0x0000050F, 0x00004013, mValue); } CHIP_ERROR SendGroupCommand(chip::GroupId groupId, chip::FabricIndex fabricIndex) override { - return WriteAttribute::SendGroupCommand(groupId, fabricIndex, 0x0000050F, 0x00008013, mValue); + return WriteAttribute::SendGroupCommand(groupId, fabricIndex, 0x0000050F, 0x00004013, mValue); } private: @@ -18075,12 +18075,12 @@ class WriteTestClusterNullableInt64s : public WriteAttribute CHIP_ERROR SendCommand(ChipDevice * device, std::vector endpointIds) override { - return WriteAttribute::SendCommand(device, endpointIds.at(0), 0x0000050F, 0x00008014, mValue); + return WriteAttribute::SendCommand(device, endpointIds.at(0), 0x0000050F, 0x00004014, mValue); } CHIP_ERROR SendGroupCommand(chip::GroupId groupId, chip::FabricIndex fabricIndex) override { - return WriteAttribute::SendGroupCommand(groupId, fabricIndex, 0x0000050F, 0x00008014, mValue); + return WriteAttribute::SendGroupCommand(groupId, fabricIndex, 0x0000050F, 0x00004014, mValue); } private: @@ -18101,12 +18101,12 @@ class WriteTestClusterNullableEnum8 : public WriteAttribute CHIP_ERROR SendCommand(ChipDevice * device, std::vector endpointIds) override { - return WriteAttribute::SendCommand(device, endpointIds.at(0), 0x0000050F, 0x00008015, mValue); + return WriteAttribute::SendCommand(device, endpointIds.at(0), 0x0000050F, 0x00004015, mValue); } CHIP_ERROR SendGroupCommand(chip::GroupId groupId, chip::FabricIndex fabricIndex) override { - return WriteAttribute::SendGroupCommand(groupId, fabricIndex, 0x0000050F, 0x00008015, mValue); + return WriteAttribute::SendGroupCommand(groupId, fabricIndex, 0x0000050F, 0x00004015, mValue); } private: @@ -18128,12 +18128,12 @@ class WriteTestClusterNullableEnum16 : public WriteAttribute CHIP_ERROR SendCommand(ChipDevice * device, std::vector endpointIds) override { - return WriteAttribute::SendCommand(device, endpointIds.at(0), 0x0000050F, 0x00008016, mValue); + return WriteAttribute::SendCommand(device, endpointIds.at(0), 0x0000050F, 0x00004016, mValue); } CHIP_ERROR SendGroupCommand(chip::GroupId groupId, chip::FabricIndex fabricIndex) override { - return WriteAttribute::SendGroupCommand(groupId, fabricIndex, 0x0000050F, 0x00008016, mValue); + return WriteAttribute::SendGroupCommand(groupId, fabricIndex, 0x0000050F, 0x00004016, mValue); } private: @@ -18155,12 +18155,12 @@ class WriteTestClusterNullableFloatSingle : public WriteAttribute CHIP_ERROR SendCommand(ChipDevice * device, std::vector endpointIds) override { - return WriteAttribute::SendCommand(device, endpointIds.at(0), 0x0000050F, 0x00008017, mValue); + return WriteAttribute::SendCommand(device, endpointIds.at(0), 0x0000050F, 0x00004017, mValue); } CHIP_ERROR SendGroupCommand(chip::GroupId groupId, chip::FabricIndex fabricIndex) override { - return WriteAttribute::SendGroupCommand(groupId, fabricIndex, 0x0000050F, 0x00008017, mValue); + return WriteAttribute::SendGroupCommand(groupId, fabricIndex, 0x0000050F, 0x00004017, mValue); } private: @@ -18182,12 +18182,12 @@ class WriteTestClusterNullableFloatDouble : public WriteAttribute CHIP_ERROR SendCommand(ChipDevice * device, std::vector endpointIds) override { - return WriteAttribute::SendCommand(device, endpointIds.at(0), 0x0000050F, 0x00008018, mValue); + return WriteAttribute::SendCommand(device, endpointIds.at(0), 0x0000050F, 0x00004018, mValue); } CHIP_ERROR SendGroupCommand(chip::GroupId groupId, chip::FabricIndex fabricIndex) override { - return WriteAttribute::SendGroupCommand(groupId, fabricIndex, 0x0000050F, 0x00008018, mValue); + return WriteAttribute::SendGroupCommand(groupId, fabricIndex, 0x0000050F, 0x00004018, mValue); } private: @@ -18209,12 +18209,12 @@ class WriteTestClusterNullableOctetString : public WriteAttribute CHIP_ERROR SendCommand(ChipDevice * device, std::vector endpointIds) override { - return WriteAttribute::SendCommand(device, endpointIds.at(0), 0x0000050F, 0x00008019, mValue); + return WriteAttribute::SendCommand(device, endpointIds.at(0), 0x0000050F, 0x00004019, mValue); } CHIP_ERROR SendGroupCommand(chip::GroupId groupId, chip::FabricIndex fabricIndex) override { - return WriteAttribute::SendGroupCommand(groupId, fabricIndex, 0x0000050F, 0x00008019, mValue); + return WriteAttribute::SendGroupCommand(groupId, fabricIndex, 0x0000050F, 0x00004019, mValue); } private: @@ -18236,12 +18236,12 @@ class WriteTestClusterNullableCharString : public WriteAttribute CHIP_ERROR SendCommand(ChipDevice * device, std::vector endpointIds) override { - return WriteAttribute::SendCommand(device, endpointIds.at(0), 0x0000050F, 0x0000801E, mValue); + return WriteAttribute::SendCommand(device, endpointIds.at(0), 0x0000050F, 0x0000401E, mValue); } CHIP_ERROR SendGroupCommand(chip::GroupId groupId, chip::FabricIndex fabricIndex) override { - return WriteAttribute::SendGroupCommand(groupId, fabricIndex, 0x0000050F, 0x0000801E, mValue); + return WriteAttribute::SendGroupCommand(groupId, fabricIndex, 0x0000050F, 0x0000401E, mValue); } private: @@ -18263,12 +18263,12 @@ class WriteTestClusterNullableEnumAttr : public WriteAttribute CHIP_ERROR SendCommand(ChipDevice * device, std::vector endpointIds) override { - return WriteAttribute::SendCommand(device, endpointIds.at(0), 0x0000050F, 0x00008024, mValue); + return WriteAttribute::SendCommand(device, endpointIds.at(0), 0x0000050F, 0x00004024, mValue); } CHIP_ERROR SendGroupCommand(chip::GroupId groupId, chip::FabricIndex fabricIndex) override { - return WriteAttribute::SendGroupCommand(groupId, fabricIndex, 0x0000050F, 0x00008024, mValue); + return WriteAttribute::SendGroupCommand(groupId, fabricIndex, 0x0000050F, 0x00004024, mValue); } private: @@ -18290,12 +18290,12 @@ class WriteTestClusterNullableStruct : public WriteAttribute CHIP_ERROR SendCommand(ChipDevice * device, std::vector endpointIds) override { - return WriteAttribute::SendCommand(device, endpointIds.at(0), 0x0000050F, 0x00008025, mValue); + return WriteAttribute::SendCommand(device, endpointIds.at(0), 0x0000050F, 0x00004025, mValue); } CHIP_ERROR SendGroupCommand(chip::GroupId groupId, chip::FabricIndex fabricIndex) override { - return WriteAttribute::SendGroupCommand(groupId, fabricIndex, 0x0000050F, 0x00008025, mValue); + return WriteAttribute::SendGroupCommand(groupId, fabricIndex, 0x0000050F, 0x00004025, mValue); } private: @@ -18318,12 +18318,12 @@ class WriteTestClusterNullableRangeRestrictedInt8u : public WriteAttribute CHIP_ERROR SendCommand(ChipDevice * device, std::vector endpointIds) override { - return WriteAttribute::SendCommand(device, endpointIds.at(0), 0x0000050F, 0x00008026, mValue); + return WriteAttribute::SendCommand(device, endpointIds.at(0), 0x0000050F, 0x00004026, mValue); } CHIP_ERROR SendGroupCommand(chip::GroupId groupId, chip::FabricIndex fabricIndex) override { - return WriteAttribute::SendGroupCommand(groupId, fabricIndex, 0x0000050F, 0x00008026, mValue); + return WriteAttribute::SendGroupCommand(groupId, fabricIndex, 0x0000050F, 0x00004026, mValue); } private: @@ -18345,12 +18345,12 @@ class WriteTestClusterNullableRangeRestrictedInt8s : public WriteAttribute CHIP_ERROR SendCommand(ChipDevice * device, std::vector endpointIds) override { - return WriteAttribute::SendCommand(device, endpointIds.at(0), 0x0000050F, 0x00008027, mValue); + return WriteAttribute::SendCommand(device, endpointIds.at(0), 0x0000050F, 0x00004027, mValue); } CHIP_ERROR SendGroupCommand(chip::GroupId groupId, chip::FabricIndex fabricIndex) override { - return WriteAttribute::SendGroupCommand(groupId, fabricIndex, 0x0000050F, 0x00008027, mValue); + return WriteAttribute::SendGroupCommand(groupId, fabricIndex, 0x0000050F, 0x00004027, mValue); } private: @@ -18372,12 +18372,12 @@ class WriteTestClusterNullableRangeRestrictedInt16u : public WriteAttribute CHIP_ERROR SendCommand(ChipDevice * device, std::vector endpointIds) override { - return WriteAttribute::SendCommand(device, endpointIds.at(0), 0x0000050F, 0x00008028, mValue); + return WriteAttribute::SendCommand(device, endpointIds.at(0), 0x0000050F, 0x00004028, mValue); } CHIP_ERROR SendGroupCommand(chip::GroupId groupId, chip::FabricIndex fabricIndex) override { - return WriteAttribute::SendGroupCommand(groupId, fabricIndex, 0x0000050F, 0x00008028, mValue); + return WriteAttribute::SendGroupCommand(groupId, fabricIndex, 0x0000050F, 0x00004028, mValue); } private: @@ -18399,12 +18399,12 @@ class WriteTestClusterNullableRangeRestrictedInt16s : public WriteAttribute CHIP_ERROR SendCommand(ChipDevice * device, std::vector endpointIds) override { - return WriteAttribute::SendCommand(device, endpointIds.at(0), 0x0000050F, 0x00008029, mValue); + return WriteAttribute::SendCommand(device, endpointIds.at(0), 0x0000050F, 0x00004029, mValue); } CHIP_ERROR SendGroupCommand(chip::GroupId groupId, chip::FabricIndex fabricIndex) override { - return WriteAttribute::SendGroupCommand(groupId, fabricIndex, 0x0000050F, 0x00008029, mValue); + return WriteAttribute::SendGroupCommand(groupId, fabricIndex, 0x0000050F, 0x00004029, mValue); } private: From 71481114b92b2f0e8dc887c4815660fe239458df Mon Sep 17 00:00:00 2001 From: Michael Spang Date: Tue, 26 Apr 2022 03:13:54 -0400 Subject: [PATCH 21/25] Allow size optimization in "debug" builds (#17708) Some platforms have forced release builds because otherwise they don't fit in flash. Currently assertions and optimization level are coupled into a single is_debug argument. Decouple these in the hope that it enables at least some of these platforms to develop with debug asserts enabled. --- build/config/compiler/BUILD.gn | 7 ++++++- build/config/compiler/compiler.gni | 3 +++ config/qpg/chip-gn/args.gni | 4 +++- examples/all-clusters-app/cc13x2x7_26x2x7/args.gni | 5 +++-- examples/lighting-app/qpg/src/AppTask.cpp | 7 +++---- examples/lock-app/cc13x2x7_26x2x7/args.gni | 3 ++- .../persistent-storage/cc13x2x7_26x2x7/args.gni | 3 ++- examples/persistent-storage/qpg/args.gni | 2 ++ examples/persistent-storage/qpg/main.cpp | 2 -- examples/pump-app/cc13x2x7_26x2x7/args.gni | 3 ++- .../pump-controller-app/cc13x2x7_26x2x7/args.gni | 3 ++- src/lwip/BUILD.gn | 2 +- src/platform/CYW30739/args.gni | 3 ++- .../cc13x2_26x2/ConfigurationManagerImpl.cpp | 1 - src/platform/cc13x2_26x2/OTAImageProcessorImpl.cpp | 14 -------------- src/platform/qpg/args.gni | 3 ++- 16 files changed, 33 insertions(+), 32 deletions(-) diff --git a/build/config/compiler/BUILD.gn b/build/config/compiler/BUILD.gn index 8e868beb244a2c..5826917e924c9d 100644 --- a/build/config/compiler/BUILD.gn +++ b/build/config/compiler/BUILD.gn @@ -174,10 +174,15 @@ config("optimize_zero") { ldflags = cflags } +config("optimize_debug") { + cflags = [ "-O${optimize_debug_level}" ] + ldflags = cflags +} + config("optimize_default") { if (is_debug) { if (optimize_debug) { - configs = [ "$dir_pw_build:optimize_debugging" ] + configs = [ ":optimize_debug" ] } else { configs = [ ":optimize_zero" ] } diff --git a/build/config/compiler/compiler.gni b/build/config/compiler/compiler.gni index f5b6414eca8ee4..6e9f0d30aadd5d 100644 --- a/build/config/compiler/compiler.gni +++ b/build/config/compiler/compiler.gni @@ -23,6 +23,9 @@ declare_args() { optimize_debug = current_os == "freertos" || current_os == "zephyr" || current_os == "mbed" + # Optimization level for debug. Only has an effect if optimize_debug is true. + optimize_debug_level = "g" + # Symbol level for debugging. symbol_level = 2 diff --git a/config/qpg/chip-gn/args.gni b/config/qpg/chip-gn/args.gni index 8b6c776dd3e408..346a1d2cb3254e 100644 --- a/config/qpg/chip-gn/args.gni +++ b/config/qpg/chip-gn/args.gni @@ -18,7 +18,9 @@ qpg_sdk_target = get_label_info(":sdk", "label_no_toolchain") chip_device_platform = "qpg" -is_debug = false +optimize_debug_level = "s" +lwip_debug = false + chip_enable_openthread = true chip_config_network_layer_ble = true chip_inet_config_enable_ipv4 = false diff --git a/examples/all-clusters-app/cc13x2x7_26x2x7/args.gni b/examples/all-clusters-app/cc13x2x7_26x2x7/args.gni index 3e93cef8d30ef7..abd9bc37d56644 100644 --- a/examples/all-clusters-app/cc13x2x7_26x2x7/args.gni +++ b/examples/all-clusters-app/cc13x2x7_26x2x7/args.gni @@ -23,7 +23,8 @@ ti_simplelink_board = "LP_CC2652R7" # Size Optimizations # use -Os instead of -Og, LWIP release build -is_debug = false +optimize_debug_level = "s" +lwip_debug = false #optimize_for_size=true chip_enable_ota_requestor = true @@ -32,7 +33,7 @@ chip_enable_ota_requestor = true chip_openthread_ftd = false # Disable CHIP Logging -#chip_progress_logging = false +chip_progress_logging = false # Dsiable verbose logs for all-clusters app to save Flash chip_detail_logging = false diff --git a/examples/lighting-app/qpg/src/AppTask.cpp b/examples/lighting-app/qpg/src/AppTask.cpp index ee522c997f7ef4..53fc9639e3a643 100644 --- a/examples/lighting-app/qpg/src/AppTask.cpp +++ b/examples/lighting-app/qpg/src/AppTask.cpp @@ -54,10 +54,9 @@ namespace { TaskHandle_t sAppTaskHandle; QueueHandle_t sAppEventQueue; -bool sIsThreadProvisioned = false; -bool sIsThreadEnabled = false; -bool sHaveBLEConnections = false; -bool sHaveServiceConnectivity = false; +bool sIsThreadProvisioned = false; +bool sIsThreadEnabled = false; +bool sHaveBLEConnections = false; uint8_t sAppEventQueueBuffer[APP_EVENT_QUEUE_SIZE * sizeof(AppEvent)]; diff --git a/examples/lock-app/cc13x2x7_26x2x7/args.gni b/examples/lock-app/cc13x2x7_26x2x7/args.gni index 2b1db21d690d61..ebb3a78797278f 100644 --- a/examples/lock-app/cc13x2x7_26x2x7/args.gni +++ b/examples/lock-app/cc13x2x7_26x2x7/args.gni @@ -23,7 +23,8 @@ ti_simplelink_board = "LP_CC2652R7" # Size Optimizations # use -Os instead of -Og, LWIP release build -is_debug = false +optimize_debug_level = "s" +lwip_debug = false chip_enable_ota_requestor = true diff --git a/examples/persistent-storage/cc13x2x7_26x2x7/args.gni b/examples/persistent-storage/cc13x2x7_26x2x7/args.gni index 86ad077d6f40f3..c35354a5f43732 100644 --- a/examples/persistent-storage/cc13x2x7_26x2x7/args.gni +++ b/examples/persistent-storage/cc13x2x7_26x2x7/args.gni @@ -22,7 +22,8 @@ ti_simplelink_sysconfig_target = ti_simplelink_board = "LP_CC2652R7" # use -Os instead of -Og -#is_debug = false +#optimize_debug_level = "s" +#lwip_debug = false # BLE options chip_config_network_layer_ble = true diff --git a/examples/persistent-storage/qpg/args.gni b/examples/persistent-storage/qpg/args.gni index 20c6596a6a866b..c798cd33d785fa 100644 --- a/examples/persistent-storage/qpg/args.gni +++ b/examples/persistent-storage/qpg/args.gni @@ -21,6 +21,8 @@ chip_openthread_ftd = false chip_system_config_use_open_thread_inet_endpoints = false chip_with_lwip = true +lwip_debug = false + declare_args() { # Disable lock tracking, since our FreeRTOS configuration does not set # INCLUDE_xSemaphoreGetMutexHolder diff --git a/examples/persistent-storage/qpg/main.cpp b/examples/persistent-storage/qpg/main.cpp index ee318821fb06be..b53692e19e448b 100644 --- a/examples/persistent-storage/qpg/main.cpp +++ b/examples/persistent-storage/qpg/main.cpp @@ -34,8 +34,6 @@ #define LOG_MODULE_ID 1 -static TaskHandle_t sTestTaskHandle; - StackType_t appStack[APP_TASK_STACK_SIZE / sizeof(StackType_t)]; StaticTask_t appTaskStruct; diff --git a/examples/pump-app/cc13x2x7_26x2x7/args.gni b/examples/pump-app/cc13x2x7_26x2x7/args.gni index cbf1d65f3ef7bb..c2a8875510a80e 100644 --- a/examples/pump-app/cc13x2x7_26x2x7/args.gni +++ b/examples/pump-app/cc13x2x7_26x2x7/args.gni @@ -23,7 +23,8 @@ ti_simplelink_board = "LP_CC2652R7" # Size Optimizations # use -Os instead of -Og, LWIP release build -is_debug = false +optimize_debug_level = "s" +lwip_debug = false chip_enable_ota_requestor = true diff --git a/examples/pump-controller-app/cc13x2x7_26x2x7/args.gni b/examples/pump-controller-app/cc13x2x7_26x2x7/args.gni index 2b1db21d690d61..ebb3a78797278f 100644 --- a/examples/pump-controller-app/cc13x2x7_26x2x7/args.gni +++ b/examples/pump-controller-app/cc13x2x7_26x2x7/args.gni @@ -23,7 +23,8 @@ ti_simplelink_board = "LP_CC2652R7" # Size Optimizations # use -Os instead of -Og, LWIP release build -is_debug = false +optimize_debug_level = "s" +lwip_debug = false chip_enable_ota_requestor = true diff --git a/src/lwip/BUILD.gn b/src/lwip/BUILD.gn index 3cc14c4ee08e56..2708e1658efad6 100644 --- a/src/lwip/BUILD.gn +++ b/src/lwip/BUILD.gn @@ -65,7 +65,7 @@ buildconfig_header("lwip_buildconfig") { defines = [ "HAVE_LWIP_UDP_BIND_NETIF=1" ] if (lwip_platform != "external") { - if (is_debug) { + if (lwip_debug) { # Automatically enable LWIP_DEBUG for internal is_debug builds. defines += [ "LWIP_DEBUG=1" ] } diff --git a/src/platform/CYW30739/args.gni b/src/platform/CYW30739/args.gni index 43f6ec41ac2fc4..474c15b41b7f5e 100644 --- a/src/platform/CYW30739/args.gni +++ b/src/platform/CYW30739/args.gni @@ -44,7 +44,8 @@ chip_system_config_locking = "none" chip_system_config_use_lwip = true chip_system_config_use_sockets = false -is_debug = false +optimize_debug_level = "s" +lwip_debug = false default_configs_optimize = [ "$dir_pw_build:optimize_size" ] chip_build_tests = false diff --git a/src/platform/cc13x2_26x2/ConfigurationManagerImpl.cpp b/src/platform/cc13x2_26x2/ConfigurationManagerImpl.cpp index 9ac4b3c683801c..15a00a54aa1ca7 100644 --- a/src/platform/cc13x2_26x2/ConfigurationManagerImpl.cpp +++ b/src/platform/cc13x2_26x2/ConfigurationManagerImpl.cpp @@ -67,7 +67,6 @@ CHIP_ERROR ConfigurationManagerImpl::Init() // Initialize the generic implementation base class. err = Internal::GenericConfigurationManagerImpl::Init(); -exit: return err; } diff --git a/src/platform/cc13x2_26x2/OTAImageProcessorImpl.cpp b/src/platform/cc13x2_26x2/OTAImageProcessorImpl.cpp index d13b8b618f73fe..65b336473d1328 100644 --- a/src/platform/cc13x2_26x2/OTAImageProcessorImpl.cpp +++ b/src/platform/cc13x2_26x2/OTAImageProcessorImpl.cpp @@ -99,20 +99,6 @@ static bool readExtFlashImgHeader(NVS_Handle handle, imgFixedHdr_t * header) return (status == NVS_STATUS_SUCCESS); } -static bool eraseExtFlashHeader(NVS_Handle handle) -{ - int_fast16_t status; - NVS_Attrs regionAttrs; - unsigned int sectors; - - NVS_getAttrs(handle, ®ionAttrs); - /* calculate the number of sectors to erase */ - sectors = (sizeof(imgFixedHdr_t) + (regionAttrs.sectorSize - 1)) / regionAttrs.sectorSize; - status = NVS_erase(handle, IMG_START, sectors * regionAttrs.sectorSize); - - return (status == NVS_STATUS_SUCCESS); -} - /* makes room for the new block if needed */ static bool writeExtFlashImgPages(NVS_Handle handle, size_t bytesWritten, MutableByteSpan block) { diff --git a/src/platform/qpg/args.gni b/src/platform/qpg/args.gni index 8507378717ff81..4bdd6ff4e1c3dd 100644 --- a/src/platform/qpg/args.gni +++ b/src/platform/qpg/args.gni @@ -35,7 +35,8 @@ chip_detail_logging = false chip_automation_logging = false # Use -Os -is_debug = false +optimize_debug_level = "s" +lwip_debug = false chip_build_tests = false From 55e64dd03c115d3753c8b4542868315ed19263d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damian=20Kr=C3=B3lik?= <66667989+Damian-Nordic@users.noreply.github.com> Date: Tue, 26 Apr 2022 14:58:38 +0200 Subject: [PATCH 22/25] [nrfconnect] Set Thread device type to router instead of FED (#17736) --- examples/chef/nrfconnect/main.cpp | 2 +- examples/light-switch-app/nrfconnect/main/AppTask.cpp | 2 +- examples/lighting-app/nrfconnect/main/AppTask.cpp | 2 +- examples/lock-app/nrfconnect/main/AppTask.cpp | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/chef/nrfconnect/main.cpp b/examples/chef/nrfconnect/main.cpp index cd3c4ce3066f4e..669ef9663a00ef 100644 --- a/examples/chef/nrfconnect/main.cpp +++ b/examples/chef/nrfconnect/main.cpp @@ -73,7 +73,7 @@ CHIP_ERROR main() #ifdef CONFIG_OPENTHREAD_MTD err = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_MinimalEndDevice); #else - err = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_FullEndDevice); + err = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_Router); #endif if (err != CHIP_NO_ERROR) { diff --git a/examples/light-switch-app/nrfconnect/main/AppTask.cpp b/examples/light-switch-app/nrfconnect/main/AppTask.cpp index f1d7d8b0064f38..06bb078a446e4d 100644 --- a/examples/light-switch-app/nrfconnect/main/AppTask.cpp +++ b/examples/light-switch-app/nrfconnect/main/AppTask.cpp @@ -115,7 +115,7 @@ CHIP_ERROR AppTask::Init() #elif CONFIG_OPENTHREAD_MTD err = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_MinimalEndDevice); #else - err = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_FullEndDevice); + err = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_Router); #endif if (err != CHIP_NO_ERROR) { diff --git a/examples/lighting-app/nrfconnect/main/AppTask.cpp b/examples/lighting-app/nrfconnect/main/AppTask.cpp index db687f1a4247ad..c6d6add3700301 100644 --- a/examples/lighting-app/nrfconnect/main/AppTask.cpp +++ b/examples/lighting-app/nrfconnect/main/AppTask.cpp @@ -114,7 +114,7 @@ CHIP_ERROR AppTask::Init() #ifdef CONFIG_OPENTHREAD_MTD err = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_MinimalEndDevice); #else - err = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_FullEndDevice); + err = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_Router); #endif if (err != CHIP_NO_ERROR) { diff --git a/examples/lock-app/nrfconnect/main/AppTask.cpp b/examples/lock-app/nrfconnect/main/AppTask.cpp index 4c26d4e339bbb2..054ea732bbf16d 100644 --- a/examples/lock-app/nrfconnect/main/AppTask.cpp +++ b/examples/lock-app/nrfconnect/main/AppTask.cpp @@ -107,7 +107,7 @@ CHIP_ERROR AppTask::Init() #elif CONFIG_OPENTHREAD_MTD err = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_MinimalEndDevice); #else - err = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_FullEndDevice); + err = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_Router); #endif if (err != CHIP_NO_ERROR) { From b16892f5af993ea14ab3a1b6d820026a243dcca6 Mon Sep 17 00:00:00 2001 From: Zang MingJie Date: Tue, 26 Apr 2022 21:02:10 +0800 Subject: [PATCH 23/25] CASEClient: Remove unused defines (#17726) --- src/app/CASEClient.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/app/CASEClient.h b/src/app/CASEClient.h index 0c0ddaad65c333..e47f664a635805 100644 --- a/src/app/CASEClient.h +++ b/src/app/CASEClient.h @@ -26,9 +26,6 @@ namespace chip { class CASEClient; -typedef void (*OnCASEConnected)(void * context, CASEClient * client); -typedef void (*OnCASEConnectionFailure)(void * context, CASEClient * client, CHIP_ERROR error); - struct CASEClientInitParams { SessionManager * sessionManager = nullptr; From 6160935fa23987c90f2f6e3ac24ce70de82d37df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damian=20Kr=C3=B3lik?= <66667989+Damian-Nordic@users.noreply.github.com> Date: Tue, 26 Apr 2022 15:13:00 +0200 Subject: [PATCH 24/25] [linux] Use BLE notification instead of indication (#17692) Linux BLE peripherals use GATT indications instead of notifications as defined in the spec. --- src/platform/Linux/bluez/Helper.cpp | 30 ++++++++++------------------- 1 file changed, 10 insertions(+), 20 deletions(-) diff --git a/src/platform/Linux/bluez/Helper.cpp b/src/platform/Linux/bluez/Helper.cpp index 81f59af086276c..c0711db3a81b1b 100644 --- a/src/platform/Linux/bluez/Helper.cpp +++ b/src/platform/Linux/bluez/Helper.cpp @@ -627,18 +627,6 @@ static gboolean BluezCharacteristicStopNotify(BluezGattCharacteristic1 * aChar, return isSuccess ? TRUE : FALSE; } -static gboolean BluezCharacteristicConfirm(BluezGattCharacteristic1 * aChar, GDBusMethodInvocation * aInvocation, - gpointer apClosure) -{ - BluezEndpoint * endpoint = static_cast(apClosure); - BluezConnection * conn = GetBluezConnectionViaDevice(endpoint); - - ChipLogDetail(Ble, "Indication confirmation, %p", conn); - BLEManagerImpl::HandleTXComplete(conn); - - return TRUE; -} - static gboolean BluezCharacteristicStopNotifyError(BluezGattCharacteristic1 * aChar, GDBusMethodInvocation * aInvocation) { g_dbus_method_invocation_return_dbus_error(aInvocation, "org.bluez.Error.Failed", @@ -1235,7 +1223,7 @@ static void BluezPeripheralObjectsSetup(gpointer apClosure) { static const char * const c1_flags[] = { "write", nullptr }; - static const char * const c2_flags[] = { "read", "indicate", nullptr }; + static const char * const c2_flags[] = { "read", "notify", nullptr }; static const char * const c3_flags[] = { "read", nullptr }; BluezEndpoint * endpoint = static_cast(apClosure); @@ -1264,7 +1252,7 @@ static void BluezPeripheralObjectsSetup(gpointer apClosure) g_signal_connect(endpoint->mpC2, "handle-acquire-notify", G_CALLBACK(BluezCharacteristicAcquireNotify), apClosure); g_signal_connect(endpoint->mpC2, "handle-start-notify", G_CALLBACK(BluezCharacteristicStartNotify), apClosure); g_signal_connect(endpoint->mpC2, "handle-stop-notify", G_CALLBACK(BluezCharacteristicStopNotify), apClosure); - g_signal_connect(endpoint->mpC2, "handle-confirm", G_CALLBACK(BluezCharacteristicConfirm), apClosure); + g_signal_connect(endpoint->mpC2, "handle-confirm", G_CALLBACK(BluezCharacteristicConfirmError), apClosure); ChipLogDetail(DeviceLayer, "CHIP BTP C1 %s", bluez_gatt_characteristic1_get_service(endpoint->mpC1)); ChipLogDetail(DeviceLayer, "CHIP BTP C2 %s", bluez_gatt_characteristic1_get_service(endpoint->mpC2)); @@ -1281,7 +1269,7 @@ static void BluezPeripheralObjectsSetup(gpointer apClosure) g_signal_connect(endpoint->mpC3, "handle-acquire-notify", G_CALLBACK(BluezCharacteristicAcquireNotify), apClosure); g_signal_connect(endpoint->mpC3, "handle-start-notify", G_CALLBACK(BluezCharacteristicStartNotify), apClosure); g_signal_connect(endpoint->mpC3, "handle-stop-notify", G_CALLBACK(BluezCharacteristicStopNotify), apClosure); - g_signal_connect(endpoint->mpC3, "handle-confirm", G_CALLBACK(BluezCharacteristicConfirm), apClosure); + g_signal_connect(endpoint->mpC3, "handle-confirm", G_CALLBACK(BluezCharacteristicConfirmError), apClosure); // update the characteristic value UpdateAdditionalDataCharacteristic(endpoint->mpC3); ChipLogDetail(DeviceLayer, "CHIP BTP C3 %s", bluez_gatt_characteristic1_get_service(endpoint->mpC3)); @@ -1369,7 +1357,7 @@ static int StartupEndpointBindings(BluezEndpoint * endpoint) return 0; } -static gboolean BluezC2Indicate(ConnectionDataBundle * closure) +static gboolean BluezC2Notify(ConnectionDataBundle * closure) { BluezConnection * conn = nullptr; GError * error = nullptr; @@ -1381,7 +1369,7 @@ static gboolean BluezC2Indicate(ConnectionDataBundle * closure) conn = closure->mpConn; VerifyOrExit(conn != nullptr, ChipLogError(DeviceLayer, "BluezConnection is NULL in %s", __func__)); - VerifyOrExit(conn->mpC2 != nullptr, ChipLogError(DeviceLayer, "FAIL: C2 Indicate: %s", "NULL C2")); + VerifyOrExit(conn->mpC2 != nullptr, ChipLogError(DeviceLayer, "FAIL: C2 Notify: %s", "NULL C2")); if (bluez_gatt_characteristic1_get_notify_acquired(conn->mpC2) == TRUE) { @@ -1392,7 +1380,7 @@ static gboolean BluezC2Indicate(ConnectionDataBundle * closure) g_variant_unref(closure->mpVal); closure->mpVal = nullptr; - VerifyOrExit(status == G_IO_STATUS_NORMAL, ChipLogError(DeviceLayer, "FAIL: C2 Indicate: %s", error->message)); + VerifyOrExit(status == G_IO_STATUS_NORMAL, ChipLogError(DeviceLayer, "FAIL: C2 Notify: %s", error->message)); } else { @@ -1400,6 +1388,8 @@ static gboolean BluezC2Indicate(ConnectionDataBundle * closure) closure->mpVal = nullptr; } + BLEManagerImpl::HandleTXComplete(conn); + exit: if (closure != nullptr) { @@ -1430,7 +1420,7 @@ bool SendBluezIndication(BLE_CONNECTION_OBJECT apConn, chip::System::PacketBuffe VerifyOrExit(!apBuf.IsNull(), ChipLogError(DeviceLayer, "apBuf is NULL in %s", __func__)); - success = MainLoop::Instance().Schedule(BluezC2Indicate, MakeConnectionDataBundle(apConn, apBuf)); + success = MainLoop::Instance().Schedule(BluezC2Notify, MakeConnectionDataBundle(apConn, apBuf)); exit: return success; @@ -1683,7 +1673,7 @@ static gboolean SubscribeCharacteristicImpl(BluezConnection * connection) VerifyOrExit(connection->mpC2 != nullptr, ChipLogError(DeviceLayer, "C2 is NULL in %s", __func__)); c2 = BLUEZ_GATT_CHARACTERISTIC1(connection->mpC2); - // Get notifications on the TX characteristic change (e.g. indication is received) + // Get notifications on the TX characteristic change (e.g. notification is received) g_signal_connect(c2, "g-properties-changed", G_CALLBACK(OnCharacteristicChanged), connection); bluez_gatt_characteristic1_call_start_notify(connection->mpC2, nullptr, SubscribeCharacteristicDone, connection); From 20579721aab812566ed57576bccc10d1bb2ee594 Mon Sep 17 00:00:00 2001 From: Vivien Nicolas Date: Tue, 26 Apr 2022 15:47:42 +0200 Subject: [PATCH 25/25] [YAML] Update the tests to use ReadClient/WriteClient/CommandSender directly instead of Invoke (#17628) * [YAML] Add an interaction model module to src/app/tests/suites * [YAML] Get the interaction model module to be built along chip-tool * Update the commandName field in ClusterTestGeneration so that the actual command to be called can be generated directly * Update template to use the interaction model module instead of Invoke * Update generated code --- .../commands/tests/TestCommandBridge.h | 4 +- .../tests/partials/test_cluster.zapt | 2 +- examples/chip-tool/BUILD.gn | 1 + .../chip-tool/commands/tests/TestCommand.cpp | 38 +- .../chip-tool/commands/tests/TestCommand.h | 51 +- examples/chip-tool/templates/tests/helper.js | 44 +- .../tests/partials/test_cluster.zapt | 376 +- .../templates/tests/partials/test_step.zapt | 111 + .../chip-tool/templates/tests/templates.json | 4 + .../placeholder/linux/include/TestCommand.h | 35 +- examples/placeholder/templates/templates.json | 4 + src/app/ChunkedWriteCallback.cpp | 3 + .../commands/interaction_model/BUILD.gn | 32 + .../interaction_model/InteractionModel.cpp | 245 + .../interaction_model/InteractionModel.h | 192 + .../tests/suites/include/ConstraintsChecker.h | 2 +- src/app/tests/suites/include/TestRunner.h | 88 + src/app/tests/suites/include/ValueChecker.h | 2 +- .../common/ClusterTestGeneration.js | 111 +- .../tests/partials/test_cluster.zapt | 2 +- .../chip-tool/zap-generated/test/Commands.h | 159897 ++++----------- .../app1/zap-generated/test/Commands.h | 903 +- .../app2/zap-generated/test/Commands.h | 903 +- 23 files changed, 45692 insertions(+), 117358 deletions(-) create mode 100644 examples/chip-tool/templates/tests/partials/test_step.zapt create mode 100644 src/app/tests/suites/commands/interaction_model/BUILD.gn create mode 100644 src/app/tests/suites/commands/interaction_model/InteractionModel.cpp create mode 100644 src/app/tests/suites/commands/interaction_model/InteractionModel.h create mode 100644 src/app/tests/suites/include/TestRunner.h diff --git a/examples/chip-tool-darwin/commands/tests/TestCommandBridge.h b/examples/chip-tool-darwin/commands/tests/TestCommandBridge.h index 6ef4b2e01753ea..e71085f05163ca 100644 --- a/examples/chip-tool-darwin/commands/tests/TestCommandBridge.h +++ b/examples/chip-tool-darwin/commands/tests/TestCommandBridge.h @@ -57,10 +57,10 @@ class TestCommandBridge : public CHIPCommandBridge, public ValueChecker, public virtual void NextTest() = 0; - void Exit(std::string message) override + void Exit(std::string message, CHIP_ERROR err = CHIP_ERROR_INTERNAL) override { ChipLogError(chipTool, " ***** Test Failure: %s\n", message.c_str()); - SetCommandExitStatus(CHIP_ERROR_INTERNAL); + SetCommandExitStatus(err); } /////////// GlobalCommands Interface ///////// diff --git a/examples/chip-tool-darwin/templates/tests/partials/test_cluster.zapt b/examples/chip-tool-darwin/templates/tests/partials/test_cluster.zapt index e67558809c04fa..ad83b03720512b 100644 --- a/examples/chip-tool-darwin/templates/tests/partials/test_cluster.zapt +++ b/examples/chip-tool-darwin/templates/tests/partials/test_cluster.zapt @@ -1,4 +1,4 @@ -{{#chip_tests tests}} +{{#chip_tests tests useSynthesizeWaitForReport=true}} class {{filename}}: public TestCommandBridge { public: diff --git a/examples/chip-tool/BUILD.gn b/examples/chip-tool/BUILD.gn index 2bd59f20c4b979..7edc8fdeb48506 100644 --- a/examples/chip-tool/BUILD.gn +++ b/examples/chip-tool/BUILD.gn @@ -84,6 +84,7 @@ static_library("chip-tool-utils") { "${chip_root}/src/app/tests/suites/commands/commissioner", "${chip_root}/src/app/tests/suites/commands/delay", "${chip_root}/src/app/tests/suites/commands/discovery", + "${chip_root}/src/app/tests/suites/commands/interaction_model", "${chip_root}/src/app/tests/suites/commands/log", "${chip_root}/src/app/tests/suites/commands/system", "${chip_root}/src/app/tests/suites/pics", diff --git a/examples/chip-tool/commands/tests/TestCommand.cpp b/examples/chip-tool/commands/tests/TestCommand.cpp index 083ed65a7b7ffb..32f1ac00fa7cad 100644 --- a/examples/chip-tool/commands/tests/TestCommand.cpp +++ b/examples/chip-tool/commands/tests/TestCommand.cpp @@ -66,18 +66,42 @@ void TestCommand::OnDeviceConnectionFailureFn(void * context, PeerId peerId, CHI LogErrorOnFailure(command->ContinueOnChipMainThread(error)); } -void TestCommand::Exit(std::string message) +void TestCommand::ExitAsync(intptr_t context) { - ChipLogError(chipTool, " ***** Test Failure: %s\n", message.c_str()); - SetCommandExitStatus(CHIP_ERROR_INTERNAL); + auto testCommand = reinterpret_cast(context); + testCommand->InteractionModel::Shutdown(); + testCommand->SetCommandExitStatus(CHIP_ERROR_INTERNAL); } -void TestCommand::ThrowFailureResponse(CHIP_ERROR error) +void TestCommand::Exit(std::string message, CHIP_ERROR err) { - Exit(std::string("Expecting success response but got a failure response: ") + chip::ErrorStr(error)); + mContinueProcessing = false; + + LogEnd(err); + + if (CHIP_NO_ERROR == err) + { + InteractionModel::Shutdown(); + SetCommandExitStatus(err); + } + else + { + chip::DeviceLayer::PlatformMgr().ScheduleWork(ExitAsync, reinterpret_cast(this)); + } } -void TestCommand::ThrowSuccessResponse() +CHIP_ERROR TestCommand::ContinueOnChipMainThread(CHIP_ERROR err) { - Exit("Expecting failure response but got a success response"); + if (mContinueProcessing == false) + { + return CHIP_NO_ERROR; + } + + if (CHIP_NO_ERROR == err) + { + return WaitForMs(0); + } + + Exit(chip::ErrorStr(err), err); + return CHIP_NO_ERROR; } diff --git a/examples/chip-tool/commands/tests/TestCommand.h b/examples/chip-tool/commands/tests/TestCommand.h index 07f3ebc939f85d..264b291175718e 100644 --- a/examples/chip-tool/commands/tests/TestCommand.h +++ b/examples/chip-tool/commands/tests/TestCommand.h @@ -22,17 +22,19 @@ #include #include #include +#include #include #include #include #include +#include #include -#include #include constexpr uint16_t kTimeoutInSeconds = 90; -class TestCommand : public CHIPCommand, +class TestCommand : public TestRunner, + public CHIPCommand, public ValueChecker, public ConstraintsChecker, public PICSChecker, @@ -40,12 +42,13 @@ class TestCommand : public CHIPCommand, public CommissionerCommands, public DiscoveryCommands, public SystemCommands, - public DelayCommands + public DelayCommands, + public InteractionModel { public: - TestCommand(const char * commandName, CredentialIssuerCommands * credsIssuerConfig) : - CHIPCommand(commandName, credsIssuerConfig), mOnDeviceConnectedCallback(OnDeviceConnectedFn, this), - mOnDeviceConnectionFailureCallback(OnDeviceConnectionFailureFn, this) + TestCommand(const char * commandName, uint16_t testsCount, CredentialIssuerCommands * credsIssuerConfig) : + TestRunner(commandName, testsCount), CHIPCommand(commandName, credsIssuerConfig), + mOnDeviceConnectedCallback(OnDeviceConnectedFn, this), mOnDeviceConnectionFailureCallback(OnDeviceConnectionFailureFn, this) { AddArgument("delayInMs", 0, UINT64_MAX, &mDelayInMs); AddArgument("PICS", &mPICSFilePath); @@ -55,33 +58,25 @@ class TestCommand : public CHIPCommand, /////////// CHIPCommand Interface ///////// CHIP_ERROR RunCommand() override; - virtual void NextTest() = 0; protected: /////////// DelayCommands Interface ///////// CHIP_ERROR WaitForCommissionee(chip::NodeId nodeId) override; void OnWaitForMs() override { NextTest(); }; - std::map mDevices; + /////////// Interaction Model Interface ///////// + chip::DeviceProxy * GetDevice(const char * identity) override { return mDevices[identity]; } + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override{}; static void OnDeviceConnectedFn(void * context, chip::OperationalDeviceProxy * device); static void OnDeviceConnectionFailureFn(void * context, PeerId peerId, CHIP_ERROR error); - CHIP_ERROR ContinueOnChipMainThread(CHIP_ERROR err) override - { - if (CHIP_NO_ERROR == err) - { - return WaitForMs(0); - } - Exit(chip::ErrorStr(err)); - return CHIP_NO_ERROR; - } + CHIP_ERROR ContinueOnChipMainThread(CHIP_ERROR err) override; chip::Controller::DeviceCommissioner & GetCurrentCommissioner() override { return CurrentCommissioner(); }; - void Exit(std::string message) override; - void ThrowFailureResponse(CHIP_ERROR error); - void ThrowSuccessResponse(); + static void ExitAsync(intptr_t context); + void Exit(std::string message, CHIP_ERROR err = CHIP_ERROR_INTERNAL) override; chip::Callback::Callback mOnDeviceConnectedCallback; chip::Callback::Callback mOnDeviceConnectionFailureCallback; @@ -92,14 +87,14 @@ class TestCommand : public CHIPCommand, status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedCommand; } - void Wait() - { - if (mDelayInMs.HasValue()) - { - chip::test_utils::SleepMillis(mDelayInMs.Value()); - } - }; - chip::Optional mDelayInMs; chip::Optional mPICSFilePath; chip::Optional mTimeout; + std::map mDevices; + + // When set to false, prevents interaction model events from affecting the current test status. + // This flag exists because if an error happens while processing a response the allocated + // command client/sender (ReadClient/WriteClient/CommandSender) can not be deallocated + // as it still used by the stack afterward. So a task is scheduled to run to close the + // test suite as soon as possible, and pending events are ignored in between. + bool mContinueProcessing = true; }; diff --git a/examples/chip-tool/templates/tests/helper.js b/examples/chip-tool/templates/tests/helper.js index 83021e5535bc30..a2f7cdb708b469 100644 --- a/examples/chip-tool/templates/tests/helper.js +++ b/examples/chip-tool/templates/tests/helper.js @@ -15,7 +15,7 @@ * limitations under the License. */ -const { zapTypeToDecodableClusterObjectType, asUpperCamelCase, asLowerCamelCase } +const { zapTypeToDecodableClusterObjectType, zapTypeToEncodableClusterObjectType, asUpperCamelCase, asLowerCamelCase } = require('../../../../src/app/zap-templates/templates/app/helper.js'); const { isTestOnlyCluster } = require('../../../../src/app/zap-templates/common/simulated-clusters/SimulatedClusters.js'); @@ -31,21 +31,44 @@ function utf8StringLength(str) */ function asPropertyValue(options) { - let name = ''; + let rootObject = 'value'; - // The decodable type for simulated cluster is a struct by default, even if the + // The decodable type for commands is a struct by default, even if the // command just returns a single value. - if (isTestOnlyCluster(this.parent.cluster)) { - name = 'value.' + if (this.parent.isCommand) { + rootObject += '.' + asLowerCamelCase(this.name); } - name += asLowerCamelCase(this.name); - if (this.isOptional && !options.hash.dontUnwrapValue) { - name += '.Value()'; + rootObject += '.Value()'; + } + + return rootObject; +} + +async function asEncodableType() +{ + // Copy some properties needed by zapTypeToEncodableClusterObjectType + let target = { global : this.global, entryType : this.entryType }; + + let type; + if ('commandObject' in this) { + type = this.commandObject.name; + } else if ('attributeObject' in this) { + type = this.attributeObject.type; + target.isArray = this.attributeObject.isArray; + target.isOptional = this.attributeObject.isOptional; + target.isNullable = this.attributeObject.isNullable; + } else { + throw new Error("Unsupported encodable type"); } - return name; + if (isTestOnlyCluster(this.cluster) || 'commandObject' in this) { + return `chip::app::Clusters::${asUpperCamelCase(this.cluster)}::Commands::${asUpperCamelCase(type)}::Type`; + } + + const options = { 'hash' : { ns : this.cluster } }; + return await zapTypeToEncodableClusterObjectType.call(target, type, options); } async function asDecodableType() @@ -62,7 +85,7 @@ async function asDecodableType() target.isOptional = this.attributeObject.isOptional; target.isNullable = this.attributeObject.isNullable; } else if ('eventObject' in this) { - type = this.eventObject.type; + type = this.event; } else { throw new Error("Unsupported decodable type"); } @@ -81,3 +104,4 @@ async function asDecodableType() exports.utf8StringLength = utf8StringLength; exports.asPropertyValue = asPropertyValue; exports.asDecodableType = asDecodableType; +exports.asEncodableType = asEncodableType; diff --git a/examples/chip-tool/templates/tests/partials/test_cluster.zapt b/examples/chip-tool/templates/tests/partials/test_cluster.zapt index a46961a68c5359..79fa65337635b5 100644 --- a/examples/chip-tool/templates/tests/partials/test_cluster.zapt +++ b/examples/chip-tool/templates/tests/partials/test_cluster.zapt @@ -1,11 +1,11 @@ {{#chip_tests tests}} class {{filename}}Suite: public TestCommand { - public: +public: {{#if ../credsIssuerConfigArg}} - {{filename}}Suite(CredentialIssuerCommands * credsIssuerConfig): TestCommand("{{filename}}", credsIssuerConfig), mTestIndex(0) + {{filename}}Suite(CredentialIssuerCommands * credsIssuerConfig): TestCommand("{{filename}}", {{totalTests}}, credsIssuerConfig) {{else}} - {{filename}}Suite(): TestCommand("{{filename}}"), mTestIndex(0) + {{filename}}Suite(): TestCommand("{{filename}}", {{totalTests}}) {{/if}} { {{#chip_tests_config}} @@ -22,67 +22,30 @@ class {{filename}}Suite: public TestCommand {{>teardownSaveAs}} } - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: {{filename}}\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: {{filename}}\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - {{#chip_tests_items}} - case {{index}}: - ChipLogProgress(chipTool, " ***** Test Step {{index}} : {{label}}\n"); - {{#if PICS}} - if (ShouldSkip("{{PICS}}")) - { - NextTest(); - return; - } - {{/if}} - err = Test{{asUpperCamelCase label}}_{{index}}(); - break; - {{/chip_tests_items}} - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - {{#if ../needsWaitDuration}} chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(mTimeout.ValueOr({{chip_tests_config_get_default_value "timeout"}})); } {{/if}} - private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = {{totalTests}}; - +private: {{#chip_tests_config}} chip::Optional<{{chipType}}> m{{asUpperCamelCase name}}; {{/chip_tests_config}} {{>setupSaveAs}} + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) + { + {{#if (chip_tests_config_has "endpoint")}} + return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; + {{else}} + return endpoint; + {{/if}} + } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -90,15 +53,11 @@ class {{filename}}Suite: public TestCommand switch (mTestIndex - 1) { {{#chip_tests_items}} - {{! - This check can be removed once the cluster APIs have been converted from Invoke to - ReadClient/WriteClient/CommandSender - }} - {{~#if (isTestOnlyCluster cluster)~}} + {{#unless isWait}} case {{index}}: {{>test_step_response}} break; - {{/if~}} + {{/unless}} {{/chip_tests_items}} default: LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); @@ -110,294 +69,19 @@ class {{filename}}Suite: public TestCommand } } - {{! Helper around zapTypeToDecodableClusterObjectType that lets us set the - array/nullable/etc context appropriately.}} - {{~#*inline "subscribeResponseDataArgument"~}} - {{zapTypeToDecodableClusterObjectType type ns=cluster isArgument=true}} value - {{~/inline~}} - {{~#*inline "subscribeResponseArguments"~}} - {{> subscribeResponseDataArgument type=attr.type isArray=attr.isArray isNullable=attr.isNullable}} - {{~/inline~}} - - {{~#*inline "subscribeDataCallback"}} - mTest_{{parent.filename}}_{{attribute}}_Reported - {{/inline}} - {{#*inline "subscribeDataCallbackType"}} - Test_{{parent.filename}}_{{attribute}}_ReportCallback - {{/inline}} - {{#chip_tests_items}} - {{#if allocateSubscribeDataCallback}} - typedef void (*{{> subscribeDataCallbackType}})(void * context, {{> subscribeResponseArguments attr=attributeObject}}); - {{> subscribeDataCallbackType}} {{> subscribeDataCallback}} = nullptr; - {{/if}} - {{/chip_tests_items}} - - {{#*inline "failureResponse"}}OnFailureResponse_{{index}}{{/inline}} - {{#*inline "successResponse"}}OnSuccessResponse_{{index}}{{/inline}} - {{#*inline "subscriptionEstablished"}}OnSubscriptionEstablishedResponse_{{index}}{{/inline}} - {{#*inline "doneResponse"}}OnDoneResponse_{{index}}{{/inline}} - - {{#*inline "staticFailureResponse"}}OnFailureCallback_{{index}}{{/inline}} - {{#*inline "staticSuccessResponse"}}OnSuccessCallback_{{index}}{{/inline}} - {{#*inline "staticSubscriptionEstablished"}}OnSubscriptionEstablished_{{index}}{{/inline}} - {{#*inline "staticDoneResponse"}}OnDoneCallback_{{index}}{{/inline}} - - {{#*inline "successArguments"}}{{#chip_tests_item_response_parameters}}{{#first}}{{#if ../leadingComma}}, {{/if}}{{/first}} {{zapTypeToDecodableClusterObjectType type ns=parent.cluster isArgument=true}} {{asLowerCamelCase name}}{{#not_last}}, {{/not_last}}{{/chip_tests_item_response_parameters}}{{/inline}} - {{! TODO: Temporary if cascade until everything is converted to the new status setup }} - {{#*inline "failureArguments"}}{{#if leadingComma}}, {{/if}}CHIP_ERROR error{{/inline}} - {{#*inline "staticSuccessArguments"}}void * context{{> successArguments leadingComma=true}}{{/inline}} - {{#*inline "staticFailureArguments"}}void * context{{> failureArguments leadingComma=true}}{{/inline}} - {{#*inline "staticDoneArguments"}}void * context{{/inline}} - {{#*inline "doneArguments"}}{{/inline}} - - {{#*inline "staticSubscriptionEstablishedArguments"}}void * context{{/inline}} - {{#*inline "subscriptionEstablishedArguments"}}{{/inline}} - - {{#chip_tests_items}} - {{#unless (isTestOnlyCluster cluster)}} - {{#unless isWait}} - {{#unless isCommand}} - {{#if isWriteAttribute}} - {{#if isGroupCommand}} - static void {{>staticDoneResponse}}({{>staticDoneArguments}}) - { - (static_cast<{{filename}}Suite *>(context))->{{> doneResponse }}(); - } - {{/if}} - {{/if}} - - static void {{>staticFailureResponse}}({{>staticFailureArguments}}) - { - (static_cast<{{filename}}Suite *>(context))->{{>failureResponse}}(error); - } - - static void {{>staticSuccessResponse}}({{> staticSuccessArguments}}) - { - (static_cast<{{filename}}Suite *>(context))->{{>successResponse}}({{#chip_tests_item_response_parameters}}{{#not_first}}, {{/not_first}}{{asLowerCamelCase name}}{{/chip_tests_item_response_parameters}}); - } - - {{#if isSubscribe}} - static void {{> staticSubscriptionEstablished}}({{> staticSubscriptionEstablishedArguments}}) - { - (static_cast<{{filename}}Suite *>(context))->{{> subscriptionEstablished}}(); - } - {{/if}} - - {{#if isWaitForReport}} - bool mReceivedReport_{{index}} = false; - {{/if}} - - {{/unless}} - {{/unless}} - {{/unless}} - {{/chip_tests_items}} - - // - // Tests methods - // - - {{#chip_tests_items}} - {{#*inline "testCommand"}}Test{{asUpperCamelCase label}}_{{index}}{{/inline}} - {{#if (isTestOnlyCluster cluster)}} - CHIP_ERROR {{>testCommand}}() - { - SetIdentity(kIdentity{{asUpperCamelCase identity}}); - return {{command}}({{#chip_tests_item_parameters}}{{#not_first}},{{/not_first}} - {{#*inline "defaultValue"}}{{asTypedLiteral (chip_tests_config_get_default_value definedValue) (chip_tests_config_get_type definedValue)}}{{/inline}} - {{~#if (chip_tests_config_has definedValue)~}} - m{{asUpperCamelCase definedValue}}.HasValue() ? m{{asUpperCamelCase definedValue}}.Value() : {{~#if (isString type)}}chip::CharSpan::fromCharString("{{>defaultValue}}"){{else}}{{>defaultValue}}{{/if~}} - {{~else if (isString type)}}"{{definedValue}}" - {{else}}{{definedValue}} - {{~/if~}} - {{/chip_tests_item_parameters}}); - } - {{else if isWait}} - CHIP_ERROR {{>testCommand}}() - { - const chip::EndpointId endpoint = {{#if (chip_tests_config_has "endpoint")}}mEndpoint.HasValue() ? mEndpoint.Value() : {{/if}}{{endpoint}}; - ChipLogError(chipTool, "[Endpoint: 0x%08x Cluster: {{cluster}} {{#if isAttribute}}Attribute: {{attribute}}{{else}}Command: {{wait}}{{/if}}] {{label}}", endpoint); - {{#*inline "waitForTypeName"}}{{#if isAttribute}}Attribute{{else}}Command{{/if}}{{/inline}} - {{#*inline "waitForTypeId"}}chip::app::Clusters::{{asUpperCamelCase cluster}}::{{#if isAttribute}}Attributes::{{asUpperCamelCase attribute}}{{else}}Commands::{{asUpperCamelCase wait}}{{/if}}::Id{{/inline}} - ClearAttributeAndCommandPaths(); - m{{>waitForTypeName}}Path = chip::app::Concrete{{>waitForTypeName}}Path(endpoint, chip::app::Clusters::{{asUpperCamelCase cluster}}::Id, {{>waitForTypeId}}); - return CHIP_NO_ERROR; - } - {{else}} - - {{#*inline "device"}}mDevices[kIdentity{{asUpperCamelCase identity}}]{{/inline}} - CHIP_ERROR {{>testCommand}}() - { - {{#if isGroupCommand}} - const chip::GroupId groupId = {{groupId}}; - {{else}} - const chip::EndpointId endpoint = {{#if (chip_tests_config_has "endpoint")}}mEndpoint.HasValue() ? mEndpoint.Value() : {{/if}}{{endpoint}}; - {{/if}} - - {{~#*inline "maybeTimedInteractionTimeout"}} - {{#if timedInteractionTimeoutMs}} - , {{timedInteractionTimeoutMs}} - {{else if commandObject.mustUseTimedInvoke}} - , chip::NullOptional - {{else if attributeObject.mustUseTimedWrite}} - , chip::NullOptional - {{/if}} - {{/inline~}} - - {{~#*inline "maybeWait"}} - {{#if busyWaitMs}} - using namespace chip::System::Clock::Literals; - BusyWaitFor({{busyWaitMs}}_ms); - {{/if}} - {{/inline~}} - - {{#if isCommand}} - using RequestType = chip::app::Clusters::{{asUpperCamelCase cluster}}::Commands::{{asUpperCamelCase command}}::Type; - - {{#if (chip_tests_item_has_list)}} ListFreer listFreer;{{/if}} - RequestType request; - {{#chip_tests_item_parameters}} - {{>commandValue ns=parent.cluster container=(concat "request." (asLowerCamelCase label)) definedValue=definedValue depth=0}} - {{/chip_tests_item_parameters}} - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast<{{filename}}Suite *>(context))->{{>successResponse}}({{#chip_tests_item_response_parameters}}{{#not_first}}, {{/not_first}}data.{{asLowerCamelCase name}}{{/chip_tests_item_response_parameters}}); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast<{{filename}}Suite *>(context))->{{>failureResponse}}(error); - }; - - {{#if isGroupCommand}} - auto done = [](void * context) { - (static_cast<{{filename}}Suite *>(context))->OnDoneResponse_{{index}}(); - }; - {{/if}} - - ReturnErrorOnFailure(chip::Controller::{{#if isGroupCommand}}InvokeGroupCommand{{else}}InvokeCommand{{/if}}({{>device}}, this, success, failure, {{#if isGroupCommand}}done,{{/if}} - {{#if isGroupCommand}}groupId{{else}}endpoint{{/if}}, - request - {{> maybeTimedInteractionTimeout }} - )); - {{> maybeWait }} - {{else}} - chip::Controller::{{asUpperCamelCase cluster}}ClusterTest cluster; - {{#unless isGroupCommand}} - cluster.Associate({{>device}}, endpoint); - {{/unless}} - - {{#if (chip_tests_item_has_list)}} ListFreer listFreer;{{/if}} - {{#chip_tests_item_parameters}} - {{zapTypeToEncodableClusterObjectType type ns=parent.cluster}} {{asLowerCamelCase name}}Argument; - {{>commandValue ns=parent.cluster container=(concat (asLowerCamelCase name) "Argument") definedValue=definedValue depth=0}} - {{/chip_tests_item_parameters}} - - {{#if isWriteAttribute}} - {{#if isGroupCommand}} - ReturnErrorOnFailure(cluster.WriteAttribute(groupId, {{>device}}->GetSecureSession().Value()->GetFabricIndex(), {{#chip_tests_item_parameters}}{{asLowerCamelCase name}}Argument, {{/chip_tests_item_parameters}}this, {{>staticSuccessResponse}}, {{>staticFailureResponse}} - {{~> maybeTimedInteractionTimeout ~}} - , {{>staticDoneResponse}} - )); - {{> maybeWait }} - {{else}} - ReturnErrorOnFailure(cluster.WriteAttribute({{#chip_tests_item_parameters}}{{asLowerCamelCase name}}Argument, {{/chip_tests_item_parameters}}this, {{>staticSuccessResponse}}, {{>staticFailureResponse}} - {{~> maybeTimedInteractionTimeout ~}} - )); - {{> maybeWait }} - {{/if}} - {{else if isReadEvent}} - ReturnErrorOnFailure(cluster.ReadEvent<{{zapTypeToDecodableClusterObjectType event ns=cluster isArgument=true}}>(this, {{>staticSuccessResponse}}, {{>staticFailureResponse}})); - {{else if isSubscribeEvent}} - ReturnErrorOnFailure(cluster.SubscribeEvent<{{zapTypeToDecodableClusterObjectType event ns=cluster isArgument=true}}>(this, {{>staticSuccessResponse}}, {{>staticFailureResponse}}, minIntervalArgument, maxIntervalArgument, {{>staticSubscriptionEstablished}})); - {{else if isReadAttribute}} - ReturnErrorOnFailure(cluster.ReadAttribute({{#chip_tests_item_parameters}}{{asLowerCamelCase name}}Argument, {{/chip_tests_item_parameters}}this, {{>staticSuccessResponse}}, {{>staticFailureResponse}}, {{fabricFiltered}})); - {{else if isSubscribeAttribute}} - ReturnErrorOnFailure(cluster.SubscribeAttribute(this, {{>staticSuccessResponse}}, {{>staticFailureResponse}}, minIntervalArgument, maxIntervalArgument, {{>staticSubscriptionEstablished}}, {{fabricFiltered}})); - {{else if isWaitForReport}} - {{> subscribeDataCallback}} = {{> staticSuccessResponse}}; - {{else}} - UNEXPECTED COMMAND: {{>commandName}} - {{/if}} - {{/if}} - {{#if async}} - return WaitForMs(0); - {{else}} - return CHIP_NO_ERROR; - {{/if}} - } - - void {{>failureResponse}}({{>failureArguments}}) - { - chip::app::StatusIB status(error); - {{#if response.error}} - {{#if optional}} - if (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute){ - {{#unless async}}NextTest();{{/unless}} - } else { - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), {{response.error}})); - {{#unless async}}NextTest();{{/unless}} - } - {{else}} - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), {{response.error}})); - {{#unless async}}NextTest();{{/unless}} - {{/if}} - {{else}} - {{#if optional}}(status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() : {{/if}}ThrowFailureResponse(error); - {{/if}} - } - - {{#if isSubscribe}} - void {{>successResponse}}({{> subscribeResponseArguments attr=attributeObject}}) - { - {{#if response.error}} - ThrowSuccessResponse(); - {{else if response.errorWrongValue}} - ThrowSuccessResponse(); - {{else}} - if ({{> subscribeDataCallback}}) { - auto callback = {{> subscribeDataCallback}}; - {{> subscribeDataCallback}} = nullptr; - callback(this, value); - } - {{/if}} - } - - void {{>subscriptionEstablished}}({{> subscriptionEstablishedArguments}}) - { - {{#if hasWaitForReport}} - VerifyOrReturn(mReceivedReport_{{waitForReport.index}}, Exit("Initial report not received!")); - {{/if}} - {{#unless async}}NextTest();{{/unless}} - } - {{else}} - void {{>successResponse}}({{>successArguments}}) - { - {{~#if response.error}} - ThrowSuccessResponse(); - {{else if response.errorWrongValue}} - ThrowSuccessResponse(); - {{else}} - {{#if isWaitForReport}} - mReceivedReport_{{index}} = true; - {{/if}} - {{#chip_tests_item_response_parameters}} - {{>maybeCheckExpectedValue}} - {{>maybeCheckExpectedConstraints}} - {{>maybeSaveAs}} - {{/chip_tests_item_response_parameters}} - {{#unless async}}NextTest();{{/unless}} - {{/if}} - } - {{/if}} - - {{#if isGroupCommand}} - void {{>doneResponse}}({{>doneArguments}}) + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - NextTest(); + using namespace chip::app::Clusters; + switch (testIndex) + { + {{#chip_tests_items}} + case {{index}}: { + {{>test_step}} + } + {{/chip_tests_items}} + } + return CHIP_NO_ERROR; } - {{/if}} - - {{/if}} - {{/chip_tests_items}} }; {{/chip_tests}} diff --git a/examples/chip-tool/templates/tests/partials/test_step.zapt b/examples/chip-tool/templates/tests/partials/test_step.zapt new file mode 100644 index 00000000000000..309011f0e3013f --- /dev/null +++ b/examples/chip-tool/templates/tests/partials/test_step.zapt @@ -0,0 +1,111 @@ +{{~#*inline "clusterName"}}{{asUpperCamelCase cluster}}{{/inline~}} + +{{~#*inline "maybePICS"}} +{{#if PICS}} + VerifyOrdo(!ShouldSkip("{{PICS}}"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); +{{/if}} +{{/inline~}} + +{{~#*inline "maybePrepareArguments"}} +{{#unless isWait}} +{{#if (isTestOnlyCluster cluster)}} + SetIdentity({{>kIdentity}}); +{{else if hasSpecificArguments}} + {{#if (chip_tests_item_has_list)}}ListFreer listFreer;{{/if~}} + {{asEncodableType}} value; + {{#chip_tests_item_parameters}} + {{>commandValue ns=parent.cluster container=(asPropertyValue dontUnwrapValue=true) definedValue=definedValue depth=0}} + {{/chip_tests_item_parameters}} +{{/if}} +{{/unless}} +{{/inline~}} + +{{~#*inline "testOnlyClusterArguments"}} +{{#chip_tests_item_parameters}}{{#not_first}},{{/not_first}} + {{#*inline "defaultValue"}}{{asTypedLiteral (chip_tests_config_get_default_value definedValue) (chip_tests_config_get_type definedValue)}}{{/inline}} + {{~#if (chip_tests_config_has definedValue)~}} + m{{asUpperCamelCase definedValue}}.HasValue() ? m{{asUpperCamelCase definedValue}}.Value() : {{~#if (isString type)}}chip::CharSpan::fromCharString("{{>defaultValue}}"){{else}}{{>defaultValue}}{{/if~}} + {{~else if (isString type)}} + "{{definedValue}}" + {{else}} + {{definedValue}} + {{~/if~}} +{{/chip_tests_item_parameters}} +{{/inline~}} + + +{{~#*inline "maybeFabricFiltered"}} +{{#unless isWait}} +{{#unless fabricFiltered}} + , false +{{/unless}} +{{/unless}} +{{/inline~}} + +{{~#*inline "maybeTimedInteractionTimeout"}} +{{#if timedInteractionTimeoutMs}} + , chip::Optional({{timedInteractionTimeoutMs}}) +{{else if commandObject.mustUseTimedInvoke}} + , chip::NullOptional +{{else if attributeObject.mustUseTimedWrite}} + , chip::NullOptional +{{/if}} +{{/inline~}} + +{{~#*inline "kIdentity"}}kIdentity{{asUpperCamelCase identity}}{{/inline~}} +{{~#*inline "groupId"}}{{groupId}}{{/inline~}} +{{~#*inline "endpointId"}}GetEndpoint({{endpoint}}){{/inline~}} +{{~#*inline "clusterId"}}{{>clusterName}}::Id{{/inline~}} +{{~#*inline "attributeId"}}{{>clusterName}}::Attributes::{{asUpperCamelCase attribute}}::Id{{/inline~}} +{{~#*inline "eventId"}}{{>clusterName}}::Events::{{asUpperCamelCase event}}::Id{{/inline~}} +{{~#*inline "commandId"}}{{>clusterName}}::Commands::{{asUpperCamelCase command}}::Id{{/inline~}} + +{{~#*inline "attributeArguments"}}{{>kIdentity}}, {{>endpointId}}, {{>clusterId}}, {{>attributeId}}{{/inline~}} +{{~#*inline "eventArguments"}}{{>kIdentity}}, {{>endpointId}}, {{>clusterId}}, {{>eventId}}{{/inline~}} +{{~#*inline "commandArguments"}}{{>kIdentity}}, {{>endpointId}}, {{>clusterId}}, {{>commandId}}{{/inline~}} +{{~#*inline "waitAttributeArguments"}}{{>endpointId}}, {{>clusterId}}, {{>attributeId}}{{/inline~}} +{{~#*inline "waitEventArguments"}}{{>endpointId}}, {{>clusterId}}, {{>eventId}}{{/inline~}} +{{~#*inline "waitCommandArguments"}}{{>endpointId}}, {{>clusterId}}, {{>commandId}}{{/inline~}} +{{~#*inline "groupAttributeArguments"}}{{>kIdentity}}, {{>groupId}}, {{>clusterId}}, {{>attributeId}}{{/inline~}} +{{~#*inline "groupCommandArguments"}}{{>kIdentity}}, {{>groupId}}, {{>clusterId}}, {{>commandId}}{{/inline~}} + +{{~#*inline "waitArguments"}} +{{#if isAttribute}} + {{>waitAttributeArguments}} +{{else if isEvent}} + {{>endpointId}}, {{>clusterId}}, {{>eventId}} +{{else}} + {{>waitCommandArguments}} +{{/if}} +{{/inline~}} + +{{~#*inline "arguments"}} +{{#if (isTestOnlyCluster cluster)}}{{>testOnlyClusterArguments}} +{{else if isWait}} {{>waitArguments}} +{{else if isReadAttribute}} {{>attributeArguments}}{{>maybeFabricFiltered~}} +{{else if isSubscribeAttribute}} {{>attributeArguments}}, {{minInterval}}, {{maxInterval}}{{>maybeFabricFiltered~}} +{{else if isWriteGroupAttribute}} {{>groupAttributeArguments}}, value{{>maybeTimedInteractionTimeout~}} +{{else if isWriteAttribute}} {{>attributeArguments}}, value{{>maybeTimedInteractionTimeout~}} +{{else if isReadEvent}} {{>eventArguments}}{{>maybeFabricFiltered}} +{{else if isSubscribeEvent}} {{>eventArguments}}, {{minInterval}}, {{maxInterval}}{{>maybeFabricFiltered~}} +{{else if isGroupCommand}} {{>groupCommandArguments}}, value{{>maybeTimedInteractionTimeout~}} +{{else if isCommand}} {{>commandArguments}}, value{{>maybeTimedInteractionTimeout~}} +{{/if}} +{{/inline~}} + +{{~#*inline "maybeBusyWait"}} +{{#if busyWaitMs}} + ReturnErrorOnFailure({{commandName}}({{>arguments}})); + + using namespace chip::System::Clock::Literals; + return BusyWaitFor({{busyWaitMs}}_ms); +{{else}} + return {{commandName}}({{>arguments}}); +{{/if}} +{{/inline~}} + +{{! --- Test Step Content --}} +LogStep({{index}}, "{{label}}"); +{{>maybePICS}} +{{>maybePrepareArguments}} +{{>maybeBusyWait}} diff --git a/examples/chip-tool/templates/tests/templates.json b/examples/chip-tool/templates/tests/templates.json index 7b95d4e1e2df79..15c3dd756aa0de 100644 --- a/examples/chip-tool/templates/tests/templates.json +++ b/examples/chip-tool/templates/tests/templates.json @@ -21,6 +21,10 @@ "name": "test_cluster", "path": "partials/test_cluster.zapt" }, + { + "name": "test_step", + "path": "partials/test_step.zapt" + }, { "name": "test_step_response", "path": "partials/test_step_response.zapt" diff --git a/examples/placeholder/linux/include/TestCommand.h b/examples/placeholder/linux/include/TestCommand.h index ad11ab80015936..9696412568e708 100644 --- a/examples/placeholder/linux/include/TestCommand.h +++ b/examples/placeholder/linux/include/TestCommand.h @@ -28,6 +28,7 @@ #include #include #include +#include #include #include @@ -38,7 +39,8 @@ constexpr const char kIdentityAlpha[] = ""; constexpr const char kIdentityBeta[] = ""; constexpr const char kIdentityGamma[] = ""; -class TestCommand : public PICSChecker, +class TestCommand : public TestRunner, + public PICSChecker, public LogCommands, public DiscoveryCommands, public DelayCommands, @@ -46,11 +48,11 @@ class TestCommand : public PICSChecker, public ConstraintsChecker { public: - TestCommand(const char * commandName) : mCommandPath(0, 0, 0), mAttributePath(0, 0, 0) {} + TestCommand(const char * commandName, uint16_t testsCount) : + TestRunner(commandName, testsCount), mCommandPath(0, 0, 0), mAttributePath(0, 0, 0) + {} virtual ~TestCommand() {} - virtual void NextTest() = 0; - void SetCommandExitStatus(CHIP_ERROR status) { chip::DeviceLayer::PlatformMgr().StopEventLoopTask(); @@ -77,15 +79,15 @@ class TestCommand : public PICSChecker, } else { - Exit(chip::ErrorStr(err)); + Exit(chip::ErrorStr(err), err); } return CHIP_NO_ERROR; } - void Exit(std::string message) override + void Exit(std::string message, CHIP_ERROR err) override { - ChipLogError(chipTool, " ***** Test Failure: %s\n", message.c_str()); - SetCommandExitStatus(CHIP_ERROR_INTERNAL); + LogEnd(err); + SetCommandExitStatus(err); } static void ScheduleNextTest(intptr_t context) @@ -139,12 +141,27 @@ class TestCommand : public PICSChecker, std::atomic_bool isRunning{ true }; + CHIP_ERROR WaitAttribute(chip::EndpointId endpointId, chip::ClusterId clusterId, chip::AttributeId attributeId) + { + ClearAttributeAndCommandPaths(); + ChipLogError(chipTool, "[Endpoint: 0x%08x Cluster: %d, Attribute: %d]", endpointId, clusterId, attributeId); + mAttributePath = chip::app::ConcreteAttributePath(endpointId, clusterId, attributeId); + return CHIP_NO_ERROR; + } + + CHIP_ERROR WaitCommand(chip::EndpointId endpointId, chip::ClusterId clusterId, chip::CommandId commandId) + { + ClearAttributeAndCommandPaths(); + ChipLogError(chipTool, "[Endpoint: 0x%08x Cluster: %d, Command: %d]", endpointId, clusterId, commandId); + mCommandPath = chip::app::ConcreteCommandPath(endpointId, clusterId, commandId); + return CHIP_NO_ERROR; + } + protected: chip::app::ConcreteCommandPath mCommandPath; chip::app::ConcreteAttributePath mAttributePath; chip::Optional mEndpointId; void SetIdentity(const char * name){}; - void Wait(){}; /////////// DelayCommands Interface ///////// void OnWaitForMs() override { NextTest(); } diff --git a/examples/placeholder/templates/templates.json b/examples/placeholder/templates/templates.json index fc2b2cc85a20bb..8efe91f4650a47 100644 --- a/examples/placeholder/templates/templates.json +++ b/examples/placeholder/templates/templates.json @@ -21,6 +21,10 @@ "name": "test_cluster", "path": "../../../examples/chip-tool/templates/tests/partials/test_cluster.zapt" }, + { + "name": "test_step", + "path": "../../../examples/chip-tool/templates/tests/partials/test_step.zapt" + }, { "name": "test_step_response", "path": "../../../examples/chip-tool/templates/tests/partials/test_step_response.zapt" diff --git a/src/app/ChunkedWriteCallback.cpp b/src/app/ChunkedWriteCallback.cpp index f20d96a13401be..eccd2b6049d5c5 100644 --- a/src/app/ChunkedWriteCallback.cpp +++ b/src/app/ChunkedWriteCallback.cpp @@ -69,6 +69,9 @@ void ChunkedWriteCallback::OnDone(WriteClient * apWriteClient) callback->OnResponse(apWriteClient, mProcessingAttributePath.Value(), mAttributeStatus); } + mProcessingAttributePath = NullOptional; + mAttributeStatus = StatusIB(); + callback->OnDone(apWriteClient); } diff --git a/src/app/tests/suites/commands/interaction_model/BUILD.gn b/src/app/tests/suites/commands/interaction_model/BUILD.gn new file mode 100644 index 00000000000000..6e4486af63357a --- /dev/null +++ b/src/app/tests/suites/commands/interaction_model/BUILD.gn @@ -0,0 +1,32 @@ +# Copyright (c) 2022 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//build_overrides/build.gni") +import("//build_overrides/chip.gni") + +static_library("interaction_model") { + output_name = "libInteractionModel" + + sources = [ + "InteractionModel.cpp", + "InteractionModel.h", + ] + + cflags = [ "-Wconversion" ] + + public_deps = [ + "${chip_root}/src/app", + "${chip_root}/src/lib/support", + ] +} diff --git a/src/app/tests/suites/commands/interaction_model/InteractionModel.cpp b/src/app/tests/suites/commands/interaction_model/InteractionModel.cpp new file mode 100644 index 00000000000000..583a15db9b1c46 --- /dev/null +++ b/src/app/tests/suites/commands/interaction_model/InteractionModel.cpp @@ -0,0 +1,245 @@ +/* + * Copyright (c) 2022 Project CHIP Authors + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#include "InteractionModel.h" + +using namespace chip; +using namespace chip::app; + +CHIP_ERROR InteractionModel::ReadAttribute(const char * identity, EndpointId endpointId, ClusterId clusterId, + AttributeId attributeId, bool fabricFiltered) +{ + DeviceProxy * device = GetDevice(identity); + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INCORRECT_STATE); + + AttributePathParams attributePathParams[1]; + if (endpointId != kInvalidEndpointId) + { + attributePathParams[0].mEndpointId = endpointId; + } + + if (clusterId != kInvalidClusterId) + { + attributePathParams[0].mClusterId = clusterId; + } + + if (attributeId != kInvalidAttributeId) + { + attributePathParams[0].mAttributeId = attributeId; + } + + ReadPrepareParams params(device->GetSecureSession().Value()); + params.mpEventPathParamsList = nullptr; + params.mEventPathParamsListSize = 0; + params.mpAttributePathParamsList = attributePathParams; + params.mAttributePathParamsListSize = 1; + params.mIsFabricFiltered = fabricFiltered; + + mReadClient = std::make_unique(InteractionModelEngine::GetInstance(), device->GetExchangeManager(), + mBufferedReadAdapter, ReadClient::InteractionType::Read); + return mReadClient->SendRequest(params); +} + +CHIP_ERROR InteractionModel::ReadEvent(const char * identity, EndpointId endpointId, ClusterId clusterId, EventId eventId, + bool fabricFiltered) +{ + DeviceProxy * device = GetDevice(identity); + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INCORRECT_STATE); + + EventPathParams eventPathParams[1]; + if (endpointId != kInvalidEndpointId) + { + eventPathParams[0].mEndpointId = endpointId; + } + + if (clusterId != kInvalidClusterId) + { + eventPathParams[0].mClusterId = clusterId; + } + + if (eventId != kInvalidEventId) + { + eventPathParams[0].mEventId = eventId; + } + + ReadPrepareParams params(device->GetSecureSession().Value()); + params.mpEventPathParamsList = eventPathParams; + params.mEventPathParamsListSize = 1; + params.mpAttributePathParamsList = nullptr; + params.mAttributePathParamsListSize = 0; + params.mIsFabricFiltered = fabricFiltered; + + // TODO: Add data version supports + mReadClient = std::make_unique(InteractionModelEngine::GetInstance(), device->GetExchangeManager(), + mBufferedReadAdapter, ReadClient::InteractionType::Read); + VerifyOrReturnError(mReadClient != nullptr, CHIP_ERROR_NO_MEMORY); + + return mReadClient->SendRequest(params); +} + +CHIP_ERROR InteractionModel::SubscribeAttribute(const char * identity, EndpointId endpointId, ClusterId clusterId, + AttributeId attributeId, uint16_t minInterval, uint16_t maxInterval, + bool fabricFiltered) +{ + DeviceProxy * device = GetDevice(identity); + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INCORRECT_STATE); + + AttributePathParams attributePathParams[1]; + if (endpointId != kInvalidEndpointId) + { + attributePathParams[0].mEndpointId = endpointId; + } + + if (clusterId != kInvalidClusterId) + { + attributePathParams[0].mClusterId = clusterId; + } + + if (attributeId != kInvalidAttributeId) + { + attributePathParams[0].mAttributeId = attributeId; + } + + ReadPrepareParams params(device->GetSecureSession().Value()); + params.mpEventPathParamsList = nullptr; + params.mEventPathParamsListSize = 0; + params.mpAttributePathParamsList = attributePathParams; + params.mAttributePathParamsListSize = 1; + params.mMinIntervalFloorSeconds = minInterval; + params.mMaxIntervalCeilingSeconds = maxInterval; + params.mIsFabricFiltered = fabricFiltered; + + mSubscribeClient = std::make_unique(InteractionModelEngine::GetInstance(), device->GetExchangeManager(), + mBufferedReadAdapter, ReadClient::InteractionType::Subscribe); + VerifyOrReturnError(mSubscribeClient != nullptr, CHIP_ERROR_NO_MEMORY); + + return mSubscribeClient->SendRequest(params); +} + +CHIP_ERROR InteractionModel::SubscribeEvent(const char * identity, EndpointId endpointId, ClusterId clusterId, EventId eventId, + uint16_t minInterval, uint16_t maxInterval, bool fabricFiltered) +{ + DeviceProxy * device = GetDevice(identity); + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INCORRECT_STATE); + + EventPathParams eventPathParams[1]; + + if (endpointId != kInvalidEndpointId) + { + eventPathParams[0].mEndpointId = endpointId; + } + + if (clusterId != kInvalidClusterId) + { + eventPathParams[0].mClusterId = clusterId; + } + + if (eventId != kInvalidEventId) + { + eventPathParams[0].mEventId = eventId; + } + + ReadPrepareParams params(device->GetSecureSession().Value()); + params.mpEventPathParamsList = eventPathParams; + params.mEventPathParamsListSize = 1; + params.mpAttributePathParamsList = nullptr; + params.mAttributePathParamsListSize = 0; + params.mMinIntervalFloorSeconds = minInterval; + params.mMaxIntervalCeilingSeconds = maxInterval; + params.mIsFabricFiltered = fabricFiltered; + + mSubscribeClient = std::make_unique(InteractionModelEngine::GetInstance(), device->GetExchangeManager(), + mBufferedReadAdapter, ReadClient::InteractionType::Subscribe); + VerifyOrReturnError(mSubscribeClient != nullptr, CHIP_ERROR_NO_MEMORY); + + return mSubscribeClient->SendRequest(params); +} + +void InteractionModel::Shutdown() +{ + mReadClient.reset(); + mSubscribeClient.reset(); + mWriteClient.reset(); + mCommandSender.reset(); +} + +/////////// ReadClient Callback Interface ///////// +void InteractionModel::OnAttributeData(const ConcreteDataAttributePath & path, TLV::TLVReader * data, const StatusIB & status) +{ + OnResponse(status, data); +} + +void InteractionModel::OnEventData(const EventHeader & eventHeader, TLV::TLVReader * data, const StatusIB * status) +{ + OnResponse(status == nullptr ? StatusIB() : *status, data); +} + +void InteractionModel::OnError(CHIP_ERROR error) +{ + StatusIB status(error); + OnResponse(status, nullptr); +} + +void InteractionModel::OnDone() +{ + mReadClient.reset(); + // TODO: Close the subscribe client + ContinueOnChipMainThread(CHIP_NO_ERROR); +} + +void InteractionModel::OnSubscriptionEstablished(uint64_t subscriptionId) +{ + ContinueOnChipMainThread(CHIP_NO_ERROR); +} + +/////////// WriteClient Callback Interface ///////// +void InteractionModel::OnResponse(const WriteClient * client, const ConcreteDataAttributePath & path, StatusIB status) +{ + OnResponse(status, nullptr); +} + +void InteractionModel::OnError(const WriteClient * client, CHIP_ERROR error) +{ + StatusIB status(error); + OnResponse(status, nullptr); +} + +void InteractionModel::OnDone(WriteClient * client) +{ + mWriteClient.reset(); + ContinueOnChipMainThread(CHIP_NO_ERROR); +} + +/////////// CommandSender Callback Interface ///////// +void InteractionModel::OnResponse(CommandSender * client, const ConcreteCommandPath & path, const StatusIB & status, + TLV::TLVReader * data) +{ + OnResponse(status, data); +} + +void InteractionModel::OnError(const CommandSender * client, CHIP_ERROR error) +{ + StatusIB status(error); + OnResponse(status, nullptr); +} + +void InteractionModel::OnDone(CommandSender * client) +{ + mCommandSender.reset(); + ContinueOnChipMainThread(CHIP_NO_ERROR); +} diff --git a/src/app/tests/suites/commands/interaction_model/InteractionModel.h b/src/app/tests/suites/commands/interaction_model/InteractionModel.h new file mode 100644 index 00000000000000..ea571b03d39d09 --- /dev/null +++ b/src/app/tests/suites/commands/interaction_model/InteractionModel.h @@ -0,0 +1,192 @@ +/* + * Copyright (c) 2022 Project CHIP Authors + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#pragma once + +#include +#include +#include +#include +#include +#include +#include + +class InteractionModel : public chip::app::ReadClient::Callback, + public chip::app::WriteClient::Callback, + public chip::app::CommandSender::Callback +{ +public: + InteractionModel() : mBufferedReadAdapter(*this), mChunkedWriteCallback(this){}; + virtual ~InteractionModel(){}; + + virtual void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) = 0; + virtual CHIP_ERROR ContinueOnChipMainThread(CHIP_ERROR err) = 0; + virtual chip::DeviceProxy * GetDevice(const char * identity) = 0; + + CHIP_ERROR ReadAttribute(const char * identity, chip::EndpointId endpointId, chip::ClusterId clusterId, + chip::AttributeId attributeId, bool fabricFiltered = true); + + CHIP_ERROR SubscribeAttribute(const char * identity, chip::EndpointId endpointId, chip::ClusterId clusterId, + chip::AttributeId attributeId, uint16_t minInterval, uint16_t maxInterval, + bool fabricFiltered = true); + + CHIP_ERROR ReadEvent(const char * identity, chip::EndpointId endpointId, chip::ClusterId clusterId, chip::EventId eventId, + bool fabricFiltered = true); + + CHIP_ERROR SubscribeEvent(const char * identity, chip::EndpointId endpointId, chip::ClusterId clusterId, chip::EventId eventId, + uint16_t minInterval, uint16_t maxInterval, bool fabricFiltered = true); + + CHIP_ERROR WaitForReport() { return CHIP_NO_ERROR; } + + template + CHIP_ERROR WriteAttribute(const char * identity, chip::EndpointId endpointId, chip::ClusterId clusterId, + chip::AttributeId attributeId, const T & value, + chip::Optional timedInteractionTimeoutMs = chip::NullOptional) + { + chip::DeviceProxy * device = GetDevice(identity); + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INCORRECT_STATE); + + chip::app::AttributePathParams attributePathParams; + if (endpointId != chip::kInvalidEndpointId) + { + attributePathParams.mEndpointId = endpointId; + } + + if (clusterId != chip::kInvalidClusterId) + { + attributePathParams.mClusterId = clusterId; + } + + if (attributeId != chip::kInvalidAttributeId) + { + attributePathParams.mAttributeId = attributeId; + } + + mWriteClient = std::make_unique(device->GetExchangeManager(), &mChunkedWriteCallback, + timedInteractionTimeoutMs); + VerifyOrReturnError(mWriteClient != nullptr, CHIP_ERROR_NO_MEMORY); + + // TODO: Add data version supports + chip::Optional dataVersion = chip::NullOptional; + ReturnErrorOnFailure(mWriteClient->EncodeAttribute(attributePathParams, value, dataVersion)); + return mWriteClient->SendWriteRequest(device->GetSecureSession().Value()); + } + + template + CHIP_ERROR WriteGroupAttribute(const char * identity, chip::GroupId groupId, chip::ClusterId clusterId, + chip::AttributeId attributeId, const T & value, + chip::Optional timedInteractionTimeoutMs = chip::NullOptional) + { + chip::DeviceProxy * device = GetDevice(identity); + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INCORRECT_STATE); + + chip::app::AttributePathParams attributePathParams; + + if (clusterId != chip::kInvalidClusterId) + { + attributePathParams.mClusterId = clusterId; + } + + if (attributeId != chip::kInvalidAttributeId) + { + attributePathParams.mAttributeId = attributeId; + } + + mWriteClient = std::make_unique(device->GetExchangeManager(), &mChunkedWriteCallback, + timedInteractionTimeoutMs); + VerifyOrReturnError(mWriteClient != nullptr, CHIP_ERROR_NO_MEMORY); + + // TODO: Add data version supports + chip::Optional dataVersion = chip::NullOptional; + ReturnErrorOnFailure(mWriteClient->EncodeAttribute(attributePathParams, value, dataVersion)); + + chip::FabricIndex fabricIndex = device->GetSecureSession().Value()->GetFabricIndex(); + chip::Transport::OutgoingGroupSession session(groupId, fabricIndex); + return mWriteClient->SendWriteRequest(chip::SessionHandle(session)); + } + + template + CHIP_ERROR SendCommand(const char * identity, chip::EndpointId endpointId, chip::ClusterId clusterId, chip::CommandId commandId, + const T & value, chip::Optional timedInteractionTimeoutMs = chip::NullOptional) + { + chip::DeviceProxy * device = GetDevice(identity); + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INCORRECT_STATE); + + chip::app::CommandPathParams commandPath = { endpointId, 0 /* groupId */, clusterId, commandId, + (chip::app::CommandPathFlags::kEndpointIdValid) }; + mCommandSender = + std::make_unique(this, device->GetExchangeManager(), timedInteractionTimeoutMs.HasValue()); + VerifyOrReturnError(mCommandSender != nullptr, CHIP_ERROR_NO_MEMORY); + + ReturnErrorOnFailure(mCommandSender->AddRequestDataNoTimedCheck(commandPath, value, timedInteractionTimeoutMs)); + return mCommandSender->SendCommandRequest(device->GetSecureSession().Value()); + } + + template + CHIP_ERROR SendGroupCommand(const char * identity, chip::GroupId groupId, chip::ClusterId clusterId, chip::CommandId commandId, + const T & value, chip::Optional timedInteractionTimeoutMs = chip::NullOptional) + { + chip::DeviceProxy * device = GetDevice(identity); + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INCORRECT_STATE); + + chip::app::CommandPathParams commandPath = { 0 /* endpoint */, groupId, clusterId, commandId, + (chip::app::CommandPathFlags::kGroupIdValid) }; + + mCommandSender = + std::make_unique(this, device->GetExchangeManager(), timedInteractionTimeoutMs.HasValue()); + VerifyOrReturnError(mCommandSender != nullptr, CHIP_ERROR_NO_MEMORY); + + chip::FabricIndex fabricIndex = device->GetSecureSession().Value()->GetFabricIndex(); + chip::Transport::OutgoingGroupSession session(groupId, fabricIndex); + ReturnErrorOnFailure(mCommandSender->AddRequestDataNoTimedCheck(commandPath, value, timedInteractionTimeoutMs)); + return mCommandSender->SendGroupCommandRequest(chip::SessionHandle(session)); + } + + void Shutdown(); + + /////////// ReadClient Callback Interface ///////// + void OnAttributeData(const chip::app::ConcreteDataAttributePath & path, chip::TLV::TLVReader * data, + const chip::app::StatusIB & status) override; + void OnEventData(const chip::app::EventHeader & eventHeader, chip::TLV::TLVReader * data, + const chip::app::StatusIB * status) override; + void OnError(CHIP_ERROR error) override; + void OnDone() override; + void OnSubscriptionEstablished(uint64_t subscriptionId) override; + + /////////// WriteClient Callback Interface ///////// + void OnResponse(const chip::app::WriteClient * client, const chip::app::ConcreteDataAttributePath & path, + chip::app::StatusIB status) override; + void OnError(const chip::app::WriteClient * client, CHIP_ERROR error) override; + void OnDone(chip::app::WriteClient * client) override; + + /////////// CommandSender Callback Interface ///////// + void OnResponse(chip::app::CommandSender * client, const chip::app::ConcreteCommandPath & path, + const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override; + void OnError(const chip::app::CommandSender * client, CHIP_ERROR error) override; + void OnDone(chip::app::CommandSender * client) override; + +protected: + std::unique_ptr mReadClient; + // TODO: Add multiple subscriptions at the same time supports + std::unique_ptr mSubscribeClient; + std::unique_ptr mWriteClient; + std::unique_ptr mCommandSender; + + chip::app::BufferedReadCallback mBufferedReadAdapter; + chip::app::ChunkedWriteCallback mChunkedWriteCallback; +}; diff --git a/src/app/tests/suites/include/ConstraintsChecker.h b/src/app/tests/suites/include/ConstraintsChecker.h index 7ac43270bfef2b..914896cefaacd3 100644 --- a/src/app/tests/suites/include/ConstraintsChecker.h +++ b/src/app/tests/suites/include/ConstraintsChecker.h @@ -30,7 +30,7 @@ class ConstraintsChecker virtual ~ConstraintsChecker(){}; protected: - virtual void Exit(std::string message) = 0; + virtual void Exit(std::string message, CHIP_ERROR err = CHIP_ERROR_INTERNAL) = 0; bool CheckConstraintType(const char * itemName, const char * current, const char * expected) { diff --git a/src/app/tests/suites/include/TestRunner.h b/src/app/tests/suites/include/TestRunner.h new file mode 100644 index 00000000000000..57ed9500c6f2c0 --- /dev/null +++ b/src/app/tests/suites/include/TestRunner.h @@ -0,0 +1,88 @@ +/* + * Copyright (c) 2022 Project CHIP Authors + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#pragma once + +#include + +class TestRunner +{ +public: + TestRunner(const char * name, uint16_t testCount) : mTestName(name), mTestCount(testCount), mTestIndex(0) {} + virtual ~TestRunner(){}; + + void LogStart() { ChipLogProgress(chipTool, " ***** Test Start : %s\n", mTestName); } + + void LogStep(uint32_t stepNumber, const char * stepName) + { + ChipLogProgress(chipTool, " ***** Test Step %u : %s\n", stepNumber, stepName); + } + + void LogEnd(CHIP_ERROR err) + { + if (CHIP_NO_ERROR == err) + { + ChipLogProgress(chipTool, " **** Test Complete: %s\n", mTestName); + } + else + { + ChipLogError(chipTool, " ***** Test Failure: %s\n", mTestName); + } + } + + virtual CHIP_ERROR DoTestStep(uint16_t testIndex) = 0; + virtual void Exit(std::string message, CHIP_ERROR err = CHIP_ERROR_INTERNAL) = 0; + + void NextTest() + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) + { + LogStart(); + } + + if (mTestCount == mTestIndex) + { + LogEnd(CHIP_NO_ERROR); + Exit(mTestName, CHIP_NO_ERROR); + return; + } + + if (mDelayInMs.HasValue()) + { + chip::test_utils::SleepMillis(mDelayInMs.Value()); + } + + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + DoTestStep(mTestIndex++); + if (CHIP_NO_ERROR != err) + { + Exit(chip::ErrorStr(err)); + } + } + +protected: + const char * mTestName; + const uint16_t mTestCount; + std::atomic_uint16_t mTestIndex; + chip::Optional mDelayInMs; +}; diff --git a/src/app/tests/suites/include/ValueChecker.h b/src/app/tests/suites/include/ValueChecker.h index 803879ea63516f..9ea70c8b67bf20 100644 --- a/src/app/tests/suites/include/ValueChecker.h +++ b/src/app/tests/suites/include/ValueChecker.h @@ -30,7 +30,7 @@ class ValueChecker virtual ~ValueChecker(){}; protected: - virtual void Exit(std::string message) = 0; + virtual void Exit(std::string message, CHIP_ERROR err = CHIP_ERROR_INTERNAL) = 0; bool CheckDecodeValue(CHIP_ERROR error) { diff --git a/src/app/zap-templates/common/ClusterTestGeneration.js b/src/app/zap-templates/common/ClusterTestGeneration.js index fafebd0a2f8a5f..d4b2d827edf4c8 100644 --- a/src/app/zap-templates/common/ClusterTestGeneration.js +++ b/src/app/zap-templates/common/ClusterTestGeneration.js @@ -88,30 +88,36 @@ function setDefaultTypeForWaitCommand(test) const type = test[kWaitCommandName]; switch (type) { case 'readEvent': + test.commandName = 'WaitEvent'; test.isEvent = true; test.isReadEvent = true; break; case 'subscribeEvent': + test.commandName = 'WaitEvent'; test.isEvent = true; test.isSubscribe = true; test.isSubscribeEvent = true; break; case 'readAttribute': + test.commandName = 'WaitAttribute'; test.isAttribute = true; test.isReadAttribute = true; break; case 'writeAttribute': + test.commandName = 'WaitAttribute'; test.isAttribute = true; test.isWriteAttribute = true; break; case 'subscribeAttribute': + test.commandName = 'WaitAttribute'; test.isAttribute = true; test.isSubscribe = true; test.isSubscribeAttribute = true; break; default: - test.isCommand = true; - test.command = test.wait + test.commandName = 'WaitCommand'; + test.isCommand = true; + test.command = test.wait break; } @@ -123,20 +129,20 @@ function setDefaultTypeForCommand(test) const type = test[kCommandName]; switch (type) { case 'readEvent': - test.commandName = 'Read'; + test.commandName = 'ReadEvent'; test.isEvent = true; test.isReadEvent = true; break; case 'subscribeEvent': - test.commandName = 'Subscribe'; + test.commandName = 'SubscribeEvent'; test.isEvent = true; test.isSubscribe = true; test.isSubscribeEvent = true; break; case 'readAttribute': - test.commandName = 'Read'; + test.commandName = 'ReadAttribute'; test.isAttribute = true; test.isReadAttribute = true; if (!(kFabricFiltered in test)) { @@ -145,17 +151,19 @@ function setDefaultTypeForCommand(test) break; case 'writeAttribute': - test.commandName = 'Write'; + test.commandName = 'WriteAttribute'; test.isAttribute = true; test.isWriteAttribute = true; if ((kGroupId in test)) { - test.isGroupCommand = true; - test.groupId = parseInt(test[kGroupId], 10); + test.isGroupCommand = true; + test.isWriteGroupAttribute = true; + test.commandName = 'WriteGroupAttribute'; + test.groupId = parseInt(test[kGroupId], 10); } break; case 'subscribeAttribute': - test.commandName = 'Subscribe'; + test.commandName = 'SubscribeAttribute'; test.isAttribute = true; test.isSubscribe = true; test.isSubscribeAttribute = true; @@ -165,16 +173,17 @@ function setDefaultTypeForCommand(test) break; case 'waitForReport': - test.commandName = 'Report'; + test.commandName = 'WaitForReport'; test.isAttribute = true; test.isWaitForReport = true; break; default: - test.commandName = test.command; + test.commandName = isTestOnlyCluster(test.cluster) ? test.command : 'SendCommand'; test.isCommand = true; if ((kGroupId in test)) { test.isGroupCommand = true; + test.commandName = 'SendGroupCommand'; test.groupId = parseInt(test[kGroupId], 10); } break; @@ -236,7 +245,7 @@ function ensureValidError(response, errorName) } } -function setDefaultResponse(test) +function setDefaultResponse(test, useSynthesizeWaitForReport) { const defaultResponse = {}; setDefault(test, kResponseName, defaultResponse); @@ -296,7 +305,7 @@ function setDefaultResponse(test) return; } - if (test.isWriteAttribute || test.isSubscribe) { + if (test.isWriteAttribute || (useSynthesizeWaitForReport && test.isSubscribe)) { if (hasResponseValueOrConstraints) { const errorStr = 'Test has a "value" or a "constraints" defined.'; throwError(test, errorStr); @@ -324,24 +333,24 @@ function setDefaultResponse(test) delete test[kResponseName].value; } -function setDefaults(test, defaultConfig) +function setDefaults(test, defaultConfig, useSynthesizeWaitForReport) { const defaultIdentityName = kIdentityName in defaultConfig ? defaultConfig[kIdentityName] : "alpha"; const defaultClusterName = defaultConfig[kClusterName] || null; const defaultEndpointId = kEndpointName in defaultConfig ? defaultConfig[kEndpointName] : null; const defaultDisabled = false; - setDefaultType(test); setDefault(test, kIdentityName, defaultIdentityName); setDefault(test, kClusterName, defaultClusterName); setDefault(test, kEndpointName, defaultEndpointId); setDefault(test, kDisabledName, defaultDisabled); + setDefaultType(test); setDefaultPICS(test); setDefaultArguments(test); - setDefaultResponse(test); + setDefaultResponse(test, useSynthesizeWaitForReport); } -function parse(filename) +function parse(filename, useSynthesizeWaitForReport) { let filepath; const isCertificationTest = filename.startsWith('Test_TC_'); @@ -354,41 +363,43 @@ function parse(filename) const data = fs.readFileSync(filepath, { encoding : 'utf8', flag : 'r' }); const yaml = YAML.parse(data); - // "subscribeAttribute" command expects a report to be acked before - // it got a success response. - // In order to validate that the report has been received with the proper value - // a "subscribeAttribute" command can have a response configured into the test step - // definition. In this case, a new async "waitForReport" test step will be synthesized - // and added to the list of tests. - yaml.tests.forEach((test, index) => { - if (test.command == "subscribeAttribute" && test.response) { - // Create a new report test where the expected response is the response argument - // for the "subscribeAttributeTest" - const reportTest = { - label : "Report: " + test.label, - command : "waitForReport", - attribute : test.attribute, - response : test.response, - async : true, - allocateSubscribeDataCallback : true, - }; - delete test.response; - - // insert the new report test into the tests list - yaml.tests.splice(index, 0, reportTest); - - // Associate the "subscribeAttribute" test with the synthesized report test - test.hasWaitForReport = true; - test.waitForReport = reportTest; - test.allocateSubscribeDataCallback = !test.hasWaitForReport; - } - }); + if (useSynthesizeWaitForReport) { + // "subscribeAttribute" command expects a report to be acked before + // it got a success response. + // In order to validate that the report has been received with the proper value + // a "subscribeAttribute" command can have a response configured into the test step + // definition. In this case, a new async "waitForReport" test step will be synthesized + // and added to the list of tests. + yaml.tests.forEach((test, index) => { + if (test.command == "subscribeAttribute" && test.response) { + // Create a new report test where the expected response is the response argument + // for the "subscribeAttributeTest" + const reportTest = { + label : "Report: " + test.label, + command : "waitForReport", + attribute : test.attribute, + response : test.response, + async : true, + allocateSubscribeDataCallback : true, + }; + delete test.response; + + // insert the new report test into the tests list + yaml.tests.splice(index, 0, reportTest); + + // Associate the "subscribeAttribute" test with the synthesized report test + test.hasWaitForReport = true; + test.waitForReport = reportTest; + test.allocateSubscribeDataCallback = !test.hasWaitForReport; + } + }); + } const defaultConfig = yaml.config || []; yaml.tests.forEach(test => { test.filename = filename; test.testName = yaml.name; - setDefaults(test, defaultConfig); + setDefaults(test, defaultConfig, useSynthesizeWaitForReport); }); // Filter disabled tests @@ -491,7 +502,7 @@ async function chip_tests(list, options) let global = this.global; const items = Array.isArray(list) ? list : list.split(','); const names = items.map(name => name.trim()); - let tests = names.map(item => parse(item)); + let tests = names.map(item => parse(item, options.hash.useSynthesizeWaitForReport)); const context = this; tests = await Promise.all(tests.map(async function(test) { @@ -656,6 +667,10 @@ function checkNumberSanity(value, errorContext) function chip_tests_item_parameters(options) { + if (this.isWait) { + return asBlocks.call(this, Promise.resolve([]), options); + } + const commandValues = this.arguments.values; const promise = assertCommandOrAttributeOrEvent(this).then(item => { diff --git a/src/darwin/Framework/CHIP/templates/tests/partials/test_cluster.zapt b/src/darwin/Framework/CHIP/templates/tests/partials/test_cluster.zapt index b7ac79f3fec77b..2d6567a39b9dc6 100644 --- a/src/darwin/Framework/CHIP/templates/tests/partials/test_cluster.zapt +++ b/src/darwin/Framework/CHIP/templates/tests/partials/test_cluster.zapt @@ -1,4 +1,4 @@ -{{#chip_tests tests}} +{{#chip_tests tests useSynthesizeWaitForReport=true}} {{#chip_tests_items}} {{#if async}} bool testSendCluster{{parent.filename}}_{{asTestIndex index}}_{{asUpperCamelCase command}}_Fulfilled = false; diff --git a/zzz_generated/chip-tool/zap-generated/test/Commands.h b/zzz_generated/chip-tool/zap-generated/test/Commands.h index 6e26334cad0b11..e8c631020ff9d1 100644 --- a/zzz_generated/chip-tool/zap-generated/test/Commands.h +++ b/zzz_generated/chip-tool/zap-generated/test/Commands.h @@ -384,7 +384,7 @@ class TestAccessControlClusterSuite : public TestCommand { public: TestAccessControlClusterSuite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("TestAccessControlCluster", credsIssuerConfig), mTestIndex(0) + TestCommand("TestAccessControlCluster", 22, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -394,151 +394,381 @@ class TestAccessControlClusterSuite : public TestCommand ~TestAccessControlClusterSuite() {} - /////////// TestCommand Interface ///////// - void NextTest() override + chip::System::Clock::Timeout GetWaitDuration() const override { - CHIP_ERROR err = CHIP_NO_ERROR; + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: TestAccessControlCluster\n"); - } +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: TestAccessControlCluster\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // - Wait(); + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override + { + bool shouldContinue = false; - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) + switch (mTestIndex - 1) { case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for commissionee\n"); - err = TestWaitForCommissionee_0(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; break; case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Write entries\n"); - err = TestWriteEntries_1(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Verify\n"); - err = TestVerify_2(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList + value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + { + auto iter_0 = value.begin(); + VerifyOrReturn(CheckNextListItemDecodes("acl", iter_0, 0)); + VerifyOrReturn(CheckValue("acl[0].privilege", iter_0.GetValue().privilege, 5)); + VerifyOrReturn(CheckValue("acl[0].authMode", iter_0.GetValue().authMode, 2)); + VerifyOrReturn(CheckValueNull("acl[0].subjects", iter_0.GetValue().subjects)); + VerifyOrReturn(CheckValueNonNull("acl[0].targets", iter_0.GetValue().targets)); + { + auto iter_NaN = iter_0.GetValue().targets.Value().begin(); + VerifyOrReturn(CheckNextListItemDecodes( + "acl[0].targets.Value()", iter_NaN, 0)); + VerifyOrReturn(CheckValueNull("acl[0].targets.Value()[0].cluster", iter_NaN.GetValue().cluster)); + VerifyOrReturn(CheckValueNonNull("acl[0].targets.Value()[0].endpoint", iter_NaN.GetValue().endpoint)); + VerifyOrReturn( + CheckValue("acl[0].targets.Value()[0].endpoint.Value()", iter_NaN.GetValue().endpoint.Value(), 0U)); + VerifyOrReturn(CheckValueNull("acl[0].targets.Value()[0].deviceType", iter_NaN.GetValue().deviceType)); + VerifyOrReturn(CheckNextListItemDecodes( + "acl[0].targets.Value()", iter_NaN, 1)); + VerifyOrReturn(CheckValueNonNull("acl[0].targets.Value()[1].cluster", iter_NaN.GetValue().cluster)); + VerifyOrReturn( + CheckValue("acl[0].targets.Value()[1].cluster.Value()", iter_NaN.GetValue().cluster.Value(), 1UL)); + VerifyOrReturn(CheckValueNull("acl[0].targets.Value()[1].endpoint", iter_NaN.GetValue().endpoint)); + VerifyOrReturn(CheckValueNull("acl[0].targets.Value()[1].deviceType", iter_NaN.GetValue().deviceType)); + VerifyOrReturn(CheckNextListItemDecodes( + "acl[0].targets.Value()", iter_NaN, 2)); + VerifyOrReturn(CheckValueNonNull("acl[0].targets.Value()[2].cluster", iter_NaN.GetValue().cluster)); + VerifyOrReturn( + CheckValue("acl[0].targets.Value()[2].cluster.Value()", iter_NaN.GetValue().cluster.Value(), 2UL)); + VerifyOrReturn(CheckValueNonNull("acl[0].targets.Value()[2].endpoint", iter_NaN.GetValue().endpoint)); + VerifyOrReturn( + CheckValue("acl[0].targets.Value()[2].endpoint.Value()", iter_NaN.GetValue().endpoint.Value(), 3U)); + VerifyOrReturn(CheckValueNull("acl[0].targets.Value()[2].deviceType", iter_NaN.GetValue().deviceType)); + VerifyOrReturn(CheckNoMoreListItems("acl[0].targets.Value()", + iter_NaN, 3)); + } + VerifyOrReturn(CheckValue("acl[0].fabricIndex", iter_0.GetValue().fabricIndex, 1)); + VerifyOrReturn(CheckNextListItemDecodes("acl", iter_0, 1)); + VerifyOrReturn(CheckValue("acl[1].privilege", iter_0.GetValue().privilege, 1)); + VerifyOrReturn(CheckValue("acl[1].authMode", iter_0.GetValue().authMode, 2)); + VerifyOrReturn(CheckValueNonNull("acl[1].subjects", iter_0.GetValue().subjects)); + { + auto iter_NaN = iter_0.GetValue().subjects.Value().begin(); + VerifyOrReturn(CheckNextListItemDecodes( + "acl[1].subjects.Value()", iter_NaN, 0)); + VerifyOrReturn(CheckValue("acl[1].subjects.Value()[0]", iter_NaN.GetValue(), 4ULL)); + VerifyOrReturn(CheckNextListItemDecodes( + "acl[1].subjects.Value()", iter_NaN, 1)); + VerifyOrReturn(CheckValue("acl[1].subjects.Value()[1]", iter_NaN.GetValue(), 5ULL)); + VerifyOrReturn(CheckNextListItemDecodes( + "acl[1].subjects.Value()", iter_NaN, 2)); + VerifyOrReturn(CheckValue("acl[1].subjects.Value()[2]", iter_NaN.GetValue(), 6ULL)); + VerifyOrReturn(CheckNextListItemDecodes( + "acl[1].subjects.Value()", iter_NaN, 3)); + VerifyOrReturn(CheckValue("acl[1].subjects.Value()[3]", iter_NaN.GetValue(), 7ULL)); + VerifyOrReturn(CheckNoMoreListItems("acl[1].subjects.Value()", + iter_NaN, 4)); + } + VerifyOrReturn(CheckValueNonNull("acl[1].targets", iter_0.GetValue().targets)); + { + auto iter_NaN = iter_0.GetValue().targets.Value().begin(); + VerifyOrReturn(CheckNextListItemDecodes( + "acl[1].targets.Value()", iter_NaN, 0)); + VerifyOrReturn(CheckValueNull("acl[1].targets.Value()[0].cluster", iter_NaN.GetValue().cluster)); + VerifyOrReturn(CheckValueNonNull("acl[1].targets.Value()[0].endpoint", iter_NaN.GetValue().endpoint)); + VerifyOrReturn( + CheckValue("acl[1].targets.Value()[0].endpoint.Value()", iter_NaN.GetValue().endpoint.Value(), 8U)); + VerifyOrReturn(CheckValueNull("acl[1].targets.Value()[0].deviceType", iter_NaN.GetValue().deviceType)); + VerifyOrReturn(CheckNextListItemDecodes( + "acl[1].targets.Value()", iter_NaN, 1)); + VerifyOrReturn(CheckValueNonNull("acl[1].targets.Value()[1].cluster", iter_NaN.GetValue().cluster)); + VerifyOrReturn( + CheckValue("acl[1].targets.Value()[1].cluster.Value()", iter_NaN.GetValue().cluster.Value(), 9UL)); + VerifyOrReturn(CheckValueNull("acl[1].targets.Value()[1].endpoint", iter_NaN.GetValue().endpoint)); + VerifyOrReturn(CheckValueNull("acl[1].targets.Value()[1].deviceType", iter_NaN.GetValue().deviceType)); + VerifyOrReturn(CheckNextListItemDecodes( + "acl[1].targets.Value()", iter_NaN, 2)); + VerifyOrReturn(CheckValueNonNull("acl[1].targets.Value()[2].cluster", iter_NaN.GetValue().cluster)); + VerifyOrReturn( + CheckValue("acl[1].targets.Value()[2].cluster.Value()", iter_NaN.GetValue().cluster.Value(), 10UL)); + VerifyOrReturn(CheckValueNonNull("acl[1].targets.Value()[2].endpoint", iter_NaN.GetValue().endpoint)); + VerifyOrReturn( + CheckValue("acl[1].targets.Value()[2].endpoint.Value()", iter_NaN.GetValue().endpoint.Value(), 11U)); + VerifyOrReturn(CheckValueNull("acl[1].targets.Value()[2].deviceType", iter_NaN.GetValue().deviceType)); + VerifyOrReturn(CheckNoMoreListItems("acl[1].targets.Value()", + iter_NaN, 3)); + } + VerifyOrReturn(CheckValue("acl[1].fabricIndex", iter_0.GetValue().fabricIndex, 1)); + VerifyOrReturn(CheckNextListItemDecodes("acl", iter_0, 2)); + VerifyOrReturn(CheckValue("acl[2].privilege", iter_0.GetValue().privilege, 3)); + VerifyOrReturn(CheckValue("acl[2].authMode", iter_0.GetValue().authMode, 3)); + VerifyOrReturn(CheckValueNonNull("acl[2].subjects", iter_0.GetValue().subjects)); + { + auto iter_NaN = iter_0.GetValue().subjects.Value().begin(); + VerifyOrReturn(CheckNextListItemDecodes( + "acl[2].subjects.Value()", iter_NaN, 0)); + VerifyOrReturn(CheckValue("acl[2].subjects.Value()[0]", iter_NaN.GetValue(), 12ULL)); + VerifyOrReturn(CheckNextListItemDecodes( + "acl[2].subjects.Value()", iter_NaN, 1)); + VerifyOrReturn(CheckValue("acl[2].subjects.Value()[1]", iter_NaN.GetValue(), 13ULL)); + VerifyOrReturn(CheckNextListItemDecodes( + "acl[2].subjects.Value()", iter_NaN, 2)); + VerifyOrReturn(CheckValue("acl[2].subjects.Value()[2]", iter_NaN.GetValue(), 14ULL)); + VerifyOrReturn(CheckNextListItemDecodes( + "acl[2].subjects.Value()", iter_NaN, 3)); + VerifyOrReturn(CheckValue("acl[2].subjects.Value()[3]", iter_NaN.GetValue(), 15ULL)); + VerifyOrReturn(CheckNoMoreListItems("acl[2].subjects.Value()", + iter_NaN, 4)); + } + VerifyOrReturn(CheckValueNonNull("acl[2].targets", iter_0.GetValue().targets)); + { + auto iter_NaN = iter_0.GetValue().targets.Value().begin(); + VerifyOrReturn(CheckNextListItemDecodes( + "acl[2].targets.Value()", iter_NaN, 0)); + VerifyOrReturn(CheckValueNull("acl[2].targets.Value()[0].cluster", iter_NaN.GetValue().cluster)); + VerifyOrReturn(CheckValueNonNull("acl[2].targets.Value()[0].endpoint", iter_NaN.GetValue().endpoint)); + VerifyOrReturn( + CheckValue("acl[2].targets.Value()[0].endpoint.Value()", iter_NaN.GetValue().endpoint.Value(), 16U)); + VerifyOrReturn(CheckValueNull("acl[2].targets.Value()[0].deviceType", iter_NaN.GetValue().deviceType)); + VerifyOrReturn(CheckNextListItemDecodes( + "acl[2].targets.Value()", iter_NaN, 1)); + VerifyOrReturn(CheckValueNonNull("acl[2].targets.Value()[1].cluster", iter_NaN.GetValue().cluster)); + VerifyOrReturn( + CheckValue("acl[2].targets.Value()[1].cluster.Value()", iter_NaN.GetValue().cluster.Value(), 17UL)); + VerifyOrReturn(CheckValueNull("acl[2].targets.Value()[1].endpoint", iter_NaN.GetValue().endpoint)); + VerifyOrReturn(CheckValueNull("acl[2].targets.Value()[1].deviceType", iter_NaN.GetValue().deviceType)); + VerifyOrReturn(CheckNextListItemDecodes( + "acl[2].targets.Value()", iter_NaN, 2)); + VerifyOrReturn(CheckValueNonNull("acl[2].targets.Value()[2].cluster", iter_NaN.GetValue().cluster)); + VerifyOrReturn( + CheckValue("acl[2].targets.Value()[2].cluster.Value()", iter_NaN.GetValue().cluster.Value(), 18UL)); + VerifyOrReturn(CheckValueNonNull("acl[2].targets.Value()[2].endpoint", iter_NaN.GetValue().endpoint)); + VerifyOrReturn( + CheckValue("acl[2].targets.Value()[2].endpoint.Value()", iter_NaN.GetValue().endpoint.Value(), 19U)); + VerifyOrReturn(CheckValueNull("acl[2].targets.Value()[2].deviceType", iter_NaN.GetValue().deviceType)); + VerifyOrReturn(CheckNoMoreListItems("acl[2].targets.Value()", + iter_NaN, 3)); + } + VerifyOrReturn(CheckValue("acl[2].fabricIndex", iter_0.GetValue().fabricIndex, 1)); + VerifyOrReturn(CheckNoMoreListItems("acl", iter_0, 3)); + } + } break; case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Write entries empty lists\n"); - err = TestWriteEntriesEmptyLists_3(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Verify\n"); - err = TestVerify_4(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList + value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + { + auto iter_0 = value.begin(); + VerifyOrReturn(CheckNextListItemDecodes("acl", iter_0, 0)); + VerifyOrReturn(CheckValue("acl[0].privilege", iter_0.GetValue().privilege, 5)); + VerifyOrReturn(CheckValue("acl[0].authMode", iter_0.GetValue().authMode, 2)); + VerifyOrReturn(CheckValueNull("acl[0].subjects", iter_0.GetValue().subjects)); + VerifyOrReturn(CheckValueNull("acl[0].targets", iter_0.GetValue().targets)); + VerifyOrReturn(CheckValue("acl[0].fabricIndex", iter_0.GetValue().fabricIndex, 1)); + VerifyOrReturn(CheckNextListItemDecodes("acl", iter_0, 1)); + VerifyOrReturn(CheckValue("acl[1].privilege", iter_0.GetValue().privilege, 1)); + VerifyOrReturn(CheckValue("acl[1].authMode", iter_0.GetValue().authMode, 2)); + VerifyOrReturn(CheckValueNull("acl[1].subjects", iter_0.GetValue().subjects)); + VerifyOrReturn(CheckValueNull("acl[1].targets", iter_0.GetValue().targets)); + VerifyOrReturn(CheckValue("acl[1].fabricIndex", iter_0.GetValue().fabricIndex, 1)); + VerifyOrReturn(CheckNoMoreListItems("acl", iter_0, 2)); + } + } break; case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Write entry invalid privilege\n"); - err = TestWriteEntryInvalidPrivilege_5(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 1)); break; case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : Verify\n"); - err = TestVerify_6(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList + value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + { + auto iter_0 = value.begin(); + VerifyOrReturn(CheckNextListItemDecodes("acl", iter_0, 0)); + VerifyOrReturn(CheckValue("acl[0].privilege", iter_0.GetValue().privilege, 5)); + VerifyOrReturn(CheckValue("acl[0].authMode", iter_0.GetValue().authMode, 2)); + VerifyOrReturn(CheckValueNull("acl[0].subjects", iter_0.GetValue().subjects)); + VerifyOrReturn(CheckValueNull("acl[0].targets", iter_0.GetValue().targets)); + VerifyOrReturn(CheckValue("acl[0].fabricIndex", iter_0.GetValue().fabricIndex, 1)); + VerifyOrReturn(CheckNoMoreListItems("acl", iter_0, 1)); + } + } break; case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : Write entry invalid auth mode\n"); - err = TestWriteEntryInvalidAuthMode_7(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 1)); break; case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : Verify\n"); - err = TestVerify_8(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList + value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + { + auto iter_0 = value.begin(); + VerifyOrReturn(CheckNextListItemDecodes("acl", iter_0, 0)); + VerifyOrReturn(CheckValue("acl[0].privilege", iter_0.GetValue().privilege, 5)); + VerifyOrReturn(CheckValue("acl[0].authMode", iter_0.GetValue().authMode, 2)); + VerifyOrReturn(CheckValueNull("acl[0].subjects", iter_0.GetValue().subjects)); + VerifyOrReturn(CheckValueNull("acl[0].targets", iter_0.GetValue().targets)); + VerifyOrReturn(CheckValue("acl[0].fabricIndex", iter_0.GetValue().fabricIndex, 1)); + VerifyOrReturn(CheckNoMoreListItems("acl", iter_0, 1)); + } + } break; case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : Write entry invalid subject\n"); - err = TestWriteEntryInvalidSubject_9(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 1)); break; case 10: - ChipLogProgress(chipTool, " ***** Test Step 10 : Verify\n"); - err = TestVerify_10(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList + value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + { + auto iter_0 = value.begin(); + VerifyOrReturn(CheckNextListItemDecodes("acl", iter_0, 0)); + VerifyOrReturn(CheckValue("acl[0].privilege", iter_0.GetValue().privilege, 5)); + VerifyOrReturn(CheckValue("acl[0].authMode", iter_0.GetValue().authMode, 2)); + VerifyOrReturn(CheckValueNull("acl[0].subjects", iter_0.GetValue().subjects)); + VerifyOrReturn(CheckValueNull("acl[0].targets", iter_0.GetValue().targets)); + VerifyOrReturn(CheckValue("acl[0].fabricIndex", iter_0.GetValue().fabricIndex, 1)); + VerifyOrReturn(CheckNoMoreListItems("acl", iter_0, 1)); + } + } break; case 11: - ChipLogProgress(chipTool, " ***** Test Step 11 : Write entry invalid target\n"); - err = TestWriteEntryInvalidTarget_11(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 1)); break; case 12: - ChipLogProgress(chipTool, " ***** Test Step 12 : Verify\n"); - err = TestVerify_12(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList + value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + { + auto iter_0 = value.begin(); + VerifyOrReturn(CheckNextListItemDecodes("acl", iter_0, 0)); + VerifyOrReturn(CheckValue("acl[0].privilege", iter_0.GetValue().privilege, 5)); + VerifyOrReturn(CheckValue("acl[0].authMode", iter_0.GetValue().authMode, 2)); + VerifyOrReturn(CheckValueNull("acl[0].subjects", iter_0.GetValue().subjects)); + VerifyOrReturn(CheckValueNull("acl[0].targets", iter_0.GetValue().targets)); + VerifyOrReturn(CheckValue("acl[0].fabricIndex", iter_0.GetValue().fabricIndex, 1)); + VerifyOrReturn(CheckNoMoreListItems("acl", iter_0, 1)); + } + } break; case 13: - ChipLogProgress(chipTool, " ***** Test Step 13 : Write entry too many subjects\n"); - err = TestWriteEntryTooManySubjects_13(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 1)); break; case 14: - ChipLogProgress(chipTool, " ***** Test Step 14 : Verify\n"); - err = TestVerify_14(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList + value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + { + auto iter_0 = value.begin(); + VerifyOrReturn(CheckNextListItemDecodes("acl", iter_0, 0)); + VerifyOrReturn(CheckValue("acl[0].privilege", iter_0.GetValue().privilege, 5)); + VerifyOrReturn(CheckValue("acl[0].authMode", iter_0.GetValue().authMode, 2)); + VerifyOrReturn(CheckValueNull("acl[0].subjects", iter_0.GetValue().subjects)); + VerifyOrReturn(CheckValueNull("acl[0].targets", iter_0.GetValue().targets)); + VerifyOrReturn(CheckValue("acl[0].fabricIndex", iter_0.GetValue().fabricIndex, 1)); + VerifyOrReturn(CheckNoMoreListItems("acl", iter_0, 1)); + } + } break; case 15: - ChipLogProgress(chipTool, " ***** Test Step 15 : Write entry too many targets\n"); - err = TestWriteEntryTooManyTargets_15(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 1)); break; case 16: - ChipLogProgress(chipTool, " ***** Test Step 16 : Verify\n"); - err = TestVerify_16(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList + value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + { + auto iter_0 = value.begin(); + VerifyOrReturn(CheckNextListItemDecodes("acl", iter_0, 0)); + VerifyOrReturn(CheckValue("acl[0].privilege", iter_0.GetValue().privilege, 5)); + VerifyOrReturn(CheckValue("acl[0].authMode", iter_0.GetValue().authMode, 2)); + VerifyOrReturn(CheckValueNull("acl[0].subjects", iter_0.GetValue().subjects)); + VerifyOrReturn(CheckValueNull("acl[0].targets", iter_0.GetValue().targets)); + VerifyOrReturn(CheckValue("acl[0].fabricIndex", iter_0.GetValue().fabricIndex, 1)); + VerifyOrReturn(CheckNoMoreListItems("acl", iter_0, 1)); + } + } break; case 17: - ChipLogProgress(chipTool, " ***** Test Step 17 : Restore ACL\n"); - err = TestRestoreAcl_17(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; case 18: - ChipLogProgress(chipTool, " ***** Test Step 18 : Verify\n"); - err = TestVerify_18(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList + value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + { + auto iter_0 = value.begin(); + VerifyOrReturn(CheckNextListItemDecodes("acl", iter_0, 0)); + VerifyOrReturn(CheckValue("acl[0].privilege", iter_0.GetValue().privilege, 5)); + VerifyOrReturn(CheckValue("acl[0].authMode", iter_0.GetValue().authMode, 2)); + VerifyOrReturn(CheckValueNull("acl[0].subjects", iter_0.GetValue().subjects)); + VerifyOrReturn(CheckValueNull("acl[0].targets", iter_0.GetValue().targets)); + VerifyOrReturn(CheckValue("acl[0].fabricIndex", iter_0.GetValue().fabricIndex, 1)); + VerifyOrReturn(CheckNoMoreListItems("acl", iter_0, 1)); + } + } break; case 19: - ChipLogProgress(chipTool, " ***** Test Step 19 : Validate resource minima (SubjectsPerAccessControlEntry)\n"); - err = TestValidateResourceMinimaSubjectsPerAccessControlEntry_19(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintMinValue("value", value, 4U)); + } break; case 20: - ChipLogProgress(chipTool, " ***** Test Step 20 : Validate resource minima (TargetsPerAccessControlEntry)\n"); - err = TestValidateResourceMinimaTargetsPerAccessControlEntry_20(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintMinValue("value", value, 3U)); + } break; case 21: - ChipLogProgress(chipTool, " ***** Test Step 21 : Validate resource minima (AccessControlEntriesPerFabric)\n"); - err = TestValidateResourceMinimaAccessControlEntriesPerFabric_21(); - break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 22; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintMinValue("value", value, 3U)); + } break; default: LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); @@ -550,1404 +780,1312 @@ class TestAccessControlClusterSuite : public TestCommand } } - static void OnFailureCallback_1(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_1(error); - } - - static void OnSuccessCallback_1(void * context) - { - (static_cast(context))->OnSuccessResponse_1(); - } - - static void OnFailureCallback_2(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_2(error); - } - - static void OnSuccessCallback_2( - void * context, - const chip::app::DataModel::DecodableList & - acl) - { - (static_cast(context))->OnSuccessResponse_2(acl); - } - - static void OnFailureCallback_3(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_3(error); - } - - static void OnSuccessCallback_3(void * context) - { - (static_cast(context))->OnSuccessResponse_3(); - } - - static void OnFailureCallback_4(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_4(error); - } - - static void OnSuccessCallback_4( - void * context, - const chip::app::DataModel::DecodableList & - acl) - { - (static_cast(context))->OnSuccessResponse_4(acl); - } - - static void OnFailureCallback_5(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_5(error); - } - - static void OnSuccessCallback_5(void * context) + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - (static_cast(context))->OnSuccessResponse_5(); - } - - static void OnFailureCallback_6(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_6(error); - } - - static void OnSuccessCallback_6( - void * context, - const chip::app::DataModel::DecodableList & - acl) - { - (static_cast(context))->OnSuccessResponse_6(acl); - } + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for commissionee"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "Write entries"); + ListFreer listFreer; + chip::app::DataModel::List value; - static void OnFailureCallback_7(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_7(error); - } + { + auto * listHolder_0 = new ListHolder(3); + listFreer.add(listHolder_0); - static void OnSuccessCallback_7(void * context) - { - (static_cast(context))->OnSuccessResponse_7(); - } + listHolder_0->mList[0].privilege = static_cast(5); + listHolder_0->mList[0].authMode = static_cast(2); + listHolder_0->mList[0].subjects.SetNull(); + listHolder_0->mList[0].targets.SetNonNull(); - static void OnFailureCallback_8(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_8(error); - } + { + auto * listHolder_3 = new ListHolder(3); + listFreer.add(listHolder_3); + + listHolder_3->mList[0].cluster.SetNull(); + listHolder_3->mList[0].endpoint.SetNonNull(); + listHolder_3->mList[0].endpoint.Value() = 0U; + listHolder_3->mList[0].deviceType.SetNull(); + + listHolder_3->mList[1].cluster.SetNonNull(); + listHolder_3->mList[1].cluster.Value() = 1UL; + listHolder_3->mList[1].endpoint.SetNull(); + listHolder_3->mList[1].deviceType.SetNull(); + + listHolder_3->mList[2].cluster.SetNonNull(); + listHolder_3->mList[2].cluster.Value() = 2UL; + listHolder_3->mList[2].endpoint.SetNonNull(); + listHolder_3->mList[2].endpoint.Value() = 3U; + listHolder_3->mList[2].deviceType.SetNull(); + + listHolder_0->mList[0].targets.Value() = + chip::app::DataModel::List(listHolder_3->mList, + 3); + } + listHolder_0->mList[0].fabricIndex = 0; - static void OnSuccessCallback_8( - void * context, - const chip::app::DataModel::DecodableList & - acl) - { - (static_cast(context))->OnSuccessResponse_8(acl); - } + listHolder_0->mList[1].privilege = static_cast(1); + listHolder_0->mList[1].authMode = static_cast(2); + listHolder_0->mList[1].subjects.SetNonNull(); - static void OnFailureCallback_9(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_9(error); - } + { + auto * listHolder_3 = new ListHolder(4); + listFreer.add(listHolder_3); + listHolder_3->mList[0] = 4ULL; + listHolder_3->mList[1] = 5ULL; + listHolder_3->mList[2] = 6ULL; + listHolder_3->mList[3] = 7ULL; + listHolder_0->mList[1].subjects.Value() = chip::app::DataModel::List(listHolder_3->mList, 4); + } + listHolder_0->mList[1].targets.SetNonNull(); - static void OnSuccessCallback_9(void * context) - { - (static_cast(context))->OnSuccessResponse_9(); - } + { + auto * listHolder_3 = new ListHolder(3); + listFreer.add(listHolder_3); + + listHolder_3->mList[0].cluster.SetNull(); + listHolder_3->mList[0].endpoint.SetNonNull(); + listHolder_3->mList[0].endpoint.Value() = 8U; + listHolder_3->mList[0].deviceType.SetNull(); + + listHolder_3->mList[1].cluster.SetNonNull(); + listHolder_3->mList[1].cluster.Value() = 9UL; + listHolder_3->mList[1].endpoint.SetNull(); + listHolder_3->mList[1].deviceType.SetNull(); + + listHolder_3->mList[2].cluster.SetNonNull(); + listHolder_3->mList[2].cluster.Value() = 10UL; + listHolder_3->mList[2].endpoint.SetNonNull(); + listHolder_3->mList[2].endpoint.Value() = 11U; + listHolder_3->mList[2].deviceType.SetNull(); + + listHolder_0->mList[1].targets.Value() = + chip::app::DataModel::List(listHolder_3->mList, + 3); + } + listHolder_0->mList[1].fabricIndex = 0; - static void OnFailureCallback_10(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_10(error); - } + listHolder_0->mList[2].privilege = static_cast(3); + listHolder_0->mList[2].authMode = static_cast(3); + listHolder_0->mList[2].subjects.SetNonNull(); - static void OnSuccessCallback_10( - void * context, - const chip::app::DataModel::DecodableList & - acl) - { - (static_cast(context))->OnSuccessResponse_10(acl); - } + { + auto * listHolder_3 = new ListHolder(4); + listFreer.add(listHolder_3); + listHolder_3->mList[0] = 12ULL; + listHolder_3->mList[1] = 13ULL; + listHolder_3->mList[2] = 14ULL; + listHolder_3->mList[3] = 15ULL; + listHolder_0->mList[2].subjects.Value() = chip::app::DataModel::List(listHolder_3->mList, 4); + } + listHolder_0->mList[2].targets.SetNonNull(); - static void OnFailureCallback_11(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_11(error); - } + { + auto * listHolder_3 = new ListHolder(3); + listFreer.add(listHolder_3); + + listHolder_3->mList[0].cluster.SetNull(); + listHolder_3->mList[0].endpoint.SetNonNull(); + listHolder_3->mList[0].endpoint.Value() = 16U; + listHolder_3->mList[0].deviceType.SetNull(); + + listHolder_3->mList[1].cluster.SetNonNull(); + listHolder_3->mList[1].cluster.Value() = 17UL; + listHolder_3->mList[1].endpoint.SetNull(); + listHolder_3->mList[1].deviceType.SetNull(); + + listHolder_3->mList[2].cluster.SetNonNull(); + listHolder_3->mList[2].cluster.Value() = 18UL; + listHolder_3->mList[2].endpoint.SetNonNull(); + listHolder_3->mList[2].endpoint.Value() = 19U; + listHolder_3->mList[2].deviceType.SetNull(); + + listHolder_0->mList[2].targets.Value() = + chip::app::DataModel::List(listHolder_3->mList, + 3); + } + listHolder_0->mList[2].fabricIndex = 0; - static void OnSuccessCallback_11(void * context) - { - (static_cast(context))->OnSuccessResponse_11(); - } + value = chip::app::DataModel::List( + listHolder_0->mList, 3); + } + return WriteAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Acl::Id, value); + } + case 2: { + LogStep(2, "Verify"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Acl::Id); + } + case 3: { + LogStep(3, "Write entries empty lists"); + ListFreer listFreer; + chip::app::DataModel::List value; - static void OnFailureCallback_12(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_12(error); - } + { + auto * listHolder_0 = new ListHolder(2); + listFreer.add(listHolder_0); - static void OnSuccessCallback_12( - void * context, - const chip::app::DataModel::DecodableList & - acl) - { - (static_cast(context))->OnSuccessResponse_12(acl); - } + listHolder_0->mList[0].privilege = static_cast(5); + listHolder_0->mList[0].authMode = static_cast(2); + listHolder_0->mList[0].subjects.SetNull(); + listHolder_0->mList[0].targets.SetNull(); + listHolder_0->mList[0].fabricIndex = 0; - static void OnFailureCallback_13(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_13(error); - } + listHolder_0->mList[1].privilege = static_cast(1); + listHolder_0->mList[1].authMode = static_cast(2); + listHolder_0->mList[1].subjects.SetNonNull(); - static void OnSuccessCallback_13(void * context) - { - (static_cast(context))->OnSuccessResponse_13(); - } + listHolder_0->mList[1].subjects.Value() = chip::app::DataModel::List(); + listHolder_0->mList[1].targets.SetNonNull(); - static void OnFailureCallback_14(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_14(error); - } + listHolder_0->mList[1].targets.Value() = + chip::app::DataModel::List(); + listHolder_0->mList[1].fabricIndex = 0; - static void OnSuccessCallback_14( - void * context, - const chip::app::DataModel::DecodableList & - acl) - { - (static_cast(context))->OnSuccessResponse_14(acl); - } + value = chip::app::DataModel::List( + listHolder_0->mList, 2); + } + return WriteAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Acl::Id, value); + } + case 4: { + LogStep(4, "Verify"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Acl::Id); + } + case 5: { + LogStep(5, "Write entry invalid privilege"); + ListFreer listFreer; + chip::app::DataModel::List value; - static void OnFailureCallback_15(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_15(error); - } + { + auto * listHolder_0 = new ListHolder(2); + listFreer.add(listHolder_0); - static void OnSuccessCallback_15(void * context) - { - (static_cast(context))->OnSuccessResponse_15(); - } + listHolder_0->mList[0].privilege = static_cast(5); + listHolder_0->mList[0].authMode = static_cast(2); + listHolder_0->mList[0].subjects.SetNull(); + listHolder_0->mList[0].targets.SetNull(); + listHolder_0->mList[0].fabricIndex = 0; - static void OnFailureCallback_16(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_16(error); - } + listHolder_0->mList[1].privilege = static_cast(5); + listHolder_0->mList[1].authMode = static_cast(3); + listHolder_0->mList[1].subjects.SetNull(); + listHolder_0->mList[1].targets.SetNull(); + listHolder_0->mList[1].fabricIndex = 0; - static void OnSuccessCallback_16( - void * context, - const chip::app::DataModel::DecodableList & - acl) - { - (static_cast(context))->OnSuccessResponse_16(acl); - } + value = chip::app::DataModel::List( + listHolder_0->mList, 2); + } + return WriteAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Acl::Id, value); + } + case 6: { + LogStep(6, "Verify"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Acl::Id); + } + case 7: { + LogStep(7, "Write entry invalid auth mode"); + ListFreer listFreer; + chip::app::DataModel::List value; - static void OnFailureCallback_17(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_17(error); - } + { + auto * listHolder_0 = new ListHolder(2); + listFreer.add(listHolder_0); - static void OnSuccessCallback_17(void * context) - { - (static_cast(context))->OnSuccessResponse_17(); - } + listHolder_0->mList[0].privilege = static_cast(5); + listHolder_0->mList[0].authMode = static_cast(2); + listHolder_0->mList[0].subjects.SetNull(); + listHolder_0->mList[0].targets.SetNull(); + listHolder_0->mList[0].fabricIndex = 0; - static void OnFailureCallback_18(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_18(error); - } + listHolder_0->mList[1].privilege = static_cast(1); + listHolder_0->mList[1].authMode = static_cast(1); + listHolder_0->mList[1].subjects.SetNull(); + listHolder_0->mList[1].targets.SetNull(); + listHolder_0->mList[1].fabricIndex = 0; - static void OnSuccessCallback_18( - void * context, - const chip::app::DataModel::DecodableList & - acl) - { - (static_cast(context))->OnSuccessResponse_18(acl); - } + value = chip::app::DataModel::List( + listHolder_0->mList, 2); + } + return WriteAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Acl::Id, value); + } + case 8: { + LogStep(8, "Verify"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Acl::Id); + } + case 9: { + LogStep(9, "Write entry invalid subject"); + ListFreer listFreer; + chip::app::DataModel::List value; - static void OnFailureCallback_19(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_19(error); - } + { + auto * listHolder_0 = new ListHolder(2); + listFreer.add(listHolder_0); - static void OnSuccessCallback_19(void * context, uint16_t subjectsPerAccessControlEntry) - { - (static_cast(context))->OnSuccessResponse_19(subjectsPerAccessControlEntry); - } + listHolder_0->mList[0].privilege = static_cast(5); + listHolder_0->mList[0].authMode = static_cast(2); + listHolder_0->mList[0].subjects.SetNull(); + listHolder_0->mList[0].targets.SetNull(); + listHolder_0->mList[0].fabricIndex = 0; - static void OnFailureCallback_20(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_20(error); - } + listHolder_0->mList[1].privilege = static_cast(1); + listHolder_0->mList[1].authMode = static_cast(2); + listHolder_0->mList[1].subjects.SetNonNull(); - static void OnSuccessCallback_20(void * context, uint16_t targetsPerAccessControlEntry) - { - (static_cast(context))->OnSuccessResponse_20(targetsPerAccessControlEntry); - } + { + auto * listHolder_3 = new ListHolder(1); + listFreer.add(listHolder_3); + listHolder_3->mList[0] = 0ULL; + listHolder_0->mList[1].subjects.Value() = chip::app::DataModel::List(listHolder_3->mList, 1); + } + listHolder_0->mList[1].targets.SetNull(); + listHolder_0->mList[1].fabricIndex = 0; - static void OnFailureCallback_21(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_21(error); - } + value = chip::app::DataModel::List( + listHolder_0->mList, 2); + } + return WriteAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Acl::Id, value); + } + case 10: { + LogStep(10, "Verify"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Acl::Id); + } + case 11: { + LogStep(11, "Write entry invalid target"); + ListFreer listFreer; + chip::app::DataModel::List value; - static void OnSuccessCallback_21(void * context, uint16_t accessControlEntriesPerFabric) - { - (static_cast(context))->OnSuccessResponse_21(accessControlEntriesPerFabric); - } + { + auto * listHolder_0 = new ListHolder(2); + listFreer.add(listHolder_0); - // - // Tests methods - // + listHolder_0->mList[0].privilege = static_cast(5); + listHolder_0->mList[0].authMode = static_cast(2); + listHolder_0->mList[0].subjects.SetNull(); + listHolder_0->mList[0].targets.SetNull(); + listHolder_0->mList[0].fabricIndex = 0; - CHIP_ERROR TestWaitForCommissionee_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } + listHolder_0->mList[1].privilege = static_cast(1); + listHolder_0->mList[1].authMode = static_cast(2); + listHolder_0->mList[1].subjects.SetNull(); + listHolder_0->mList[1].targets.SetNonNull(); - CHIP_ERROR TestWriteEntries_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::AccessControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); + { + auto * listHolder_3 = new ListHolder(1); + listFreer.add(listHolder_3); - ListFreer listFreer; - chip::app::DataModel::List aclArgument; + listHolder_3->mList[0].cluster.SetNull(); + listHolder_3->mList[0].endpoint.SetNull(); + listHolder_3->mList[0].deviceType.SetNull(); - { - auto * listHolder_0 = new ListHolder(3); - listFreer.add(listHolder_0); + listHolder_0->mList[1].targets.Value() = + chip::app::DataModel::List(listHolder_3->mList, + 1); + } + listHolder_0->mList[1].fabricIndex = 0; - listHolder_0->mList[0].privilege = static_cast(5); - listHolder_0->mList[0].authMode = static_cast(2); - listHolder_0->mList[0].subjects.SetNull(); - listHolder_0->mList[0].targets.SetNonNull(); + value = chip::app::DataModel::List( + listHolder_0->mList, 2); + } + return WriteAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Acl::Id, value); + } + case 12: { + LogStep(12, "Verify"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Acl::Id); + } + case 13: { + LogStep(13, "Write entry too many subjects"); + ListFreer listFreer; + chip::app::DataModel::List value; { - auto * listHolder_3 = new ListHolder(3); - listFreer.add(listHolder_3); + auto * listHolder_0 = new ListHolder(2); + listFreer.add(listHolder_0); - listHolder_3->mList[0].cluster.SetNull(); - listHolder_3->mList[0].endpoint.SetNonNull(); - listHolder_3->mList[0].endpoint.Value() = 0U; - listHolder_3->mList[0].deviceType.SetNull(); + listHolder_0->mList[0].privilege = static_cast(5); + listHolder_0->mList[0].authMode = static_cast(2); + listHolder_0->mList[0].subjects.SetNull(); + listHolder_0->mList[0].targets.SetNull(); + listHolder_0->mList[0].fabricIndex = 0; - listHolder_3->mList[1].cluster.SetNonNull(); - listHolder_3->mList[1].cluster.Value() = 1UL; - listHolder_3->mList[1].endpoint.SetNull(); - listHolder_3->mList[1].deviceType.SetNull(); + listHolder_0->mList[1].privilege = static_cast(1); + listHolder_0->mList[1].authMode = static_cast(2); + listHolder_0->mList[1].subjects.SetNonNull(); - listHolder_3->mList[2].cluster.SetNonNull(); - listHolder_3->mList[2].cluster.Value() = 2UL; - listHolder_3->mList[2].endpoint.SetNonNull(); - listHolder_3->mList[2].endpoint.Value() = 3U; - listHolder_3->mList[2].deviceType.SetNull(); - - listHolder_0->mList[0].targets.Value() = - chip::app::DataModel::List(listHolder_3->mList, 3); - } - listHolder_0->mList[0].fabricIndex = 0; - - listHolder_0->mList[1].privilege = static_cast(1); - listHolder_0->mList[1].authMode = static_cast(2); - listHolder_0->mList[1].subjects.SetNonNull(); + { + auto * listHolder_3 = new ListHolder(20); + listFreer.add(listHolder_3); + listHolder_3->mList[0] = 1ULL; + listHolder_3->mList[1] = 2ULL; + listHolder_3->mList[2] = 3ULL; + listHolder_3->mList[3] = 4ULL; + listHolder_3->mList[4] = 5ULL; + listHolder_3->mList[5] = 6ULL; + listHolder_3->mList[6] = 7ULL; + listHolder_3->mList[7] = 8ULL; + listHolder_3->mList[8] = 9ULL; + listHolder_3->mList[9] = 10ULL; + listHolder_3->mList[10] = 11ULL; + listHolder_3->mList[11] = 12ULL; + listHolder_3->mList[12] = 13ULL; + listHolder_3->mList[13] = 14ULL; + listHolder_3->mList[14] = 15ULL; + listHolder_3->mList[15] = 16ULL; + listHolder_3->mList[16] = 17ULL; + listHolder_3->mList[17] = 18ULL; + listHolder_3->mList[18] = 19ULL; + listHolder_3->mList[19] = 20ULL; + listHolder_0->mList[1].subjects.Value() = chip::app::DataModel::List(listHolder_3->mList, 20); + } + listHolder_0->mList[1].targets.SetNull(); + listHolder_0->mList[1].fabricIndex = 0; - { - auto * listHolder_3 = new ListHolder(4); - listFreer.add(listHolder_3); - listHolder_3->mList[0] = 4ULL; - listHolder_3->mList[1] = 5ULL; - listHolder_3->mList[2] = 6ULL; - listHolder_3->mList[3] = 7ULL; - listHolder_0->mList[1].subjects.Value() = chip::app::DataModel::List(listHolder_3->mList, 4); + value = chip::app::DataModel::List( + listHolder_0->mList, 2); } - listHolder_0->mList[1].targets.SetNonNull(); + return WriteAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Acl::Id, value); + } + case 14: { + LogStep(14, "Verify"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Acl::Id); + } + case 15: { + LogStep(15, "Write entry too many targets"); + ListFreer listFreer; + chip::app::DataModel::List value; { - auto * listHolder_3 = new ListHolder(3); - listFreer.add(listHolder_3); - - listHolder_3->mList[0].cluster.SetNull(); - listHolder_3->mList[0].endpoint.SetNonNull(); - listHolder_3->mList[0].endpoint.Value() = 8U; - listHolder_3->mList[0].deviceType.SetNull(); + auto * listHolder_0 = new ListHolder(2); + listFreer.add(listHolder_0); - listHolder_3->mList[1].cluster.SetNonNull(); - listHolder_3->mList[1].cluster.Value() = 9UL; - listHolder_3->mList[1].endpoint.SetNull(); - listHolder_3->mList[1].deviceType.SetNull(); + listHolder_0->mList[0].privilege = static_cast(5); + listHolder_0->mList[0].authMode = static_cast(2); + listHolder_0->mList[0].subjects.SetNull(); + listHolder_0->mList[0].targets.SetNull(); + listHolder_0->mList[0].fabricIndex = 0; - listHolder_3->mList[2].cluster.SetNonNull(); - listHolder_3->mList[2].cluster.Value() = 10UL; - listHolder_3->mList[2].endpoint.SetNonNull(); - listHolder_3->mList[2].endpoint.Value() = 11U; - listHolder_3->mList[2].deviceType.SetNull(); - - listHolder_0->mList[1].targets.Value() = - chip::app::DataModel::List(listHolder_3->mList, 3); - } - listHolder_0->mList[1].fabricIndex = 0; + listHolder_0->mList[1].privilege = static_cast(1); + listHolder_0->mList[1].authMode = static_cast(2); + listHolder_0->mList[1].subjects.SetNull(); + listHolder_0->mList[1].targets.SetNonNull(); - listHolder_0->mList[2].privilege = static_cast(3); - listHolder_0->mList[2].authMode = static_cast(3); - listHolder_0->mList[2].subjects.SetNonNull(); + { + auto * listHolder_3 = new ListHolder(20); + listFreer.add(listHolder_3); + + listHolder_3->mList[0].cluster.SetNull(); + listHolder_3->mList[0].endpoint.SetNonNull(); + listHolder_3->mList[0].endpoint.Value() = 1U; + listHolder_3->mList[0].deviceType.SetNull(); + + listHolder_3->mList[1].cluster.SetNull(); + listHolder_3->mList[1].endpoint.SetNonNull(); + listHolder_3->mList[1].endpoint.Value() = 2U; + listHolder_3->mList[1].deviceType.SetNull(); + + listHolder_3->mList[2].cluster.SetNull(); + listHolder_3->mList[2].endpoint.SetNonNull(); + listHolder_3->mList[2].endpoint.Value() = 3U; + listHolder_3->mList[2].deviceType.SetNull(); + + listHolder_3->mList[3].cluster.SetNull(); + listHolder_3->mList[3].endpoint.SetNonNull(); + listHolder_3->mList[3].endpoint.Value() = 4U; + listHolder_3->mList[3].deviceType.SetNull(); + + listHolder_3->mList[4].cluster.SetNull(); + listHolder_3->mList[4].endpoint.SetNonNull(); + listHolder_3->mList[4].endpoint.Value() = 5U; + listHolder_3->mList[4].deviceType.SetNull(); + + listHolder_3->mList[5].cluster.SetNull(); + listHolder_3->mList[5].endpoint.SetNonNull(); + listHolder_3->mList[5].endpoint.Value() = 6U; + listHolder_3->mList[5].deviceType.SetNull(); + + listHolder_3->mList[6].cluster.SetNull(); + listHolder_3->mList[6].endpoint.SetNonNull(); + listHolder_3->mList[6].endpoint.Value() = 7U; + listHolder_3->mList[6].deviceType.SetNull(); + + listHolder_3->mList[7].cluster.SetNull(); + listHolder_3->mList[7].endpoint.SetNonNull(); + listHolder_3->mList[7].endpoint.Value() = 8U; + listHolder_3->mList[7].deviceType.SetNull(); + + listHolder_3->mList[8].cluster.SetNull(); + listHolder_3->mList[8].endpoint.SetNonNull(); + listHolder_3->mList[8].endpoint.Value() = 9U; + listHolder_3->mList[8].deviceType.SetNull(); + + listHolder_3->mList[9].cluster.SetNull(); + listHolder_3->mList[9].endpoint.SetNonNull(); + listHolder_3->mList[9].endpoint.Value() = 10U; + listHolder_3->mList[9].deviceType.SetNull(); + + listHolder_3->mList[10].cluster.SetNull(); + listHolder_3->mList[10].endpoint.SetNonNull(); + listHolder_3->mList[10].endpoint.Value() = 11U; + listHolder_3->mList[10].deviceType.SetNull(); + + listHolder_3->mList[11].cluster.SetNull(); + listHolder_3->mList[11].endpoint.SetNonNull(); + listHolder_3->mList[11].endpoint.Value() = 12U; + listHolder_3->mList[11].deviceType.SetNull(); + + listHolder_3->mList[12].cluster.SetNull(); + listHolder_3->mList[12].endpoint.SetNonNull(); + listHolder_3->mList[12].endpoint.Value() = 13U; + listHolder_3->mList[12].deviceType.SetNull(); + + listHolder_3->mList[13].cluster.SetNull(); + listHolder_3->mList[13].endpoint.SetNonNull(); + listHolder_3->mList[13].endpoint.Value() = 14U; + listHolder_3->mList[13].deviceType.SetNull(); + + listHolder_3->mList[14].cluster.SetNull(); + listHolder_3->mList[14].endpoint.SetNonNull(); + listHolder_3->mList[14].endpoint.Value() = 15U; + listHolder_3->mList[14].deviceType.SetNull(); + + listHolder_3->mList[15].cluster.SetNull(); + listHolder_3->mList[15].endpoint.SetNonNull(); + listHolder_3->mList[15].endpoint.Value() = 16U; + listHolder_3->mList[15].deviceType.SetNull(); + + listHolder_3->mList[16].cluster.SetNull(); + listHolder_3->mList[16].endpoint.SetNonNull(); + listHolder_3->mList[16].endpoint.Value() = 17U; + listHolder_3->mList[16].deviceType.SetNull(); + + listHolder_3->mList[17].cluster.SetNull(); + listHolder_3->mList[17].endpoint.SetNonNull(); + listHolder_3->mList[17].endpoint.Value() = 18U; + listHolder_3->mList[17].deviceType.SetNull(); + + listHolder_3->mList[18].cluster.SetNull(); + listHolder_3->mList[18].endpoint.SetNonNull(); + listHolder_3->mList[18].endpoint.Value() = 19U; + listHolder_3->mList[18].deviceType.SetNull(); + + listHolder_3->mList[19].cluster.SetNull(); + listHolder_3->mList[19].endpoint.SetNonNull(); + listHolder_3->mList[19].endpoint.Value() = 20U; + listHolder_3->mList[19].deviceType.SetNull(); + + listHolder_0->mList[1].targets.Value() = + chip::app::DataModel::List(listHolder_3->mList, + 20); + } + listHolder_0->mList[1].fabricIndex = 0; - { - auto * listHolder_3 = new ListHolder(4); - listFreer.add(listHolder_3); - listHolder_3->mList[0] = 12ULL; - listHolder_3->mList[1] = 13ULL; - listHolder_3->mList[2] = 14ULL; - listHolder_3->mList[3] = 15ULL; - listHolder_0->mList[2].subjects.Value() = chip::app::DataModel::List(listHolder_3->mList, 4); + value = chip::app::DataModel::List( + listHolder_0->mList, 2); } - listHolder_0->mList[2].targets.SetNonNull(); + return WriteAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Acl::Id, value); + } + case 16: { + LogStep(16, "Verify"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Acl::Id); + } + case 17: { + LogStep(17, "Restore ACL"); + ListFreer listFreer; + chip::app::DataModel::List value; { - auto * listHolder_3 = new ListHolder(3); - listFreer.add(listHolder_3); - - listHolder_3->mList[0].cluster.SetNull(); - listHolder_3->mList[0].endpoint.SetNonNull(); - listHolder_3->mList[0].endpoint.Value() = 16U; - listHolder_3->mList[0].deviceType.SetNull(); + auto * listHolder_0 = new ListHolder(1); + listFreer.add(listHolder_0); - listHolder_3->mList[1].cluster.SetNonNull(); - listHolder_3->mList[1].cluster.Value() = 17UL; - listHolder_3->mList[1].endpoint.SetNull(); - listHolder_3->mList[1].deviceType.SetNull(); + listHolder_0->mList[0].privilege = static_cast(5); + listHolder_0->mList[0].authMode = static_cast(2); + listHolder_0->mList[0].subjects.SetNull(); + listHolder_0->mList[0].targets.SetNull(); + listHolder_0->mList[0].fabricIndex = 0; - listHolder_3->mList[2].cluster.SetNonNull(); - listHolder_3->mList[2].cluster.Value() = 18UL; - listHolder_3->mList[2].endpoint.SetNonNull(); - listHolder_3->mList[2].endpoint.Value() = 19U; - listHolder_3->mList[2].deviceType.SetNull(); - - listHolder_0->mList[2].targets.Value() = - chip::app::DataModel::List(listHolder_3->mList, 3); + value = chip::app::DataModel::List( + listHolder_0->mList, 1); } - listHolder_0->mList[2].fabricIndex = 0; - - aclArgument = chip::app::DataModel::List( - listHolder_0->mList, 3); + return WriteAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Acl::Id, value); + } + case 18: { + LogStep(18, "Verify"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Acl::Id); + } + case 19: { + LogStep(19, "Validate resource minima (SubjectsPerAccessControlEntry)"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, + AccessControl::Attributes::SubjectsPerAccessControlEntry::Id); + } + case 20: { + LogStep(20, "Validate resource minima (TargetsPerAccessControlEntry)"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, + AccessControl::Attributes::TargetsPerAccessControlEntry::Id); + } + case 21: { + LogStep(21, "Validate resource minima (AccessControlEntriesPerFabric)"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, + AccessControl::Attributes::AccessControlEntriesPerFabric::Id); + } } - - ReturnErrorOnFailure(cluster.WriteAttribute( - aclArgument, this, OnSuccessCallback_1, OnFailureCallback_1)); return CHIP_NO_ERROR; } +}; - void OnFailureResponse_1(CHIP_ERROR error) +class Test_TC_BI_1_1Suite : public TestCommand +{ +public: + Test_TC_BI_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_BI_1_1", 8, credsIssuerConfig) { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - void OnSuccessResponse_1() { NextTest(); } + ~Test_TC_BI_1_1Suite() {} - CHIP_ERROR TestVerify_2() + chip::System::Clock::Timeout GetWaitDuration() const override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::AccessControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_2, OnFailureCallback_2, true)); - return CHIP_NO_ERROR; + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } - void OnFailureResponse_2(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // - void OnSuccessResponse_2( - const chip::app::DataModel::DecodableList & - acl) + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { + bool shouldContinue = false; + + switch (mTestIndex - 1) { - auto iter_0 = acl.begin(); - VerifyOrReturn(CheckNextListItemDecodes("acl", iter_0, 0)); - VerifyOrReturn(CheckValue("acl[0].privilege", iter_0.GetValue().privilege, 5)); - VerifyOrReturn(CheckValue("acl[0].authMode", iter_0.GetValue().authMode, 2)); - VerifyOrReturn(CheckValueNull("acl[0].subjects", iter_0.GetValue().subjects)); - VerifyOrReturn(CheckValueNonNull("acl[0].targets", iter_0.GetValue().targets)); + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { - auto iter_NaN = iter_0.GetValue().targets.Value().begin(); - VerifyOrReturn( - CheckNextListItemDecodes("acl[0].targets.Value()", iter_NaN, 0)); - VerifyOrReturn(CheckValueNull("acl[0].targets.Value()[0].cluster", iter_NaN.GetValue().cluster)); - VerifyOrReturn(CheckValueNonNull("acl[0].targets.Value()[0].endpoint", iter_NaN.GetValue().endpoint)); - VerifyOrReturn(CheckValue("acl[0].targets.Value()[0].endpoint.Value()", iter_NaN.GetValue().endpoint.Value(), 0U)); - VerifyOrReturn(CheckValueNull("acl[0].targets.Value()[0].deviceType", iter_NaN.GetValue().deviceType)); - VerifyOrReturn( - CheckNextListItemDecodes("acl[0].targets.Value()", iter_NaN, 1)); - VerifyOrReturn(CheckValueNonNull("acl[0].targets.Value()[1].cluster", iter_NaN.GetValue().cluster)); - VerifyOrReturn(CheckValue("acl[0].targets.Value()[1].cluster.Value()", iter_NaN.GetValue().cluster.Value(), 1UL)); - VerifyOrReturn(CheckValueNull("acl[0].targets.Value()[1].endpoint", iter_NaN.GetValue().endpoint)); - VerifyOrReturn(CheckValueNull("acl[0].targets.Value()[1].deviceType", iter_NaN.GetValue().deviceType)); - VerifyOrReturn( - CheckNextListItemDecodes("acl[0].targets.Value()", iter_NaN, 2)); - VerifyOrReturn(CheckValueNonNull("acl[0].targets.Value()[2].cluster", iter_NaN.GetValue().cluster)); - VerifyOrReturn(CheckValue("acl[0].targets.Value()[2].cluster.Value()", iter_NaN.GetValue().cluster.Value(), 2UL)); - VerifyOrReturn(CheckValueNonNull("acl[0].targets.Value()[2].endpoint", iter_NaN.GetValue().endpoint)); - VerifyOrReturn(CheckValue("acl[0].targets.Value()[2].endpoint.Value()", iter_NaN.GetValue().endpoint.Value(), 3U)); - VerifyOrReturn(CheckValueNull("acl[0].targets.Value()[2].deviceType", iter_NaN.GetValue().deviceType)); - VerifyOrReturn( - CheckNoMoreListItems("acl[0].targets.Value()", iter_NaN, 3)); + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("clusterRevision", value, 1U)); } - VerifyOrReturn(CheckValue("acl[0].fabricIndex", iter_0.GetValue().fabricIndex, 1)); - VerifyOrReturn(CheckNextListItemDecodes("acl", iter_0, 1)); - VerifyOrReturn(CheckValue("acl[1].privilege", iter_0.GetValue().privilege, 1)); - VerifyOrReturn(CheckValue("acl[1].authMode", iter_0.GetValue().authMode, 2)); - VerifyOrReturn(CheckValueNonNull("acl[1].subjects", iter_0.GetValue().subjects)); + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { - auto iter_NaN = iter_0.GetValue().subjects.Value().begin(); - VerifyOrReturn( - CheckNextListItemDecodes("acl[1].subjects.Value()", iter_NaN, 0)); - VerifyOrReturn(CheckValue("acl[1].subjects.Value()[0]", iter_NaN.GetValue(), 4ULL)); - VerifyOrReturn( - CheckNextListItemDecodes("acl[1].subjects.Value()", iter_NaN, 1)); - VerifyOrReturn(CheckValue("acl[1].subjects.Value()[1]", iter_NaN.GetValue(), 5ULL)); - VerifyOrReturn( - CheckNextListItemDecodes("acl[1].subjects.Value()", iter_NaN, 2)); - VerifyOrReturn(CheckValue("acl[1].subjects.Value()[2]", iter_NaN.GetValue(), 6ULL)); - VerifyOrReturn( - CheckNextListItemDecodes("acl[1].subjects.Value()", iter_NaN, 3)); - VerifyOrReturn(CheckValue("acl[1].subjects.Value()[3]", iter_NaN.GetValue(), 7ULL)); - VerifyOrReturn( - CheckNoMoreListItems("acl[1].subjects.Value()", iter_NaN, 4)); + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); } - VerifyOrReturn(CheckValueNonNull("acl[1].targets", iter_0.GetValue().targets)); + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { - auto iter_NaN = iter_0.GetValue().targets.Value().begin(); - VerifyOrReturn( - CheckNextListItemDecodes("acl[1].targets.Value()", iter_NaN, 0)); - VerifyOrReturn(CheckValueNull("acl[1].targets.Value()[0].cluster", iter_NaN.GetValue().cluster)); - VerifyOrReturn(CheckValueNonNull("acl[1].targets.Value()[0].endpoint", iter_NaN.GetValue().endpoint)); - VerifyOrReturn(CheckValue("acl[1].targets.Value()[0].endpoint.Value()", iter_NaN.GetValue().endpoint.Value(), 8U)); - VerifyOrReturn(CheckValueNull("acl[1].targets.Value()[0].deviceType", iter_NaN.GetValue().deviceType)); - VerifyOrReturn( - CheckNextListItemDecodes("acl[1].targets.Value()", iter_NaN, 1)); - VerifyOrReturn(CheckValueNonNull("acl[1].targets.Value()[1].cluster", iter_NaN.GetValue().cluster)); - VerifyOrReturn(CheckValue("acl[1].targets.Value()[1].cluster.Value()", iter_NaN.GetValue().cluster.Value(), 9UL)); - VerifyOrReturn(CheckValueNull("acl[1].targets.Value()[1].endpoint", iter_NaN.GetValue().endpoint)); - VerifyOrReturn(CheckValueNull("acl[1].targets.Value()[1].deviceType", iter_NaN.GetValue().deviceType)); - VerifyOrReturn( - CheckNextListItemDecodes("acl[1].targets.Value()", iter_NaN, 2)); - VerifyOrReturn(CheckValueNonNull("acl[1].targets.Value()[2].cluster", iter_NaN.GetValue().cluster)); - VerifyOrReturn(CheckValue("acl[1].targets.Value()[2].cluster.Value()", iter_NaN.GetValue().cluster.Value(), 10UL)); - VerifyOrReturn(CheckValueNonNull("acl[1].targets.Value()[2].endpoint", iter_NaN.GetValue().endpoint)); - VerifyOrReturn(CheckValue("acl[1].targets.Value()[2].endpoint.Value()", iter_NaN.GetValue().endpoint.Value(), 11U)); - VerifyOrReturn(CheckValueNull("acl[1].targets.Value()[2].deviceType", iter_NaN.GetValue().deviceType)); - VerifyOrReturn( - CheckNoMoreListItems("acl[1].targets.Value()", iter_NaN, 3)); + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("clusterRevision", value, 1U)); } - VerifyOrReturn(CheckValue("acl[1].fabricIndex", iter_0.GetValue().fabricIndex, 1)); - VerifyOrReturn(CheckNextListItemDecodes("acl", iter_0, 2)); - VerifyOrReturn(CheckValue("acl[2].privilege", iter_0.GetValue().privilege, 3)); - VerifyOrReturn(CheckValue("acl[2].authMode", iter_0.GetValue().authMode, 3)); - VerifyOrReturn(CheckValueNonNull("acl[2].subjects", iter_0.GetValue().subjects)); + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { - auto iter_NaN = iter_0.GetValue().subjects.Value().begin(); - VerifyOrReturn( - CheckNextListItemDecodes("acl[2].subjects.Value()", iter_NaN, 0)); - VerifyOrReturn(CheckValue("acl[2].subjects.Value()[0]", iter_NaN.GetValue(), 12ULL)); - VerifyOrReturn( - CheckNextListItemDecodes("acl[2].subjects.Value()", iter_NaN, 1)); - VerifyOrReturn(CheckValue("acl[2].subjects.Value()[1]", iter_NaN.GetValue(), 13ULL)); - VerifyOrReturn( - CheckNextListItemDecodes("acl[2].subjects.Value()", iter_NaN, 2)); - VerifyOrReturn(CheckValue("acl[2].subjects.Value()[2]", iter_NaN.GetValue(), 14ULL)); - VerifyOrReturn( - CheckNextListItemDecodes("acl[2].subjects.Value()", iter_NaN, 3)); - VerifyOrReturn(CheckValue("acl[2].subjects.Value()[3]", iter_NaN.GetValue(), 15ULL)); - VerifyOrReturn( - CheckNoMoreListItems("acl[2].subjects.Value()", iter_NaN, 4)); + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "list")); } - VerifyOrReturn(CheckValueNonNull("acl[2].targets", iter_0.GetValue().targets)); + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { - auto iter_NaN = iter_0.GetValue().targets.Value().begin(); - VerifyOrReturn( - CheckNextListItemDecodes("acl[2].targets.Value()", iter_NaN, 0)); - VerifyOrReturn(CheckValueNull("acl[2].targets.Value()[0].cluster", iter_NaN.GetValue().cluster)); - VerifyOrReturn(CheckValueNonNull("acl[2].targets.Value()[0].endpoint", iter_NaN.GetValue().endpoint)); - VerifyOrReturn(CheckValue("acl[2].targets.Value()[0].endpoint.Value()", iter_NaN.GetValue().endpoint.Value(), 16U)); - VerifyOrReturn(CheckValueNull("acl[2].targets.Value()[0].deviceType", iter_NaN.GetValue().deviceType)); - VerifyOrReturn( - CheckNextListItemDecodes("acl[2].targets.Value()", iter_NaN, 1)); - VerifyOrReturn(CheckValueNonNull("acl[2].targets.Value()[1].cluster", iter_NaN.GetValue().cluster)); - VerifyOrReturn(CheckValue("acl[2].targets.Value()[1].cluster.Value()", iter_NaN.GetValue().cluster.Value(), 17UL)); - VerifyOrReturn(CheckValueNull("acl[2].targets.Value()[1].endpoint", iter_NaN.GetValue().endpoint)); - VerifyOrReturn(CheckValueNull("acl[2].targets.Value()[1].deviceType", iter_NaN.GetValue().deviceType)); - VerifyOrReturn( - CheckNextListItemDecodes("acl[2].targets.Value()", iter_NaN, 2)); - VerifyOrReturn(CheckValueNonNull("acl[2].targets.Value()[2].cluster", iter_NaN.GetValue().cluster)); - VerifyOrReturn(CheckValue("acl[2].targets.Value()[2].cluster.Value()", iter_NaN.GetValue().cluster.Value(), 18UL)); - VerifyOrReturn(CheckValueNonNull("acl[2].targets.Value()[2].endpoint", iter_NaN.GetValue().endpoint)); - VerifyOrReturn(CheckValue("acl[2].targets.Value()[2].endpoint.Value()", iter_NaN.GetValue().endpoint.Value(), 19U)); - VerifyOrReturn(CheckValueNull("acl[2].targets.Value()[2].deviceType", iter_NaN.GetValue().deviceType)); - VerifyOrReturn( - CheckNoMoreListItems("acl[2].targets.Value()", iter_NaN, 3)); + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "list")); + } + break; + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "list")); } - VerifyOrReturn(CheckValue("acl[2].fabricIndex", iter_0.GetValue().fabricIndex, 1)); - VerifyOrReturn(CheckNoMoreListItems("acl", iter_0, 3)); + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); } - NextTest(); - } - - CHIP_ERROR TestWriteEntriesEmptyLists_3() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::AccessControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ListFreer listFreer; - chip::app::DataModel::List aclArgument; - + if (shouldContinue) { - auto * listHolder_0 = new ListHolder(2); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].privilege = static_cast(5); - listHolder_0->mList[0].authMode = static_cast(2); - listHolder_0->mList[0].subjects.SetNull(); - listHolder_0->mList[0].targets.SetNull(); - listHolder_0->mList[0].fabricIndex = 0; - - listHolder_0->mList[1].privilege = static_cast(1); - listHolder_0->mList[1].authMode = static_cast(2); - listHolder_0->mList[1].subjects.SetNonNull(); - - listHolder_0->mList[1].subjects.Value() = chip::app::DataModel::List(); - listHolder_0->mList[1].targets.SetNonNull(); - - listHolder_0->mList[1].targets.Value() = - chip::app::DataModel::List(); - listHolder_0->mList[1].fabricIndex = 0; - - aclArgument = chip::app::DataModel::List( - listHolder_0->mList, 2); + ContinueOnChipMainThread(CHIP_NO_ERROR); } - - ReturnErrorOnFailure(cluster.WriteAttribute( - aclArgument, this, OnSuccessCallback_3, OnFailureCallback_3)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_3(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_3() { NextTest(); } - - CHIP_ERROR TestVerify_4() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::AccessControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_4, OnFailureCallback_4, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_4(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); } - void OnSuccessResponse_4( - const chip::app::DataModel::DecodableList & - acl) + CHIP_ERROR DoTestStep(uint16_t testIndex) override { + using namespace chip::app::Clusters; + switch (testIndex) { - auto iter_0 = acl.begin(); - VerifyOrReturn(CheckNextListItemDecodes("acl", iter_0, 0)); - VerifyOrReturn(CheckValue("acl[0].privilege", iter_0.GetValue().privilege, 5)); - VerifyOrReturn(CheckValue("acl[0].authMode", iter_0.GetValue().authMode, 2)); - VerifyOrReturn(CheckValueNull("acl[0].subjects", iter_0.GetValue().subjects)); - VerifyOrReturn(CheckValueNull("acl[0].targets", iter_0.GetValue().targets)); - VerifyOrReturn(CheckValue("acl[0].fabricIndex", iter_0.GetValue().fabricIndex, 1)); - VerifyOrReturn(CheckNextListItemDecodes("acl", iter_0, 1)); - VerifyOrReturn(CheckValue("acl[1].privilege", iter_0.GetValue().privilege, 1)); - VerifyOrReturn(CheckValue("acl[1].authMode", iter_0.GetValue().authMode, 2)); - VerifyOrReturn(CheckValueNull("acl[1].subjects", iter_0.GetValue().subjects)); - VerifyOrReturn(CheckValueNull("acl[1].targets", iter_0.GetValue().targets)); - VerifyOrReturn(CheckValue("acl[1].fabricIndex", iter_0.GetValue().fabricIndex, 1)); - VerifyOrReturn(CheckNoMoreListItems("acl", iter_0, 2)); + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); } - - NextTest(); - } - - CHIP_ERROR TestWriteEntryInvalidPrivilege_5() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::AccessControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ListFreer listFreer; - chip::app::DataModel::List aclArgument; - - { - auto * listHolder_0 = new ListHolder(2); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].privilege = static_cast(5); - listHolder_0->mList[0].authMode = static_cast(2); - listHolder_0->mList[0].subjects.SetNull(); - listHolder_0->mList[0].targets.SetNull(); - listHolder_0->mList[0].fabricIndex = 0; - - listHolder_0->mList[1].privilege = static_cast(5); - listHolder_0->mList[1].authMode = static_cast(3); - listHolder_0->mList[1].subjects.SetNull(); - listHolder_0->mList[1].targets.SetNull(); - listHolder_0->mList[1].fabricIndex = 0; - - aclArgument = chip::app::DataModel::List( - listHolder_0->mList, 2); + case 1: { + LogStep(1, "read the global attribute: ClusterRevision"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), BinaryInputBasic::Id, + BinaryInputBasic::Attributes::ClusterRevision::Id); } - - ReturnErrorOnFailure(cluster.WriteAttribute( - aclArgument, this, OnSuccessCallback_5, OnFailureCallback_5)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_5(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 1)); - NextTest(); - } - - void OnSuccessResponse_5() { ThrowSuccessResponse(); } - - CHIP_ERROR TestVerify_6() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::AccessControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_6, OnFailureCallback_6, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_6(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_6( - const chip::app::DataModel::DecodableList & - acl) - { - { - auto iter_0 = acl.begin(); - VerifyOrReturn(CheckNextListItemDecodes("acl", iter_0, 0)); - VerifyOrReturn(CheckValue("acl[0].privilege", iter_0.GetValue().privilege, 5)); - VerifyOrReturn(CheckValue("acl[0].authMode", iter_0.GetValue().authMode, 2)); - VerifyOrReturn(CheckValueNull("acl[0].subjects", iter_0.GetValue().subjects)); - VerifyOrReturn(CheckValueNull("acl[0].targets", iter_0.GetValue().targets)); - VerifyOrReturn(CheckValue("acl[0].fabricIndex", iter_0.GetValue().fabricIndex, 1)); - VerifyOrReturn(CheckNoMoreListItems("acl", iter_0, 1)); + case 2: { + LogStep(2, "Read the global attribute constraints: ClusterRevision"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), BinaryInputBasic::Id, + BinaryInputBasic::Attributes::ClusterRevision::Id); } - - NextTest(); - } - - CHIP_ERROR TestWriteEntryInvalidAuthMode_7() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::AccessControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ListFreer listFreer; - chip::app::DataModel::List aclArgument; - - { - auto * listHolder_0 = new ListHolder(2); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].privilege = static_cast(5); - listHolder_0->mList[0].authMode = static_cast(2); - listHolder_0->mList[0].subjects.SetNull(); - listHolder_0->mList[0].targets.SetNull(); - listHolder_0->mList[0].fabricIndex = 0; - - listHolder_0->mList[1].privilege = static_cast(1); - listHolder_0->mList[1].authMode = static_cast(1); - listHolder_0->mList[1].subjects.SetNull(); - listHolder_0->mList[1].targets.SetNull(); - listHolder_0->mList[1].fabricIndex = 0; - - aclArgument = chip::app::DataModel::List( - listHolder_0->mList, 2); + case 3: { + LogStep(3, "write the default values to mandatory global attribute: ClusterRevision"); + uint16_t value; + value = 1U; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), BinaryInputBasic::Id, + BinaryInputBasic::Attributes::ClusterRevision::Id, value); } - - ReturnErrorOnFailure(cluster.WriteAttribute( - aclArgument, this, OnSuccessCallback_7, OnFailureCallback_7)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_7(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 1)); - NextTest(); - } - - void OnSuccessResponse_7() { ThrowSuccessResponse(); } - - CHIP_ERROR TestVerify_8() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::AccessControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_8, OnFailureCallback_8, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_8(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_8( - const chip::app::DataModel::DecodableList & - acl) - { - { - auto iter_0 = acl.begin(); - VerifyOrReturn(CheckNextListItemDecodes("acl", iter_0, 0)); - VerifyOrReturn(CheckValue("acl[0].privilege", iter_0.GetValue().privilege, 5)); - VerifyOrReturn(CheckValue("acl[0].authMode", iter_0.GetValue().authMode, 2)); - VerifyOrReturn(CheckValueNull("acl[0].subjects", iter_0.GetValue().subjects)); - VerifyOrReturn(CheckValueNull("acl[0].targets", iter_0.GetValue().targets)); - VerifyOrReturn(CheckValue("acl[0].fabricIndex", iter_0.GetValue().fabricIndex, 1)); - VerifyOrReturn(CheckNoMoreListItems("acl", iter_0, 1)); + case 4: { + LogStep(4, "reads back global attribute: ClusterRevision"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), BinaryInputBasic::Id, + BinaryInputBasic::Attributes::ClusterRevision::Id); + } + case 5: { + LogStep(5, "Read the global attribute: AttributeList"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), BinaryInputBasic::Id, + BinaryInputBasic::Attributes::AttributeList::Id); + } + case 6: { + LogStep(6, "Read the global attribute: AcceptedCommandList"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), BinaryInputBasic::Id, + BinaryInputBasic::Attributes::AcceptedCommandList::Id); + } + case 7: { + LogStep(7, "Read the global attribute: GeneratedCommandList"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), BinaryInputBasic::Id, + BinaryInputBasic::Attributes::GeneratedCommandList::Id); } - - NextTest(); - } - - CHIP_ERROR TestWriteEntryInvalidSubject_9() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::AccessControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ListFreer listFreer; - chip::app::DataModel::List aclArgument; - - { - auto * listHolder_0 = new ListHolder(2); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].privilege = static_cast(5); - listHolder_0->mList[0].authMode = static_cast(2); - listHolder_0->mList[0].subjects.SetNull(); - listHolder_0->mList[0].targets.SetNull(); - listHolder_0->mList[0].fabricIndex = 0; - - listHolder_0->mList[1].privilege = static_cast(1); - listHolder_0->mList[1].authMode = static_cast(2); - listHolder_0->mList[1].subjects.SetNonNull(); - - { - auto * listHolder_3 = new ListHolder(1); - listFreer.add(listHolder_3); - listHolder_3->mList[0] = 0ULL; - listHolder_0->mList[1].subjects.Value() = chip::app::DataModel::List(listHolder_3->mList, 1); - } - listHolder_0->mList[1].targets.SetNull(); - listHolder_0->mList[1].fabricIndex = 0; - - aclArgument = chip::app::DataModel::List( - listHolder_0->mList, 2); } - - ReturnErrorOnFailure(cluster.WriteAttribute( - aclArgument, this, OnSuccessCallback_9, OnFailureCallback_9)); return CHIP_NO_ERROR; } +}; - void OnFailureResponse_9(CHIP_ERROR error) +class Test_TC_BI_2_1Suite : public TestCommand +{ +public: + Test_TC_BI_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_BI_2_1", 12, credsIssuerConfig) { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 1)); - NextTest(); + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - void OnSuccessResponse_9() { ThrowSuccessResponse(); } + ~Test_TC_BI_2_1Suite() {} - CHIP_ERROR TestVerify_10() + chip::System::Clock::Timeout GetWaitDuration() const override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::AccessControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_10, OnFailureCallback_10, true)); - return CHIP_NO_ERROR; + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } - void OnFailureResponse_10(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; - void OnSuccessResponse_10( - const chip::app::DataModel::DecodableList & - acl) - { - { - auto iter_0 = acl.begin(); - VerifyOrReturn(CheckNextListItemDecodes("acl", iter_0, 0)); - VerifyOrReturn(CheckValue("acl[0].privilege", iter_0.GetValue().privilege, 5)); - VerifyOrReturn(CheckValue("acl[0].authMode", iter_0.GetValue().authMode, 2)); - VerifyOrReturn(CheckValueNull("acl[0].subjects", iter_0.GetValue().subjects)); - VerifyOrReturn(CheckValueNull("acl[0].targets", iter_0.GetValue().targets)); - VerifyOrReturn(CheckValue("acl[0].fabricIndex", iter_0.GetValue().fabricIndex, 1)); - VerifyOrReturn(CheckNoMoreListItems("acl", iter_0, 1)); - } + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } - NextTest(); - } + // + // Tests methods + // - CHIP_ERROR TestWriteEntryInvalidTarget_11() + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::AccessControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ListFreer listFreer; - chip::app::DataModel::List aclArgument; + bool shouldContinue = false; + switch (mTestIndex - 1) { - auto * listHolder_0 = new ListHolder(2); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].privilege = static_cast(5); - listHolder_0->mList[0].authMode = static_cast(2); - listHolder_0->mList[0].subjects.SetNull(); - listHolder_0->mList[0].targets.SetNull(); - listHolder_0->mList[0].fabricIndex = 0; - - listHolder_0->mList[1].privilege = static_cast(1); - listHolder_0->mList[1].authMode = static_cast(2); - listHolder_0->mList[1].subjects.SetNull(); - listHolder_0->mList[1].targets.SetNonNull(); - + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { - auto * listHolder_3 = new ListHolder(1); - listFreer.add(listHolder_3); - - listHolder_3->mList[0].cluster.SetNull(); - listHolder_3->mList[0].endpoint.SetNull(); - listHolder_3->mList[0].deviceType.SetNull(); - - listHolder_0->mList[1].targets.Value() = - chip::app::DataModel::List(listHolder_3->mList, 1); + bool value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("outOfService", value, 0)); } - listHolder_0->mList[1].fabricIndex = 0; - - aclArgument = chip::app::DataModel::List( - listHolder_0->mList, 2); + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + bool value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "bool")); + } + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + bool value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("outOfService", value, 0)); + } + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + bool value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "bool")); + } + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + bool value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("presentValue", value, 0)); + } + break; + case 8: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("statusFlags", value, 0)); + } + break; + case 9: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "map8")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 15)); + } + break; + case 10: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); + break; + case 11: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("statusFlags", value, 0)); + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); } - ReturnErrorOnFailure(cluster.WriteAttribute( - aclArgument, this, OnSuccessCallback_11, OnFailureCallback_11)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_11(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 1)); - NextTest(); - } - - void OnSuccessResponse_11() { ThrowSuccessResponse(); } - - CHIP_ERROR TestVerify_12() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::AccessControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_12, OnFailureCallback_12, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_12(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_12( - const chip::app::DataModel::DecodableList & - acl) - { + if (shouldContinue) { - auto iter_0 = acl.begin(); - VerifyOrReturn(CheckNextListItemDecodes("acl", iter_0, 0)); - VerifyOrReturn(CheckValue("acl[0].privilege", iter_0.GetValue().privilege, 5)); - VerifyOrReturn(CheckValue("acl[0].authMode", iter_0.GetValue().authMode, 2)); - VerifyOrReturn(CheckValueNull("acl[0].subjects", iter_0.GetValue().subjects)); - VerifyOrReturn(CheckValueNull("acl[0].targets", iter_0.GetValue().targets)); - VerifyOrReturn(CheckValue("acl[0].fabricIndex", iter_0.GetValue().fabricIndex, 1)); - VerifyOrReturn(CheckNoMoreListItems("acl", iter_0, 1)); + ContinueOnChipMainThread(CHIP_NO_ERROR); } - - NextTest(); } - CHIP_ERROR TestWriteEntryTooManySubjects_13() + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::AccessControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ListFreer listFreer; - chip::app::DataModel::List aclArgument; - + using namespace chip::app::Clusters; + switch (testIndex) { - auto * listHolder_0 = new ListHolder(2); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].privilege = static_cast(5); - listHolder_0->mList[0].authMode = static_cast(2); - listHolder_0->mList[0].subjects.SetNull(); - listHolder_0->mList[0].targets.SetNull(); - listHolder_0->mList[0].fabricIndex = 0; - - listHolder_0->mList[1].privilege = static_cast(1); - listHolder_0->mList[1].authMode = static_cast(2); - listHolder_0->mList[1].subjects.SetNonNull(); - - { - auto * listHolder_3 = new ListHolder(20); - listFreer.add(listHolder_3); - listHolder_3->mList[0] = 1ULL; - listHolder_3->mList[1] = 2ULL; - listHolder_3->mList[2] = 3ULL; - listHolder_3->mList[3] = 4ULL; - listHolder_3->mList[4] = 5ULL; - listHolder_3->mList[5] = 6ULL; - listHolder_3->mList[6] = 7ULL; - listHolder_3->mList[7] = 8ULL; - listHolder_3->mList[8] = 9ULL; - listHolder_3->mList[9] = 10ULL; - listHolder_3->mList[10] = 11ULL; - listHolder_3->mList[11] = 12ULL; - listHolder_3->mList[12] = 13ULL; - listHolder_3->mList[13] = 14ULL; - listHolder_3->mList[14] = 15ULL; - listHolder_3->mList[15] = 16ULL; - listHolder_3->mList[16] = 17ULL; - listHolder_3->mList[17] = 18ULL; - listHolder_3->mList[18] = 19ULL; - listHolder_3->mList[19] = 20ULL; - listHolder_0->mList[1].subjects.Value() = chip::app::DataModel::List(listHolder_3->mList, 20); - } - listHolder_0->mList[1].targets.SetNull(); - listHolder_0->mList[1].fabricIndex = 0; - - aclArgument = chip::app::DataModel::List( - listHolder_0->mList, 2); + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "Read mandatory non-global attribute: OutOfService"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), BinaryInputBasic::Id, + BinaryInputBasic::Attributes::OutOfService::Id); + } + case 2: { + LogStep(2, "Read mandatory non-global attribute constraints: OutOfService"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), BinaryInputBasic::Id, + BinaryInputBasic::Attributes::OutOfService::Id); + } + case 3: { + LogStep(3, "Write the default values to mandatory non-global attribute: OutOfService"); + bool value; + value = 0; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), BinaryInputBasic::Id, + BinaryInputBasic::Attributes::OutOfService::Id, value); + } + case 4: { + LogStep(4, "Reads back the mandatory non-global attribute: OutOfService"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), BinaryInputBasic::Id, + BinaryInputBasic::Attributes::OutOfService::Id); + } + case 5: { + LogStep(5, "Read mandatory non-global attribute constraints: PresentValue"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), BinaryInputBasic::Id, + BinaryInputBasic::Attributes::PresentValue::Id); + } + case 6: { + LogStep(6, "Write the default values to mandatory non-global attribute: PresentValue"); + bool value; + value = 0; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), BinaryInputBasic::Id, + BinaryInputBasic::Attributes::PresentValue::Id, value); + } + case 7: { + LogStep(7, "Reads back the mandatory non-global attribute: PresentValue"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), BinaryInputBasic::Id, + BinaryInputBasic::Attributes::PresentValue::Id); + } + case 8: { + LogStep(8, "Read mandatory non-global attribute: StatusFlags"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), BinaryInputBasic::Id, + BinaryInputBasic::Attributes::StatusFlags::Id); + } + case 9: { + LogStep(9, "Read mandatory non-global attribute constraints: StatusFlags"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), BinaryInputBasic::Id, + BinaryInputBasic::Attributes::StatusFlags::Id); + } + case 10: { + LogStep(10, "Write the default values to mandatory non-global attribute: StatusFlags"); + uint8_t value; + value = 0; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), BinaryInputBasic::Id, + BinaryInputBasic::Attributes::StatusFlags::Id, value); + } + case 11: { + LogStep(11, "Reads back the mandatory non-global attribute: StatusFlags"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), BinaryInputBasic::Id, + BinaryInputBasic::Attributes::StatusFlags::Id); + } } - - ReturnErrorOnFailure(cluster.WriteAttribute( - aclArgument, this, OnSuccessCallback_13, OnFailureCallback_13)); return CHIP_NO_ERROR; } +}; - void OnFailureResponse_13(CHIP_ERROR error) +class Test_TC_BI_2_2Suite : public TestCommand +{ +public: + Test_TC_BI_2_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_BI_2_2", 9, credsIssuerConfig) { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 1)); - NextTest(); + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - void OnSuccessResponse_13() { ThrowSuccessResponse(); } + ~Test_TC_BI_2_2Suite() {} - CHIP_ERROR TestVerify_14() + chip::System::Clock::Timeout GetWaitDuration() const override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::AccessControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_14, OnFailureCallback_14, true)); - return CHIP_NO_ERROR; + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } - void OnFailureResponse_14(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; - void OnSuccessResponse_14( - const chip::app::DataModel::DecodableList & - acl) - { - { - auto iter_0 = acl.begin(); - VerifyOrReturn(CheckNextListItemDecodes("acl", iter_0, 0)); - VerifyOrReturn(CheckValue("acl[0].privilege", iter_0.GetValue().privilege, 5)); - VerifyOrReturn(CheckValue("acl[0].authMode", iter_0.GetValue().authMode, 2)); - VerifyOrReturn(CheckValueNull("acl[0].subjects", iter_0.GetValue().subjects)); - VerifyOrReturn(CheckValueNull("acl[0].targets", iter_0.GetValue().targets)); - VerifyOrReturn(CheckValue("acl[0].fabricIndex", iter_0.GetValue().fabricIndex, 1)); - VerifyOrReturn(CheckNoMoreListItems("acl", iter_0, 1)); - } + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } - NextTest(); - } + // + // Tests methods + // - CHIP_ERROR TestWriteEntryTooManyTargets_15() + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::AccessControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ListFreer listFreer; - chip::app::DataModel::List aclArgument; + bool shouldContinue = false; + switch (mTestIndex - 1) { - auto * listHolder_0 = new ListHolder(2); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].privilege = static_cast(5); - listHolder_0->mList[0].authMode = static_cast(2); - listHolder_0->mList[0].subjects.SetNull(); - listHolder_0->mList[0].targets.SetNull(); - listHolder_0->mList[0].fabricIndex = 0; - - listHolder_0->mList[1].privilege = static_cast(1); - listHolder_0->mList[1].authMode = static_cast(2); - listHolder_0->mList[1].subjects.SetNull(); - listHolder_0->mList[1].targets.SetNonNull(); - + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { - auto * listHolder_3 = new ListHolder(20); - listFreer.add(listHolder_3); - - listHolder_3->mList[0].cluster.SetNull(); - listHolder_3->mList[0].endpoint.SetNonNull(); - listHolder_3->mList[0].endpoint.Value() = 1U; - listHolder_3->mList[0].deviceType.SetNull(); - - listHolder_3->mList[1].cluster.SetNull(); - listHolder_3->mList[1].endpoint.SetNonNull(); - listHolder_3->mList[1].endpoint.Value() = 2U; - listHolder_3->mList[1].deviceType.SetNull(); - - listHolder_3->mList[2].cluster.SetNull(); - listHolder_3->mList[2].endpoint.SetNonNull(); - listHolder_3->mList[2].endpoint.Value() = 3U; - listHolder_3->mList[2].deviceType.SetNull(); - - listHolder_3->mList[3].cluster.SetNull(); - listHolder_3->mList[3].endpoint.SetNonNull(); - listHolder_3->mList[3].endpoint.Value() = 4U; - listHolder_3->mList[3].deviceType.SetNull(); - - listHolder_3->mList[4].cluster.SetNull(); - listHolder_3->mList[4].endpoint.SetNonNull(); - listHolder_3->mList[4].endpoint.Value() = 5U; - listHolder_3->mList[4].deviceType.SetNull(); - - listHolder_3->mList[5].cluster.SetNull(); - listHolder_3->mList[5].endpoint.SetNonNull(); - listHolder_3->mList[5].endpoint.Value() = 6U; - listHolder_3->mList[5].deviceType.SetNull(); - - listHolder_3->mList[6].cluster.SetNull(); - listHolder_3->mList[6].endpoint.SetNonNull(); - listHolder_3->mList[6].endpoint.Value() = 7U; - listHolder_3->mList[6].deviceType.SetNull(); - - listHolder_3->mList[7].cluster.SetNull(); - listHolder_3->mList[7].endpoint.SetNonNull(); - listHolder_3->mList[7].endpoint.Value() = 8U; - listHolder_3->mList[7].deviceType.SetNull(); - - listHolder_3->mList[8].cluster.SetNull(); - listHolder_3->mList[8].endpoint.SetNonNull(); - listHolder_3->mList[8].endpoint.Value() = 9U; - listHolder_3->mList[8].deviceType.SetNull(); - - listHolder_3->mList[9].cluster.SetNull(); - listHolder_3->mList[9].endpoint.SetNonNull(); - listHolder_3->mList[9].endpoint.Value() = 10U; - listHolder_3->mList[9].deviceType.SetNull(); - - listHolder_3->mList[10].cluster.SetNull(); - listHolder_3->mList[10].endpoint.SetNonNull(); - listHolder_3->mList[10].endpoint.Value() = 11U; - listHolder_3->mList[10].deviceType.SetNull(); - - listHolder_3->mList[11].cluster.SetNull(); - listHolder_3->mList[11].endpoint.SetNonNull(); - listHolder_3->mList[11].endpoint.Value() = 12U; - listHolder_3->mList[11].deviceType.SetNull(); - - listHolder_3->mList[12].cluster.SetNull(); - listHolder_3->mList[12].endpoint.SetNonNull(); - listHolder_3->mList[12].endpoint.Value() = 13U; - listHolder_3->mList[12].deviceType.SetNull(); - - listHolder_3->mList[13].cluster.SetNull(); - listHolder_3->mList[13].endpoint.SetNonNull(); - listHolder_3->mList[13].endpoint.Value() = 14U; - listHolder_3->mList[13].deviceType.SetNull(); - - listHolder_3->mList[14].cluster.SetNull(); - listHolder_3->mList[14].endpoint.SetNonNull(); - listHolder_3->mList[14].endpoint.Value() = 15U; - listHolder_3->mList[14].deviceType.SetNull(); - - listHolder_3->mList[15].cluster.SetNull(); - listHolder_3->mList[15].endpoint.SetNonNull(); - listHolder_3->mList[15].endpoint.Value() = 16U; - listHolder_3->mList[15].deviceType.SetNull(); - - listHolder_3->mList[16].cluster.SetNull(); - listHolder_3->mList[16].endpoint.SetNonNull(); - listHolder_3->mList[16].endpoint.Value() = 17U; - listHolder_3->mList[16].deviceType.SetNull(); - - listHolder_3->mList[17].cluster.SetNull(); - listHolder_3->mList[17].endpoint.SetNonNull(); - listHolder_3->mList[17].endpoint.Value() = 18U; - listHolder_3->mList[17].deviceType.SetNull(); - - listHolder_3->mList[18].cluster.SetNull(); - listHolder_3->mList[18].endpoint.SetNonNull(); - listHolder_3->mList[18].endpoint.Value() = 19U; - listHolder_3->mList[18].deviceType.SetNull(); - - listHolder_3->mList[19].cluster.SetNull(); - listHolder_3->mList[19].endpoint.SetNonNull(); - listHolder_3->mList[19].endpoint.Value() = 20U; - listHolder_3->mList[19].deviceType.SetNull(); - - listHolder_0->mList[1].targets.Value() = - chip::app::DataModel::List(listHolder_3->mList, 20); + bool value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("presentValue", value, 0)); } - listHolder_0->mList[1].fabricIndex = 0; - - aclArgument = chip::app::DataModel::List( - listHolder_0->mList, 2); + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + bool value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("outOfService", value, 0)); + } + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("statusFlags", value, 0)); + } + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + bool value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("presentValue", value, 0)); + } + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + bool value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("outOfService", value, 0)); + } + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("statusFlags", value, 0)); + } + break; + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("statusFlags", value, 0)); + } + break; + case 8: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("statusFlags", value, 0)); + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); } - ReturnErrorOnFailure(cluster.WriteAttribute( - aclArgument, this, OnSuccessCallback_15, OnFailureCallback_15)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_15(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 1)); - NextTest(); - } - - void OnSuccessResponse_15() { ThrowSuccessResponse(); } - - CHIP_ERROR TestVerify_16() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::AccessControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_16, OnFailureCallback_16, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_16(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_16( - const chip::app::DataModel::DecodableList & - acl) - { + if (shouldContinue) { - auto iter_0 = acl.begin(); - VerifyOrReturn(CheckNextListItemDecodes("acl", iter_0, 0)); - VerifyOrReturn(CheckValue("acl[0].privilege", iter_0.GetValue().privilege, 5)); - VerifyOrReturn(CheckValue("acl[0].authMode", iter_0.GetValue().authMode, 2)); - VerifyOrReturn(CheckValueNull("acl[0].subjects", iter_0.GetValue().subjects)); - VerifyOrReturn(CheckValueNull("acl[0].targets", iter_0.GetValue().targets)); - VerifyOrReturn(CheckValue("acl[0].fabricIndex", iter_0.GetValue().fabricIndex, 1)); - VerifyOrReturn(CheckNoMoreListItems("acl", iter_0, 1)); + ContinueOnChipMainThread(CHIP_NO_ERROR); } - - NextTest(); } - CHIP_ERROR TestRestoreAcl_17() + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::AccessControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ListFreer listFreer; - chip::app::DataModel::List aclArgument; - + using namespace chip::app::Clusters; + switch (testIndex) { - auto * listHolder_0 = new ListHolder(1); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].privilege = static_cast(5); - listHolder_0->mList[0].authMode = static_cast(2); - listHolder_0->mList[0].subjects.SetNull(); - listHolder_0->mList[0].targets.SetNull(); - listHolder_0->mList[0].fabricIndex = 0; - - aclArgument = chip::app::DataModel::List( - listHolder_0->mList, 1); + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "Reads PresentValue attribute from DUT"); + VerifyOrdo(!ShouldSkip("A_PRESENTVALUE"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), BinaryInputBasic::Id, + BinaryInputBasic::Attributes::PresentValue::Id); + } + case 2: { + LogStep(2, "Reads OutOfService attribute from DUT"); + VerifyOrdo(!ShouldSkip("A_OUTOFSERVICE"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), BinaryInputBasic::Id, + BinaryInputBasic::Attributes::OutOfService::Id); + } + case 3: { + LogStep(3, "Reads StatusFlags attribute from DUT"); + VerifyOrdo(!ShouldSkip("A_STATUSFLAGS"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), BinaryInputBasic::Id, + BinaryInputBasic::Attributes::StatusFlags::Id); + } + case 4: { + LogStep(4, "Reads PresentValue attribute from DUT"); + VerifyOrdo(!ShouldSkip("A_PRESENTVALUE"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), BinaryInputBasic::Id, + BinaryInputBasic::Attributes::PresentValue::Id); + } + case 5: { + LogStep(5, "Reads OutOfService attribute from DUT"); + VerifyOrdo(!ShouldSkip("A_OUTOFSERVICE"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), BinaryInputBasic::Id, + BinaryInputBasic::Attributes::OutOfService::Id); + } + case 6: { + LogStep(6, "Reads StatusFlags attribute from DUT"); + VerifyOrdo(!ShouldSkip("A_STATUSFLAGS"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), BinaryInputBasic::Id, + BinaryInputBasic::Attributes::StatusFlags::Id); + } + case 7: { + LogStep(7, "Reads StatusFlags attribute from DUT"); + VerifyOrdo(!ShouldSkip("A_STATUSFLAGS"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), BinaryInputBasic::Id, + BinaryInputBasic::Attributes::StatusFlags::Id); + } + case 8: { + LogStep(8, "Reads StatusFlags attribute from DUT"); + VerifyOrdo(!ShouldSkip("A_STATUSFLAGS"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), BinaryInputBasic::Id, + BinaryInputBasic::Attributes::StatusFlags::Id); + } } - - ReturnErrorOnFailure(cluster.WriteAttribute( - aclArgument, this, OnSuccessCallback_17, OnFailureCallback_17)); return CHIP_NO_ERROR; } +}; - void OnFailureResponse_17(CHIP_ERROR error) +class Test_TC_BOOL_1_1Suite : public TestCommand +{ +public: + Test_TC_BOOL_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_BOOL_1_1", 6, credsIssuerConfig) { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - void OnSuccessResponse_17() { NextTest(); } + ~Test_TC_BOOL_1_1Suite() {} - CHIP_ERROR TestVerify_18() + chip::System::Clock::Timeout GetWaitDuration() const override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::AccessControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_18, OnFailureCallback_18, true)); - return CHIP_NO_ERROR; + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } - void OnFailureResponse_18(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // - void OnSuccessResponse_18( - const chip::app::DataModel::DecodableList & - acl) + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { + bool shouldContinue = false; + + switch (mTestIndex - 1) { - auto iter_0 = acl.begin(); - VerifyOrReturn(CheckNextListItemDecodes("acl", iter_0, 0)); - VerifyOrReturn(CheckValue("acl[0].privilege", iter_0.GetValue().privilege, 5)); - VerifyOrReturn(CheckValue("acl[0].authMode", iter_0.GetValue().authMode, 2)); - VerifyOrReturn(CheckValueNull("acl[0].subjects", iter_0.GetValue().subjects)); - VerifyOrReturn(CheckValueNull("acl[0].targets", iter_0.GetValue().targets)); - VerifyOrReturn(CheckValue("acl[0].fabricIndex", iter_0.GetValue().fabricIndex, 1)); - VerifyOrReturn(CheckNoMoreListItems("acl", iter_0, 1)); + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("clusterRevision", value, 1U)); + } + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + } + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "list")); + } + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "list")); + } + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "list")); + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); } - NextTest(); + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } } - CHIP_ERROR TestValidateResourceMinimaSubjectsPerAccessControlEntry_19() + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::AccessControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_19, OnFailureCallback_19, true)); + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "read the global attribute: ClusterRevision"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), BooleanState::Id, BooleanState::Attributes::ClusterRevision::Id); + } + case 2: { + LogStep(2, "Read the global attribute constraints: ClusterRevision"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), BooleanState::Id, BooleanState::Attributes::ClusterRevision::Id); + } + case 3: { + LogStep(3, "Read the global attribute: AttributeList"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), BooleanState::Id, BooleanState::Attributes::AttributeList::Id); + } + case 4: { + LogStep(4, "Read the global attribute: AcceptedCommandList"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), BooleanState::Id, + BooleanState::Attributes::AcceptedCommandList::Id); + } + case 5: { + LogStep(5, "Read the global attribute: GeneratedCommandList"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), BooleanState::Id, + BooleanState::Attributes::GeneratedCommandList::Id); + } + } return CHIP_NO_ERROR; } +}; - void OnFailureResponse_19(CHIP_ERROR error) +class Test_TC_BOOL_2_1Suite : public TestCommand +{ +public: + Test_TC_BOOL_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_BOOL_2_1", 3, credsIssuerConfig) { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - void OnSuccessResponse_19(uint16_t subjectsPerAccessControlEntry) - { - VerifyOrReturn(CheckConstraintMinValue("subjectsPerAccessControlEntry", subjectsPerAccessControlEntry, 4U)); - NextTest(); - } + ~Test_TC_BOOL_2_1Suite() {} - CHIP_ERROR TestValidateResourceMinimaTargetsPerAccessControlEntry_20() + chip::System::Clock::Timeout GetWaitDuration() const override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::AccessControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_20, OnFailureCallback_20, true)); - return CHIP_NO_ERROR; + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } - void OnFailureResponse_20(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; - void OnSuccessResponse_20(uint16_t targetsPerAccessControlEntry) - { - VerifyOrReturn(CheckConstraintMinValue("targetsPerAccessControlEntry", targetsPerAccessControlEntry, 3U)); - NextTest(); - } + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // - CHIP_ERROR TestValidateResourceMinimaAccessControlEntriesPerFabric_21() + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::AccessControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); + bool shouldContinue = false; - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_21, OnFailureCallback_21, true)); - return CHIP_NO_ERROR; - } + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + bool value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("stateValue", value, 0)); + } + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + bool value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "bool")); + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } - void OnFailureResponse_21(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } } - void OnSuccessResponse_21(uint16_t accessControlEntriesPerFabric) + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - VerifyOrReturn(CheckConstraintMinValue("accessControlEntriesPerFabric", accessControlEntriesPerFabric, 3U)); - NextTest(); + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "Read mandatory non-global attribute: StateValue"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), BooleanState::Id, BooleanState::Attributes::StateValue::Id); + } + case 2: { + LogStep(2, "Read mandatory non-global attribute constraints: StateValue"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), BooleanState::Id, BooleanState::Attributes::StateValue::Id); + } + } + return CHIP_NO_ERROR; } }; -class Test_TC_BI_1_1Suite : public TestCommand +class Test_TC_BRAC_1_1Suite : public TestCommand { public: - Test_TC_BI_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_BI_1_1", credsIssuerConfig), mTestIndex(0) + Test_TC_BRAC_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_BRAC_1_1", 6, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -1955,89 +2093,154 @@ class Test_TC_BI_1_1Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_BI_1_1Suite() {} + ~Test_TC_BRAC_1_1Suite() {} - /////////// TestCommand Interface ///////// - void NextTest() override + chip::System::Clock::Timeout GetWaitDuration() const override { - CHIP_ERROR err = CHIP_NO_ERROR; + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_BI_1_1\n"); - } +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_BI_1_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // - Wait(); + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override + { + bool shouldContinue = false; - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) + switch (mTestIndex - 1) { case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; break; case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : read the global attribute: ClusterRevision\n"); - err = TestReadTheGlobalAttributeClusterRevision_1(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("clusterRevision", value, 1U)); + } break; case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Read the global attribute constraints: ClusterRevision\n"); - err = TestReadTheGlobalAttributeConstraintsClusterRevision_2(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + } break; case 3: - ChipLogProgress(chipTool, - " ***** Test Step 3 : write the default values to mandatory global attribute: ClusterRevision\n"); - err = TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_3(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "list")); + } break; case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : reads back global attribute: ClusterRevision\n"); - err = TestReadsBackGlobalAttributeClusterRevision_4(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "list")); + } break; case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Read the global attribute: AttributeList\n"); - err = TestReadTheGlobalAttributeAttributeList_5(); - break; - case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : Read the global attribute: AcceptedCommandList\n"); - err = TestReadTheGlobalAttributeAcceptedCommandList_6(); - break; - case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : Read the global attribute: GeneratedCommandList\n"); - err = TestReadTheGlobalAttributeGeneratedCommandList_7(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "list")); + } break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); } - if (CHIP_NO_ERROR != err) + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } + } + + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "Read the global attribute: ClusterRevision"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), BridgedActions::Id, + BridgedActions::Attributes::ClusterRevision::Id); } + case 2: { + LogStep(2, "Read the global attribute constraints: ClusterRevision"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), BridgedActions::Id, + BridgedActions::Attributes::ClusterRevision::Id); + } + case 3: { + LogStep(3, "Read the global attribute: AttributeList"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), BridgedActions::Id, BridgedActions::Attributes::AttributeList::Id); + } + case 4: { + LogStep(4, "Read the global attribute: AcceptedCommandList"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), BridgedActions::Id, + BridgedActions::Attributes::AcceptedCommandList::Id); + } + case 5: { + LogStep(5, "Read the global attribute: GeneratedCommandList"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), BridgedActions::Id, + BridgedActions::Attributes::GeneratedCommandList::Id); + } + } + return CHIP_NO_ERROR; + } +}; + +class Test_TC_CC_1_1Suite : public TestCommand +{ +public: + Test_TC_CC_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_CC_1_1", 4, credsIssuerConfig) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } + ~Test_TC_CC_1_1Suite() {} + chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 8; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -2048,6 +2251,25 @@ class Test_TC_BI_1_1Suite : public TestCommand VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); shouldContinue = true; break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + } + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "list")); + } + break; default: LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); } @@ -2058,2770 +2280,1995 @@ class Test_TC_BI_1_1Suite : public TestCommand } } - static void OnFailureCallback_1(void * context, CHIP_ERROR error) + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - (static_cast(context))->OnFailureResponse_1(error); + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "Read the global attribute constraints : ClusterRevision"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ClusterRevision::Id); + } + case 2: { + LogStep(2, "write the default values to mandatory global attribute: ClusterRevision"); + uint16_t value; + value = 4U; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ClusterRevision::Id, + value); + } + case 3: { + LogStep(3, "Read the global attribute: AttributeList"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::AttributeList::Id); + } + } + return CHIP_NO_ERROR; } +}; - static void OnSuccessCallback_1(void * context, uint16_t clusterRevision) +class Test_TC_CC_2_1Suite : public TestCommand +{ +public: + Test_TC_CC_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_CC_2_1", 139, credsIssuerConfig) { - (static_cast(context))->OnSuccessResponse_1(clusterRevision); + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - static void OnFailureCallback_2(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_2(error); - } + ~Test_TC_CC_2_1Suite() {} - static void OnSuccessCallback_2(void * context, uint16_t clusterRevision) + chip::System::Clock::Timeout GetWaitDuration() const override { - (static_cast(context))->OnSuccessResponse_2(clusterRevision); + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } - static void OnFailureCallback_3(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_3(error); - } +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; - static void OnSuccessCallback_3(void * context) { (static_cast(context))->OnSuccessResponse_3(); } + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } - static void OnFailureCallback_4(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_4(error); - } + // + // Tests methods + // - static void OnSuccessCallback_4(void * context, uint16_t clusterRevision) - { - (static_cast(context))->OnSuccessResponse_4(clusterRevision); - } - - static void OnFailureCallback_5(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_5(error); - } - - static void OnSuccessCallback_5(void * context, const chip::app::DataModel::DecodableList & attributeList) - { - (static_cast(context))->OnSuccessResponse_5(attributeList); - } - - static void OnFailureCallback_6(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_6(error); - } - - static void OnSuccessCallback_6(void * context, - const chip::app::DataModel::DecodableList & acceptedCommandList) - { - (static_cast(context))->OnSuccessResponse_6(acceptedCommandList); - } - - static void OnFailureCallback_7(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_7(error); - } - - static void OnSuccessCallback_7(void * context, - const chip::app::DataModel::DecodableList & generatedCommandList) - { - (static_cast(context))->OnSuccessResponse_7(generatedCommandList); - } - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestReadTheGlobalAttributeClusterRevision_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::BinaryInputBasicClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_1, OnFailureCallback_1, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_1(uint16_t clusterRevision) - { - VerifyOrReturn(CheckValue("clusterRevision", clusterRevision, 1U)); - - NextTest(); - } - - CHIP_ERROR TestReadTheGlobalAttributeConstraintsClusterRevision_2() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::BinaryInputBasicClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_2, OnFailureCallback_2, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_2(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_2(uint16_t clusterRevision) - { - VerifyOrReturn(CheckConstraintType("clusterRevision", "", "uint16")); - NextTest(); - } - - CHIP_ERROR TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_3() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::BinaryInputBasicClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - uint16_t clusterRevisionArgument; - clusterRevisionArgument = 1U; - - ReturnErrorOnFailure(cluster.WriteAttribute( - clusterRevisionArgument, this, OnSuccessCallback_3, OnFailureCallback_3)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_3(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - NextTest(); - } - - void OnSuccessResponse_3() { ThrowSuccessResponse(); } - - CHIP_ERROR TestReadsBackGlobalAttributeClusterRevision_4() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::BinaryInputBasicClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_4, OnFailureCallback_4, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_4(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_4(uint16_t clusterRevision) - { - VerifyOrReturn(CheckValue("clusterRevision", clusterRevision, 1U)); - - NextTest(); - } - - CHIP_ERROR TestReadTheGlobalAttributeAttributeList_5() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::BinaryInputBasicClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_5, OnFailureCallback_5, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_5(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_5(const chip::app::DataModel::DecodableList & attributeList) - { - VerifyOrReturn(CheckConstraintType("attributeList", "", "list")); - NextTest(); - } - - CHIP_ERROR TestReadTheGlobalAttributeAcceptedCommandList_6() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::BinaryInputBasicClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_6, OnFailureCallback_6, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_6(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_6(const chip::app::DataModel::DecodableList & acceptedCommandList) - { - VerifyOrReturn(CheckConstraintType("acceptedCommandList", "", "list")); - NextTest(); - } - - CHIP_ERROR TestReadTheGlobalAttributeGeneratedCommandList_7() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::BinaryInputBasicClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_7, OnFailureCallback_7, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_7(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_7(const chip::app::DataModel::DecodableList & generatedCommandList) - { - VerifyOrReturn(CheckConstraintType("generatedCommandList", "", "list")); - NextTest(); - } -}; - -class Test_TC_BI_2_1Suite : public TestCommand -{ -public: - Test_TC_BI_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_BI_2_1", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_BI_2_1Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_BI_2_1\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_BI_2_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); + bool shouldContinue = false; - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) + switch (mTestIndex - 1) { case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; break; case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Read mandatory non-global attribute: OutOfService\n"); - err = TestReadMandatoryNonGlobalAttributeOutOfService_1(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint8")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 254)); + } break; case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Read mandatory non-global attribute constraints: OutOfService\n"); - err = TestReadMandatoryNonGlobalAttributeConstraintsOutOfService_2(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); break; case 3: - ChipLogProgress(chipTool, - " ***** Test Step 3 : Write the default values to mandatory non-global attribute: OutOfService\n"); - err = TestWriteTheDefaultValuesToMandatoryNonGlobalAttributeOutOfService_3(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint8")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 254)); + } break; case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Reads back the mandatory non-global attribute: OutOfService\n"); - err = TestReadsBackTheMandatoryNonGlobalAttributeOutOfService_4(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint8")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 254)); + } break; case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Read mandatory non-global attribute constraints: PresentValue\n"); - err = TestReadMandatoryNonGlobalAttributeConstraintsPresentValue_5(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); break; case 6: - ChipLogProgress(chipTool, - " ***** Test Step 6 : Write the default values to mandatory non-global attribute: PresentValue\n"); - err = TestWriteTheDefaultValuesToMandatoryNonGlobalAttributePresentValue_6(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint8")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 254)); + } break; case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : Reads back the mandatory non-global attribute: PresentValue\n"); - err = TestReadsBackTheMandatoryNonGlobalAttributePresentValue_7(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 65279U)); + } break; case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : Read mandatory non-global attribute: StatusFlags\n"); - err = TestReadMandatoryNonGlobalAttributeStatusFlags_8(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); break; case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : Read mandatory non-global attribute constraints: StatusFlags\n"); - err = TestReadMandatoryNonGlobalAttributeConstraintsStatusFlags_9(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 65279U)); + } break; case 10: - ChipLogProgress(chipTool, - " ***** Test Step 10 : Write the default values to mandatory non-global attribute: StatusFlags\n"); - err = TestWriteTheDefaultValuesToMandatoryNonGlobalAttributeStatusFlags_10(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 65279U)); + } break; case 11: - ChipLogProgress(chipTool, " ***** Test Step 11 : Reads back the mandatory non-global attribute: StatusFlags\n"); - err = TestReadsBackTheMandatoryNonGlobalAttributeStatusFlags_11(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 12; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: + case 12: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 65279U)); + } break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - static void OnFailureCallback_1(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_1(error); - } - - static void OnSuccessCallback_1(void * context, bool outOfService) - { - (static_cast(context))->OnSuccessResponse_1(outOfService); - } - - static void OnFailureCallback_2(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_2(error); - } - - static void OnSuccessCallback_2(void * context, bool outOfService) - { - (static_cast(context))->OnSuccessResponse_2(outOfService); - } - - static void OnFailureCallback_3(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_3(error); - } - - static void OnSuccessCallback_3(void * context) { (static_cast(context))->OnSuccessResponse_3(); } - - static void OnFailureCallback_4(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_4(error); - } - - static void OnSuccessCallback_4(void * context, bool outOfService) - { - (static_cast(context))->OnSuccessResponse_4(outOfService); - } - - static void OnFailureCallback_5(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_5(error); - } - - static void OnSuccessCallback_5(void * context, bool presentValue) - { - (static_cast(context))->OnSuccessResponse_5(presentValue); - } - - static void OnFailureCallback_6(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_6(error); - } - - static void OnSuccessCallback_6(void * context) { (static_cast(context))->OnSuccessResponse_6(); } - - static void OnFailureCallback_7(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_7(error); - } - - static void OnSuccessCallback_7(void * context, bool presentValue) - { - (static_cast(context))->OnSuccessResponse_7(presentValue); - } - - static void OnFailureCallback_8(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_8(error); - } - - static void OnSuccessCallback_8(void * context, uint8_t statusFlags) - { - (static_cast(context))->OnSuccessResponse_8(statusFlags); - } - - static void OnFailureCallback_9(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_9(error); - } - - static void OnSuccessCallback_9(void * context, uint8_t statusFlags) - { - (static_cast(context))->OnSuccessResponse_9(statusFlags); - } - - static void OnFailureCallback_10(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_10(error); - } - - static void OnSuccessCallback_10(void * context) { (static_cast(context))->OnSuccessResponse_10(); } - - static void OnFailureCallback_11(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_11(error); - } - - static void OnSuccessCallback_11(void * context, uint8_t statusFlags) - { - (static_cast(context))->OnSuccessResponse_11(statusFlags); - } - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestReadMandatoryNonGlobalAttributeOutOfService_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::BinaryInputBasicClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_1, OnFailureCallback_1, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_1(bool outOfService) - { - VerifyOrReturn(CheckValue("outOfService", outOfService, 0)); - - NextTest(); - } - - CHIP_ERROR TestReadMandatoryNonGlobalAttributeConstraintsOutOfService_2() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::BinaryInputBasicClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_2, OnFailureCallback_2, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_2(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_2(bool outOfService) - { - VerifyOrReturn(CheckConstraintType("outOfService", "", "bool")); - NextTest(); - } - - CHIP_ERROR TestWriteTheDefaultValuesToMandatoryNonGlobalAttributeOutOfService_3() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::BinaryInputBasicClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - bool outOfServiceArgument; - outOfServiceArgument = 0; - - ReturnErrorOnFailure(cluster.WriteAttribute( - outOfServiceArgument, this, OnSuccessCallback_3, OnFailureCallback_3)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_3(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_3() { NextTest(); } - - CHIP_ERROR TestReadsBackTheMandatoryNonGlobalAttributeOutOfService_4() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::BinaryInputBasicClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_4, OnFailureCallback_4, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_4(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_4(bool outOfService) - { - VerifyOrReturn(CheckValue("outOfService", outOfService, 0)); - - NextTest(); - } - - CHIP_ERROR TestReadMandatoryNonGlobalAttributeConstraintsPresentValue_5() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::BinaryInputBasicClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_5, OnFailureCallback_5, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_5(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_5(bool presentValue) - { - VerifyOrReturn(CheckConstraintType("presentValue", "", "bool")); - NextTest(); - } - - CHIP_ERROR TestWriteTheDefaultValuesToMandatoryNonGlobalAttributePresentValue_6() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::BinaryInputBasicClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - bool presentValueArgument; - presentValueArgument = 0; - - ReturnErrorOnFailure(cluster.WriteAttribute( - presentValueArgument, this, OnSuccessCallback_6, OnFailureCallback_6)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_6(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_6() { NextTest(); } - - CHIP_ERROR TestReadsBackTheMandatoryNonGlobalAttributePresentValue_7() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::BinaryInputBasicClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_7, OnFailureCallback_7, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_7(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_7(bool presentValue) - { - VerifyOrReturn(CheckValue("presentValue", presentValue, 0)); - - NextTest(); - } - - CHIP_ERROR TestReadMandatoryNonGlobalAttributeStatusFlags_8() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::BinaryInputBasicClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_8, OnFailureCallback_8, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_8(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_8(uint8_t statusFlags) - { - VerifyOrReturn(CheckValue("statusFlags", statusFlags, 0)); - - NextTest(); - } - - CHIP_ERROR TestReadMandatoryNonGlobalAttributeConstraintsStatusFlags_9() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::BinaryInputBasicClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_9, OnFailureCallback_9, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_9(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_9(uint8_t statusFlags) - { - VerifyOrReturn(CheckConstraintType("statusFlags", "", "map8")); - VerifyOrReturn(CheckConstraintMinValue("statusFlags", statusFlags, 0)); - VerifyOrReturn(CheckConstraintMaxValue("statusFlags", statusFlags, 15)); - NextTest(); - } - - CHIP_ERROR TestWriteTheDefaultValuesToMandatoryNonGlobalAttributeStatusFlags_10() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::BinaryInputBasicClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - uint8_t statusFlagsArgument; - statusFlagsArgument = 0; - - ReturnErrorOnFailure(cluster.WriteAttribute( - statusFlagsArgument, this, OnSuccessCallback_10, OnFailureCallback_10)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_10(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - NextTest(); - } - - void OnSuccessResponse_10() { ThrowSuccessResponse(); } - - CHIP_ERROR TestReadsBackTheMandatoryNonGlobalAttributeStatusFlags_11() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::BinaryInputBasicClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_11, OnFailureCallback_11, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_11(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_11(uint8_t statusFlags) - { - VerifyOrReturn(CheckValue("statusFlags", statusFlags, 0)); - - NextTest(); - } -}; - -class Test_TC_BI_2_2Suite : public TestCommand -{ -public: - Test_TC_BI_2_2Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_BI_2_2", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_BI_2_2Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_BI_2_2\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_BI_2_2\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + case 13: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 65279U)); + } break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Reads PresentValue attribute from DUT\n"); - if (ShouldSkip("A_PRESENTVALUE")) + case 14: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { - NextTest(); - return; + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 2)); } - err = TestReadsPresentValueAttributeFromDut_1(); break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Reads OutOfService attribute from DUT\n"); - if (ShouldSkip("A_OUTOFSERVICE")) + case 15: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { - NextTest(); - return; + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "map8")); } - err = TestReadsOutOfServiceAttributeFromDut_2(); break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Reads StatusFlags attribute from DUT\n"); - if (ShouldSkip("A_STATUSFLAGS")) + case 16: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 17: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { - NextTest(); - return; + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("colorControlOptions", value, 0)); } - err = TestReadsStatusFlagsAttributeFromDut_3(); break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Reads PresentValue attribute from DUT\n"); - if (ShouldSkip("A_PRESENTVALUE")) + case 18: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { - NextTest(); - return; + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); } - err = TestReadsPresentValueAttributeFromDut_4(); break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Reads OutOfService attribute from DUT\n"); - if (ShouldSkip("A_OUTOFSERVICE")) + case 19: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); + break; + case 20: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { - NextTest(); - return; + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); } - err = TestReadsOutOfServiceAttributeFromDut_5(); break; - case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : Reads StatusFlags attribute from DUT\n"); - if (ShouldSkip("A_STATUSFLAGS")) + case 21: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { - NextTest(); - return; + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "enum8")); } - err = TestReadsStatusFlagsAttributeFromDut_6(); break; - case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : Reads StatusFlags attribute from DUT\n"); - if (ShouldSkip("A_STATUSFLAGS")) + case 22: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { - NextTest(); - return; + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint8")); } - err = TestReadsStatusFlagsAttributeFromDut_7(); break; - case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : Reads StatusFlags attribute from DUT\n"); - if (ShouldSkip("A_STATUSFLAGS")) + case 23: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); + break; + case 24: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { - NextTest(); - return; + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint8")); } - err = TestReadsStatusFlagsAttributeFromDut_8(); break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 9; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: + case 25: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint8")); + } break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - static void OnFailureCallback_1(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_1(error); - } - - static void OnSuccessCallback_1(void * context, bool presentValue) - { - (static_cast(context))->OnSuccessResponse_1(presentValue); - } - - static void OnFailureCallback_2(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_2(error); - } - - static void OnSuccessCallback_2(void * context, bool outOfService) - { - (static_cast(context))->OnSuccessResponse_2(outOfService); - } - - static void OnFailureCallback_3(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_3(error); - } - - static void OnSuccessCallback_3(void * context, uint8_t statusFlags) - { - (static_cast(context))->OnSuccessResponse_3(statusFlags); - } - - static void OnFailureCallback_4(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_4(error); - } - - static void OnSuccessCallback_4(void * context, bool presentValue) - { - (static_cast(context))->OnSuccessResponse_4(presentValue); - } - - static void OnFailureCallback_5(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_5(error); - } - - static void OnSuccessCallback_5(void * context, bool outOfService) - { - (static_cast(context))->OnSuccessResponse_5(outOfService); - } - - static void OnFailureCallback_6(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_6(error); - } - - static void OnSuccessCallback_6(void * context, uint8_t statusFlags) - { - (static_cast(context))->OnSuccessResponse_6(statusFlags); - } - - static void OnFailureCallback_7(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_7(error); - } - - static void OnSuccessCallback_7(void * context, uint8_t statusFlags) - { - (static_cast(context))->OnSuccessResponse_7(statusFlags); - } - - static void OnFailureCallback_8(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_8(error); - } - - static void OnSuccessCallback_8(void * context, uint8_t statusFlags) - { - (static_cast(context))->OnSuccessResponse_8(statusFlags); - } - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestReadsPresentValueAttributeFromDut_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::BinaryInputBasicClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_1, OnFailureCallback_1, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_1(bool presentValue) - { - VerifyOrReturn(CheckValue("presentValue", presentValue, 0)); - - NextTest(); - } - - CHIP_ERROR TestReadsOutOfServiceAttributeFromDut_2() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::BinaryInputBasicClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_2, OnFailureCallback_2, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_2(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_2(bool outOfService) - { - VerifyOrReturn(CheckValue("outOfService", outOfService, 0)); - - NextTest(); - } - - CHIP_ERROR TestReadsStatusFlagsAttributeFromDut_3() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::BinaryInputBasicClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_3, OnFailureCallback_3, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_3(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_3(uint8_t statusFlags) - { - VerifyOrReturn(CheckValue("statusFlags", statusFlags, 0)); - - NextTest(); - } - - CHIP_ERROR TestReadsPresentValueAttributeFromDut_4() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::BinaryInputBasicClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_4, OnFailureCallback_4, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_4(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_4(bool presentValue) - { - VerifyOrReturn(CheckValue("presentValue", presentValue, 0)); - - NextTest(); - } - - CHIP_ERROR TestReadsOutOfServiceAttributeFromDut_5() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::BinaryInputBasicClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_5, OnFailureCallback_5, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_5(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_5(bool outOfService) - { - VerifyOrReturn(CheckValue("outOfService", outOfService, 0)); - - NextTest(); - } - - CHIP_ERROR TestReadsStatusFlagsAttributeFromDut_6() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::BinaryInputBasicClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_6, OnFailureCallback_6, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_6(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_6(uint8_t statusFlags) - { - VerifyOrReturn(CheckValue("statusFlags", statusFlags, 0)); - - NextTest(); - } - - CHIP_ERROR TestReadsStatusFlagsAttributeFromDut_7() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::BinaryInputBasicClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_7, OnFailureCallback_7, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_7(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_7(uint8_t statusFlags) - { - VerifyOrReturn(CheckValue("statusFlags", statusFlags, 0)); - - NextTest(); - } - - CHIP_ERROR TestReadsStatusFlagsAttributeFromDut_8() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::BinaryInputBasicClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_8, OnFailureCallback_8, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_8(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_8(uint8_t statusFlags) - { - VerifyOrReturn(CheckValue("statusFlags", statusFlags, 0)); - - NextTest(); - } -}; - -class Test_TC_BOOL_1_1Suite : public TestCommand -{ -public: - Test_TC_BOOL_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_BOOL_1_1", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_BOOL_1_1Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_BOOL_1_1\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_BOOL_1_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + case 26: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : read the global attribute: ClusterRevision\n"); - err = TestReadTheGlobalAttributeClusterRevision_1(); + case 27: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint8")); + } break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Read the global attribute constraints: ClusterRevision\n"); - err = TestReadTheGlobalAttributeConstraintsClusterRevision_2(); + case 28: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + } break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Read the global attribute: AttributeList\n"); - err = TestReadTheGlobalAttributeAttributeList_3(); + case 29: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Read the global attribute: AcceptedCommandList\n"); - err = TestReadTheGlobalAttributeAcceptedCommandList_4(); + case 30: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + } break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Read the global attribute: GeneratedCommandList\n"); - err = TestReadTheGlobalAttributeGeneratedCommandList_5(); + case 31: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + } break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 6; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: + case 32: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); + break; + case 33: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + } break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - static void OnFailureCallback_1(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_1(error); - } - - static void OnSuccessCallback_1(void * context, uint16_t clusterRevision) - { - (static_cast(context))->OnSuccessResponse_1(clusterRevision); - } - - static void OnFailureCallback_2(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_2(error); - } - - static void OnSuccessCallback_2(void * context, uint16_t clusterRevision) - { - (static_cast(context))->OnSuccessResponse_2(clusterRevision); - } - - static void OnFailureCallback_3(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_3(error); - } - - static void OnSuccessCallback_3(void * context, const chip::app::DataModel::DecodableList & attributeList) - { - (static_cast(context))->OnSuccessResponse_3(attributeList); - } - - static void OnFailureCallback_4(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_4(error); - } - - static void OnSuccessCallback_4(void * context, - const chip::app::DataModel::DecodableList & acceptedCommandList) - { - (static_cast(context))->OnSuccessResponse_4(acceptedCommandList); - } - - static void OnFailureCallback_5(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_5(error); - } - - static void OnSuccessCallback_5(void * context, - const chip::app::DataModel::DecodableList & generatedCommandList) - { - (static_cast(context))->OnSuccessResponse_5(generatedCommandList); - } - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestReadTheGlobalAttributeClusterRevision_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::BooleanStateClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_1, OnFailureCallback_1, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_1(uint16_t clusterRevision) - { - VerifyOrReturn(CheckValue("clusterRevision", clusterRevision, 1U)); - - NextTest(); - } - - CHIP_ERROR TestReadTheGlobalAttributeConstraintsClusterRevision_2() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::BooleanStateClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_2, OnFailureCallback_2, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_2(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_2(uint16_t clusterRevision) - { - VerifyOrReturn(CheckConstraintType("clusterRevision", "", "uint16")); - NextTest(); - } - - CHIP_ERROR TestReadTheGlobalAttributeAttributeList_3() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::BooleanStateClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_3, OnFailureCallback_3, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_3(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_3(const chip::app::DataModel::DecodableList & attributeList) - { - VerifyOrReturn(CheckConstraintType("attributeList", "", "list")); - NextTest(); - } - - CHIP_ERROR TestReadTheGlobalAttributeAcceptedCommandList_4() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::BooleanStateClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_4, OnFailureCallback_4, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_4(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_4(const chip::app::DataModel::DecodableList & acceptedCommandList) - { - VerifyOrReturn(CheckConstraintType("acceptedCommandList", "", "list")); - NextTest(); - } - - CHIP_ERROR TestReadTheGlobalAttributeGeneratedCommandList_5() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::BooleanStateClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_5, OnFailureCallback_5, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_5(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_5(const chip::app::DataModel::DecodableList & generatedCommandList) - { - VerifyOrReturn(CheckConstraintType("generatedCommandList", "", "list")); - NextTest(); - } -}; - -class Test_TC_BOOL_2_1Suite : public TestCommand -{ -public: - Test_TC_BOOL_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_BOOL_2_1", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_BOOL_2_1Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_BOOL_2_1\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_BOOL_2_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + case 34: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + } break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Read mandatory non-global attribute: StateValue\n"); - err = TestReadMandatoryNonGlobalAttributeStateValue_1(); + case 35: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Read mandatory non-global attribute constraints: StateValue\n"); - err = TestReadMandatoryNonGlobalAttributeConstraintsStateValue_2(); + case 36: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + } break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 3; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: + case 37: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "map16")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 31U)); + } break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - static void OnFailureCallback_1(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_1(error); - } - - static void OnSuccessCallback_1(void * context, bool stateValue) - { - (static_cast(context))->OnSuccessResponse_1(stateValue); - } - - static void OnFailureCallback_2(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_2(error); - } - - static void OnSuccessCallback_2(void * context, bool stateValue) - { - (static_cast(context))->OnSuccessResponse_2(stateValue); - } - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestReadMandatoryNonGlobalAttributeStateValue_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::BooleanStateClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_1, OnFailureCallback_1, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_1(bool stateValue) - { - VerifyOrReturn(CheckValue("stateValue", stateValue, 0)); - - NextTest(); - } - - CHIP_ERROR TestReadMandatoryNonGlobalAttributeConstraintsStateValue_2() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::BooleanStateClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_2, OnFailureCallback_2, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_2(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_2(bool stateValue) - { - VerifyOrReturn(CheckConstraintType("stateValue", "", "bool")); - NextTest(); - } -}; - -class Test_TC_BRAC_1_1Suite : public TestCommand -{ -public: - Test_TC_BRAC_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_BRAC_1_1", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_BRAC_1_1Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_BRAC_1_1\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_BRAC_1_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + case 38: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Read the global attribute: ClusterRevision\n"); - err = TestReadTheGlobalAttributeClusterRevision_1(); + case 39: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "map16")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 31U)); + } break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Read the global attribute constraints: ClusterRevision\n"); - err = TestReadTheGlobalAttributeConstraintsClusterRevision_2(); + case 40: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 65279U)); + } break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Read the global attribute: AttributeList\n"); - err = TestReadTheGlobalAttributeAttributeList_3(); + case 41: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Read the global attribute: AcceptedCommandList\n"); - err = TestReadTheGlobalAttributeAcceptedCommandList_4(); + case 42: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 65279U)); + } break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Read the global attribute: GeneratedCommandList\n"); - err = TestReadTheGlobalAttributeGeneratedCommandList_5(); - break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 6; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - static void OnFailureCallback_1(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_1(error); - } - - static void OnSuccessCallback_1(void * context, uint16_t clusterRevision) - { - (static_cast(context))->OnSuccessResponse_1(clusterRevision); - } - - static void OnFailureCallback_2(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_2(error); - } - - static void OnSuccessCallback_2(void * context, uint16_t clusterRevision) - { - (static_cast(context))->OnSuccessResponse_2(clusterRevision); - } - - static void OnFailureCallback_3(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_3(error); - } - - static void OnSuccessCallback_3(void * context, const chip::app::DataModel::DecodableList & attributeList) - { - (static_cast(context))->OnSuccessResponse_3(attributeList); - } - - static void OnFailureCallback_4(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_4(error); - } - - static void OnSuccessCallback_4(void * context, - const chip::app::DataModel::DecodableList & acceptedCommandList) - { - (static_cast(context))->OnSuccessResponse_4(acceptedCommandList); - } - - static void OnFailureCallback_5(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_5(error); - } - - static void OnSuccessCallback_5(void * context, - const chip::app::DataModel::DecodableList & generatedCommandList) - { - (static_cast(context))->OnSuccessResponse_5(generatedCommandList); - } - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestReadTheGlobalAttributeClusterRevision_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::BridgedActionsClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_1, OnFailureCallback_1, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_1(uint16_t clusterRevision) - { - VerifyOrReturn(CheckValue("clusterRevision", clusterRevision, 1U)); - - NextTest(); - } - - CHIP_ERROR TestReadTheGlobalAttributeConstraintsClusterRevision_2() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::BridgedActionsClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_2, OnFailureCallback_2, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_2(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_2(uint16_t clusterRevision) - { - VerifyOrReturn(CheckConstraintType("clusterRevision", "", "uint16")); - NextTest(); - } - - CHIP_ERROR TestReadTheGlobalAttributeAttributeList_3() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::BridgedActionsClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_3, OnFailureCallback_3, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_3(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_3(const chip::app::DataModel::DecodableList & attributeList) - { - VerifyOrReturn(CheckConstraintType("attributeList", "", "list")); - NextTest(); - } - - CHIP_ERROR TestReadTheGlobalAttributeAcceptedCommandList_4() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::BridgedActionsClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_4, OnFailureCallback_4, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_4(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_4(const chip::app::DataModel::DecodableList & acceptedCommandList) - { - VerifyOrReturn(CheckConstraintType("acceptedCommandList", "", "list")); - NextTest(); - } - - CHIP_ERROR TestReadTheGlobalAttributeGeneratedCommandList_5() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::BridgedActionsClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_5, OnFailureCallback_5, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_5(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_5(const chip::app::DataModel::DecodableList & generatedCommandList) - { - VerifyOrReturn(CheckConstraintType("generatedCommandList", "", "list")); - NextTest(); - } -}; - -class Test_TC_CC_1_1Suite : public TestCommand -{ -public: - Test_TC_CC_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_CC_1_1", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_CC_1_1Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_CC_1_1\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_CC_1_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Read the global attribute constraints : ClusterRevision\n"); - err = TestReadTheGlobalAttributeConstraintsClusterRevision_1(); - break; - case 2: - ChipLogProgress(chipTool, - " ***** Test Step 2 : write the default values to mandatory global attribute: ClusterRevision\n"); - err = TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_2(); - break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Read the global attribute: AttributeList\n"); - err = TestReadTheGlobalAttributeAttributeList_3(); - break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 4; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - static void OnFailureCallback_1(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_1(error); - } - - static void OnSuccessCallback_1(void * context, uint16_t clusterRevision) - { - (static_cast(context))->OnSuccessResponse_1(clusterRevision); - } - - static void OnFailureCallback_2(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_2(error); - } - - static void OnSuccessCallback_2(void * context) { (static_cast(context))->OnSuccessResponse_2(); } - - static void OnFailureCallback_3(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_3(error); - } - - static void OnSuccessCallback_3(void * context, const chip::app::DataModel::DecodableList & attributeList) - { - (static_cast(context))->OnSuccessResponse_3(attributeList); - } - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestReadTheGlobalAttributeConstraintsClusterRevision_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_1, OnFailureCallback_1, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_1(uint16_t clusterRevision) - { - VerifyOrReturn(CheckConstraintType("clusterRevision", "", "uint16")); - NextTest(); - } - - CHIP_ERROR TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_2() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - uint16_t clusterRevisionArgument; - clusterRevisionArgument = 4U; - - ReturnErrorOnFailure(cluster.WriteAttribute( - clusterRevisionArgument, this, OnSuccessCallback_2, OnFailureCallback_2)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_2(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - NextTest(); - } - - void OnSuccessResponse_2() { ThrowSuccessResponse(); } - - CHIP_ERROR TestReadTheGlobalAttributeAttributeList_3() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_3, OnFailureCallback_3, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_3(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_3(const chip::app::DataModel::DecodableList & attributeList) - { - VerifyOrReturn(CheckConstraintType("attributeList", "", "list")); - NextTest(); - } -}; - -class Test_TC_CC_2_1Suite : public TestCommand -{ -public: - Test_TC_CC_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_CC_2_1", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_CC_2_1Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_CC_2_1\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_CC_2_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Validate constraints of attribute: current hue\n"); - err = TestValidateConstraintsOfAttributeCurrentHue_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Write the default value to mandatory attribute: CurrentHue\n"); - err = TestWriteTheDefaultValueToMandatoryAttributeCurrentHue_2(); - break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Reads back mandatory attribute: CurrentHue\n"); - err = TestReadsBackMandatoryAttributeCurrentHue_3(); - break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Validate constraints of attribute: CurrentSaturation\n"); - err = TestValidateConstraintsOfAttributeCurrentSaturation_4(); - break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Write the default value to mandatory attribute: CurrentSaturation\n"); - err = TestWriteTheDefaultValueToMandatoryAttributeCurrentSaturation_5(); - break; - case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : Reads back mandatory attribute: CurrentSaturation\n"); - err = TestReadsBackMandatoryAttributeCurrentSaturation_6(); - break; - case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : Validate constraints of attribute: CurrentX\n"); - err = TestValidateConstraintsOfAttributeCurrentX_7(); - break; - case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : Write the default value to mandatory attribute: CurrentX\n"); - err = TestWriteTheDefaultValueToMandatoryAttributeCurrentX_8(); - break; - case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : Reads back mandatory attribute: CurrentX\n"); - err = TestReadsBackMandatoryAttributeCurrentX_9(); - break; - case 10: - ChipLogProgress(chipTool, " ***** Test Step 10 : Validate constraints of attribute: CurrentY\n"); - err = TestValidateConstraintsOfAttributeCurrentY_10(); - break; - case 11: - ChipLogProgress(chipTool, " ***** Test Step 11 : Write the default values to mandatory attribute: CurrentY\n"); - err = TestWriteTheDefaultValuesToMandatoryAttributeCurrentY_11(); - break; - case 12: - ChipLogProgress(chipTool, " ***** Test Step 12 : Reads back mandatory attribute: CurrentY\n"); - err = TestReadsBackMandatoryAttributeCurrentY_12(); - break; - case 13: - ChipLogProgress(chipTool, " ***** Test Step 13 : Validate constraints of attribute: ColorTemperatureMireds\n"); - err = TestValidateConstraintsOfAttributeColorTemperatureMireds_13(); - break; - case 14: - ChipLogProgress(chipTool, " ***** Test Step 14 : Validate constraints of attribute: ColorMode\n"); - err = TestValidateConstraintsOfAttributeColorMode_14(); - break; - case 15: - ChipLogProgress(chipTool, " ***** Test Step 15 : Validate constraints of attribute: Options\n"); - err = TestValidateConstraintsOfAttributeOptions_15(); - break; - case 16: - ChipLogProgress(chipTool, " ***** Test Step 16 : Write the default values to mandatory attribute: Options\n"); - err = TestWriteTheDefaultValuesToMandatoryAttributeOptions_16(); - break; - case 17: - ChipLogProgress(chipTool, " ***** Test Step 17 : Reads back mandatory attribute: Options\n"); - err = TestReadsBackMandatoryAttributeOptions_17(); - break; - case 18: - ChipLogProgress(chipTool, " ***** Test Step 18 : Validate constraints of attribute: EnhancedCurrentHue\n"); - err = TestValidateConstraintsOfAttributeEnhancedCurrentHue_18(); - break; - case 19: - ChipLogProgress(chipTool, - " ***** Test Step 19 : Write the default values to mandatory attribute: EnhancedCurrentHue\n"); - err = TestWriteTheDefaultValuesToMandatoryAttributeEnhancedCurrentHue_19(); - break; - case 20: - ChipLogProgress(chipTool, " ***** Test Step 20 : Reads back mandatory attribute: EnhancedCurrentHue\n"); - err = TestReadsBackMandatoryAttributeEnhancedCurrentHue_20(); - break; - case 21: - ChipLogProgress(chipTool, " ***** Test Step 21 : Validate constraints of attribute: EnhancedColorMode\n"); - err = TestValidateConstraintsOfAttributeEnhancedColorMode_21(); - break; - case 22: - ChipLogProgress(chipTool, " ***** Test Step 22 : Validate constraints of attribute: ColorLoopActive\n"); - err = TestValidateConstraintsOfAttributeColorLoopActive_22(); - break; - case 23: - ChipLogProgress(chipTool, " ***** Test Step 23 : Write the default values to mandatory attribute: ColorLoopActive\n"); - err = TestWriteTheDefaultValuesToMandatoryAttributeColorLoopActive_23(); - break; - case 24: - ChipLogProgress(chipTool, " ***** Test Step 24 : Reads back mandatory attribute: ColorLoopActive\n"); - err = TestReadsBackMandatoryAttributeColorLoopActive_24(); - break; - case 25: - ChipLogProgress(chipTool, " ***** Test Step 25 : Validate constraints of attribute: ColorLoopDirection\n"); - err = TestValidateConstraintsOfAttributeColorLoopDirection_25(); - break; - case 26: - ChipLogProgress(chipTool, - " ***** Test Step 26 : Write the default values to mandatory attribute: ColorLoopDirection\n"); - err = TestWriteTheDefaultValuesToMandatoryAttributeColorLoopDirection_26(); - break; - case 27: - ChipLogProgress(chipTool, " ***** Test Step 27 : Reads back mandatory attribute: ColorLoopDirection\n"); - err = TestReadsBackMandatoryAttributeColorLoopDirection_27(); - break; - case 28: - ChipLogProgress(chipTool, " ***** Test Step 28 : Validate constraints of attribute: ColorLoopTime\n"); - err = TestValidateConstraintsOfAttributeColorLoopTime_28(); - break; - case 29: - ChipLogProgress(chipTool, " ***** Test Step 29 : Write the default values to mandatory attribute: ColorLoopTime\n"); - err = TestWriteTheDefaultValuesToMandatoryAttributeColorLoopTime_29(); - break; - case 30: - ChipLogProgress(chipTool, " ***** Test Step 30 : Reads back mandatory attribute: ColorLoopTime\n"); - err = TestReadsBackMandatoryAttributeColorLoopTime_30(); - break; - case 31: - ChipLogProgress(chipTool, " ***** Test Step 31 : Validate constraints of attribute: ColorLoopStartEnhancedHue\n"); - err = TestValidateConstraintsOfAttributeColorLoopStartEnhancedHue_31(); - break; - case 32: - ChipLogProgress(chipTool, - " ***** Test Step 32 : Write the default values to mandatory attribute: ColorLoopStartEnhancedHue\n"); - err = TestWriteTheDefaultValuesToMandatoryAttributeColorLoopStartEnhancedHue_32(); - break; - case 33: - ChipLogProgress(chipTool, " ***** Test Step 33 : Reads back mandatory attribute: ColorLoopStartEnhancedHue\n"); - err = TestReadsBackMandatoryAttributeColorLoopStartEnhancedHue_33(); - break; - case 34: - ChipLogProgress(chipTool, " ***** Test Step 34 : Validate constraints of attribute: ColorLoopStoredEnhancedHue\n"); - err = TestValidateConstraintsOfAttributeColorLoopStoredEnhancedHue_34(); - break; - case 35: - ChipLogProgress(chipTool, - " ***** Test Step 35 : Write the default values to mandatory attribute: ColorLoopStoredEnhancedHue\n"); - err = TestWriteTheDefaultValuesToMandatoryAttributeColorLoopStoredEnhancedHue_35(); - break; - case 36: - ChipLogProgress(chipTool, " ***** Test Step 36 : Reads back mandatory attribute: ColorLoopStoredEnhancedHue\n"); - err = TestReadsBackMandatoryAttributeColorLoopStoredEnhancedHue_36(); - break; - case 37: - ChipLogProgress(chipTool, " ***** Test Step 37 : Validate constraints of attribute: ColorCapabilities\n"); - err = TestValidateConstraintsOfAttributeColorCapabilities_37(); - break; - case 38: - ChipLogProgress(chipTool, " ***** Test Step 38 : Write the default values to mandatory attribute: ColorCapabilities\n"); - err = TestWriteTheDefaultValuesToMandatoryAttributeColorCapabilities_38(); - break; - case 39: - ChipLogProgress(chipTool, " ***** Test Step 39 : Reads back mandatory attribute: ColorCapabilities\n"); - err = TestReadsBackMandatoryAttributeColorCapabilities_39(); - break; - case 40: - ChipLogProgress(chipTool, " ***** Test Step 40 : Validate constraints of attribute: ColorTempPhysicalMinMireds\n"); - err = TestValidateConstraintsOfAttributeColorTempPhysicalMinMireds_40(); - break; - case 41: - ChipLogProgress(chipTool, - " ***** Test Step 41 : Write the default values to mandatory attribute: ColorTempPhysicalMinMireds\n"); - err = TestWriteTheDefaultValuesToMandatoryAttributeColorTempPhysicalMinMireds_41(); - break; - case 42: - ChipLogProgress(chipTool, " ***** Test Step 42 : Reads back mandatory attribute: ColorTempPhysicalMinMireds\n"); - err = TestReadsBackMandatoryAttributeColorTempPhysicalMinMireds_42(); - break; - case 43: - ChipLogProgress(chipTool, " ***** Test Step 43 : Validate constraints of attribute: ColorTempPhysicalMaxMireds\n"); - err = TestValidateConstraintsOfAttributeColorTempPhysicalMaxMireds_43(); + case 43: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 65279U)); + } break; case 44: - ChipLogProgress(chipTool, - " ***** Test Step 44 : Write the default values to mandatory attribute: ColorTempPhysicalMaxMireds\n"); - err = TestWriteTheDefaultValuesToMandatoryAttributeColorTempPhysicalMaxMireds_44(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); break; case 45: - ChipLogProgress(chipTool, " ***** Test Step 45 : Reads back mandatory attribute: ColorTempPhysicalMaxMireds\n"); - err = TestReadsBackMandatoryAttributeColorTempPhysicalMaxMireds_45(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 65279U)); + } break; case 46: - ChipLogProgress(chipTool, " ***** Test Step 46 : Read the optional attribute: CoupleColorTempToLevelMinMireds\n"); - err = TestReadTheOptionalAttributeCoupleColorTempToLevelMinMireds_46(); + if (IsUnsupported(status.mStatus)) + { + return; + } + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + } break; case 47: - ChipLogProgress( - chipTool, - " ***** Test Step 47 : Write the default values to optional attribute: CoupleColorTempToLevelMinMireds\n"); - err = TestWriteTheDefaultValuesToOptionalAttributeCoupleColorTempToLevelMinMireds_47(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); break; case 48: - ChipLogProgress(chipTool, " ***** Test Step 48 : Reads back optional attribute: CoupleColorTempToLevelMinMireds\n"); - err = TestReadsBackOptionalAttributeCoupleColorTempToLevelMinMireds_48(); + if (IsUnsupported(status.mStatus)) + { + return; + } + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + } break; case 49: - ChipLogProgress(chipTool, " ***** Test Step 49 : Read the optional attribute: StartUpColorTemperatureMireds\n"); - err = TestReadTheOptionalAttributeStartUpColorTemperatureMireds_49(); + if (IsUnsupported(status.mStatus)) + { + return; + } + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 65279U)); + } break; case 50: - ChipLogProgress( - chipTool, " ***** Test Step 50 : Write the default values to optional attribute: StartUpColorTemperatureMireds\n"); - err = TestWriteTheDefaultValuesToOptionalAttributeStartUpColorTemperatureMireds_50(); + if (IsUnsupported(status.mStatus)) + { + return; + } + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; case 51: - ChipLogProgress(chipTool, " ***** Test Step 51 : Reads back optional attribute: StartUpColorTemperatureMireds\n"); - err = TestReadsBackOptionalAttributeStartUpColorTemperatureMireds_51(); + if (IsUnsupported(status.mStatus)) + { + return; + } + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("startUpColorTemperatureMireds", value, 0U)); + } break; case 52: - ChipLogProgress(chipTool, " ***** Test Step 52 : Validate constraints of attribute: RemainingTime\n"); - err = TestValidateConstraintsOfAttributeRemainingTime_52(); + if (IsUnsupported(status.mStatus)) + { + return; + } + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + } break; case 53: - ChipLogProgress(chipTool, " ***** Test Step 53 : Write the default values to optional attribute: RemainingTime\n"); - err = TestWriteTheDefaultValuesToOptionalAttributeRemainingTime_53(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); break; case 54: - ChipLogProgress(chipTool, " ***** Test Step 54 : Reads back optional attribute: RemainingTime\n"); - err = TestReadsBackOptionalAttributeRemainingTime_54(); + if (IsUnsupported(status.mStatus)) + { + return; + } + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + } break; case 55: - ChipLogProgress(chipTool, " ***** Test Step 55 : Read the optional attribute: DriftCompensation\n"); - err = TestReadTheOptionalAttributeDriftCompensation_55(); + if (IsUnsupported(status.mStatus)) + { + return; + } + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 4)); + } break; case 56: - ChipLogProgress(chipTool, " ***** Test Step 56 : Write the default values to optional attribute: DriftCompensation\n"); - err = TestWriteTheDefaultValuesToOptionalAttributeDriftCompensation_56(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); break; case 57: - ChipLogProgress(chipTool, " ***** Test Step 57 : Reads back optional attribute: DriftCompensation\n"); - err = TestReadsBackOptionalAttributeDriftCompensation_57(); + if (IsUnsupported(status.mStatus)) + { + return; + } + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 4)); + } break; case 58: - ChipLogProgress(chipTool, " ***** Test Step 58 : Read the optional attribute: CompensationText\n"); - err = TestReadTheOptionalAttributeCompensationText_58(); + if (IsUnsupported(status.mStatus)) + { + return; + } + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::CharSpan value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "string")); + VerifyOrReturn(CheckConstraintMaxLength("value", value.size(), 254)); + } break; case 59: - ChipLogProgress(chipTool, " ***** Test Step 59 : Write the default values to optional attribute: CompensationText\n"); - err = TestWriteTheDefaultValuesToOptionalAttributeCompensationText_59(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); break; case 60: - ChipLogProgress(chipTool, " ***** Test Step 60 : Reads back optional attribute: CompensationText\n"); - err = TestReadsBackOptionalAttributeCompensationText_60(); + if (IsUnsupported(status.mStatus)) + { + return; + } + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::CharSpan value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "string")); + VerifyOrReturn(CheckConstraintMaxLength("value", value.size(), 254)); + } break; case 61: - ChipLogProgress(chipTool, " ***** Test Step 61 : Read the mandatory attribute: NumberOfPrimaries\n"); - err = TestReadTheMandatoryAttributeNumberOfPrimaries_61(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint8")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 6)); + } break; case 62: - ChipLogProgress(chipTool, " ***** Test Step 62 : Write the default mandatory attribute: NumberOfPrimaries\n"); - err = TestWriteTheDefaultMandatoryAttributeNumberOfPrimaries_62(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); break; case 63: - ChipLogProgress(chipTool, " ***** Test Step 63 : Read back the mandatory attribute: NumberOfPrimaries\n"); - err = TestReadBackTheMandatoryAttributeNumberOfPrimaries_63(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint8")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 6)); + } break; case 64: - ChipLogProgress(chipTool, " ***** Test Step 64 : Read the mandatory attribute: Primary1X\n"); - err = TestReadTheMandatoryAttributePrimary1X_64(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 65279U)); + } break; case 65: - ChipLogProgress(chipTool, " ***** Test Step 65 : Write the default mandatory attribute: Primary1X\n"); - err = TestWriteTheDefaultMandatoryAttributePrimary1X_65(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); break; case 66: - ChipLogProgress(chipTool, " ***** Test Step 66 : Read back the mandatory attribute: Primary1X\n"); - err = TestReadBackTheMandatoryAttributePrimary1X_66(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 65279U)); + } break; case 67: - ChipLogProgress(chipTool, " ***** Test Step 67 : Read the mandatory attribute: Primary1Y\n"); - err = TestReadTheMandatoryAttributePrimary1Y_67(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 65279U)); + } break; case 68: - ChipLogProgress(chipTool, " ***** Test Step 68 : Write the default mandatory attribute: Primary1Y\n"); - err = TestWriteTheDefaultMandatoryAttributePrimary1Y_68(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); break; case 69: - ChipLogProgress(chipTool, " ***** Test Step 69 : Read back the mandatory attribute: Primary1Y\n"); - err = TestReadBackTheMandatoryAttributePrimary1Y_69(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 65279U)); + } break; case 70: - ChipLogProgress(chipTool, " ***** Test Step 70 : Read the mandatory attribute: Primary1Intensity\n"); - err = TestReadTheMandatoryAttributePrimary1Intensity_70(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint8")); + } break; case 71: - ChipLogProgress(chipTool, " ***** Test Step 71 : Read the mandatory attribute: Primary2X\n"); - err = TestReadTheMandatoryAttributePrimary2X_71(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 65279U)); + } break; case 72: - ChipLogProgress(chipTool, " ***** Test Step 72 : Write the default mandatory attribute: Primary2X\n"); - err = TestWriteTheDefaultMandatoryAttributePrimary2X_72(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); break; case 73: - ChipLogProgress(chipTool, " ***** Test Step 73 : Read back the mandatory attribute: Primary2X\n"); - err = TestReadBackTheMandatoryAttributePrimary2X_73(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 65279U)); + } break; case 74: - ChipLogProgress(chipTool, " ***** Test Step 74 : Read the mandatory attribute: Primary2Y\n"); - err = TestReadTheMandatoryAttributePrimary2Y_74(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 65279U)); + } break; case 75: - ChipLogProgress(chipTool, " ***** Test Step 75 : Write the default mandatory attribute: Primary2Y\n"); - err = TestWriteTheDefaultMandatoryAttributePrimary2Y_75(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); break; case 76: - ChipLogProgress(chipTool, " ***** Test Step 76 : Read back the mandatory attribute: Primary2Y\n"); - err = TestReadBackTheMandatoryAttributePrimary2Y_76(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 65279U)); + } break; case 77: - ChipLogProgress(chipTool, " ***** Test Step 77 : Validate constraints of attribute: Primary2Intensity\n"); - err = TestValidateConstraintsOfAttributePrimary2Intensity_77(); - break; - case 78: - ChipLogProgress(chipTool, " ***** Test Step 78 : Read the mandatory attribute: Primary3X\n"); - err = TestReadTheMandatoryAttributePrimary3X_78(); - break; + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint8")); + } + break; + case 78: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 65279U)); + } + break; case 79: - ChipLogProgress(chipTool, " ***** Test Step 79 : Write the default mandatory attribute: Primary3X\n"); - err = TestWriteTheDefaultMandatoryAttributePrimary3X_79(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); break; case 80: - ChipLogProgress(chipTool, " ***** Test Step 80 : Read back the mandatory attribute: Primary3X\n"); - err = TestReadBackTheMandatoryAttributePrimary3X_80(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 65279U)); + } break; case 81: - ChipLogProgress(chipTool, " ***** Test Step 81 : Read the mandatory attribute: Primary3Y\n"); - err = TestReadTheMandatoryAttributePrimary3Y_81(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 65279U)); + } break; case 82: - ChipLogProgress(chipTool, " ***** Test Step 82 : Write the default mandatory attribute: Primary3Y\n"); - err = TestWriteTheDefaultMandatoryAttributePrimary3Y_82(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); break; case 83: - ChipLogProgress(chipTool, " ***** Test Step 83 : Read back the mandatory attribute: Primary3Y\n"); - err = TestReadBackTheMandatoryAttributePrimary3Y_83(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 65279U)); + } break; case 84: - ChipLogProgress(chipTool, " ***** Test Step 84 : Read the mandatory attribute: Primary3Intensity\n"); - err = TestReadTheMandatoryAttributePrimary3Intensity_84(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint8")); + } break; case 85: - ChipLogProgress(chipTool, " ***** Test Step 85 : Read the mandatory attribute: Primary4X\n"); - err = TestReadTheMandatoryAttributePrimary4X_85(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 65279U)); + } break; case 86: - ChipLogProgress(chipTool, " ***** Test Step 86 : Write the default mandatory attribute: Primary4X\n"); - err = TestWriteTheDefaultMandatoryAttributePrimary4X_86(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); break; case 87: - ChipLogProgress(chipTool, " ***** Test Step 87 : Read back the mandatory attribute: Primary4X\n"); - err = TestReadBackTheMandatoryAttributePrimary4X_87(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 65279U)); + } break; case 88: - ChipLogProgress(chipTool, " ***** Test Step 88 : Read the mandatory attribute: Primary4Y\n"); - err = TestReadTheMandatoryAttributePrimary4Y_88(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 65279U)); + } break; case 89: - ChipLogProgress(chipTool, " ***** Test Step 89 : Write the default mandatory attribute: Primary4Y\n"); - err = TestWriteTheDefaultMandatoryAttributePrimary4Y_89(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); break; case 90: - ChipLogProgress(chipTool, " ***** Test Step 90 : Read back the mandatory attribute: Primary4Y\n"); - err = TestReadBackTheMandatoryAttributePrimary4Y_90(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 65279U)); + } break; case 91: - ChipLogProgress(chipTool, " ***** Test Step 91 : Read the mandatory attribute: Primary4Intensity\n"); - err = TestReadTheMandatoryAttributePrimary4Intensity_91(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint8")); + } break; case 92: - ChipLogProgress(chipTool, " ***** Test Step 92 : Read the mandatory attribute: Primary5X\n"); - err = TestReadTheMandatoryAttributePrimary5X_92(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 65279U)); + } break; case 93: - ChipLogProgress(chipTool, " ***** Test Step 93 : Write the default mandatory attribute: Primary5X\n"); - err = TestWriteTheDefaultMandatoryAttributePrimary5X_93(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); break; case 94: - ChipLogProgress(chipTool, " ***** Test Step 94 : Read back the mandatory attribute: Primary5X\n"); - err = TestReadBackTheMandatoryAttributePrimary5X_94(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 65279U)); + } break; case 95: - ChipLogProgress(chipTool, " ***** Test Step 95 : Read the mandatory attribute: Primary5Y\n"); - err = TestReadTheMandatoryAttributePrimary5Y_95(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 65279U)); + } break; case 96: - ChipLogProgress(chipTool, " ***** Test Step 96 : Write the default mandatory attribute: Primary5Y\n"); - err = TestWriteTheDefaultMandatoryAttributePrimary5Y_96(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); break; case 97: - ChipLogProgress(chipTool, " ***** Test Step 97 : Read back the mandatory attribute: Primary5Y\n"); - err = TestReadBackTheMandatoryAttributePrimary5Y_97(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 65279U)); + } break; case 98: - ChipLogProgress(chipTool, " ***** Test Step 98 : Read the mandatory attribute: Primary5Intensity\n"); - err = TestReadTheMandatoryAttributePrimary5Intensity_98(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint8")); + } break; case 99: - ChipLogProgress(chipTool, " ***** Test Step 99 : Read the mandatory attribute: Primary6X\n"); - err = TestReadTheMandatoryAttributePrimary6X_99(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 65279U)); + } break; case 100: - ChipLogProgress(chipTool, " ***** Test Step 100 : Write the default mandatory attribute: Primary6X\n"); - err = TestWriteTheDefaultMandatoryAttributePrimary6X_100(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); break; case 101: - ChipLogProgress(chipTool, " ***** Test Step 101 : Read back the mandatory attribute: Primary6X\n"); - err = TestReadBackTheMandatoryAttributePrimary6X_101(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 65279U)); + } break; case 102: - ChipLogProgress(chipTool, " ***** Test Step 102 : Read the mandatory attribute: Primary6Y\n"); - err = TestReadTheMandatoryAttributePrimary6Y_102(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 65279U)); + } break; case 103: - ChipLogProgress(chipTool, " ***** Test Step 103 : Write the default mandatory attribute: Primary6Y\n"); - err = TestWriteTheDefaultMandatoryAttributePrimary6Y_103(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); break; case 104: - ChipLogProgress(chipTool, " ***** Test Step 104 : Read back the mandatory attribute: Primary6Y\n"); - err = TestReadBackTheMandatoryAttributePrimary6Y_104(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 65279U)); + } break; case 105: - ChipLogProgress(chipTool, " ***** Test Step 105 : Read the mandatory attribute: Primary6Intensity\n"); - err = TestReadTheMandatoryAttributePrimary6Intensity_105(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint8")); + } break; case 106: - ChipLogProgress(chipTool, " ***** Test Step 106 : Read the optional attribute: WhitePointX\n"); - err = TestReadTheOptionalAttributeWhitePointX_106(); + if (IsUnsupported(status.mStatus)) + { + return; + } + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 65279U)); + } break; case 107: - ChipLogProgress(chipTool, " ***** Test Step 107 : Write the default optional attribute: WhitePointX\n"); - err = TestWriteTheDefaultOptionalAttributeWhitePointX_107(); + if (IsUnsupported(status.mStatus)) + { + return; + } + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; case 108: - ChipLogProgress(chipTool, " ***** Test Step 108 : Read back the optional attribute: WhitePointX\n"); - err = TestReadBackTheOptionalAttributeWhitePointX_108(); + if (IsUnsupported(status.mStatus)) + { + return; + } + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("whitePointX", value, 0U)); + } break; case 109: - ChipLogProgress(chipTool, " ***** Test Step 109 : Read the optional attribute: WhitePointY\n"); - err = TestReadTheOptionalAttributeWhitePointY_109(); + if (IsUnsupported(status.mStatus)) + { + return; + } + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 65279U)); + } break; case 110: - ChipLogProgress(chipTool, " ***** Test Step 110 : Write the default optional attribute: WhitePointY\n"); - err = TestWriteTheDefaultOptionalAttributeWhitePointY_110(); + if (IsUnsupported(status.mStatus)) + { + return; + } + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; case 111: - ChipLogProgress(chipTool, " ***** Test Step 111 : Read back the optional attribute: WhitePointY\n"); - err = TestReadBackTheOptionalAttributeWhitePointY_111(); + if (IsUnsupported(status.mStatus)) + { + return; + } + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("whitePointY", value, 0U)); + } break; case 112: - ChipLogProgress(chipTool, " ***** Test Step 112 : Read the optional attribute: ColorPointRX\n"); - err = TestReadTheOptionalAttributeColorPointRX_112(); + if (IsUnsupported(status.mStatus)) + { + return; + } + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 65279U)); + } break; case 113: - ChipLogProgress(chipTool, " ***** Test Step 113 : Write the default optional attribute: ColorPointRX\n"); - err = TestWriteTheDefaultOptionalAttributeColorPointRX_113(); + if (IsUnsupported(status.mStatus)) + { + return; + } + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; case 114: - ChipLogProgress(chipTool, " ***** Test Step 114 : Read back the optional attribute: ColorPointRX\n"); - err = TestReadBackTheOptionalAttributeColorPointRX_114(); + if (IsUnsupported(status.mStatus)) + { + return; + } + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("colorPointRX", value, 0U)); + } break; case 115: - ChipLogProgress(chipTool, " ***** Test Step 115 : Read the optional attribute: ColorPointRY\n"); - err = TestReadTheOptionalAttributeColorPointRY_115(); + if (IsUnsupported(status.mStatus)) + { + return; + } + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 65279U)); + } break; case 116: - ChipLogProgress(chipTool, " ***** Test Step 116 : Write the default optional attribute: ColorPointRY\n"); - err = TestWriteTheDefaultOptionalAttributeColorPointRY_116(); + if (IsUnsupported(status.mStatus)) + { + return; + } + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; case 117: - ChipLogProgress(chipTool, " ***** Test Step 117 : Read back the optional attribute: ColorPointRY\n"); - err = TestReadBackTheOptionalAttributeColorPointRY_117(); + if (IsUnsupported(status.mStatus)) + { + return; + } + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("colorPointRY", value, 0U)); + } break; case 118: - ChipLogProgress(chipTool, " ***** Test Step 118 : Read the optional attribute: ColorPointRIntensity\n"); - err = TestReadTheOptionalAttributeColorPointRIntensity_118(); + if (IsUnsupported(status.mStatus)) + { + return; + } + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint8")); + } break; case 119: - ChipLogProgress(chipTool, " ***** Test Step 119 : Write the default optional attribute: ColorPointRIntensity\n"); - err = TestWriteTheDefaultOptionalAttributeColorPointRIntensity_119(); + if (IsUnsupported(status.mStatus)) + { + return; + } + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; case 120: - ChipLogProgress(chipTool, " ***** Test Step 120 : Read back the optional attribute: ColorPointRIntensity\n"); - err = TestReadBackTheOptionalAttributeColorPointRIntensity_120(); + if (IsUnsupported(status.mStatus)) + { + return; + } + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("colorPointRIntensity", value, 0)); + } break; case 121: - ChipLogProgress(chipTool, " ***** Test Step 121 : Read the optional attribute: ColorPointGX\n"); - err = TestReadTheOptionalAttributeColorPointGX_121(); + if (IsUnsupported(status.mStatus)) + { + return; + } + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 65279U)); + } break; case 122: - ChipLogProgress(chipTool, " ***** Test Step 122 : Write the default optional attribute: ColorPointGX\n"); - err = TestWriteTheDefaultOptionalAttributeColorPointGX_122(); + if (IsUnsupported(status.mStatus)) + { + return; + } + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; case 123: - ChipLogProgress(chipTool, " ***** Test Step 123 : Read back the optional attribute: ColorPointGX\n"); - err = TestReadBackTheOptionalAttributeColorPointGX_123(); + if (IsUnsupported(status.mStatus)) + { + return; + } + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("colorPointGX", value, 0U)); + } break; case 124: - ChipLogProgress(chipTool, " ***** Test Step 124 : Read the optional attribute: ColorPointGY\n"); - err = TestReadTheOptionalAttributeColorPointGY_124(); + if (IsUnsupported(status.mStatus)) + { + return; + } + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 65279U)); + } break; case 125: - ChipLogProgress(chipTool, " ***** Test Step 125 : Write the default optional attribute: ColorPointGY\n"); - err = TestWriteTheDefaultOptionalAttributeColorPointGY_125(); + if (IsUnsupported(status.mStatus)) + { + return; + } + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; case 126: - ChipLogProgress(chipTool, " ***** Test Step 126 : Read back the optional attribute: ColorPointGY\n"); - err = TestReadBackTheOptionalAttributeColorPointGY_126(); + if (IsUnsupported(status.mStatus)) + { + return; + } + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("colorPointGY", value, 0U)); + } break; case 127: - ChipLogProgress(chipTool, " ***** Test Step 127 : Read the optional attribute: ColorPointGIntensity\n"); - err = TestReadTheOptionalAttributeColorPointGIntensity_127(); + if (IsUnsupported(status.mStatus)) + { + return; + } + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint8")); + } break; case 128: - ChipLogProgress(chipTool, " ***** Test Step 128 : Write the default optional attribute: ColorPointGIntensity\n"); - err = TestWriteTheDefaultOptionalAttributeColorPointGIntensity_128(); + if (IsUnsupported(status.mStatus)) + { + return; + } + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; case 129: - ChipLogProgress(chipTool, " ***** Test Step 129 : Read back the optional attribute: ColorPointGIntensity\n"); - err = TestReadBackTheOptionalAttributeColorPointGIntensity_129(); + if (IsUnsupported(status.mStatus)) + { + return; + } + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("colorPointGIntensity", value, 0)); + } break; case 130: - ChipLogProgress(chipTool, " ***** Test Step 130 : Read the optional attribute: ColorPointBX\n"); - err = TestReadTheOptionalAttributeColorPointBX_130(); + if (IsUnsupported(status.mStatus)) + { + return; + } + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 65279U)); + } break; case 131: - ChipLogProgress(chipTool, " ***** Test Step 131 : Write the default optional attribute: ColorPointBX\n"); - err = TestWriteTheDefaultOptionalAttributeColorPointBX_131(); + if (IsUnsupported(status.mStatus)) + { + return; + } + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; case 132: - ChipLogProgress(chipTool, " ***** Test Step 132 : Read back the optional attribute: ColorPointBX\n"); - err = TestReadBackTheOptionalAttributeColorPointBX_132(); + if (IsUnsupported(status.mStatus)) + { + return; + } + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("colorPointBX", value, 0U)); + } break; case 133: - ChipLogProgress(chipTool, " ***** Test Step 133 : Read the optional attribute: ColorPointBY\n"); - err = TestReadTheOptionalAttributeColorPointBY_133(); + if (IsUnsupported(status.mStatus)) + { + return; + } + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 65279U)); + } break; case 134: - ChipLogProgress(chipTool, " ***** Test Step 134 : Write the default optional attribute: ColorPointBY\n"); - err = TestWriteTheDefaultOptionalAttributeColorPointBY_134(); + if (IsUnsupported(status.mStatus)) + { + return; + } + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; case 135: - ChipLogProgress(chipTool, " ***** Test Step 135 : Read back the optional attribute: ColorPointBY\n"); - err = TestReadBackTheOptionalAttributeColorPointBY_135(); + if (IsUnsupported(status.mStatus)) + { + return; + } + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("colorPointBY", value, 0U)); + } break; case 136: - ChipLogProgress(chipTool, " ***** Test Step 136 : Read the optional attribute: ColorPointBIntensity\n"); - err = TestReadTheOptionalAttributeColorPointBIntensity_136(); + if (IsUnsupported(status.mStatus)) + { + return; + } + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint8")); + } break; case 137: - ChipLogProgress(chipTool, " ***** Test Step 137 : Write the default optional attribute: ColorPointBIntensity\n"); - err = TestWriteTheDefaultOptionalAttributeColorPointBIntensity_137(); + if (IsUnsupported(status.mStatus)) + { + return; + } + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; case 138: - ChipLogProgress(chipTool, " ***** Test Step 138 : Read back the optional attribute: ColorPointBIntensity\n"); - err = TestReadBackTheOptionalAttributeColorPointBIntensity_138(); + if (IsUnsupported(status.mStatus)) + { + return; + } + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("colorPointBIntensity", value, 0)); + } break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); } - if (CHIP_NO_ERROR != err) + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } + } + + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "Validate constraints of attribute: current hue"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::CurrentHue::Id); + } + case 2: { + LogStep(2, "Write the default value to mandatory attribute: CurrentHue"); + uint8_t value; + value = 0; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::CurrentHue::Id, + value); + } + case 3: { + LogStep(3, "Reads back mandatory attribute: CurrentHue"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::CurrentHue::Id); + } + case 4: { + LogStep(4, "Validate constraints of attribute: CurrentSaturation"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::CurrentSaturation::Id); + } + case 5: { + LogStep(5, "Write the default value to mandatory attribute: CurrentSaturation"); + uint8_t value; + value = 0; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::CurrentSaturation::Id, + value); + } + case 6: { + LogStep(6, "Reads back mandatory attribute: CurrentSaturation"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::CurrentSaturation::Id); + } + case 7: { + LogStep(7, "Validate constraints of attribute: CurrentX"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::CurrentX::Id); + } + case 8: { + LogStep(8, "Write the default value to mandatory attribute: CurrentX"); + uint16_t value; + value = 24939U; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::CurrentX::Id, value); + } + case 9: { + LogStep(9, "Reads back mandatory attribute: CurrentX"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::CurrentX::Id); + } + case 10: { + LogStep(10, "Validate constraints of attribute: CurrentY"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::CurrentY::Id); + } + case 11: { + LogStep(11, "Write the default values to mandatory attribute: CurrentY"); + uint16_t value; + value = 24701U; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::CurrentY::Id, value); + } + case 12: { + LogStep(12, "Reads back mandatory attribute: CurrentY"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::CurrentY::Id); + } + case 13: { + LogStep(13, "Validate constraints of attribute: ColorTemperatureMireds"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ColorTemperature::Id); + } + case 14: { + LogStep(14, "Validate constraints of attribute: ColorMode"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ColorMode::Id); + } + case 15: { + LogStep(15, "Validate constraints of attribute: Options"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, + ColorControl::Attributes::ColorControlOptions::Id); + } + case 16: { + LogStep(16, "Write the default values to mandatory attribute: Options"); + uint8_t value; + value = 0; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, + ColorControl::Attributes::ColorControlOptions::Id, value); + } + case 17: { + LogStep(17, "Reads back mandatory attribute: Options"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, + ColorControl::Attributes::ColorControlOptions::Id); + } + case 18: { + LogStep(18, "Validate constraints of attribute: EnhancedCurrentHue"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, + ColorControl::Attributes::EnhancedCurrentHue::Id); + } + case 19: { + LogStep(19, "Write the default values to mandatory attribute: EnhancedCurrentHue"); + uint16_t value; + value = 0U; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, + ColorControl::Attributes::EnhancedCurrentHue::Id, value); + } + case 20: { + LogStep(20, "Reads back mandatory attribute: EnhancedCurrentHue"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, + ColorControl::Attributes::EnhancedCurrentHue::Id); + } + case 21: { + LogStep(21, "Validate constraints of attribute: EnhancedColorMode"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::EnhancedColorMode::Id); + } + case 22: { + LogStep(22, "Validate constraints of attribute: ColorLoopActive"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ColorLoopActive::Id); + } + case 23: { + LogStep(23, "Write the default values to mandatory attribute: ColorLoopActive"); + uint8_t value; + value = 0; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ColorLoopActive::Id, + value); + } + case 24: { + LogStep(24, "Reads back mandatory attribute: ColorLoopActive"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ColorLoopActive::Id); + } + case 25: { + LogStep(25, "Validate constraints of attribute: ColorLoopDirection"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, + ColorControl::Attributes::ColorLoopDirection::Id); + } + case 26: { + LogStep(26, "Write the default values to mandatory attribute: ColorLoopDirection"); + uint8_t value; + value = 0; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, + ColorControl::Attributes::ColorLoopDirection::Id, value); + } + case 27: { + LogStep(27, "Reads back mandatory attribute: ColorLoopDirection"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, + ColorControl::Attributes::ColorLoopDirection::Id); + } + case 28: { + LogStep(28, "Validate constraints of attribute: ColorLoopTime"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ColorLoopTime::Id); + } + case 29: { + LogStep(29, "Write the default values to mandatory attribute: ColorLoopTime"); + uint16_t value; + value = 25U; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ColorLoopTime::Id, + value); + } + case 30: { + LogStep(30, "Reads back mandatory attribute: ColorLoopTime"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ColorLoopTime::Id); + } + case 31: { + LogStep(31, "Validate constraints of attribute: ColorLoopStartEnhancedHue"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, + ColorControl::Attributes::ColorLoopStartEnhancedHue::Id); + } + case 32: { + LogStep(32, "Write the default values to mandatory attribute: ColorLoopStartEnhancedHue"); + uint16_t value; + value = 8960U; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, + ColorControl::Attributes::ColorLoopStartEnhancedHue::Id, value); + } + case 33: { + LogStep(33, "Reads back mandatory attribute: ColorLoopStartEnhancedHue"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, + ColorControl::Attributes::ColorLoopStartEnhancedHue::Id); + } + case 34: { + LogStep(34, "Validate constraints of attribute: ColorLoopStoredEnhancedHue"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, + ColorControl::Attributes::ColorLoopStoredEnhancedHue::Id); + } + case 35: { + LogStep(35, "Write the default values to mandatory attribute: ColorLoopStoredEnhancedHue"); + uint16_t value; + value = 0U; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, + ColorControl::Attributes::ColorLoopStoredEnhancedHue::Id, value); + } + case 36: { + LogStep(36, "Reads back mandatory attribute: ColorLoopStoredEnhancedHue"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, + ColorControl::Attributes::ColorLoopStoredEnhancedHue::Id); + } + case 37: { + LogStep(37, "Validate constraints of attribute: ColorCapabilities"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ColorCapabilities::Id); + } + case 38: { + LogStep(38, "Write the default values to mandatory attribute: ColorCapabilities"); + uint16_t value; + value = 0U; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ColorCapabilities::Id, + value); + } + case 39: { + LogStep(39, "Reads back mandatory attribute: ColorCapabilities"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ColorCapabilities::Id); + } + case 40: { + LogStep(40, "Validate constraints of attribute: ColorTempPhysicalMinMireds"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, + ColorControl::Attributes::ColorTempPhysicalMin::Id); + } + case 41: { + LogStep(41, "Write the default values to mandatory attribute: ColorTempPhysicalMinMireds"); + uint16_t value; + value = 0U; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, + ColorControl::Attributes::ColorTempPhysicalMin::Id, value); + } + case 42: { + LogStep(42, "Reads back mandatory attribute: ColorTempPhysicalMinMireds"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, + ColorControl::Attributes::ColorTempPhysicalMin::Id); + } + case 43: { + LogStep(43, "Validate constraints of attribute: ColorTempPhysicalMaxMireds"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, + ColorControl::Attributes::ColorTempPhysicalMax::Id); + } + case 44: { + LogStep(44, "Write the default values to mandatory attribute: ColorTempPhysicalMaxMireds"); + uint16_t value; + value = 65279U; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, + ColorControl::Attributes::ColorTempPhysicalMax::Id, value); + } + case 45: { + LogStep(45, "Reads back mandatory attribute: ColorTempPhysicalMaxMireds"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, + ColorControl::Attributes::ColorTempPhysicalMax::Id); + } + case 46: { + LogStep(46, "Read the optional attribute: CoupleColorTempToLevelMinMireds"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, + ColorControl::Attributes::CoupleColorTempToLevelMinMireds::Id); + } + case 47: { + LogStep(47, "Write the default values to optional attribute: CoupleColorTempToLevelMinMireds"); + uint16_t value; + value = 0U; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, + ColorControl::Attributes::CoupleColorTempToLevelMinMireds::Id, value); + } + case 48: { + LogStep(48, "Reads back optional attribute: CoupleColorTempToLevelMinMireds"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, + ColorControl::Attributes::CoupleColorTempToLevelMinMireds::Id); + } + case 49: { + LogStep(49, "Read the optional attribute: StartUpColorTemperatureMireds"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, + ColorControl::Attributes::StartUpColorTemperatureMireds::Id); + } + case 50: { + LogStep(50, "Write the default values to optional attribute: StartUpColorTemperatureMireds"); + uint16_t value; + value = 0U; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, + ColorControl::Attributes::StartUpColorTemperatureMireds::Id, value); + } + case 51: { + LogStep(51, "Reads back optional attribute: StartUpColorTemperatureMireds"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, + ColorControl::Attributes::StartUpColorTemperatureMireds::Id); + } + case 52: { + LogStep(52, "Validate constraints of attribute: RemainingTime"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::RemainingTime::Id); + } + case 53: { + LogStep(53, "Write the default values to optional attribute: RemainingTime"); + uint16_t value; + value = 0U; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::RemainingTime::Id, + value); + } + case 54: { + LogStep(54, "Reads back optional attribute: RemainingTime"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::RemainingTime::Id); + } + case 55: { + LogStep(55, "Read the optional attribute: DriftCompensation"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::DriftCompensation::Id); + } + case 56: { + LogStep(56, "Write the default values to optional attribute: DriftCompensation"); + uint8_t value; + value = 0; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::DriftCompensation::Id, + value); + } + case 57: { + LogStep(57, "Reads back optional attribute: DriftCompensation"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::DriftCompensation::Id); + } + case 58: { + LogStep(58, "Read the optional attribute: CompensationText"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::CompensationText::Id); + } + case 59: { + LogStep(59, "Write the default values to optional attribute: CompensationText"); + chip::CharSpan value; + value = chip::Span("garbage: not in length on purpose", 0); + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::CompensationText::Id, + value); + } + case 60: { + LogStep(60, "Reads back optional attribute: CompensationText"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::CompensationText::Id); + } + case 61: { + LogStep(61, "Read the mandatory attribute: NumberOfPrimaries"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::NumberOfPrimaries::Id); + } + case 62: { + LogStep(62, "Write the default mandatory attribute: NumberOfPrimaries"); + uint8_t value; + value = 0; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::NumberOfPrimaries::Id, + value); + } + case 63: { + LogStep(63, "Read back the mandatory attribute: NumberOfPrimaries"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::NumberOfPrimaries::Id); + } + case 64: { + LogStep(64, "Read the mandatory attribute: Primary1X"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::Primary1X::Id); + } + case 65: { + LogStep(65, "Write the default mandatory attribute: Primary1X"); + uint16_t value; + value = 0U; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::Primary1X::Id, value); + } + case 66: { + LogStep(66, "Read back the mandatory attribute: Primary1X"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::Primary1X::Id); + } + case 67: { + LogStep(67, "Read the mandatory attribute: Primary1Y"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::Primary1Y::Id); + } + case 68: { + LogStep(68, "Write the default mandatory attribute: Primary1Y"); + uint16_t value; + value = 0U; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::Primary1Y::Id, value); + } + case 69: { + LogStep(69, "Read back the mandatory attribute: Primary1Y"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::Primary1Y::Id); + } + case 70: { + LogStep(70, "Read the mandatory attribute: Primary1Intensity"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::Primary1Intensity::Id); + } + case 71: { + LogStep(71, "Read the mandatory attribute: Primary2X"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::Primary2X::Id); + } + case 72: { + LogStep(72, "Write the default mandatory attribute: Primary2X"); + uint16_t value; + value = 0U; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::Primary2X::Id, value); + } + case 73: { + LogStep(73, "Read back the mandatory attribute: Primary2X"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::Primary2X::Id); + } + case 74: { + LogStep(74, "Read the mandatory attribute: Primary2Y"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::Primary2Y::Id); + } + case 75: { + LogStep(75, "Write the default mandatory attribute: Primary2Y"); + uint16_t value; + value = 0U; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::Primary2Y::Id, value); + } + case 76: { + LogStep(76, "Read back the mandatory attribute: Primary2Y"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::Primary2Y::Id); + } + case 77: { + LogStep(77, "Validate constraints of attribute: Primary2Intensity"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::Primary2Intensity::Id); + } + case 78: { + LogStep(78, "Read the mandatory attribute: Primary3X"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::Primary3X::Id); + } + case 79: { + LogStep(79, "Write the default mandatory attribute: Primary3X"); + uint16_t value; + value = 0U; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::Primary3X::Id, value); + } + case 80: { + LogStep(80, "Read back the mandatory attribute: Primary3X"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::Primary3X::Id); + } + case 81: { + LogStep(81, "Read the mandatory attribute: Primary3Y"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::Primary3Y::Id); + } + case 82: { + LogStep(82, "Write the default mandatory attribute: Primary3Y"); + uint16_t value; + value = 0U; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::Primary3Y::Id, value); + } + case 83: { + LogStep(83, "Read back the mandatory attribute: Primary3Y"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::Primary3Y::Id); + } + case 84: { + LogStep(84, "Read the mandatory attribute: Primary3Intensity"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::Primary3Intensity::Id); + } + case 85: { + LogStep(85, "Read the mandatory attribute: Primary4X"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::Primary4X::Id); + } + case 86: { + LogStep(86, "Write the default mandatory attribute: Primary4X"); + uint16_t value; + value = 0U; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::Primary4X::Id, value); + } + case 87: { + LogStep(87, "Read back the mandatory attribute: Primary4X"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::Primary4X::Id); + } + case 88: { + LogStep(88, "Read the mandatory attribute: Primary4Y"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::Primary4Y::Id); + } + case 89: { + LogStep(89, "Write the default mandatory attribute: Primary4Y"); + uint16_t value; + value = 0U; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::Primary4Y::Id, value); + } + case 90: { + LogStep(90, "Read back the mandatory attribute: Primary4Y"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::Primary4Y::Id); + } + case 91: { + LogStep(91, "Read the mandatory attribute: Primary4Intensity"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::Primary4Intensity::Id); + } + case 92: { + LogStep(92, "Read the mandatory attribute: Primary5X"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::Primary5X::Id); + } + case 93: { + LogStep(93, "Write the default mandatory attribute: Primary5X"); + uint16_t value; + value = 0U; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::Primary5X::Id, value); + } + case 94: { + LogStep(94, "Read back the mandatory attribute: Primary5X"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::Primary5X::Id); + } + case 95: { + LogStep(95, "Read the mandatory attribute: Primary5Y"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::Primary5Y::Id); + } + case 96: { + LogStep(96, "Write the default mandatory attribute: Primary5Y"); + uint16_t value; + value = 0U; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::Primary5Y::Id, value); + } + case 97: { + LogStep(97, "Read back the mandatory attribute: Primary5Y"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::Primary5Y::Id); + } + case 98: { + LogStep(98, "Read the mandatory attribute: Primary5Intensity"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::Primary5Intensity::Id); + } + case 99: { + LogStep(99, "Read the mandatory attribute: Primary6X"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::Primary6X::Id); + } + case 100: { + LogStep(100, "Write the default mandatory attribute: Primary6X"); + uint16_t value; + value = 0U; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::Primary6X::Id, value); + } + case 101: { + LogStep(101, "Read back the mandatory attribute: Primary6X"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::Primary6X::Id); + } + case 102: { + LogStep(102, "Read the mandatory attribute: Primary6Y"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::Primary6Y::Id); + } + case 103: { + LogStep(103, "Write the default mandatory attribute: Primary6Y"); + uint16_t value; + value = 0U; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::Primary6Y::Id, value); + } + case 104: { + LogStep(104, "Read back the mandatory attribute: Primary6Y"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::Primary6Y::Id); + } + case 105: { + LogStep(105, "Read the mandatory attribute: Primary6Intensity"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::Primary6Intensity::Id); + } + case 106: { + LogStep(106, "Read the optional attribute: WhitePointX"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::WhitePointX::Id); + } + case 107: { + LogStep(107, "Write the default optional attribute: WhitePointX"); + uint16_t value; + value = 0U; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::WhitePointX::Id, + value); + } + case 108: { + LogStep(108, "Read back the optional attribute: WhitePointX"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::WhitePointX::Id); + } + case 109: { + LogStep(109, "Read the optional attribute: WhitePointY"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::WhitePointY::Id); + } + case 110: { + LogStep(110, "Write the default optional attribute: WhitePointY"); + uint16_t value; + value = 0U; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::WhitePointY::Id, + value); + } + case 111: { + LogStep(111, "Read back the optional attribute: WhitePointY"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::WhitePointY::Id); + } + case 112: { + LogStep(112, "Read the optional attribute: ColorPointRX"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ColorPointRX::Id); + } + case 113: { + LogStep(113, "Write the default optional attribute: ColorPointRX"); + uint16_t value; + value = 0U; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ColorPointRX::Id, + value); + } + case 114: { + LogStep(114, "Read back the optional attribute: ColorPointRX"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ColorPointRX::Id); + } + case 115: { + LogStep(115, "Read the optional attribute: ColorPointRY"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ColorPointRY::Id); + } + case 116: { + LogStep(116, "Write the default optional attribute: ColorPointRY"); + uint16_t value; + value = 0U; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ColorPointRY::Id, + value); + } + case 117: { + LogStep(117, "Read back the optional attribute: ColorPointRY"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ColorPointRY::Id); + } + case 118: { + LogStep(118, "Read the optional attribute: ColorPointRIntensity"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, + ColorControl::Attributes::ColorPointRIntensity::Id); + } + case 119: { + LogStep(119, "Write the default optional attribute: ColorPointRIntensity"); + uint8_t value; + value = 0; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, + ColorControl::Attributes::ColorPointRIntensity::Id, value); + } + case 120: { + LogStep(120, "Read back the optional attribute: ColorPointRIntensity"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, + ColorControl::Attributes::ColorPointRIntensity::Id); + } + case 121: { + LogStep(121, "Read the optional attribute: ColorPointGX"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ColorPointGX::Id); + } + case 122: { + LogStep(122, "Write the default optional attribute: ColorPointGX"); + uint16_t value; + value = 0U; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ColorPointGX::Id, + value); + } + case 123: { + LogStep(123, "Read back the optional attribute: ColorPointGX"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ColorPointGX::Id); + } + case 124: { + LogStep(124, "Read the optional attribute: ColorPointGY"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ColorPointGY::Id); + } + case 125: { + LogStep(125, "Write the default optional attribute: ColorPointGY"); + uint16_t value; + value = 0U; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ColorPointGY::Id, + value); + } + case 126: { + LogStep(126, "Read back the optional attribute: ColorPointGY"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ColorPointGY::Id); + } + case 127: { + LogStep(127, "Read the optional attribute: ColorPointGIntensity"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, + ColorControl::Attributes::ColorPointGIntensity::Id); + } + case 128: { + LogStep(128, "Write the default optional attribute: ColorPointGIntensity"); + uint8_t value; + value = 0; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, + ColorControl::Attributes::ColorPointGIntensity::Id, value); + } + case 129: { + LogStep(129, "Read back the optional attribute: ColorPointGIntensity"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, + ColorControl::Attributes::ColorPointGIntensity::Id); + } + case 130: { + LogStep(130, "Read the optional attribute: ColorPointBX"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ColorPointBX::Id); + } + case 131: { + LogStep(131, "Write the default optional attribute: ColorPointBX"); + uint16_t value; + value = 0U; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ColorPointBX::Id, + value); + } + case 132: { + LogStep(132, "Read back the optional attribute: ColorPointBX"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ColorPointBX::Id); + } + case 133: { + LogStep(133, "Read the optional attribute: ColorPointBY"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ColorPointBY::Id); + } + case 134: { + LogStep(134, "Write the default optional attribute: ColorPointBY"); + uint16_t value; + value = 0U; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ColorPointBY::Id, + value); + } + case 135: { + LogStep(135, "Read back the optional attribute: ColorPointBY"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ColorPointBY::Id); + } + case 136: { + LogStep(136, "Read the optional attribute: ColorPointBIntensity"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, + ColorControl::Attributes::ColorPointBIntensity::Id); + } + case 137: { + LogStep(137, "Write the default optional attribute: ColorPointBIntensity"); + uint8_t value; + value = 0; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, + ColorControl::Attributes::ColorPointBIntensity::Id, value); + } + case 138: { + LogStep(138, "Read back the optional attribute: ColorPointBIntensity"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, + ColorControl::Attributes::ColorPointBIntensity::Id); + } } + return CHIP_NO_ERROR; + } +}; + +class Test_TC_CC_3_1Suite : public TestCommand +{ +public: + Test_TC_CC_3_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_CC_3_1", 10, credsIssuerConfig) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } + ~Test_TC_CC_3_1Suite() {} + chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 139; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -4832,6 +4279,50 @@ class Test_TC_CC_2_1Suite : public TestCommand VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); shouldContinue = true; break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + bool value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("onOff", value, 1)); + } + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint8")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 254)); + } + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 8: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 9: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + bool value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("onOff", value, 0)); + } + break; default: LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); } @@ -4842,4639 +4333,9833 @@ class Test_TC_CC_2_1Suite : public TestCommand } } - static void OnFailureCallback_1(void * context, CHIP_ERROR error) + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - (static_cast(context))->OnFailureResponse_1(error); - } - - static void OnSuccessCallback_1(void * context, uint8_t currentHue) - { - (static_cast(context))->OnSuccessResponse_1(currentHue); + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "Turn on light for color control tests"); + chip::app::Clusters::OnOff::Commands::On::Type value; + return SendCommand(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Commands::On::Id, value); + } + case 2: { + LogStep(2, "Check on/off attribute value is true after on command"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnOff::Id); + } + case 3: { + LogStep(3, "Reads CurrentHue attribute from DUT."); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::CurrentHue::Id); + } + case 4: { + LogStep(4, "Move to hue shortest distance command"); + chip::app::Clusters::ColorControl::Commands::MoveToHue::Type value; + value.hue = 150; + value.direction = static_cast(0); + value.transitionTime = 300U; + value.optionsMask = 0; + value.optionsOverride = 0; + return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::MoveToHue::Id, value); + } + case 5: { + LogStep(5, "Move to hue longest distance command"); + chip::app::Clusters::ColorControl::Commands::MoveToHue::Type value; + value.hue = 200; + value.direction = static_cast(1); + value.transitionTime = 300U; + value.optionsMask = 0; + value.optionsOverride = 0; + return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::MoveToHue::Id, value); + } + case 6: { + LogStep(6, "Move to hue up command"); + chip::app::Clusters::ColorControl::Commands::MoveToHue::Type value; + value.hue = 250; + value.direction = static_cast(2); + value.transitionTime = 300U; + value.optionsMask = 0; + value.optionsOverride = 0; + return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::MoveToHue::Id, value); + } + case 7: { + LogStep(7, "Move to hue down command"); + chip::app::Clusters::ColorControl::Commands::MoveToHue::Type value; + value.hue = 225; + value.direction = static_cast(3); + value.transitionTime = 300U; + value.optionsMask = 0; + value.optionsOverride = 0; + return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::MoveToHue::Id, value); + } + case 8: { + LogStep(8, "Turn off light that we turned on"); + chip::app::Clusters::OnOff::Commands::Off::Type value; + return SendCommand(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Commands::Off::Id, value); + } + case 9: { + LogStep(9, "Check on/off attribute value is false after off command"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnOff::Id); + } + } + return CHIP_NO_ERROR; } +}; - static void OnFailureCallback_2(void * context, CHIP_ERROR error) +class Test_TC_CC_3_2Suite : public TestCommand +{ +public: + Test_TC_CC_3_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_CC_3_2", 9, credsIssuerConfig) { - (static_cast(context))->OnFailureResponse_2(error); + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - static void OnSuccessCallback_2(void * context) { (static_cast(context))->OnSuccessResponse_2(); } + ~Test_TC_CC_3_2Suite() {} - static void OnFailureCallback_3(void * context, CHIP_ERROR error) + chip::System::Clock::Timeout GetWaitDuration() const override { - (static_cast(context))->OnFailureResponse_3(error); + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } - static void OnSuccessCallback_3(void * context, uint8_t currentHue) - { - (static_cast(context))->OnSuccessResponse_3(currentHue); - } +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; - static void OnFailureCallback_4(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_4(error); - } + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } - static void OnSuccessCallback_4(void * context, uint8_t currentSaturation) - { - (static_cast(context))->OnSuccessResponse_4(currentSaturation); - } + // + // Tests methods + // - static void OnFailureCallback_5(void * context, CHIP_ERROR error) + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { - (static_cast(context))->OnFailureResponse_5(error); - } + bool shouldContinue = false; - static void OnSuccessCallback_5(void * context) { (static_cast(context))->OnSuccessResponse_5(); } + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + bool value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("onOff", value, 1)); + } + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 8: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + bool value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("onOff", value, 0)); + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } - static void OnFailureCallback_6(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_6(error); + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } } - static void OnSuccessCallback_6(void * context, uint8_t currentSaturation) + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - (static_cast(context))->OnSuccessResponse_6(currentSaturation); + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "Turn on light for color control tests"); + chip::app::Clusters::OnOff::Commands::On::Type value; + return SendCommand(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Commands::On::Id, value); + } + case 2: { + LogStep(2, "Check on/off attribute value is true after on command"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnOff::Id); + } + case 3: { + LogStep(3, "Move hue up command"); + chip::app::Clusters::ColorControl::Commands::MoveHue::Type value; + value.moveMode = static_cast(1); + value.rate = 50; + value.optionsMask = 0; + value.optionsOverride = 0; + return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::MoveHue::Id, value); + } + case 4: { + LogStep(4, "Move hue stop command"); + chip::app::Clusters::ColorControl::Commands::MoveHue::Type value; + value.moveMode = static_cast(0); + value.rate = 50; + value.optionsMask = 0; + value.optionsOverride = 0; + return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::MoveHue::Id, value); + } + case 5: { + LogStep(5, "Move hue down command"); + chip::app::Clusters::ColorControl::Commands::MoveHue::Type value; + value.moveMode = static_cast(3); + value.rate = 50; + value.optionsMask = 0; + value.optionsOverride = 0; + return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::MoveHue::Id, value); + } + case 6: { + LogStep(6, "Move hue stop command"); + chip::app::Clusters::ColorControl::Commands::MoveHue::Type value; + value.moveMode = static_cast(0); + value.rate = 50; + value.optionsMask = 0; + value.optionsOverride = 0; + return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::MoveHue::Id, value); + } + case 7: { + LogStep(7, "Turn off light that we turned on"); + chip::app::Clusters::OnOff::Commands::Off::Type value; + return SendCommand(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Commands::Off::Id, value); + } + case 8: { + LogStep(8, "Check on/off attribute value is false after off command"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnOff::Id); + } + } + return CHIP_NO_ERROR; } +}; - static void OnFailureCallback_7(void * context, CHIP_ERROR error) +class Test_TC_CC_3_3Suite : public TestCommand +{ +public: + Test_TC_CC_3_3Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_CC_3_3", 7, credsIssuerConfig) { - (static_cast(context))->OnFailureResponse_7(error); - } - - static void OnSuccessCallback_7(void * context, uint16_t currentX) - { - (static_cast(context))->OnSuccessResponse_7(currentX); - } - - static void OnFailureCallback_8(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_8(error); - } - - static void OnSuccessCallback_8(void * context) { (static_cast(context))->OnSuccessResponse_8(); } - - static void OnFailureCallback_9(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_9(error); - } - - static void OnSuccessCallback_9(void * context, uint16_t currentX) - { - (static_cast(context))->OnSuccessResponse_9(currentX); + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - static void OnFailureCallback_10(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_10(error); - } + ~Test_TC_CC_3_3Suite() {} - static void OnSuccessCallback_10(void * context, uint16_t currentY) + chip::System::Clock::Timeout GetWaitDuration() const override { - (static_cast(context))->OnSuccessResponse_10(currentY); + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } - static void OnFailureCallback_11(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_11(error); - } +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; - static void OnSuccessCallback_11(void * context) { (static_cast(context))->OnSuccessResponse_11(); } + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } - static void OnFailureCallback_12(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_12(error); - } + // + // Tests methods + // - static void OnSuccessCallback_12(void * context, uint16_t currentY) + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { - (static_cast(context))->OnSuccessResponse_12(currentY); - } + bool shouldContinue = false; - static void OnFailureCallback_13(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_13(error); - } + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + bool value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("onOff", value, 1)); + } + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + bool value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("onOff", value, 0)); + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } - static void OnSuccessCallback_13(void * context, uint16_t colorTemperature) - { - (static_cast(context))->OnSuccessResponse_13(colorTemperature); + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } } - static void OnFailureCallback_14(void * context, CHIP_ERROR error) + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - (static_cast(context))->OnFailureResponse_14(error); + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "Turn on light for color control tests"); + chip::app::Clusters::OnOff::Commands::On::Type value; + return SendCommand(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Commands::On::Id, value); + } + case 2: { + LogStep(2, "Check on/off attribute value is true after on command"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnOff::Id); + } + case 3: { + LogStep(3, "Step hue up command"); + chip::app::Clusters::ColorControl::Commands::StepHue::Type value; + value.stepMode = static_cast(1); + value.stepSize = 5; + value.transitionTime = 25; + value.optionsMask = 0; + value.optionsOverride = 0; + return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::StepHue::Id, value); + } + case 4: { + LogStep(4, "Step hue down command"); + chip::app::Clusters::ColorControl::Commands::StepHue::Type value; + value.stepMode = static_cast(3); + value.stepSize = 5; + value.transitionTime = 25; + value.optionsMask = 0; + value.optionsOverride = 0; + return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::StepHue::Id, value); + } + case 5: { + LogStep(5, "Turn off light that we turned on"); + chip::app::Clusters::OnOff::Commands::Off::Type value; + return SendCommand(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Commands::Off::Id, value); + } + case 6: { + LogStep(6, "Check on/off attribute value is false after off command"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnOff::Id); + } + } + return CHIP_NO_ERROR; } +}; - static void OnSuccessCallback_14(void * context, uint8_t colorMode) +class Test_TC_CC_4_1Suite : public TestCommand +{ +public: + Test_TC_CC_4_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_CC_4_1", 6, credsIssuerConfig) { - (static_cast(context))->OnSuccessResponse_14(colorMode); + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - static void OnFailureCallback_15(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_15(error); - } + ~Test_TC_CC_4_1Suite() {} - static void OnSuccessCallback_15(void * context, uint8_t colorControlOptions) + chip::System::Clock::Timeout GetWaitDuration() const override { - (static_cast(context))->OnSuccessResponse_15(colorControlOptions); + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } - static void OnFailureCallback_16(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_16(error); - } +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; - static void OnSuccessCallback_16(void * context) { (static_cast(context))->OnSuccessResponse_16(); } + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } - static void OnFailureCallback_17(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_17(error); - } + // + // Tests methods + // - static void OnSuccessCallback_17(void * context, uint8_t colorControlOptions) + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { - (static_cast(context))->OnSuccessResponse_17(colorControlOptions); - } + bool shouldContinue = false; - static void OnFailureCallback_18(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_18(error); - } + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + bool value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("onOff", value, 1)); + } + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + bool value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("onOff", value, 0)); + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } - static void OnSuccessCallback_18(void * context, uint16_t enhancedCurrentHue) - { - (static_cast(context))->OnSuccessResponse_18(enhancedCurrentHue); + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } } - static void OnFailureCallback_19(void * context, CHIP_ERROR error) + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - (static_cast(context))->OnFailureResponse_19(error); + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "Turn on light for color control tests"); + chip::app::Clusters::OnOff::Commands::On::Type value; + return SendCommand(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Commands::On::Id, value); + } + case 2: { + LogStep(2, "Check on/off attribute value is true after on command"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnOff::Id); + } + case 3: { + LogStep(3, "Move to saturation command"); + chip::app::Clusters::ColorControl::Commands::MoveToSaturation::Type value; + value.saturation = 90; + value.transitionTime = 10U; + value.optionsMask = 0; + value.optionsOverride = 0; + return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::MoveToSaturation::Id, + value); + } + case 4: { + LogStep(4, "Turn off light that we turned on"); + chip::app::Clusters::OnOff::Commands::Off::Type value; + return SendCommand(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Commands::Off::Id, value); + } + case 5: { + LogStep(5, "Check on/off attribute value is false after off command"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnOff::Id); + } + } + return CHIP_NO_ERROR; } +}; - static void OnSuccessCallback_19(void * context) { (static_cast(context))->OnSuccessResponse_19(); } - - static void OnFailureCallback_20(void * context, CHIP_ERROR error) +class Test_TC_CC_4_2Suite : public TestCommand +{ +public: + Test_TC_CC_4_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_CC_4_2", 11, credsIssuerConfig) { - (static_cast(context))->OnFailureResponse_20(error); + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - static void OnSuccessCallback_20(void * context, uint16_t enhancedCurrentHue) - { - (static_cast(context))->OnSuccessResponse_20(enhancedCurrentHue); - } + ~Test_TC_CC_4_2Suite() {} - static void OnFailureCallback_21(void * context, CHIP_ERROR error) + chip::System::Clock::Timeout GetWaitDuration() const override { - (static_cast(context))->OnFailureResponse_21(error); + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } - static void OnSuccessCallback_21(void * context, uint8_t enhancedColorMode) - { - (static_cast(context))->OnSuccessResponse_21(enhancedColorMode); - } +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; - static void OnFailureCallback_22(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_22(error); - } + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } - static void OnSuccessCallback_22(void * context, uint8_t colorLoopActive) - { - (static_cast(context))->OnSuccessResponse_22(colorLoopActive); - } + // + // Tests methods + // - static void OnFailureCallback_23(void * context, CHIP_ERROR error) + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { - (static_cast(context))->OnFailureResponse_23(error); - } + bool shouldContinue = false; - static void OnSuccessCallback_23(void * context) { (static_cast(context))->OnSuccessResponse_23(); } + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + bool value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("onOff", value, 1)); + } + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 8: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 9: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 10: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + bool value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("onOff", value, 0)); + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } - static void OnFailureCallback_24(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_24(error); + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } } - static void OnSuccessCallback_24(void * context, uint8_t colorLoopActive) + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - (static_cast(context))->OnSuccessResponse_24(colorLoopActive); + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "Turn on light for color control tests"); + chip::app::Clusters::OnOff::Commands::On::Type value; + return SendCommand(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Commands::On::Id, value); + } + case 2: { + LogStep(2, "Check on/off attribute value is true after on command"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnOff::Id); + } + case 3: { + LogStep(3, "Move saturation up command"); + chip::app::Clusters::ColorControl::Commands::MoveSaturation::Type value; + value.moveMode = static_cast(1); + value.rate = 5; + value.optionsMask = 0; + value.optionsOverride = 0; + return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::MoveSaturation::Id, value); + } + case 4: { + LogStep(4, "Move saturation down command"); + chip::app::Clusters::ColorControl::Commands::MoveSaturation::Type value; + value.moveMode = static_cast(3); + value.rate = 5; + value.optionsMask = 0; + value.optionsOverride = 0; + return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::MoveSaturation::Id, value); + } + case 5: { + LogStep(5, "Move saturation up command"); + chip::app::Clusters::ColorControl::Commands::MoveSaturation::Type value; + value.moveMode = static_cast(1); + value.rate = 5; + value.optionsMask = 0; + value.optionsOverride = 0; + return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::MoveSaturation::Id, value); + } + case 6: { + LogStep(6, "Move saturation stop command"); + chip::app::Clusters::ColorControl::Commands::MoveSaturation::Type value; + value.moveMode = static_cast(0); + value.rate = 5; + value.optionsMask = 0; + value.optionsOverride = 0; + return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::MoveSaturation::Id, value); + } + case 7: { + LogStep(7, "Move saturation down command"); + chip::app::Clusters::ColorControl::Commands::MoveSaturation::Type value; + value.moveMode = static_cast(3); + value.rate = 5; + value.optionsMask = 0; + value.optionsOverride = 0; + return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::MoveSaturation::Id, value); + } + case 8: { + LogStep(8, "Move saturation stop command"); + chip::app::Clusters::ColorControl::Commands::MoveSaturation::Type value; + value.moveMode = static_cast(0); + value.rate = 5; + value.optionsMask = 0; + value.optionsOverride = 0; + return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::MoveSaturation::Id, value); + } + case 9: { + LogStep(9, "Turn off light that we turned on"); + chip::app::Clusters::OnOff::Commands::Off::Type value; + return SendCommand(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Commands::Off::Id, value); + } + case 10: { + LogStep(10, "Check on/off attribute value is false after off command"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnOff::Id); + } + } + return CHIP_NO_ERROR; } +}; - static void OnFailureCallback_25(void * context, CHIP_ERROR error) +class Test_TC_CC_4_3Suite : public TestCommand +{ +public: + Test_TC_CC_4_3Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_CC_4_3", 7, credsIssuerConfig) { - (static_cast(context))->OnFailureResponse_25(error); + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - static void OnSuccessCallback_25(void * context, uint8_t colorLoopDirection) - { - (static_cast(context))->OnSuccessResponse_25(colorLoopDirection); - } + ~Test_TC_CC_4_3Suite() {} - static void OnFailureCallback_26(void * context, CHIP_ERROR error) + chip::System::Clock::Timeout GetWaitDuration() const override { - (static_cast(context))->OnFailureResponse_26(error); + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } - static void OnSuccessCallback_26(void * context) { (static_cast(context))->OnSuccessResponse_26(); } +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; - static void OnFailureCallback_27(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_27(error); - } + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } - static void OnSuccessCallback_27(void * context, uint8_t colorLoopDirection) - { - (static_cast(context))->OnSuccessResponse_27(colorLoopDirection); - } + // + // Tests methods + // - static void OnFailureCallback_28(void * context, CHIP_ERROR error) + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { - (static_cast(context))->OnFailureResponse_28(error); - } + bool shouldContinue = false; - static void OnSuccessCallback_28(void * context, uint16_t colorLoopTime) - { - (static_cast(context))->OnSuccessResponse_28(colorLoopTime); - } + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + bool value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("onOff", value, 1)); + } + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + bool value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("onOff", value, 0)); + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } - static void OnFailureCallback_29(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_29(error); + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } } - static void OnSuccessCallback_29(void * context) { (static_cast(context))->OnSuccessResponse_29(); } - - static void OnFailureCallback_30(void * context, CHIP_ERROR error) + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - (static_cast(context))->OnFailureResponse_30(error); + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "Turn on light for color control tests"); + chip::app::Clusters::OnOff::Commands::On::Type value; + return SendCommand(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Commands::On::Id, value); + } + case 2: { + LogStep(2, "Check on/off attribute value is true after on command"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnOff::Id); + } + case 3: { + LogStep(3, "Step saturation up command"); + chip::app::Clusters::ColorControl::Commands::StepSaturation::Type value; + value.stepMode = static_cast(1); + value.stepSize = 15; + value.transitionTime = 10; + value.optionsMask = 0; + value.optionsOverride = 0; + return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::StepSaturation::Id, value); + } + case 4: { + LogStep(4, "Step saturation down command"); + chip::app::Clusters::ColorControl::Commands::StepSaturation::Type value; + value.stepMode = static_cast(3); + value.stepSize = 20; + value.transitionTime = 10; + value.optionsMask = 0; + value.optionsOverride = 0; + return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::StepSaturation::Id, value); + } + case 5: { + LogStep(5, "Turn off light that we turned on"); + chip::app::Clusters::OnOff::Commands::Off::Type value; + return SendCommand(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Commands::Off::Id, value); + } + case 6: { + LogStep(6, "Check on/off attribute value is false after off command"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnOff::Id); + } + } + return CHIP_NO_ERROR; } +}; - static void OnSuccessCallback_30(void * context, uint16_t colorLoopTime) +class Test_TC_CC_4_4Suite : public TestCommand +{ +public: + Test_TC_CC_4_4Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_CC_4_4", 6, credsIssuerConfig) { - (static_cast(context))->OnSuccessResponse_30(colorLoopTime); + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - static void OnFailureCallback_31(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_31(error); - } + ~Test_TC_CC_4_4Suite() {} - static void OnSuccessCallback_31(void * context, uint16_t colorLoopStartEnhancedHue) + chip::System::Clock::Timeout GetWaitDuration() const override { - (static_cast(context))->OnSuccessResponse_31(colorLoopStartEnhancedHue); + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } - static void OnFailureCallback_32(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_32(error); - } +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; - static void OnSuccessCallback_32(void * context) { (static_cast(context))->OnSuccessResponse_32(); } + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } - static void OnFailureCallback_33(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_33(error); - } + // + // Tests methods + // - static void OnSuccessCallback_33(void * context, uint16_t colorLoopStartEnhancedHue) + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { - (static_cast(context))->OnSuccessResponse_33(colorLoopStartEnhancedHue); - } + bool shouldContinue = false; - static void OnFailureCallback_34(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_34(error); - } + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + bool value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("onOff", value, 1)); + } + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + bool value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("onOff", value, 0)); + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } - static void OnSuccessCallback_34(void * context, uint16_t colorLoopStoredEnhancedHue) - { - (static_cast(context))->OnSuccessResponse_34(colorLoopStoredEnhancedHue); + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } } - static void OnFailureCallback_35(void * context, CHIP_ERROR error) + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - (static_cast(context))->OnFailureResponse_35(error); + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "Turn on light for color control tests"); + chip::app::Clusters::OnOff::Commands::On::Type value; + return SendCommand(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Commands::On::Id, value); + } + case 2: { + LogStep(2, "Check on/off attribute value is true after on command"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnOff::Id); + } + case 3: { + LogStep(3, "Move To current hue and saturation command"); + chip::app::Clusters::ColorControl::Commands::MoveToHueAndSaturation::Type value; + value.hue = 40; + value.saturation = 160; + value.transitionTime = 10U; + value.optionsMask = 0; + value.optionsOverride = 0; + return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::MoveToHueAndSaturation::Id, + value); + } + case 4: { + LogStep(4, "Turn off light that we turned on"); + chip::app::Clusters::OnOff::Commands::Off::Type value; + return SendCommand(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Commands::Off::Id, value); + } + case 5: { + LogStep(5, "Check on/off attribute value is false after off command"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnOff::Id); + } + } + return CHIP_NO_ERROR; } +}; - static void OnSuccessCallback_35(void * context) { (static_cast(context))->OnSuccessResponse_35(); } - - static void OnFailureCallback_36(void * context, CHIP_ERROR error) +class Test_TC_CC_5_1Suite : public TestCommand +{ +public: + Test_TC_CC_5_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_CC_5_1", 6, credsIssuerConfig) { - (static_cast(context))->OnFailureResponse_36(error); + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - static void OnSuccessCallback_36(void * context, uint16_t colorLoopStoredEnhancedHue) - { - (static_cast(context))->OnSuccessResponse_36(colorLoopStoredEnhancedHue); - } + ~Test_TC_CC_5_1Suite() {} - static void OnFailureCallback_37(void * context, CHIP_ERROR error) + chip::System::Clock::Timeout GetWaitDuration() const override { - (static_cast(context))->OnFailureResponse_37(error); + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } - static void OnSuccessCallback_37(void * context, uint16_t colorCapabilities) - { - (static_cast(context))->OnSuccessResponse_37(colorCapabilities); - } +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; - static void OnFailureCallback_38(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_38(error); - } + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } - static void OnSuccessCallback_38(void * context) { (static_cast(context))->OnSuccessResponse_38(); } + // + // Tests methods + // - static void OnFailureCallback_39(void * context, CHIP_ERROR error) + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { - (static_cast(context))->OnFailureResponse_39(error); - } + bool shouldContinue = false; - static void OnSuccessCallback_39(void * context, uint16_t colorCapabilities) - { - (static_cast(context))->OnSuccessResponse_39(colorCapabilities); - } + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + bool value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("onOff", value, 1)); + } + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + bool value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("onOff", value, 0)); + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } - static void OnFailureCallback_40(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_40(error); + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } } - static void OnSuccessCallback_40(void * context, uint16_t colorTempPhysicalMin) + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - (static_cast(context))->OnSuccessResponse_40(colorTempPhysicalMin); + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "Turn on light for color control tests"); + chip::app::Clusters::OnOff::Commands::On::Type value; + return SendCommand(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Commands::On::Id, value); + } + case 2: { + LogStep(2, "Check on/off attribute value is true after on command"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnOff::Id); + } + case 3: { + LogStep(3, "Move to Color command"); + chip::app::Clusters::ColorControl::Commands::MoveToColor::Type value; + value.colorX = 200U; + value.colorY = 300U; + value.transitionTime = 20U; + value.optionsMask = 0; + value.optionsOverride = 0; + return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::MoveToColor::Id, value); + } + case 4: { + LogStep(4, "Turn off light that we turned on"); + chip::app::Clusters::OnOff::Commands::Off::Type value; + return SendCommand(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Commands::Off::Id, value); + } + case 5: { + LogStep(5, "Check on/off attribute value is false after off command"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnOff::Id); + } + } + return CHIP_NO_ERROR; } +}; - static void OnFailureCallback_41(void * context, CHIP_ERROR error) +class Test_TC_CC_5_2Suite : public TestCommand +{ +public: + Test_TC_CC_5_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_CC_5_2", 7, credsIssuerConfig) { - (static_cast(context))->OnFailureResponse_41(error); + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - static void OnSuccessCallback_41(void * context) { (static_cast(context))->OnSuccessResponse_41(); } + ~Test_TC_CC_5_2Suite() {} - static void OnFailureCallback_42(void * context, CHIP_ERROR error) + chip::System::Clock::Timeout GetWaitDuration() const override { - (static_cast(context))->OnFailureResponse_42(error); + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } - static void OnSuccessCallback_42(void * context, uint16_t colorTempPhysicalMin) - { - (static_cast(context))->OnSuccessResponse_42(colorTempPhysicalMin); - } +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; - static void OnFailureCallback_43(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_43(error); - } + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } - static void OnSuccessCallback_43(void * context, uint16_t colorTempPhysicalMax) - { - (static_cast(context))->OnSuccessResponse_43(colorTempPhysicalMax); - } + // + // Tests methods + // - static void OnFailureCallback_44(void * context, CHIP_ERROR error) + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { - (static_cast(context))->OnFailureResponse_44(error); - } + bool shouldContinue = false; - static void OnSuccessCallback_44(void * context) { (static_cast(context))->OnSuccessResponse_44(); } - - static void OnFailureCallback_45(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_45(error); - } - - static void OnSuccessCallback_45(void * context, uint16_t colorTempPhysicalMax) - { - (static_cast(context))->OnSuccessResponse_45(colorTempPhysicalMax); - } - - static void OnFailureCallback_46(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_46(error); - } - - static void OnSuccessCallback_46(void * context, uint16_t coupleColorTempToLevelMinMireds) - { - (static_cast(context))->OnSuccessResponse_46(coupleColorTempToLevelMinMireds); - } - - static void OnFailureCallback_47(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_47(error); - } - - static void OnSuccessCallback_47(void * context) { (static_cast(context))->OnSuccessResponse_47(); } - - static void OnFailureCallback_48(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_48(error); - } - - static void OnSuccessCallback_48(void * context, uint16_t coupleColorTempToLevelMinMireds) - { - (static_cast(context))->OnSuccessResponse_48(coupleColorTempToLevelMinMireds); - } - - static void OnFailureCallback_49(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_49(error); - } - - static void OnSuccessCallback_49(void * context, uint16_t startUpColorTemperatureMireds) - { - (static_cast(context))->OnSuccessResponse_49(startUpColorTemperatureMireds); - } - - static void OnFailureCallback_50(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_50(error); - } - - static void OnSuccessCallback_50(void * context) { (static_cast(context))->OnSuccessResponse_50(); } + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + bool value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("onOff", value, 1)); + } + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + bool value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("onOff", value, 0)); + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } - static void OnFailureCallback_51(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_51(error); + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } } - static void OnSuccessCallback_51(void * context, uint16_t startUpColorTemperatureMireds) + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - (static_cast(context))->OnSuccessResponse_51(startUpColorTemperatureMireds); + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "Turn on light for color control tests"); + chip::app::Clusters::OnOff::Commands::On::Type value; + return SendCommand(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Commands::On::Id, value); + } + case 2: { + LogStep(2, "Check on/off attribute value is true after on command"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnOff::Id); + } + case 3: { + LogStep(3, "Move Color command"); + chip::app::Clusters::ColorControl::Commands::MoveColor::Type value; + value.rateX = 15; + value.rateY = 20; + value.optionsMask = 0; + value.optionsOverride = 0; + return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::MoveColor::Id, value); + } + case 4: { + LogStep(4, "Stop Move Step command"); + chip::app::Clusters::ColorControl::Commands::StopMoveStep::Type value; + value.optionsMask = 0; + value.optionsOverride = 0; + return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::StopMoveStep::Id, value); + } + case 5: { + LogStep(5, "Turn off light that we turned on"); + chip::app::Clusters::OnOff::Commands::Off::Type value; + return SendCommand(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Commands::Off::Id, value); + } + case 6: { + LogStep(6, "Check on/off attribute value is false after off command"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnOff::Id); + } + } + return CHIP_NO_ERROR; } +}; - static void OnFailureCallback_52(void * context, CHIP_ERROR error) +class Test_TC_CC_5_3Suite : public TestCommand +{ +public: + Test_TC_CC_5_3Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_CC_5_3", 6, credsIssuerConfig) { - (static_cast(context))->OnFailureResponse_52(error); + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - static void OnSuccessCallback_52(void * context, uint16_t remainingTime) - { - (static_cast(context))->OnSuccessResponse_52(remainingTime); - } + ~Test_TC_CC_5_3Suite() {} - static void OnFailureCallback_53(void * context, CHIP_ERROR error) + chip::System::Clock::Timeout GetWaitDuration() const override { - (static_cast(context))->OnFailureResponse_53(error); + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } - static void OnSuccessCallback_53(void * context) { (static_cast(context))->OnSuccessResponse_53(); } +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; - static void OnFailureCallback_54(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_54(error); - } + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } - static void OnSuccessCallback_54(void * context, uint16_t remainingTime) - { - (static_cast(context))->OnSuccessResponse_54(remainingTime); - } + // + // Tests methods + // - static void OnFailureCallback_55(void * context, CHIP_ERROR error) + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { - (static_cast(context))->OnFailureResponse_55(error); - } + bool shouldContinue = false; - static void OnSuccessCallback_55(void * context, uint8_t driftCompensation) - { - (static_cast(context))->OnSuccessResponse_55(driftCompensation); - } + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + bool value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("onOff", value, 1)); + } + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + bool value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("onOff", value, 0)); + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } - static void OnFailureCallback_56(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_56(error); + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } } - static void OnSuccessCallback_56(void * context) { (static_cast(context))->OnSuccessResponse_56(); } - - static void OnFailureCallback_57(void * context, CHIP_ERROR error) + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - (static_cast(context))->OnFailureResponse_57(error); + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "Turn on light for color control tests"); + chip::app::Clusters::OnOff::Commands::On::Type value; + return SendCommand(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Commands::On::Id, value); + } + case 2: { + LogStep(2, "Check on/off attribute value is true after on command"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnOff::Id); + } + case 3: { + LogStep(3, "Step Color command"); + chip::app::Clusters::ColorControl::Commands::StepColor::Type value; + value.stepX = 15; + value.stepY = 20; + value.transitionTime = 50U; + value.optionsMask = 0; + value.optionsOverride = 0; + return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::StepColor::Id, value); + } + case 4: { + LogStep(4, "Turn off light that we turned on"); + chip::app::Clusters::OnOff::Commands::Off::Type value; + return SendCommand(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Commands::Off::Id, value); + } + case 5: { + LogStep(5, "Check on/off attribute value is false after off command"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnOff::Id); + } + } + return CHIP_NO_ERROR; } +}; - static void OnSuccessCallback_57(void * context, uint8_t driftCompensation) +class Test_TC_CC_6_1Suite : public TestCommand +{ +public: + Test_TC_CC_6_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_CC_6_1", 6, credsIssuerConfig) { - (static_cast(context))->OnSuccessResponse_57(driftCompensation); + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - static void OnFailureCallback_58(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_58(error); - } + ~Test_TC_CC_6_1Suite() {} - static void OnSuccessCallback_58(void * context, chip::CharSpan compensationText) + chip::System::Clock::Timeout GetWaitDuration() const override { - (static_cast(context))->OnSuccessResponse_58(compensationText); + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } - static void OnFailureCallback_59(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_59(error); - } +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; - static void OnSuccessCallback_59(void * context) { (static_cast(context))->OnSuccessResponse_59(); } + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } - static void OnFailureCallback_60(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_60(error); - } + // + // Tests methods + // - static void OnSuccessCallback_60(void * context, chip::CharSpan compensationText) + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { - (static_cast(context))->OnSuccessResponse_60(compensationText); - } + bool shouldContinue = false; - static void OnFailureCallback_61(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_61(error); - } + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + bool value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("onOff", value, 1)); + } + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + bool value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("onOff", value, 0)); + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } - static void OnSuccessCallback_61(void * context, uint8_t numberOfPrimaries) - { - (static_cast(context))->OnSuccessResponse_61(numberOfPrimaries); + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } } - static void OnFailureCallback_62(void * context, CHIP_ERROR error) + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - (static_cast(context))->OnFailureResponse_62(error); + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "Turn on light for color control tests"); + chip::app::Clusters::OnOff::Commands::On::Type value; + return SendCommand(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Commands::On::Id, value); + } + case 2: { + LogStep(2, "Check on/off attribute value is true after on command"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnOff::Id); + } + case 3: { + LogStep(3, "Move To Color Temperature command"); + chip::app::Clusters::ColorControl::Commands::MoveToColorTemperature::Type value; + value.colorTemperature = 100U; + value.transitionTime = 10U; + value.optionsMask = 0; + value.optionsOverride = 0; + return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::MoveToColorTemperature::Id, + value); + } + case 4: { + LogStep(4, "Turn off light that we turned on"); + chip::app::Clusters::OnOff::Commands::Off::Type value; + return SendCommand(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Commands::Off::Id, value); + } + case 5: { + LogStep(5, "Check on/off attribute value is false after off command"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnOff::Id); + } + } + return CHIP_NO_ERROR; } +}; - static void OnSuccessCallback_62(void * context) { (static_cast(context))->OnSuccessResponse_62(); } - - static void OnFailureCallback_63(void * context, CHIP_ERROR error) +class Test_TC_CC_6_2Suite : public TestCommand +{ +public: + Test_TC_CC_6_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_CC_6_2", 12, credsIssuerConfig) { - (static_cast(context))->OnFailureResponse_63(error); + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - static void OnSuccessCallback_63(void * context, uint8_t numberOfPrimaries) - { - (static_cast(context))->OnSuccessResponse_63(numberOfPrimaries); - } + ~Test_TC_CC_6_2Suite() {} - static void OnFailureCallback_64(void * context, CHIP_ERROR error) + chip::System::Clock::Timeout GetWaitDuration() const override { - (static_cast(context))->OnFailureResponse_64(error); + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } - static void OnSuccessCallback_64(void * context, uint16_t primary1X) - { - (static_cast(context))->OnSuccessResponse_64(primary1X); - } +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; - static void OnFailureCallback_65(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_65(error); - } + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } - static void OnSuccessCallback_65(void * context) { (static_cast(context))->OnSuccessResponse_65(); } + // + // Tests methods + // - static void OnFailureCallback_66(void * context, CHIP_ERROR error) + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { - (static_cast(context))->OnFailureResponse_66(error); - } + bool shouldContinue = false; - static void OnSuccessCallback_66(void * context, uint16_t primary1X) - { - (static_cast(context))->OnSuccessResponse_66(primary1X); + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + bool value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("onOff", value, 1)); + } + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 65279U)); + } + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 8: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 9: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 10: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 11: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + bool value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("onOff", value, 0)); + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } + + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } + } + + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "Turn on light for color control tests"); + chip::app::Clusters::OnOff::Commands::On::Type value; + return SendCommand(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Commands::On::Id, value); + } + case 2: { + LogStep(2, "Check on/off attribute value is true after on command"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnOff::Id); + } + case 3: { + LogStep(3, "Read current color temprature"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ColorTemperature::Id); + } + case 4: { + LogStep(4, "Move up color temperature command"); + chip::app::Clusters::ColorControl::Commands::MoveColorTemperature::Type value; + value.moveMode = static_cast(1); + value.rate = 10U; + value.colorTemperatureMinimum = 1U; + value.colorTemperatureMaximum = 255U; + value.optionsMask = 0; + value.optionsOverride = 0; + return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::MoveColorTemperature::Id, + value); + } + case 5: { + LogStep(5, "Move down color temperature command"); + chip::app::Clusters::ColorControl::Commands::MoveColorTemperature::Type value; + value.moveMode = static_cast(3); + value.rate = 20U; + value.colorTemperatureMinimum = 1U; + value.colorTemperatureMaximum = 255U; + value.optionsMask = 0; + value.optionsOverride = 0; + return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::MoveColorTemperature::Id, + value); + } + case 6: { + LogStep(6, "Move up color temperature command"); + chip::app::Clusters::ColorControl::Commands::MoveColorTemperature::Type value; + value.moveMode = static_cast(1); + value.rate = 10U; + value.colorTemperatureMinimum = 1U; + value.colorTemperatureMaximum = 255U; + value.optionsMask = 0; + value.optionsOverride = 0; + return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::MoveColorTemperature::Id, + value); + } + case 7: { + LogStep(7, "Stop Color Temperature command"); + chip::app::Clusters::ColorControl::Commands::MoveColorTemperature::Type value; + value.moveMode = static_cast(0); + value.rate = 10U; + value.colorTemperatureMinimum = 1U; + value.colorTemperatureMaximum = 255U; + value.optionsMask = 0; + value.optionsOverride = 0; + return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::MoveColorTemperature::Id, + value); + } + case 8: { + LogStep(8, "Move down color temperature command"); + chip::app::Clusters::ColorControl::Commands::MoveColorTemperature::Type value; + value.moveMode = static_cast(3); + value.rate = 20U; + value.colorTemperatureMinimum = 1U; + value.colorTemperatureMaximum = 255U; + value.optionsMask = 0; + value.optionsOverride = 0; + return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::MoveColorTemperature::Id, + value); + } + case 9: { + LogStep(9, "Stop Color Temperature command"); + chip::app::Clusters::ColorControl::Commands::MoveColorTemperature::Type value; + value.moveMode = static_cast(0); + value.rate = 10U; + value.colorTemperatureMinimum = 1U; + value.colorTemperatureMaximum = 255U; + value.optionsMask = 0; + value.optionsOverride = 0; + return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::MoveColorTemperature::Id, + value); + } + case 10: { + LogStep(10, "Turn off light that we turned on"); + chip::app::Clusters::OnOff::Commands::Off::Type value; + return SendCommand(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Commands::Off::Id, value); + } + case 11: { + LogStep(11, "Check on/off attribute value is false after off command"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnOff::Id); + } + } + return CHIP_NO_ERROR; } +}; - static void OnFailureCallback_67(void * context, CHIP_ERROR error) +class Test_TC_CC_6_3Suite : public TestCommand +{ +public: + Test_TC_CC_6_3Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_CC_6_3", 7, credsIssuerConfig) { - (static_cast(context))->OnFailureResponse_67(error); + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - static void OnSuccessCallback_67(void * context, uint16_t primary1Y) - { - (static_cast(context))->OnSuccessResponse_67(primary1Y); - } + ~Test_TC_CC_6_3Suite() {} - static void OnFailureCallback_68(void * context, CHIP_ERROR error) + chip::System::Clock::Timeout GetWaitDuration() const override { - (static_cast(context))->OnFailureResponse_68(error); + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } - static void OnSuccessCallback_68(void * context) { (static_cast(context))->OnSuccessResponse_68(); } +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; - static void OnFailureCallback_69(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_69(error); - } + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } - static void OnSuccessCallback_69(void * context, uint16_t primary1Y) - { - (static_cast(context))->OnSuccessResponse_69(primary1Y); - } + // + // Tests methods + // - static void OnFailureCallback_70(void * context, CHIP_ERROR error) + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { - (static_cast(context))->OnFailureResponse_70(error); - } + bool shouldContinue = false; - static void OnSuccessCallback_70(void * context, uint8_t primary1Intensity) - { - (static_cast(context))->OnSuccessResponse_70(primary1Intensity); - } + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + bool value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("onOff", value, 1)); + } + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + bool value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("onOff", value, 0)); + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } - static void OnFailureCallback_71(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_71(error); + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } } - static void OnSuccessCallback_71(void * context, uint16_t primary2X) + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - (static_cast(context))->OnSuccessResponse_71(primary2X); + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "Turn on light for color control tests"); + chip::app::Clusters::OnOff::Commands::On::Type value; + return SendCommand(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Commands::On::Id, value); + } + case 2: { + LogStep(2, "Check on/off attribute value is true after on command"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnOff::Id); + } + case 3: { + LogStep(3, "Step up color temperature command"); + chip::app::Clusters::ColorControl::Commands::StepColorTemperature::Type value; + value.stepMode = static_cast(1); + value.stepSize = 5U; + value.transitionTime = 50U; + value.colorTemperatureMinimum = 5U; + value.colorTemperatureMaximum = 100U; + value.optionsMask = 0; + value.optionsOverride = 0; + return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::StepColorTemperature::Id, + value); + } + case 4: { + LogStep(4, "Step down color temperature command"); + chip::app::Clusters::ColorControl::Commands::StepColorTemperature::Type value; + value.stepMode = static_cast(3); + value.stepSize = 5U; + value.transitionTime = 50U; + value.colorTemperatureMinimum = 5U; + value.colorTemperatureMaximum = 100U; + value.optionsMask = 0; + value.optionsOverride = 0; + return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::StepColorTemperature::Id, + value); + } + case 5: { + LogStep(5, "Turn off light that we turned on"); + chip::app::Clusters::OnOff::Commands::Off::Type value; + return SendCommand(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Commands::Off::Id, value); + } + case 6: { + LogStep(6, "Check on/off attribute value is false after off command"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnOff::Id); + } + } + return CHIP_NO_ERROR; } +}; - static void OnFailureCallback_72(void * context, CHIP_ERROR error) +class Test_TC_CC_7_1Suite : public TestCommand +{ +public: + Test_TC_CC_7_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_CC_7_1", 10, credsIssuerConfig) { - (static_cast(context))->OnFailureResponse_72(error); + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - static void OnSuccessCallback_72(void * context) { (static_cast(context))->OnSuccessResponse_72(); } + ~Test_TC_CC_7_1Suite() {} - static void OnFailureCallback_73(void * context, CHIP_ERROR error) + chip::System::Clock::Timeout GetWaitDuration() const override { - (static_cast(context))->OnFailureResponse_73(error); + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } - static void OnSuccessCallback_73(void * context, uint16_t primary2X) - { - (static_cast(context))->OnSuccessResponse_73(primary2X); - } +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; - static void OnFailureCallback_74(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_74(error); - } + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } - static void OnSuccessCallback_74(void * context, uint16_t primary2Y) - { - (static_cast(context))->OnSuccessResponse_74(primary2Y); - } + // + // Tests methods + // - static void OnFailureCallback_75(void * context, CHIP_ERROR error) + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { - (static_cast(context))->OnFailureResponse_75(error); - } + bool shouldContinue = false; - static void OnSuccessCallback_75(void * context) { (static_cast(context))->OnSuccessResponse_75(); } + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + bool value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("onOff", value, 1)); + } + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 8: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 9: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + bool value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("onOff", value, 0)); + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } - static void OnFailureCallback_76(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_76(error); + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } } - static void OnSuccessCallback_76(void * context, uint16_t primary2Y) + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - (static_cast(context))->OnSuccessResponse_76(primary2Y); + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "Turn on light for color control tests"); + chip::app::Clusters::OnOff::Commands::On::Type value; + return SendCommand(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Commands::On::Id, value); + } + case 2: { + LogStep(2, "Check on/off attribute value is true after on command"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnOff::Id); + } + case 3: { + LogStep(3, "Enhanced Move To Hue command"); + chip::app::Clusters::ColorControl::Commands::EnhancedMoveToHue::Type value; + value.enhancedHue = 1025U; + value.direction = static_cast(0); + value.transitionTime = 1U; + value.optionsMask = 0; + value.optionsOverride = 0; + return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::EnhancedMoveToHue::Id, + value); + } + case 4: { + LogStep(4, "Enhanced Move To Hue command"); + chip::app::Clusters::ColorControl::Commands::EnhancedMoveToHue::Type value; + value.enhancedHue = 1100U; + value.direction = static_cast(0); + value.transitionTime = 300U; + value.optionsMask = 0; + value.optionsOverride = 0; + return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::EnhancedMoveToHue::Id, + value); + } + case 5: { + LogStep(5, "Enhanced Move To Hue command"); + chip::app::Clusters::ColorControl::Commands::EnhancedMoveToHue::Type value; + value.enhancedHue = 1150U; + value.direction = static_cast(1); + value.transitionTime = 300U; + value.optionsMask = 0; + value.optionsOverride = 0; + return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::EnhancedMoveToHue::Id, + value); + } + case 6: { + LogStep(6, "Enhanced Move To Hue command"); + chip::app::Clusters::ColorControl::Commands::EnhancedMoveToHue::Type value; + value.enhancedHue = 1200U; + value.direction = static_cast(2); + value.transitionTime = 300U; + value.optionsMask = 0; + value.optionsOverride = 0; + return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::EnhancedMoveToHue::Id, + value); + } + case 7: { + LogStep(7, "Enhanced Move To Hue command"); + chip::app::Clusters::ColorControl::Commands::EnhancedMoveToHue::Type value; + value.enhancedHue = 1300U; + value.direction = static_cast(3); + value.transitionTime = 300U; + value.optionsMask = 0; + value.optionsOverride = 0; + return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::EnhancedMoveToHue::Id, + value); + } + case 8: { + LogStep(8, "Turn off light that we turned on"); + chip::app::Clusters::OnOff::Commands::Off::Type value; + return SendCommand(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Commands::Off::Id, value); + } + case 9: { + LogStep(9, "Check on/off attribute value is false after off command"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnOff::Id); + } + } + return CHIP_NO_ERROR; } +}; - static void OnFailureCallback_77(void * context, CHIP_ERROR error) +class Test_TC_CC_7_2Suite : public TestCommand +{ +public: + Test_TC_CC_7_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_CC_7_2", 10, credsIssuerConfig) { - (static_cast(context))->OnFailureResponse_77(error); + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - static void OnSuccessCallback_77(void * context, uint8_t primary2Intensity) - { - (static_cast(context))->OnSuccessResponse_77(primary2Intensity); - } + ~Test_TC_CC_7_2Suite() {} - static void OnFailureCallback_78(void * context, CHIP_ERROR error) + chip::System::Clock::Timeout GetWaitDuration() const override { - (static_cast(context))->OnFailureResponse_78(error); + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } - static void OnSuccessCallback_78(void * context, uint16_t primary3X) - { - (static_cast(context))->OnSuccessResponse_78(primary3X); - } +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; - static void OnFailureCallback_79(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_79(error); - } + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } - static void OnSuccessCallback_79(void * context) { (static_cast(context))->OnSuccessResponse_79(); } + // + // Tests methods + // - static void OnFailureCallback_80(void * context, CHIP_ERROR error) + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { - (static_cast(context))->OnFailureResponse_80(error); - } + bool shouldContinue = false; - static void OnSuccessCallback_80(void * context, uint16_t primary3X) - { - (static_cast(context))->OnSuccessResponse_80(primary3X); - } - - static void OnFailureCallback_81(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_81(error); - } - - static void OnSuccessCallback_81(void * context, uint16_t primary3Y) - { - (static_cast(context))->OnSuccessResponse_81(primary3Y); - } - - static void OnFailureCallback_82(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_82(error); - } - - static void OnSuccessCallback_82(void * context) { (static_cast(context))->OnSuccessResponse_82(); } - - static void OnFailureCallback_83(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_83(error); - } - - static void OnSuccessCallback_83(void * context, uint16_t primary3Y) - { - (static_cast(context))->OnSuccessResponse_83(primary3Y); - } - - static void OnFailureCallback_84(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_84(error); - } - - static void OnSuccessCallback_84(void * context, uint8_t primary3Intensity) - { - (static_cast(context))->OnSuccessResponse_84(primary3Intensity); - } - - static void OnFailureCallback_85(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_85(error); - } - - static void OnSuccessCallback_85(void * context, uint16_t primary4X) - { - (static_cast(context))->OnSuccessResponse_85(primary4X); - } - - static void OnFailureCallback_86(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_86(error); - } - - static void OnSuccessCallback_86(void * context) { (static_cast(context))->OnSuccessResponse_86(); } - - static void OnFailureCallback_87(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_87(error); - } - - static void OnSuccessCallback_87(void * context, uint16_t primary4X) - { - (static_cast(context))->OnSuccessResponse_87(primary4X); - } - - static void OnFailureCallback_88(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_88(error); - } - - static void OnSuccessCallback_88(void * context, uint16_t primary4Y) - { - (static_cast(context))->OnSuccessResponse_88(primary4Y); - } - - static void OnFailureCallback_89(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_89(error); - } - - static void OnSuccessCallback_89(void * context) { (static_cast(context))->OnSuccessResponse_89(); } - - static void OnFailureCallback_90(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_90(error); - } - - static void OnSuccessCallback_90(void * context, uint16_t primary4Y) - { - (static_cast(context))->OnSuccessResponse_90(primary4Y); - } - - static void OnFailureCallback_91(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_91(error); - } - - static void OnSuccessCallback_91(void * context, uint8_t primary4Intensity) - { - (static_cast(context))->OnSuccessResponse_91(primary4Intensity); - } - - static void OnFailureCallback_92(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_92(error); - } - - static void OnSuccessCallback_92(void * context, uint16_t primary5X) - { - (static_cast(context))->OnSuccessResponse_92(primary5X); - } - - static void OnFailureCallback_93(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_93(error); - } - - static void OnSuccessCallback_93(void * context) { (static_cast(context))->OnSuccessResponse_93(); } - - static void OnFailureCallback_94(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_94(error); - } - - static void OnSuccessCallback_94(void * context, uint16_t primary5X) - { - (static_cast(context))->OnSuccessResponse_94(primary5X); - } - - static void OnFailureCallback_95(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_95(error); - } - - static void OnSuccessCallback_95(void * context, uint16_t primary5Y) - { - (static_cast(context))->OnSuccessResponse_95(primary5Y); - } - - static void OnFailureCallback_96(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_96(error); - } - - static void OnSuccessCallback_96(void * context) { (static_cast(context))->OnSuccessResponse_96(); } - - static void OnFailureCallback_97(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_97(error); - } - - static void OnSuccessCallback_97(void * context, uint16_t primary5Y) - { - (static_cast(context))->OnSuccessResponse_97(primary5Y); - } - - static void OnFailureCallback_98(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_98(error); - } - - static void OnSuccessCallback_98(void * context, uint8_t primary5Intensity) - { - (static_cast(context))->OnSuccessResponse_98(primary5Intensity); - } - - static void OnFailureCallback_99(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_99(error); - } - - static void OnSuccessCallback_99(void * context, uint16_t primary6X) - { - (static_cast(context))->OnSuccessResponse_99(primary6X); - } - - static void OnFailureCallback_100(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_100(error); - } - - static void OnSuccessCallback_100(void * context) { (static_cast(context))->OnSuccessResponse_100(); } - - static void OnFailureCallback_101(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_101(error); - } - - static void OnSuccessCallback_101(void * context, uint16_t primary6X) - { - (static_cast(context))->OnSuccessResponse_101(primary6X); - } + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + bool value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("onOff", value, 1)); + } + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 65535U)); + } + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 8: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 9: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + bool value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("onOff", value, 0)); + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } - static void OnFailureCallback_102(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_102(error); + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } } - static void OnSuccessCallback_102(void * context, uint16_t primary6Y) + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - (static_cast(context))->OnSuccessResponse_102(primary6Y); + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "Turn on light for color control tests"); + chip::app::Clusters::OnOff::Commands::On::Type value; + return SendCommand(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Commands::On::Id, value); + } + case 2: { + LogStep(2, "Check on/off attribute value is true after on command"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnOff::Id); + } + case 3: { + LogStep(3, "Check EnhancedCurrentHue attribute from DUT"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, + ColorControl::Attributes::EnhancedCurrentHue::Id); + } + case 4: { + LogStep(4, "Enhanced Move Hue Up command"); + chip::app::Clusters::ColorControl::Commands::EnhancedMoveHue::Type value; + value.moveMode = static_cast(1); + value.rate = 50U; + value.optionsMask = 0; + value.optionsOverride = 0; + return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::EnhancedMoveHue::Id, + value); + } + case 5: { + LogStep(5, "Enhanced Move Hue Stop command"); + chip::app::Clusters::ColorControl::Commands::EnhancedMoveHue::Type value; + value.moveMode = static_cast(0); + value.rate = 0U; + value.optionsMask = 0; + value.optionsOverride = 0; + return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::EnhancedMoveHue::Id, + value); + } + case 6: { + LogStep(6, "Enhanced Move Hue Down command "); + chip::app::Clusters::ColorControl::Commands::EnhancedMoveHue::Type value; + value.moveMode = static_cast(3); + value.rate = 5U; + value.optionsMask = 0; + value.optionsOverride = 0; + return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::EnhancedMoveHue::Id, + value); + } + case 7: { + LogStep(7, "Enhanced Move Hue Stop command"); + chip::app::Clusters::ColorControl::Commands::EnhancedMoveHue::Type value; + value.moveMode = static_cast(0); + value.rate = 0U; + value.optionsMask = 0; + value.optionsOverride = 0; + return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::EnhancedMoveHue::Id, + value); + } + case 8: { + LogStep(8, "Turn off light that we turned on"); + chip::app::Clusters::OnOff::Commands::Off::Type value; + return SendCommand(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Commands::Off::Id, value); + } + case 9: { + LogStep(9, "Check on/off attribute value is false after off command"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnOff::Id); + } + } + return CHIP_NO_ERROR; } +}; - static void OnFailureCallback_103(void * context, CHIP_ERROR error) +class Test_TC_CC_7_3Suite : public TestCommand +{ +public: + Test_TC_CC_7_3Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_CC_7_3", 7, credsIssuerConfig) { - (static_cast(context))->OnFailureResponse_103(error); + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - static void OnSuccessCallback_103(void * context) { (static_cast(context))->OnSuccessResponse_103(); } + ~Test_TC_CC_7_3Suite() {} - static void OnFailureCallback_104(void * context, CHIP_ERROR error) + chip::System::Clock::Timeout GetWaitDuration() const override { - (static_cast(context))->OnFailureResponse_104(error); + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } - static void OnSuccessCallback_104(void * context, uint16_t primary6Y) - { - (static_cast(context))->OnSuccessResponse_104(primary6Y); - } +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; - static void OnFailureCallback_105(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_105(error); - } + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } - static void OnSuccessCallback_105(void * context, uint8_t primary6Intensity) - { - (static_cast(context))->OnSuccessResponse_105(primary6Intensity); - } + // + // Tests methods + // - static void OnFailureCallback_106(void * context, CHIP_ERROR error) + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { - (static_cast(context))->OnFailureResponse_106(error); - } + bool shouldContinue = false; - static void OnSuccessCallback_106(void * context, uint16_t whitePointX) - { - (static_cast(context))->OnSuccessResponse_106(whitePointX); - } + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + bool value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("onOff", value, 1)); + } + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + bool value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("onOff", value, 0)); + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } - static void OnFailureCallback_107(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_107(error); + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } } - static void OnSuccessCallback_107(void * context) { (static_cast(context))->OnSuccessResponse_107(); } - - static void OnFailureCallback_108(void * context, CHIP_ERROR error) + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - (static_cast(context))->OnFailureResponse_108(error); + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "Turn on light for color control tests"); + chip::app::Clusters::OnOff::Commands::On::Type value; + return SendCommand(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Commands::On::Id, value); + } + case 2: { + LogStep(2, "Check on/off attribute value is true after on command"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnOff::Id); + } + case 3: { + LogStep(3, "Enhanced Step Hue Up command"); + chip::app::Clusters::ColorControl::Commands::EnhancedStepHue::Type value; + value.stepMode = static_cast(0); + value.stepSize = 50U; + value.transitionTime = 1U; + value.optionsMask = 0; + value.optionsOverride = 0; + return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::EnhancedStepHue::Id, + value); + } + case 4: { + LogStep(4, "Enhanced Step Hue Down command"); + chip::app::Clusters::ColorControl::Commands::EnhancedStepHue::Type value; + value.stepMode = static_cast(1); + value.stepSize = 75U; + value.transitionTime = 1U; + value.optionsMask = 0; + value.optionsOverride = 0; + return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::EnhancedStepHue::Id, + value); + } + case 5: { + LogStep(5, "Turn off light that we turned on"); + chip::app::Clusters::OnOff::Commands::Off::Type value; + return SendCommand(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Commands::Off::Id, value); + } + case 6: { + LogStep(6, "Check on/off attribute value is false after off command"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnOff::Id); + } + } + return CHIP_NO_ERROR; } +}; - static void OnSuccessCallback_108(void * context, uint16_t whitePointX) +class Test_TC_CC_7_4Suite : public TestCommand +{ +public: + Test_TC_CC_7_4Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_CC_7_4", 6, credsIssuerConfig) { - (static_cast(context))->OnSuccessResponse_108(whitePointX); + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - static void OnFailureCallback_109(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_109(error); - } + ~Test_TC_CC_7_4Suite() {} - static void OnSuccessCallback_109(void * context, uint16_t whitePointY) + chip::System::Clock::Timeout GetWaitDuration() const override { - (static_cast(context))->OnSuccessResponse_109(whitePointY); + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } - static void OnFailureCallback_110(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_110(error); - } +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; - static void OnSuccessCallback_110(void * context) { (static_cast(context))->OnSuccessResponse_110(); } + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } - static void OnFailureCallback_111(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_111(error); - } + // + // Tests methods + // - static void OnSuccessCallback_111(void * context, uint16_t whitePointY) + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { - (static_cast(context))->OnSuccessResponse_111(whitePointY); - } + bool shouldContinue = false; - static void OnFailureCallback_112(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_112(error); - } + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + bool value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("onOff", value, 1)); + } + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + bool value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("onOff", value, 0)); + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } - static void OnSuccessCallback_112(void * context, uint16_t colorPointRX) - { - (static_cast(context))->OnSuccessResponse_112(colorPointRX); + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } } - static void OnFailureCallback_113(void * context, CHIP_ERROR error) + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - (static_cast(context))->OnFailureResponse_113(error); + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "Turn on light for color control tests"); + chip::app::Clusters::OnOff::Commands::On::Type value; + return SendCommand(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Commands::On::Id, value); + } + case 2: { + LogStep(2, "Check on/off attribute value is true after on command"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnOff::Id); + } + case 3: { + LogStep(3, "Enhanced move to hue and saturation command"); + chip::app::Clusters::ColorControl::Commands::EnhancedMoveToHueAndSaturation::Type value; + value.enhancedHue = 1200U; + value.saturation = 90; + value.transitionTime = 10U; + value.optionsMask = 0; + value.optionsOverride = 0; + return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, + ColorControl::Commands::EnhancedMoveToHueAndSaturation::Id, value); + } + case 4: { + LogStep(4, "Turn off light that we turned on"); + chip::app::Clusters::OnOff::Commands::Off::Type value; + return SendCommand(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Commands::Off::Id, value); + } + case 5: { + LogStep(5, "Check on/off attribute value is false after off command"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnOff::Id); + } + } + return CHIP_NO_ERROR; } +}; - static void OnSuccessCallback_113(void * context) { (static_cast(context))->OnSuccessResponse_113(); } - - static void OnFailureCallback_114(void * context, CHIP_ERROR error) +class Test_TC_CC_8_1Suite : public TestCommand +{ +public: + Test_TC_CC_8_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_CC_8_1", 17, credsIssuerConfig) { - (static_cast(context))->OnFailureResponse_114(error); + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - static void OnSuccessCallback_114(void * context, uint16_t colorPointRX) - { - (static_cast(context))->OnSuccessResponse_114(colorPointRX); - } + ~Test_TC_CC_8_1Suite() {} - static void OnFailureCallback_115(void * context, CHIP_ERROR error) + chip::System::Clock::Timeout GetWaitDuration() const override { - (static_cast(context))->OnFailureResponse_115(error); + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } - static void OnSuccessCallback_115(void * context, uint16_t colorPointRY) - { - (static_cast(context))->OnSuccessResponse_115(colorPointRY); - } +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; - static void OnFailureCallback_116(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_116(error); - } + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } - static void OnSuccessCallback_116(void * context) { (static_cast(context))->OnSuccessResponse_116(); } + // + // Tests methods + // - static void OnFailureCallback_117(void * context, CHIP_ERROR error) + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { - (static_cast(context))->OnFailureResponse_117(error); - } + bool shouldContinue = false; - static void OnSuccessCallback_117(void * context, uint16_t colorPointRY) - { - (static_cast(context))->OnSuccessResponse_117(colorPointRY); - } + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + bool value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("onOff", value, 1)); + } + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("colorLoopDirection", value, 1)); + } + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("colorLoopTime", value, 100U)); + } + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("colorLoopStartEnhancedHue", value, 500U)); + } + break; + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("colorLoopActive", value, 0)); + } + break; + case 8: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 9: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("colorLoopActive", value, 1)); + } + break; + case 10: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 11: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("colorLoopDirection", value, 0)); + } + break; + case 12: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("colorLoopTime", value, 3500U)); + } + break; + case 13: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 14: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("colorLoopDirection", value, 1)); + } + break; + case 15: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 16: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + bool value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("onOff", value, 0)); + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } - static void OnFailureCallback_118(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_118(error); + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } } - static void OnSuccessCallback_118(void * context, uint8_t colorPointRIntensity) + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - (static_cast(context))->OnSuccessResponse_118(colorPointRIntensity); + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "Turn on light for color control tests"); + chip::app::Clusters::OnOff::Commands::On::Type value; + return SendCommand(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Commands::On::Id, value); + } + case 2: { + LogStep(2, "Check on/off attribute value is true after on command"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnOff::Id); + } + case 3: { + LogStep(3, "Color Loop Set Command - Set all Attributes"); + chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type value; + value.updateFlags = static_cast>(14); + value.action = static_cast(0); + value.direction = static_cast(1); + value.time = 100U; + value.startHue = 500U; + value.optionsMask = 0; + value.optionsOverride = 0; + return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::ColorLoopSet::Id, value); + } + case 4: { + LogStep(4, "Check ColorLoopDirection Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, + ColorControl::Attributes::ColorLoopDirection::Id); + } + case 5: { + LogStep(5, "Check ColorLoopTime Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ColorLoopTime::Id); + } + case 6: { + LogStep(6, "Check ColorLoopStartEnhancedHue Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, + ColorControl::Attributes::ColorLoopStartEnhancedHue::Id); + } + case 7: { + LogStep(7, "Check ColorLoopActive Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ColorLoopActive::Id); + } + case 8: { + LogStep(8, "Color Loop Set Command - Start Color Loop"); + chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type value; + value.updateFlags = static_cast>(1); + value.action = static_cast(1); + value.direction = static_cast(0); + value.time = 0U; + value.startHue = 0U; + value.optionsMask = 0; + value.optionsOverride = 0; + return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::ColorLoopSet::Id, value); + } + case 9: { + LogStep(9, "Check ColorLoopActive Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ColorLoopActive::Id); + } + case 10: { + LogStep(10, "Color Loop Set Command - Set direction and time while running"); + chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type value; + value.updateFlags = static_cast>(6); + value.action = static_cast(0); + value.direction = static_cast(0); + value.time = 3500U; + value.startHue = 0U; + value.optionsMask = 0; + value.optionsOverride = 0; + return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::ColorLoopSet::Id, value); + } + case 11: { + LogStep(11, "Check ColorLoopDirection Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, + ColorControl::Attributes::ColorLoopDirection::Id); + } + case 12: { + LogStep(12, "Check ColorLoopTime Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ColorLoopTime::Id); + } + case 13: { + LogStep(13, "Color Loop Set Command - Set direction while running"); + chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type value; + value.updateFlags = static_cast>(2); + value.action = static_cast(0); + value.direction = static_cast(1); + value.time = 0U; + value.startHue = 0U; + value.optionsMask = 0; + value.optionsOverride = 0; + return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::ColorLoopSet::Id, value); + } + case 14: { + LogStep(14, "Check ColorLoopDirection Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, + ColorControl::Attributes::ColorLoopDirection::Id); + } + case 15: { + LogStep(15, "Turn off light that we turned on"); + chip::app::Clusters::OnOff::Commands::Off::Type value; + return SendCommand(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Commands::Off::Id, value); + } + case 16: { + LogStep(16, "Check on/off attribute value is false after off command"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnOff::Id); + } + } + return CHIP_NO_ERROR; } +}; - static void OnFailureCallback_119(void * context, CHIP_ERROR error) +class Test_TC_CC_9_1Suite : public TestCommand +{ +public: + Test_TC_CC_9_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_CC_9_1", 54, credsIssuerConfig) { - (static_cast(context))->OnFailureResponse_119(error); + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - static void OnSuccessCallback_119(void * context) { (static_cast(context))->OnSuccessResponse_119(); } - - static void OnFailureCallback_120(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_120(error); - } + ~Test_TC_CC_9_1Suite() {} - static void OnSuccessCallback_120(void * context, uint8_t colorPointRIntensity) + chip::System::Clock::Timeout GetWaitDuration() const override { - (static_cast(context))->OnSuccessResponse_120(colorPointRIntensity); + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } - static void OnFailureCallback_121(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_121(error); - } +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; - static void OnSuccessCallback_121(void * context, uint16_t colorPointGX) - { - (static_cast(context))->OnSuccessResponse_121(colorPointGX); - } + uint16_t EnhancedCurrentHueValue1; + uint16_t ColorLoopStoredEnhancedHueValue1; + uint16_t EnhancedCurrentHueValue2; + uint16_t ColorLoopStoredEnhancedHueValue2; + uint16_t EnhancedCurrentHueValue3; + uint16_t ColorLoopStoredEnhancedHueValue3; + uint16_t EnhancedCurrentHueValue4; + uint16_t ColorLoopStoredEnhancedHue4; - static void OnFailureCallback_122(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_122(error); - } + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } - static void OnSuccessCallback_122(void * context) { (static_cast(context))->OnSuccessResponse_122(); } + // + // Tests methods + // - static void OnFailureCallback_123(void * context, CHIP_ERROR error) + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { - (static_cast(context))->OnFailureResponse_123(error); - } + bool shouldContinue = false; - static void OnSuccessCallback_123(void * context, uint16_t colorPointGX) - { - (static_cast(context))->OnSuccessResponse_123(colorPointGX); - } - - static void OnFailureCallback_124(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_124(error); - } - - static void OnSuccessCallback_124(void * context, uint16_t colorPointGY) - { - (static_cast(context))->OnSuccessResponse_124(colorPointGY); - } - - static void OnFailureCallback_125(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_125(error); - } - - static void OnSuccessCallback_125(void * context) { (static_cast(context))->OnSuccessResponse_125(); } - - static void OnFailureCallback_126(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_126(error); - } - - static void OnSuccessCallback_126(void * context, uint16_t colorPointGY) - { - (static_cast(context))->OnSuccessResponse_126(colorPointGY); - } - - static void OnFailureCallback_127(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_127(error); - } - - static void OnSuccessCallback_127(void * context, uint8_t colorPointGIntensity) - { - (static_cast(context))->OnSuccessResponse_127(colorPointGIntensity); - } - - static void OnFailureCallback_128(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_128(error); - } - - static void OnSuccessCallback_128(void * context) { (static_cast(context))->OnSuccessResponse_128(); } - - static void OnFailureCallback_129(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_129(error); - } - - static void OnSuccessCallback_129(void * context, uint8_t colorPointGIntensity) - { - (static_cast(context))->OnSuccessResponse_129(colorPointGIntensity); - } - - static void OnFailureCallback_130(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_130(error); - } - - static void OnSuccessCallback_130(void * context, uint16_t colorPointBX) - { - (static_cast(context))->OnSuccessResponse_130(colorPointBX); - } - - static void OnFailureCallback_131(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_131(error); - } - - static void OnSuccessCallback_131(void * context) { (static_cast(context))->OnSuccessResponse_131(); } - - static void OnFailureCallback_132(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_132(error); - } - - static void OnSuccessCallback_132(void * context, uint16_t colorPointBX) - { - (static_cast(context))->OnSuccessResponse_132(colorPointBX); - } - - static void OnFailureCallback_133(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_133(error); - } - - static void OnSuccessCallback_133(void * context, uint16_t colorPointBY) - { - (static_cast(context))->OnSuccessResponse_133(colorPointBY); - } - - static void OnFailureCallback_134(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_134(error); - } - - static void OnSuccessCallback_134(void * context) { (static_cast(context))->OnSuccessResponse_134(); } - - static void OnFailureCallback_135(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_135(error); - } - - static void OnSuccessCallback_135(void * context, uint16_t colorPointBY) - { - (static_cast(context))->OnSuccessResponse_135(colorPointBY); + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + bool value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("onOff", value, 1)); + } + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("colorLoopActive", value, 0)); + } + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("colorLoopDirection", value, 0)); + } + break; + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 8: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("colorLoopTime", value, 30U)); + } + break; + case 9: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 10: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("colorLoopStartEnhancedHue", value, 160U)); + } + break; + case 11: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 12: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("colorLoopActive", value, 1)); + } + break; + case 13: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + EnhancedCurrentHueValue1 = value; + } + break; + case 14: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("colorLoopStoredEnhancedHue", value, EnhancedCurrentHueValue1)); + } + break; + case 15: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 16: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("colorLoopActive", value, 0)); + } + break; + case 17: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + ColorLoopStoredEnhancedHueValue1 = value; + } + break; + case 18: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("enhancedCurrentHue", value, ColorLoopStoredEnhancedHueValue1)); + } + break; + case 19: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 20: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("colorLoopDirection", value, 1)); + } + break; + case 21: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 22: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("colorLoopActive", value, 1)); + } + break; + case 23: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + EnhancedCurrentHueValue2 = value; + } + break; + case 24: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("colorLoopStoredEnhancedHue", value, EnhancedCurrentHueValue2)); + } + break; + case 25: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 26: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("colorLoopActive", value, 0)); + } + break; + case 27: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + ColorLoopStoredEnhancedHueValue2 = value; + } + break; + case 28: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("enhancedCurrentHue", value, ColorLoopStoredEnhancedHueValue2)); + } + break; + case 29: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 30: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 31: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("enhancedCurrentHue", value, 40960U)); + } + break; + case 32: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 33: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("colorLoopDirection", value, 0)); + } + break; + case 34: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 35: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("colorLoopActive", value, 1)); + } + break; + case 36: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + EnhancedCurrentHueValue3 = value; + } + break; + case 37: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("colorLoopStoredEnhancedHue", value, EnhancedCurrentHueValue3)); + } + break; + case 38: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 39: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("colorLoopActive", value, 0)); + } + break; + case 40: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + ColorLoopStoredEnhancedHueValue3 = value; + } + break; + case 41: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("enhancedCurrentHue", value, ColorLoopStoredEnhancedHueValue3)); + } + break; + case 42: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 43: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("colorLoopDirection", value, 1)); + } + break; + case 44: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 45: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("colorLoopActive", value, 1)); + } + break; + case 46: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + EnhancedCurrentHueValue4 = value; + } + break; + case 47: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("colorLoopStoredEnhancedHue", value, EnhancedCurrentHueValue4)); + } + break; + case 48: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 49: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("colorLoopActive", value, 0)); + } + break; + case 50: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + ColorLoopStoredEnhancedHue4 = value; + } + break; + case 51: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("enhancedCurrentHue", value, ColorLoopStoredEnhancedHue4)); + } + break; + case 52: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 53: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + bool value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("onOff", value, 0)); + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } + + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } + } + + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "Precondition : Turn on light for color control tests"); + chip::app::Clusters::OnOff::Commands::On::Type value; + return SendCommand(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Commands::On::Id, value); + } + case 2: { + LogStep(2, "Check on/off attribute value is true after on command"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnOff::Id); + } + case 3: { + LogStep(3, "Sends ColorLoopSet Command - Set all Attributes"); + VerifyOrdo(!ShouldSkip("CR_COLORLOOPSET"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type value; + value.updateFlags = static_cast>(1); + value.action = static_cast(0); + value.direction = static_cast(0); + value.time = 0U; + value.startHue = 0U; + value.optionsMask = 0; + value.optionsOverride = 0; + return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::ColorLoopSet::Id, value); + } + case 4: { + LogStep(4, "Read ColorLoopActive attribute from DUT"); + VerifyOrdo(!ShouldSkip("A_COLORLOOPACTIVE"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ColorLoopActive::Id); + } + case 5: { + LogStep(5, "Sends ColorLoopSet Command - Set all Attributes"); + VerifyOrdo(!ShouldSkip("CR_COLORLOOPSET"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type value; + value.updateFlags = static_cast>(2); + value.action = static_cast(0); + value.direction = static_cast(0); + value.time = 0U; + value.startHue = 0U; + value.optionsMask = 0; + value.optionsOverride = 0; + return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::ColorLoopSet::Id, value); + } + case 6: { + LogStep(6, "Read ColorLoopDirection attribute from DUT"); + VerifyOrdo(!ShouldSkip("A_COLORLOOPDIRECTION"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, + ColorControl::Attributes::ColorLoopDirection::Id); + } + case 7: { + LogStep(7, "Sends ColorLoopSet Command - Set all Attributes"); + VerifyOrdo(!ShouldSkip("CR_COLORLOOPSET"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type value; + value.updateFlags = static_cast>(4); + value.action = static_cast(0); + value.direction = static_cast(0); + value.time = 30U; + value.startHue = 0U; + value.optionsMask = 0; + value.optionsOverride = 0; + return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::ColorLoopSet::Id, value); + } + case 8: { + LogStep(8, "Read ColorLoopTime attribute from DUT"); + VerifyOrdo(!ShouldSkip("A_COLORLOOPTIME"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ColorLoopTime::Id); + } + case 9: { + LogStep(9, "Sends ColorLoopSet Command - Set all Attributes"); + VerifyOrdo(!ShouldSkip("CR_COLORLOOPSET"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type value; + value.updateFlags = static_cast>(8); + value.action = static_cast(0); + value.direction = static_cast(0); + value.time = 0U; + value.startHue = 160U; + value.optionsMask = 0; + value.optionsOverride = 0; + return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::ColorLoopSet::Id, value); + } + case 10: { + LogStep(10, "Read ColorLoopStartEnhancedHue attribute from DUT"); + VerifyOrdo(!ShouldSkip("A_COLORLOOPSTARTENHANCEDHUE"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, + ColorControl::Attributes::ColorLoopStartEnhancedHue::Id); + } + case 11: { + LogStep(11, "Sends ColorLoopSet Command - Set all Attributes"); + VerifyOrdo(!ShouldSkip("CR_COLORLOOPSET"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type value; + value.updateFlags = static_cast>(1); + value.action = static_cast(1); + value.direction = static_cast(0); + value.time = 0U; + value.startHue = 0U; + value.optionsMask = 0; + value.optionsOverride = 0; + return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::ColorLoopSet::Id, value); + } + case 12: { + LogStep(12, "Read ColorLoopActive attribute from DUT"); + VerifyOrdo(!ShouldSkip("A_COLORLOOPACTIVE"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ColorLoopActive::Id); + } + case 13: { + LogStep(13, "Read EnhancedCurrentHue attribute from DUT"); + VerifyOrdo(!ShouldSkip("A_ENHANCEDCURRENTHUE"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, + ColorControl::Attributes::EnhancedCurrentHue::Id); + } + case 14: { + LogStep(14, "Read ColorLoopStoredEnhancedHue attribute from DUT."); + VerifyOrdo(!ShouldSkip("A_COLORLOOPSTOREDENHANCEDHUE"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, + ColorControl::Attributes::ColorLoopStoredEnhancedHue::Id); + } + case 15: { + LogStep(15, "Sends ColorLoopSet Command - Set all Attributes"); + VerifyOrdo(!ShouldSkip("CR_COLORLOOPSET"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type value; + value.updateFlags = static_cast>(1); + value.action = static_cast(0); + value.direction = static_cast(0); + value.time = 0U; + value.startHue = 0U; + value.optionsMask = 0; + value.optionsOverride = 0; + return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::ColorLoopSet::Id, value); + } + case 16: { + LogStep(16, "Read ColorLoopActive attribute from DUT"); + VerifyOrdo(!ShouldSkip("A_COLORLOOPACTIVE"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ColorLoopActive::Id); + } + case 17: { + LogStep(17, "Read ColorLoopStoredEnhancedHue attribute from DUT."); + VerifyOrdo(!ShouldSkip("A_COLORLOOPSTOREDENHANCEDHUE"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, + ColorControl::Attributes::ColorLoopStoredEnhancedHue::Id); + } + case 18: { + LogStep(18, "Read EnhancedCurrentHue attribute from DUT"); + VerifyOrdo(!ShouldSkip("A_ENHANCEDCURRENTHUE"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, + ColorControl::Attributes::EnhancedCurrentHue::Id); + } + case 19: { + LogStep(19, "Sends ColorLoopSet Command - Set all Attributes"); + VerifyOrdo(!ShouldSkip("CR_COLORLOOPSET"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type value; + value.updateFlags = static_cast>(2); + value.action = static_cast(0); + value.direction = static_cast(1); + value.time = 0U; + value.startHue = 0U; + value.optionsMask = 0; + value.optionsOverride = 0; + return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::ColorLoopSet::Id, value); + } + case 20: { + LogStep(20, "Read ColorLoopDirection attribute from DUT"); + VerifyOrdo(!ShouldSkip("A_COLORLOOPDIRECTION"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, + ColorControl::Attributes::ColorLoopDirection::Id); + } + case 21: { + LogStep(21, "Sends ColorLoopSet Command - Set all Attributes"); + VerifyOrdo(!ShouldSkip("CR_COLORLOOPSET"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type value; + value.updateFlags = static_cast>(1); + value.action = static_cast(1); + value.direction = static_cast(0); + value.time = 0U; + value.startHue = 0U; + value.optionsMask = 0; + value.optionsOverride = 0; + return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::ColorLoopSet::Id, value); + } + case 22: { + LogStep(22, "Read ColorLoopActive attribute from DUT"); + VerifyOrdo(!ShouldSkip("A_COLORLOOPACTIVE"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ColorLoopActive::Id); + } + case 23: { + LogStep(23, "Read EnhancedCurrentHue attribute from DUT"); + VerifyOrdo(!ShouldSkip("A_ENHANCEDCURRENTHUE"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, + ColorControl::Attributes::EnhancedCurrentHue::Id); + } + case 24: { + LogStep(24, "Read ColorLoopStoredEnhancedHue attribute from DUT"); + VerifyOrdo(!ShouldSkip("A_COLORLOOPSTOREDENHANCEDHUE"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, + ColorControl::Attributes::ColorLoopStoredEnhancedHue::Id); + } + case 25: { + LogStep(25, "Sends ColorLoopSet Command - Set all Attributes"); + VerifyOrdo(!ShouldSkip("CR_COLORLOOPSET"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type value; + value.updateFlags = static_cast>(1); + value.action = static_cast(0); + value.direction = static_cast(0); + value.time = 0U; + value.startHue = 0U; + value.optionsMask = 0; + value.optionsOverride = 0; + return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::ColorLoopSet::Id, value); + } + case 26: { + LogStep(26, "Read ColorLoopActive attribute from DUT"); + VerifyOrdo(!ShouldSkip("A_COLORLOOPACTIVE"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ColorLoopActive::Id); + } + case 27: { + LogStep(27, "Read ColorLoopStoredEnhancedHue attribute from DUT."); + VerifyOrdo(!ShouldSkip("A_COLORLOOPSTOREDENHANCEDHUE"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, + ColorControl::Attributes::ColorLoopStoredEnhancedHue::Id); + } + case 28: { + LogStep(28, "Read EnhancedCurrentHue attribute from DUT"); + VerifyOrdo(!ShouldSkip("A_ENHANCEDCURRENTHUE"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, + ColorControl::Attributes::EnhancedCurrentHue::Id); + } + case 29: { + LogStep(29, "Enhanced Move To Hue command"); + VerifyOrdo(!ShouldSkip("CR_ENHANCEDMOVETOHUE"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + chip::app::Clusters::ColorControl::Commands::EnhancedMoveToHue::Type value; + value.enhancedHue = 40960U; + value.direction = static_cast(0); + value.transitionTime = 0U; + value.optionsMask = 0; + value.optionsOverride = 0; + return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::EnhancedMoveToHue::Id, + value); + } + case 30: { + LogStep(30, "Wait 2000ms"); + SetIdentity(kIdentityAlpha); + return WaitForMs(2000); + } + case 31: { + LogStep(31, "Read EnhancedCurrentHue attribute from DUT"); + VerifyOrdo(!ShouldSkip("A_ENHANCEDCURRENTHUE"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, + ColorControl::Attributes::EnhancedCurrentHue::Id); + } + case 32: { + LogStep(32, "Sends ColorLoopSet Command - Set all Attributes"); + VerifyOrdo(!ShouldSkip("CR_COLORLOOPSET"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type value; + value.updateFlags = static_cast>(2); + value.action = static_cast(0); + value.direction = static_cast(0); + value.time = 0U; + value.startHue = 0U; + value.optionsMask = 0; + value.optionsOverride = 0; + return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::ColorLoopSet::Id, value); + } + case 33: { + LogStep(33, "Read ColorLoopDirection attribute from DUT"); + VerifyOrdo(!ShouldSkip("A_COLORLOOPDIRECTION"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, + ColorControl::Attributes::ColorLoopDirection::Id); + } + case 34: { + LogStep(34, "Sends ColorLoopSet Command - Set all Attributes"); + VerifyOrdo(!ShouldSkip("CR_COLORLOOPSET"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type value; + value.updateFlags = static_cast>(1); + value.action = static_cast(2); + value.direction = static_cast(0); + value.time = 0U; + value.startHue = 0U; + value.optionsMask = 0; + value.optionsOverride = 0; + return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::ColorLoopSet::Id, value); + } + case 35: { + LogStep(35, "Read ColorLoopActive attribute from DUT"); + VerifyOrdo(!ShouldSkip("A_COLORLOOPACTIVE"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ColorLoopActive::Id); + } + case 36: { + LogStep(36, "Read EnhancedCurrentHue attribute from DUT"); + VerifyOrdo(!ShouldSkip("A_ENHANCEDCURRENTHUE"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, + ColorControl::Attributes::EnhancedCurrentHue::Id); + } + case 37: { + LogStep(37, "Read ColorLoopStoredEnhancedHue attribute from DUT"); + VerifyOrdo(!ShouldSkip("A_COLORLOOPSTOREDENHANCEDHUE"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, + ColorControl::Attributes::ColorLoopStoredEnhancedHue::Id); + } + case 38: { + LogStep(38, "Sends ColorLoopSet Command - Set all Attributes"); + VerifyOrdo(!ShouldSkip("CR_COLORLOOPSET"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type value; + value.updateFlags = static_cast>(1); + value.action = static_cast(0); + value.direction = static_cast(0); + value.time = 0U; + value.startHue = 0U; + value.optionsMask = 0; + value.optionsOverride = 0; + return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::ColorLoopSet::Id, value); + } + case 39: { + LogStep(39, "Read ColorLoopActive attribute from DUT"); + VerifyOrdo(!ShouldSkip("A_COLORLOOPACTIVE"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ColorLoopActive::Id); + } + case 40: { + LogStep(40, "Read ColorLoopStoredEnhancedHue attribute from DUT."); + VerifyOrdo(!ShouldSkip("A_COLORLOOPSTOREDENHANCEDHUE"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, + ColorControl::Attributes::ColorLoopStoredEnhancedHue::Id); + } + case 41: { + LogStep(41, "Read EnhancedCurrentHue attribute from DUT"); + VerifyOrdo(!ShouldSkip("A_ENHANCEDCURRENTHUE"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, + ColorControl::Attributes::EnhancedCurrentHue::Id); + } + case 42: { + LogStep(42, "Sends ColorLoopSet Command - Set all Attributes"); + VerifyOrdo(!ShouldSkip("CR_COLORLOOPSET"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type value; + value.updateFlags = static_cast>(2); + value.action = static_cast(0); + value.direction = static_cast(1); + value.time = 0U; + value.startHue = 0U; + value.optionsMask = 0; + value.optionsOverride = 0; + return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::ColorLoopSet::Id, value); + } + case 43: { + LogStep(43, "Read ColorLoopDirection attribute from DUT"); + VerifyOrdo(!ShouldSkip("A_COLORLOOPDIRECTION"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, + ColorControl::Attributes::ColorLoopDirection::Id); + } + case 44: { + LogStep(44, "Sends ColorLoopSet Command - Set all Attributes"); + VerifyOrdo(!ShouldSkip("CR_COLORLOOPSET"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type value; + value.updateFlags = static_cast>(1); + value.action = static_cast(2); + value.direction = static_cast(0); + value.time = 0U; + value.startHue = 0U; + value.optionsMask = 0; + value.optionsOverride = 0; + return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::ColorLoopSet::Id, value); + } + case 45: { + LogStep(45, "Read ColorLoopActive attribute from DUT"); + VerifyOrdo(!ShouldSkip("A_COLORLOOPACTIVE"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ColorLoopActive::Id); + } + case 46: { + LogStep(46, "Read EnhancedCurrentHue attribute from DUT"); + VerifyOrdo(!ShouldSkip("A_ENHANCEDCURRENTHUE"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, + ColorControl::Attributes::EnhancedCurrentHue::Id); + } + case 47: { + LogStep(47, "Read ColorLoopStoredEnhancedHue attribute from DUT"); + VerifyOrdo(!ShouldSkip("A_COLORLOOPSTOREDENHANCEDHUE"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, + ColorControl::Attributes::ColorLoopStoredEnhancedHue::Id); + } + case 48: { + LogStep(48, "Sends ColorLoopSet Command - Set all Attributes"); + VerifyOrdo(!ShouldSkip("CR_COLORLOOPSET"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type value; + value.updateFlags = static_cast>(1); + value.action = static_cast(0); + value.direction = static_cast(0); + value.time = 0U; + value.startHue = 0U; + value.optionsMask = 0; + value.optionsOverride = 0; + return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::ColorLoopSet::Id, value); + } + case 49: { + LogStep(49, "Read ColorLoopActive attribute from DUT"); + VerifyOrdo(!ShouldSkip("A_COLORLOOPACTIVE"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ColorLoopActive::Id); + } + case 50: { + LogStep(50, "Read ColorLoopStoredEnhancedHue attribute from DUT."); + VerifyOrdo(!ShouldSkip("A_COLORLOOPSTOREDENHANCEDHUE"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, + ColorControl::Attributes::ColorLoopStoredEnhancedHue::Id); + } + case 51: { + LogStep(51, "Read EnhancedCurrentHue attribute from DUT"); + VerifyOrdo(!ShouldSkip("A_ENHANCEDCURRENTHUE"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, + ColorControl::Attributes::EnhancedCurrentHue::Id); + } + case 52: { + LogStep(52, "Turn Off light for color control tests"); + chip::app::Clusters::OnOff::Commands::Off::Type value; + return SendCommand(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Commands::Off::Id, value); + } + case 53: { + LogStep(53, "Check on/off attribute value is false after off command"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnOff::Id); + } + } + return CHIP_NO_ERROR; } +}; - static void OnFailureCallback_136(void * context, CHIP_ERROR error) +class Test_TC_CC_9_2Suite : public TestCommand +{ +public: + Test_TC_CC_9_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_CC_9_2", 20, credsIssuerConfig) { - (static_cast(context))->OnFailureResponse_136(error); + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - static void OnSuccessCallback_136(void * context, uint8_t colorPointBIntensity) - { - (static_cast(context))->OnSuccessResponse_136(colorPointBIntensity); - } + ~Test_TC_CC_9_2Suite() {} - static void OnFailureCallback_137(void * context, CHIP_ERROR error) + chip::System::Clock::Timeout GetWaitDuration() const override { - (static_cast(context))->OnFailureResponse_137(error); + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } - static void OnSuccessCallback_137(void * context) { (static_cast(context))->OnSuccessResponse_137(); } +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; - static void OnFailureCallback_138(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_138(error); - } + uint16_t EnhancedCurrentHueValue; + uint16_t ColorLoopStoredEnhancedHueValue; - static void OnSuccessCallback_138(void * context, uint8_t colorPointBIntensity) - { - (static_cast(context))->OnSuccessResponse_138(colorPointBIntensity); - } + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } // // Tests methods // - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } + bool shouldContinue = false; - CHIP_ERROR TestValidateConstraintsOfAttributeCurrentHue_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + bool value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("onOff", value, 1)); + } + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("colorLoopActive", value, 0)); + } + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("colorLoopDirection", value, 0)); + } + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("colorLoopTime", value, 30U)); + } + break; + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("colorLoopStartEnhancedHue", value, 160U)); + } + break; + case 8: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + EnhancedCurrentHueValue = value; + } + break; + case 9: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 10: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("colorLoopActive", value, 1)); + } + break; + case 11: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("colorLoopStoredEnhancedHue", value, EnhancedCurrentHueValue)); + } + break; + case 12: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 13: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("colorLoopDirection", value, 1)); + } + break; + case 14: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 15: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("colorLoopActive", value, 0)); + } + break; + case 16: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + ColorLoopStoredEnhancedHueValue = value; + } + break; + case 17: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("enhancedCurrentHue", value, ColorLoopStoredEnhancedHueValue)); + } + break; + case 18: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 19: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + bool value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("onOff", value, 0)); + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_1, OnFailureCallback_1, true)); + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } + } + + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "Precondition: Turn on light for color control tests"); + chip::app::Clusters::OnOff::Commands::On::Type value; + return SendCommand(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Commands::On::Id, value); + } + case 2: { + LogStep(2, "Precondition: Check on/off attribute value is true after on command"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnOff::Id); + } + case 3: { + LogStep(3, "Sends ColorLoopSet Command - Set all Attributes"); + VerifyOrdo(!ShouldSkip("CR_COLORLOOPSET"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type value; + value.updateFlags = static_cast>(15); + value.action = static_cast(0); + value.direction = static_cast(0); + value.time = 30U; + value.startHue = 160U; + value.optionsMask = 0; + value.optionsOverride = 0; + return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::ColorLoopSet::Id, value); + } + case 4: { + LogStep(4, "Read ColorLoopActive attribute from DUT"); + VerifyOrdo(!ShouldSkip("A_COLORLOOPACTIVE"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ColorLoopActive::Id); + } + case 5: { + LogStep(5, "Read ColorLoopDirection attribute from DUT."); + VerifyOrdo(!ShouldSkip("A_COLORLOOPDIRECTION"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, + ColorControl::Attributes::ColorLoopDirection::Id); + } + case 6: { + LogStep(6, "Read ColorLoopTime attribute from DUT."); + VerifyOrdo(!ShouldSkip("A_COLORLOOPTIME"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ColorLoopTime::Id); + } + case 7: { + LogStep(7, "Read ColorLoopStartEnhancedHue attribute from DUT."); + VerifyOrdo(!ShouldSkip("A_COLORLOOPSTARTENHANCEDHUE"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, + ColorControl::Attributes::ColorLoopStartEnhancedHue::Id); + } + case 8: { + LogStep(8, "Read EnhancedCurrentHue attribute from DUT."); + VerifyOrdo(!ShouldSkip("A_ENHANCEDCURRENTHUE"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, + ColorControl::Attributes::EnhancedCurrentHue::Id); + } + case 9: { + LogStep(9, "Color Loop Set Command - Set all Attributes"); + VerifyOrdo(!ShouldSkip("CR_COLORLOOPSET"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type value; + value.updateFlags = static_cast>(1); + value.action = static_cast(1); + value.direction = static_cast(0); + value.time = 0U; + value.startHue = 0U; + value.optionsMask = 0; + value.optionsOverride = 0; + return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::ColorLoopSet::Id, value); + } + case 10: { + LogStep(10, "Read ColorLoopActive attribute from DUT."); + VerifyOrdo(!ShouldSkip("A_COLORLOOPACTIVE"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ColorLoopActive::Id); + } + case 11: { + LogStep(11, "Read ColorLoopStoredEnhancedHue attribute from DUT."); + VerifyOrdo(!ShouldSkip("A_COLORLOOPSTOREDENHANCEDHUE"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, + ColorControl::Attributes::ColorLoopStoredEnhancedHue::Id); + } + case 12: { + LogStep(12, "Color Loop Set Command - Start Color Loop"); + VerifyOrdo(!ShouldSkip("CR_COLORLOOPSET"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type value; + value.updateFlags = static_cast>(2); + value.action = static_cast(0); + value.direction = static_cast(1); + value.time = 0U; + value.startHue = 0U; + value.optionsMask = 0; + value.optionsOverride = 0; + return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::ColorLoopSet::Id, value); + } + case 13: { + LogStep(13, "Read ColorLoopDirection attribute from DUT."); + VerifyOrdo(!ShouldSkip("A_COLORLOOPDIRECTION"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, + ColorControl::Attributes::ColorLoopDirection::Id); + } + case 14: { + LogStep(14, "Color Loop Set Command - Start Color Loop"); + VerifyOrdo(!ShouldSkip("CR_COLORLOOPSET"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type value; + value.updateFlags = static_cast>(1); + value.action = static_cast(0); + value.direction = static_cast(0); + value.time = 0U; + value.startHue = 0U; + value.optionsMask = 0; + value.optionsOverride = 0; + return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::ColorLoopSet::Id, value); + } + case 15: { + LogStep(15, "Read ColorLoopActive attribute from DUT"); + VerifyOrdo(!ShouldSkip("A_COLORLOOPACTIVE"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ColorLoopActive::Id); + } + case 16: { + LogStep(16, "Read ColorLoopStoredEnhancedHue attribute from DUT."); + VerifyOrdo(!ShouldSkip("A_COLORLOOPSTOREDENHANCEDHUE"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, + ColorControl::Attributes::ColorLoopStoredEnhancedHue::Id); + } + case 17: { + LogStep(17, "Read EnhancedCurrentHue attribute from DUT."); + VerifyOrdo(!ShouldSkip("A_ENHANCEDCURRENTHUE"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, + ColorControl::Attributes::EnhancedCurrentHue::Id); + } + case 18: { + LogStep(18, "Turn off light for color control tests"); + chip::app::Clusters::OnOff::Commands::Off::Type value; + return SendCommand(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Commands::Off::Id, value); + } + case 19: { + LogStep(19, "Check on/off attribute value is false after off command"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnOff::Id); + } + } return CHIP_NO_ERROR; } +}; - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_1(uint8_t currentHue) +class Test_TC_CC_9_3Suite : public TestCommand +{ +public: + Test_TC_CC_9_3Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_CC_9_3", 20, credsIssuerConfig) { - VerifyOrReturn(CheckConstraintType("currentHue", "", "uint8")); - VerifyOrReturn(CheckConstraintMinValue("currentHue", currentHue, 0)); - VerifyOrReturn(CheckConstraintMaxValue("currentHue", currentHue, 254)); - NextTest(); + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - CHIP_ERROR TestWriteTheDefaultValueToMandatoryAttributeCurrentHue_2() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - uint8_t currentHueArgument; - currentHueArgument = 0; - - ReturnErrorOnFailure(cluster.WriteAttribute( - currentHueArgument, this, OnSuccessCallback_2, OnFailureCallback_2)); - return CHIP_NO_ERROR; - } + ~Test_TC_CC_9_3Suite() {} - void OnFailureResponse_2(CHIP_ERROR error) + chip::System::Clock::Timeout GetWaitDuration() const override { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - NextTest(); + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } - void OnSuccessResponse_2() { ThrowSuccessResponse(); } - - CHIP_ERROR TestReadsBackMandatoryAttributeCurrentHue_3() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_3, OnFailureCallback_3, true)); - return CHIP_NO_ERROR; - } + uint16_t EnhancedCurrentHueValue; + uint16_t ColorLoopStoredEnhancedHueValue; - void OnFailureResponse_3(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } - void OnSuccessResponse_3(uint8_t currentHue) - { - VerifyOrReturn(CheckConstraintType("currentHue", "", "uint8")); - VerifyOrReturn(CheckConstraintMinValue("currentHue", currentHue, 0)); - VerifyOrReturn(CheckConstraintMaxValue("currentHue", currentHue, 254)); - NextTest(); - } + // + // Tests methods + // - CHIP_ERROR TestValidateConstraintsOfAttributeCurrentSaturation_4() + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_4, OnFailureCallback_4, true)); - return CHIP_NO_ERROR; - } + bool shouldContinue = false; - void OnFailureResponse_4(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_4(uint8_t currentSaturation) - { - VerifyOrReturn(CheckConstraintType("currentSaturation", "", "uint8")); - VerifyOrReturn(CheckConstraintMinValue("currentSaturation", currentSaturation, 0)); - VerifyOrReturn(CheckConstraintMaxValue("currentSaturation", currentSaturation, 254)); - NextTest(); - } + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + bool value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("onOff", value, 1)); + } + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("colorLoopActive", value, 0)); + } + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("colorLoopDirection", value, 0)); + } + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("colorLoopTime", value, 30U)); + } + break; + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("colorLoopStartEnhancedHue", value, 160U)); + } + break; + case 8: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 9: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("colorLoopActive", value, 1)); + } + break; + case 10: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + EnhancedCurrentHueValue = value; + } + break; + case 11: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("colorLoopStoredEnhancedHue", value, EnhancedCurrentHueValue)); + } + break; + case 12: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 13: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("colorLoopTime", value, 60U)); + } + break; + case 14: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 15: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("colorLoopActive", value, 0)); + } + break; + case 16: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + ColorLoopStoredEnhancedHueValue = value; + } + break; + case 17: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("enhancedCurrentHue", value, ColorLoopStoredEnhancedHueValue)); + } + break; + case 18: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 19: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + bool value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("onOff", value, 0)); + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } - CHIP_ERROR TestWriteTheDefaultValueToMandatoryAttributeCurrentSaturation_5() + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } + } + + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - uint8_t currentSaturationArgument; - currentSaturationArgument = 0; - - ReturnErrorOnFailure(cluster.WriteAttribute( - currentSaturationArgument, this, OnSuccessCallback_5, OnFailureCallback_5)); + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "Precondition: Turn on light for color control tests"); + chip::app::Clusters::OnOff::Commands::On::Type value; + return SendCommand(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Commands::On::Id, value); + } + case 2: { + LogStep(2, "Precondition: Check on/off attribute value is true after on command"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnOff::Id); + } + case 3: { + LogStep(3, "Sends ColorLoopSet Command - Set all Attributes"); + VerifyOrdo(!ShouldSkip("CR_COLORLOOPSET"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type value; + value.updateFlags = static_cast>(15); + value.action = static_cast(0); + value.direction = static_cast(0); + value.time = 30U; + value.startHue = 160U; + value.optionsMask = 0; + value.optionsOverride = 0; + return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::ColorLoopSet::Id, value); + } + case 4: { + LogStep(4, "Read ColorLoopActive attribute from DUT"); + VerifyOrdo(!ShouldSkip("A_COLORLOOPACTIVE"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ColorLoopActive::Id); + } + case 5: { + LogStep(5, "Read ColorLoopDirection attribute from DUT."); + VerifyOrdo(!ShouldSkip("A_COLORLOOPDIRECTION"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, + ColorControl::Attributes::ColorLoopDirection::Id); + } + case 6: { + LogStep(6, "Read ColorLoopTime attribute from DUT."); + VerifyOrdo(!ShouldSkip("A_COLORLOOPTIME"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ColorLoopTime::Id); + } + case 7: { + LogStep(7, "Read ColorLoopStartEnhancedHue attribute from DUT."); + VerifyOrdo(!ShouldSkip("A_COLORLOOPSTARTENHANCEDHUE"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, + ColorControl::Attributes::ColorLoopStartEnhancedHue::Id); + } + case 8: { + LogStep(8, "Color Loop Set Command - Set all Attributes"); + VerifyOrdo(!ShouldSkip("CR_COLORLOOPSET"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type value; + value.updateFlags = static_cast>(1); + value.action = static_cast(1); + value.direction = static_cast(0); + value.time = 0U; + value.startHue = 0U; + value.optionsMask = 0; + value.optionsOverride = 0; + return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::ColorLoopSet::Id, value); + } + case 9: { + LogStep(9, "Read ColorLoopActive attribute from DUT."); + VerifyOrdo(!ShouldSkip("A_COLORLOOPACTIVE"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ColorLoopActive::Id); + } + case 10: { + LogStep(10, "Read EnhancedCurrentHue attribute from DUT."); + VerifyOrdo(!ShouldSkip("A_ENHANCEDCURRENTHUE"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, + ColorControl::Attributes::EnhancedCurrentHue::Id); + } + case 11: { + LogStep(11, "Read ColorLoopStoredEnhancedHue attribute from DUT."); + VerifyOrdo(!ShouldSkip("A_COLORLOOPSTOREDENHANCEDHUE"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, + ColorControl::Attributes::ColorLoopStoredEnhancedHue::Id); + } + case 12: { + LogStep(12, "Color Loop Set Command - Start Color Loop"); + VerifyOrdo(!ShouldSkip("CR_COLORLOOPSET"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type value; + value.updateFlags = static_cast>(4); + value.action = static_cast(0); + value.direction = static_cast(0); + value.time = 60U; + value.startHue = 0U; + value.optionsMask = 0; + value.optionsOverride = 0; + return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::ColorLoopSet::Id, value); + } + case 13: { + LogStep(13, "Read ColorLoopTime attribute from DUT."); + VerifyOrdo(!ShouldSkip("A_COLORLOOPTIME"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ColorLoopTime::Id); + } + case 14: { + LogStep(14, "Color Loop Set Command - Start Color Loop"); + VerifyOrdo(!ShouldSkip("CR_COLORLOOPSET"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type value; + value.updateFlags = static_cast>(1); + value.action = static_cast(0); + value.direction = static_cast(0); + value.time = 0U; + value.startHue = 0U; + value.optionsMask = 0; + value.optionsOverride = 0; + return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::ColorLoopSet::Id, value); + } + case 15: { + LogStep(15, "Read ColorLoopActive attribute from DUT"); + VerifyOrdo(!ShouldSkip("A_COLORLOOPACTIVE"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ColorLoopActive::Id); + } + case 16: { + LogStep(16, "Read ColorLoopStoredEnhancedHue attribute from DUT."); + VerifyOrdo(!ShouldSkip("A_COLORLOOPSTOREDENHANCEDHUE"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, + ColorControl::Attributes::ColorLoopStoredEnhancedHue::Id); + } + case 17: { + LogStep(17, "Read EnhancedCurrentHue attribute from DUT."); + VerifyOrdo(!ShouldSkip("A_ENHANCEDCURRENTHUE"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, + ColorControl::Attributes::EnhancedCurrentHue::Id); + } + case 18: { + LogStep(18, "Turn off light for color control tests"); + chip::app::Clusters::OnOff::Commands::Off::Type value; + return SendCommand(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Commands::Off::Id, value); + } + case 19: { + LogStep(19, "Check on/off attribute value is false after off command"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnOff::Id); + } + } return CHIP_NO_ERROR; } +}; - void OnFailureResponse_5(CHIP_ERROR error) +class Test_TC_DM_1_1Suite : public TestCommand +{ +public: + Test_TC_DM_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_DM_1_1", 20, credsIssuerConfig) { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - NextTest(); + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - void OnSuccessResponse_5() { ThrowSuccessResponse(); } + ~Test_TC_DM_1_1Suite() {} - CHIP_ERROR TestReadsBackMandatoryAttributeCurrentSaturation_6() + chip::System::Clock::Timeout GetWaitDuration() const override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_6, OnFailureCallback_6, true)); - return CHIP_NO_ERROR; + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } - void OnFailureResponse_6(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; - void OnSuccessResponse_6(uint8_t currentSaturation) - { - VerifyOrReturn(CheckConstraintType("currentSaturation", "", "uint8")); - VerifyOrReturn(CheckConstraintMinValue("currentSaturation", currentSaturation, 0)); - VerifyOrReturn(CheckConstraintMaxValue("currentSaturation", currentSaturation, 254)); - NextTest(); - } + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // - CHIP_ERROR TestValidateConstraintsOfAttributeCurrentX_7() + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); + bool shouldContinue = false; - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_7, OnFailureCallback_7, true)); - return CHIP_NO_ERROR; - } + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + } + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::CharSpan value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "string")); + VerifyOrReturn(CheckConstraintMaxLength("value", value.size(), 32)); + } + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::VendorId value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + } + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::CharSpan value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "string")); + VerifyOrReturn(CheckConstraintMaxLength("value", value.size(), 32)); + } + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + } + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::CharSpan value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "string")); + VerifyOrReturn(CheckConstraintMaxLength("value", value.size(), 32)); + } + break; + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::CharSpan value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "string")); + VerifyOrReturn(CheckConstraintFormat("value", "", "ISO 3166-1 alpha-2")); + VerifyOrReturn(CheckConstraintMaxLength("value", value.size(), 2)); + } + break; + case 8: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + } + break; + case 9: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::CharSpan value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "string")); + VerifyOrReturn(CheckConstraintMinLength("value", value.size(), 1)); + VerifyOrReturn(CheckConstraintMaxLength("value", value.size(), 64)); + } + break; + case 10: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint32")); + } + break; + case 11: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::CharSpan value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "string")); + VerifyOrReturn(CheckConstraintFormat("value", "", "ASCII")); + VerifyOrReturn(CheckConstraintMinLength("value", value.size(), 1)); + VerifyOrReturn(CheckConstraintMaxLength("value", value.size(), 64)); + } + break; + case 12: + if (IsUnsupported(status.mStatus)) + { + return; + } + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::CharSpan value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "string")); + VerifyOrReturn(CheckConstraintFormat("value", "", "ISO 8601")); + VerifyOrReturn(CheckConstraintMinLength("value", value.size(), 8)); + VerifyOrReturn(CheckConstraintMaxLength("value", value.size(), 16)); + } + break; + case 13: + if (IsUnsupported(status.mStatus)) + { + return; + } + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::CharSpan value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "string")); + VerifyOrReturn(CheckConstraintMaxLength("value", value.size(), 32)); + } + break; + case 14: + if (IsUnsupported(status.mStatus)) + { + return; + } + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::CharSpan value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "string")); + VerifyOrReturn(CheckConstraintFormat("value", "", "RFC3986")); + VerifyOrReturn(CheckConstraintMaxLength("value", value.size(), 256)); + } + break; + case 15: + if (IsUnsupported(status.mStatus)) + { + return; + } + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::CharSpan value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "string")); + VerifyOrReturn(CheckConstraintMaxLength("value", value.size(), 64)); + } + break; + case 16: + if (IsUnsupported(status.mStatus)) + { + return; + } + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::CharSpan value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "string")); + VerifyOrReturn(CheckConstraintMaxLength("value", value.size(), 32)); + } + break; + case 17: + if (IsUnsupported(status.mStatus)) + { + return; + } + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + bool value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "boolean")); + } + break; + case 18: + if (IsUnsupported(status.mStatus)) + { + return; + } + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + bool value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "boolean")); + } + break; + case 19: + if (IsUnsupported(status.mStatus)) + { + return; + } + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::CharSpan value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "string")); + VerifyOrReturn(CheckConstraintMaxLength("value", value.size(), 32)); + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } - void OnFailureResponse_7(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } } - void OnSuccessResponse_7(uint16_t currentX) + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - VerifyOrReturn(CheckConstraintType("currentX", "", "uint16")); - VerifyOrReturn(CheckConstraintMinValue("currentX", currentX, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("currentX", currentX, 65279U)); - NextTest(); + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "Query Data Model Revision"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), Basic::Id, Basic::Attributes::DataModelRevision::Id); + } + case 2: { + LogStep(2, "Query Vendor Name"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), Basic::Id, Basic::Attributes::VendorName::Id); + } + case 3: { + LogStep(3, "Query VendorID"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), Basic::Id, Basic::Attributes::VendorID::Id); + } + case 4: { + LogStep(4, "Query Product Name"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), Basic::Id, Basic::Attributes::ProductName::Id); + } + case 5: { + LogStep(5, "Query ProductID"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), Basic::Id, Basic::Attributes::ProductID::Id); + } + case 6: { + LogStep(6, "Query Node Label"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), Basic::Id, Basic::Attributes::NodeLabel::Id); + } + case 7: { + LogStep(7, "Query User Location"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), Basic::Id, Basic::Attributes::Location::Id); + } + case 8: { + LogStep(8, "Query HardwareVersion"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), Basic::Id, Basic::Attributes::HardwareVersion::Id); + } + case 9: { + LogStep(9, "Query HardwareVersionString"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), Basic::Id, Basic::Attributes::HardwareVersionString::Id); + } + case 10: { + LogStep(10, "Query SoftwareVersion"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), Basic::Id, Basic::Attributes::SoftwareVersion::Id); + } + case 11: { + LogStep(11, "Query SoftwareVersionString"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), Basic::Id, Basic::Attributes::SoftwareVersionString::Id); + } + case 12: { + LogStep(12, "Query ManufacturingDate"); + VerifyOrdo(!ShouldSkip("MANF_DATE"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), Basic::Id, Basic::Attributes::ManufacturingDate::Id); + } + case 13: { + LogStep(13, "Query PartNumber"); + VerifyOrdo(!ShouldSkip("PART_NUM"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), Basic::Id, Basic::Attributes::PartNumber::Id); + } + case 14: { + LogStep(14, "Query ProductURL"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), Basic::Id, Basic::Attributes::ProductURL::Id); + } + case 15: { + LogStep(15, "Query ProductLabel"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), Basic::Id, Basic::Attributes::ProductLabel::Id); + } + case 16: { + LogStep(16, "Query SerialNumber"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), Basic::Id, Basic::Attributes::SerialNumber::Id); + } + case 17: { + LogStep(17, "Query LocalConfigDisabled"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), Basic::Id, Basic::Attributes::LocalConfigDisabled::Id); + } + case 18: { + LogStep(18, "Query Reachable"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), Basic::Id, Basic::Attributes::Reachable::Id); + } + case 19: { + LogStep(19, "Query UniqueID"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), Basic::Id, Basic::Attributes::UniqueID::Id); + } + } + return CHIP_NO_ERROR; } +}; - CHIP_ERROR TestWriteTheDefaultValueToMandatoryAttributeCurrentX_8() +class Test_TC_DM_3_1Suite : public TestCommand +{ +public: + Test_TC_DM_3_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_DM_3_1", 3, credsIssuerConfig) { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - uint16_t currentXArgument; - currentXArgument = 24939U; - - ReturnErrorOnFailure(cluster.WriteAttribute( - currentXArgument, this, OnSuccessCallback_8, OnFailureCallback_8)); - return CHIP_NO_ERROR; + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - void OnFailureResponse_8(CHIP_ERROR error) + ~Test_TC_DM_3_1Suite() {} + + chip::System::Clock::Timeout GetWaitDuration() const override { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - NextTest(); + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } - void OnSuccessResponse_8() { ThrowSuccessResponse(); } +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; - CHIP_ERROR TestReadsBackMandatoryAttributeCurrentX_9() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_9, OnFailureCallback_9, true)); - return CHIP_NO_ERROR; - } + // + // Tests methods + // - void OnFailureResponse_9(CHIP_ERROR error) + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } + bool shouldContinue = false; - void OnSuccessResponse_9(uint16_t currentX) - { - VerifyOrReturn(CheckConstraintType("currentX", "", "uint16")); - VerifyOrReturn(CheckConstraintMinValue("currentX", currentX, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("currentX", currentX, 65279U)); - NextTest(); + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + if (IsUnsupported(status.mStatus)) + { + return; + } + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint8")); + } + break; + case 2: + if (IsUnsupported(status.mStatus)) + { + return; + } + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList + value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "list")); + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } + + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } } - CHIP_ERROR TestValidateConstraintsOfAttributeCurrentY_10() + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_10, OnFailureCallback_10, true)); + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "Query MaxNetworks"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), NetworkCommissioning::Id, + NetworkCommissioning::Attributes::MaxNetworks::Id); + } + case 2: { + LogStep(2, "Query Networks"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), NetworkCommissioning::Id, + NetworkCommissioning::Attributes::Networks::Id); + } + } return CHIP_NO_ERROR; } +}; - void OnFailureResponse_10(CHIP_ERROR error) +class Test_TC_DM_2_2Suite : public TestCommand +{ +public: + Test_TC_DM_2_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_DM_2_2", 5, credsIssuerConfig) { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - void OnSuccessResponse_10(uint16_t currentY) + ~Test_TC_DM_2_2Suite() {} + + chip::System::Clock::Timeout GetWaitDuration() const override { - VerifyOrReturn(CheckConstraintType("currentY", "", "uint16")); - VerifyOrReturn(CheckConstraintMinValue("currentY", currentY, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("currentY", currentY, 65279U)); - NextTest(); + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } - CHIP_ERROR TestWriteTheDefaultValuesToMandatoryAttributeCurrentY_11() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; - uint16_t currentYArgument; - currentYArgument = 24701U; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } - ReturnErrorOnFailure(cluster.WriteAttribute( - currentYArgument, this, OnSuccessCallback_11, OnFailureCallback_11)); - return CHIP_NO_ERROR; - } + // + // Tests methods + // - void OnFailureResponse_11(CHIP_ERROR error) + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - NextTest(); - } - - void OnSuccessResponse_11() { ThrowSuccessResponse(); } + bool shouldContinue = false; - CHIP_ERROR TestReadsBackMandatoryAttributeCurrentY_12() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList< + chip::app::Clusters::OperationalCredentials::Structs::FabricDescriptor::DecodableType> + value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + { + auto iter_0 = value.begin(); + VerifyOrReturn(CheckNextListItemDecodes("fabrics", iter_0, 0)); + VerifyOrReturn(CheckValueAsString("fabrics[0].label", iter_0.GetValue().label, chip::CharSpan("", 0))); + VerifyOrReturn(CheckNoMoreListItems("fabrics", iter_0, 1)); + } + VerifyOrReturn(CheckConstraintType("value", "", "list")); + } + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("supportedFabrics", value, 16)); + VerifyOrReturn(CheckConstraintType("value", "", "uint8")); + } + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("commissionedFabrics", value, 1)); + VerifyOrReturn(CheckConstraintType("value", "", "uint8")); + } + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "list")); + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_12, OnFailureCallback_12, true)); - return CHIP_NO_ERROR; + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } } - void OnFailureResponse_12(CHIP_ERROR error) + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "Query fabrics list"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), OperationalCredentials::Id, + OperationalCredentials::Attributes::Fabrics::Id); + } + case 2: { + LogStep(2, "Query Supported Fabrics"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), OperationalCredentials::Id, + OperationalCredentials::Attributes::SupportedFabrics::Id); + } + case 3: { + LogStep(3, "Query Commissioned Fabrics"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), OperationalCredentials::Id, + OperationalCredentials::Attributes::CommissionedFabrics::Id); + } + case 4: { + LogStep(4, "Query User Trusted Root Certificates"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), OperationalCredentials::Id, + OperationalCredentials::Attributes::TrustedRootCertificates::Id); + } + } + return CHIP_NO_ERROR; } +}; - void OnSuccessResponse_12(uint16_t currentY) +class Test_TC_EMR_1_1Suite : public TestCommand +{ +public: + Test_TC_EMR_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_EMR_1_1", 6, credsIssuerConfig) { - VerifyOrReturn(CheckConstraintType("currentY", "", "uint16")); - VerifyOrReturn(CheckConstraintMinValue("currentY", currentY, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("currentY", currentY, 65279U)); - NextTest(); + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - CHIP_ERROR TestValidateConstraintsOfAttributeColorTemperatureMireds_13() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_13, OnFailureCallback_13, true)); - return CHIP_NO_ERROR; - } + ~Test_TC_EMR_1_1Suite() {} - void OnFailureResponse_13(CHIP_ERROR error) + chip::System::Clock::Timeout GetWaitDuration() const override { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } - void OnSuccessResponse_13(uint16_t colorTemperature) - { - VerifyOrReturn(CheckConstraintType("colorTemperature", "", "uint16")); - VerifyOrReturn(CheckConstraintMinValue("colorTemperature", colorTemperature, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("colorTemperature", colorTemperature, 65279U)); - NextTest(); - } +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; - CHIP_ERROR TestValidateConstraintsOfAttributeColorMode_14() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_14, OnFailureCallback_14, true)); - return CHIP_NO_ERROR; - } + // + // Tests methods + // - void OnFailureResponse_14(CHIP_ERROR error) + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } + bool shouldContinue = false; - void OnSuccessResponse_14(uint8_t colorMode) - { - VerifyOrReturn(CheckConstraintType("colorMode", "", "enum8")); - VerifyOrReturn(CheckConstraintMinValue("colorMode", colorMode, 0)); - VerifyOrReturn(CheckConstraintMaxValue("colorMode", colorMode, 2)); - NextTest(); - } - - CHIP_ERROR TestValidateConstraintsOfAttributeOptions_15() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("clusterRevision", value, 3U)); + } + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + } + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("clusterRevision", value, 3U)); + } + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "list")); + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_15, OnFailureCallback_15, true)); - return CHIP_NO_ERROR; + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } } - void OnFailureResponse_15(CHIP_ERROR error) + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "read the global attribute: ClusterRevision"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ElectricalMeasurement::Id, + ElectricalMeasurement::Attributes::ClusterRevision::Id); + } + case 2: { + LogStep(2, "Read the global attribute constraints: ClusterRevision"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ElectricalMeasurement::Id, + ElectricalMeasurement::Attributes::ClusterRevision::Id); + } + case 3: { + LogStep(3, "write the default values to mandatory global attribute: ClusterRevision"); + uint16_t value; + value = 1U; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), ElectricalMeasurement::Id, + ElectricalMeasurement::Attributes::ClusterRevision::Id, value); + } + case 4: { + LogStep(4, "reads back global attribute: ClusterRevision"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ElectricalMeasurement::Id, + ElectricalMeasurement::Attributes::ClusterRevision::Id); + } + case 5: { + LogStep(5, "Read the global attribute: AttributeList"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ElectricalMeasurement::Id, + ElectricalMeasurement::Attributes::AttributeList::Id); + } + } + return CHIP_NO_ERROR; } +}; - void OnSuccessResponse_15(uint8_t colorControlOptions) +class Test_TC_ETHDIAG_1_1Suite : public TestCommand +{ +public: + Test_TC_ETHDIAG_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("Test_TC_ETHDIAG_1_1", 10, credsIssuerConfig) { - VerifyOrReturn(CheckConstraintType("colorControlOptions", "", "map8")); - NextTest(); + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - CHIP_ERROR TestWriteTheDefaultValuesToMandatoryAttributeOptions_16() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - uint8_t colorControlOptionsArgument; - colorControlOptionsArgument = 0; - - ReturnErrorOnFailure(cluster.WriteAttribute( - colorControlOptionsArgument, this, OnSuccessCallback_16, OnFailureCallback_16)); - return CHIP_NO_ERROR; - } + ~Test_TC_ETHDIAG_1_1Suite() {} - void OnFailureResponse_16(CHIP_ERROR error) + chip::System::Clock::Timeout GetWaitDuration() const override { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } - void OnSuccessResponse_16() { NextTest(); } +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; - CHIP_ERROR TestReadsBackMandatoryAttributeOptions_17() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_17, OnFailureCallback_17, true)); - return CHIP_NO_ERROR; - } + // + // Tests methods + // - void OnFailureResponse_17(CHIP_ERROR error) + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } + bool shouldContinue = false; - void OnSuccessResponse_17(uint8_t colorControlOptions) - { - VerifyOrReturn(CheckValue("colorControlOptions", colorControlOptions, 0)); + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 9)); + } + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "bool")); + } + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint64_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint64")); + } + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint64_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint64")); + } + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint64_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint64")); + } + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint64_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint64")); + } + break; + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint64_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint64")); + } + break; + case 8: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "bool")); + } + break; + case 9: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint64_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint64")); + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } - NextTest(); + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } } - CHIP_ERROR TestValidateConstraintsOfAttributeEnhancedCurrentHue_18() + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_18, OnFailureCallback_18, true)); + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "Read PHYRate attribute constraints"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), EthernetNetworkDiagnostics::Id, + EthernetNetworkDiagnostics::Attributes::PHYRate::Id); + } + case 2: { + LogStep(2, "Read FullDuplex attribute constraints"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), EthernetNetworkDiagnostics::Id, + EthernetNetworkDiagnostics::Attributes::FullDuplex::Id); + } + case 3: { + LogStep(3, "Read PacketRxCount attribute constraints"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), EthernetNetworkDiagnostics::Id, + EthernetNetworkDiagnostics::Attributes::PacketRxCount::Id); + } + case 4: { + LogStep(4, "Read PacketTxCount attribute constraints"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), EthernetNetworkDiagnostics::Id, + EthernetNetworkDiagnostics::Attributes::PacketTxCount::Id); + } + case 5: { + LogStep(5, "Read TxErrCount attribute constraints"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), EthernetNetworkDiagnostics::Id, + EthernetNetworkDiagnostics::Attributes::TxErrCount::Id); + } + case 6: { + LogStep(6, "Read CollisionCount attribute constraints"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), EthernetNetworkDiagnostics::Id, + EthernetNetworkDiagnostics::Attributes::CollisionCount::Id); + } + case 7: { + LogStep(7, "Read OverrunCount attribute constraints"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), EthernetNetworkDiagnostics::Id, + EthernetNetworkDiagnostics::Attributes::OverrunCount::Id); + } + case 8: { + LogStep(8, "Read CarrierDetect attribute constraints"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), EthernetNetworkDiagnostics::Id, + EthernetNetworkDiagnostics::Attributes::CarrierDetect::Id); + } + case 9: { + LogStep(9, "Read TimeSinceReset attribute constraints"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), EthernetNetworkDiagnostics::Id, + EthernetNetworkDiagnostics::Attributes::TimeSinceReset::Id); + } + } return CHIP_NO_ERROR; } +}; - void OnFailureResponse_18(CHIP_ERROR error) +class Test_TC_ETHDIAG_2_1Suite : public TestCommand +{ +public: + Test_TC_ETHDIAG_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("Test_TC_ETHDIAG_2_1", 1, credsIssuerConfig) { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - void OnSuccessResponse_18(uint16_t enhancedCurrentHue) + ~Test_TC_ETHDIAG_2_1Suite() {} + + chip::System::Clock::Timeout GetWaitDuration() const override { - VerifyOrReturn(CheckConstraintType("enhancedCurrentHue", "", "uint16")); - NextTest(); + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } - CHIP_ERROR TestWriteTheDefaultValuesToMandatoryAttributeEnhancedCurrentHue_19() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; - uint16_t enhancedCurrentHueArgument; - enhancedCurrentHueArgument = 0U; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } - ReturnErrorOnFailure(cluster.WriteAttribute( - enhancedCurrentHueArgument, this, OnSuccessCallback_19, OnFailureCallback_19)); - return CHIP_NO_ERROR; - } + // + // Tests methods + // - void OnFailureResponse_19(CHIP_ERROR error) + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - NextTest(); - } - - void OnSuccessResponse_19() { ThrowSuccessResponse(); } + bool shouldContinue = false; - CHIP_ERROR TestReadsBackMandatoryAttributeEnhancedCurrentHue_20() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_20, OnFailureCallback_20, true)); - return CHIP_NO_ERROR; + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } } - void OnFailureResponse_20(CHIP_ERROR error) + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + } + return CHIP_NO_ERROR; } +}; - void OnSuccessResponse_20(uint16_t enhancedCurrentHue) +class Test_TC_FLW_1_1Suite : public TestCommand +{ +public: + Test_TC_FLW_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_FLW_1_1", 4, credsIssuerConfig) { - VerifyOrReturn(CheckConstraintType("enhancedCurrentHue", "", "uint16")); - NextTest(); + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - CHIP_ERROR TestValidateConstraintsOfAttributeEnhancedColorMode_21() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_21, OnFailureCallback_21, true)); - return CHIP_NO_ERROR; - } + ~Test_TC_FLW_1_1Suite() {} - void OnFailureResponse_21(CHIP_ERROR error) + chip::System::Clock::Timeout GetWaitDuration() const override { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } - void OnSuccessResponse_21(uint8_t enhancedColorMode) - { - VerifyOrReturn(CheckConstraintType("enhancedColorMode", "", "enum8")); - NextTest(); - } +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; - CHIP_ERROR TestValidateConstraintsOfAttributeColorLoopActive_22() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_22, OnFailureCallback_22, true)); - return CHIP_NO_ERROR; - } + // + // Tests methods + // - void OnFailureResponse_22(CHIP_ERROR error) + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } + bool shouldContinue = false; - void OnSuccessResponse_22(uint8_t colorLoopActive) - { - VerifyOrReturn(CheckConstraintType("colorLoopActive", "", "uint8")); - NextTest(); + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + } + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "list")); + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } + + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } } - CHIP_ERROR TestWriteTheDefaultValuesToMandatoryAttributeColorLoopActive_23() + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - uint8_t colorLoopActiveArgument; - colorLoopActiveArgument = 0; - - ReturnErrorOnFailure(cluster.WriteAttribute( - colorLoopActiveArgument, this, OnSuccessCallback_23, OnFailureCallback_23)); + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "Read the global attribute constraints: ClusterRevision"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FlowMeasurement::Id, + FlowMeasurement::Attributes::ClusterRevision::Id); + } + case 2: { + LogStep(2, "write the default values to mandatory global attribute: ClusterRevision"); + uint16_t value; + value = 2U; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), FlowMeasurement::Id, + FlowMeasurement::Attributes::ClusterRevision::Id, value); + } + case 3: { + LogStep(3, "Read the global attribute: AttributeList"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FlowMeasurement::Id, + FlowMeasurement::Attributes::AttributeList::Id); + } + } return CHIP_NO_ERROR; } +}; - void OnFailureResponse_23(CHIP_ERROR error) +class Test_TC_FLW_2_1Suite : public TestCommand +{ +public: + Test_TC_FLW_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_FLW_2_1", 14, credsIssuerConfig) { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - NextTest(); + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - void OnSuccessResponse_23() { ThrowSuccessResponse(); } - - CHIP_ERROR TestReadsBackMandatoryAttributeColorLoopActive_24() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_24, OnFailureCallback_24, true)); - return CHIP_NO_ERROR; - } + ~Test_TC_FLW_2_1Suite() {} - void OnFailureResponse_24(CHIP_ERROR error) + chip::System::Clock::Timeout GetWaitDuration() const override { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } - void OnSuccessResponse_24(uint8_t colorLoopActive) - { - VerifyOrReturn(CheckConstraintType("colorLoopActive", "", "uint8")); - NextTest(); - } +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; - CHIP_ERROR TestValidateConstraintsOfAttributeColorLoopDirection_25() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_25, OnFailureCallback_25, true)); - return CHIP_NO_ERROR; - } + // + // Tests methods + // - void OnFailureResponse_25(CHIP_ERROR error) + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } + bool shouldContinue = false; - void OnSuccessResponse_25(uint8_t colorLoopDirection) - { - VerifyOrReturn(CheckConstraintType("colorLoopDirection", "", "uint8")); - NextTest(); + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + } + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + } + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + } + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); + break; + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + } + break; + case 8: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + } + break; + case 9: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + } + break; + case 10: + if (IsUnsupported(status.mStatus)) + { + return; + } + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("tolerance", value, 0U)); + } + break; + case 11: + if (IsUnsupported(status.mStatus)) + { + return; + } + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 2048U)); + } + break; + case 12: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); + break; + case 13: + if (IsUnsupported(status.mStatus)) + { + return; + } + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("tolerance", value, 0U)); + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } + + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } } - CHIP_ERROR TestWriteTheDefaultValuesToMandatoryAttributeColorLoopDirection_26() + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - uint8_t colorLoopDirectionArgument; - colorLoopDirectionArgument = 0; - - ReturnErrorOnFailure(cluster.WriteAttribute( - colorLoopDirectionArgument, this, OnSuccessCallback_26, OnFailureCallback_26)); + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "read the mandatory attribute: MeasuredValue"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FlowMeasurement::Id, + FlowMeasurement::Attributes::MeasuredValue::Id); + } + case 2: { + LogStep(2, "read the mandatory attribute: MinMeasuredValue"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FlowMeasurement::Id, + FlowMeasurement::Attributes::MinMeasuredValue::Id); + } + case 3: { + LogStep(3, "read the mandatory attribute: MaxMeasuredValue"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FlowMeasurement::Id, + FlowMeasurement::Attributes::MaxMeasuredValue::Id); + } + case 4: { + LogStep(4, "write the default value to optional attribute: MeasuredValue"); + chip::app::DataModel::Nullable value; + value.SetNonNull(); + value.Value() = 0U; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), FlowMeasurement::Id, + FlowMeasurement::Attributes::MeasuredValue::Id, value); + } + case 5: { + LogStep(5, "write the default value to optional attribute: MinMeasuredValue"); + chip::app::DataModel::Nullable value; + value.SetNonNull(); + value.Value() = 0U; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), FlowMeasurement::Id, + FlowMeasurement::Attributes::MinMeasuredValue::Id, value); + } + case 6: { + LogStep(6, "write the default value to optional attribute: MaxMeasuredValue"); + chip::app::DataModel::Nullable value; + value.SetNonNull(); + value.Value() = 0U; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), FlowMeasurement::Id, + FlowMeasurement::Attributes::MaxMeasuredValue::Id, value); + } + case 7: { + LogStep(7, "read the mandatory attribute: MeasuredValue"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FlowMeasurement::Id, + FlowMeasurement::Attributes::MeasuredValue::Id); + } + case 8: { + LogStep(8, "read the mandatory attribute: MinMeasuredValue"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FlowMeasurement::Id, + FlowMeasurement::Attributes::MinMeasuredValue::Id); + } + case 9: { + LogStep(9, "read the mandatory attribute: MaxMeasuredValue"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FlowMeasurement::Id, + FlowMeasurement::Attributes::MaxMeasuredValue::Id); + } + case 10: { + LogStep(10, "read the optional attribute: Tolerance"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FlowMeasurement::Id, FlowMeasurement::Attributes::Tolerance::Id); + } + case 11: { + LogStep(11, "read the optional attribute: Tolerance"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FlowMeasurement::Id, FlowMeasurement::Attributes::Tolerance::Id); + } + case 12: { + LogStep(12, "write the default value to optional attribute: Tolerance"); + uint16_t value; + value = 0U; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), FlowMeasurement::Id, FlowMeasurement::Attributes::Tolerance::Id, + value); + } + case 13: { + LogStep(13, "read the optional attribute: Tolerance"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FlowMeasurement::Id, FlowMeasurement::Attributes::Tolerance::Id); + } + } return CHIP_NO_ERROR; } +}; - void OnFailureResponse_26(CHIP_ERROR error) +class Test_TC_FLW_2_2Suite : public TestCommand +{ +public: + Test_TC_FLW_2_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_FLW_2_2", 3, credsIssuerConfig) { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - NextTest(); + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - void OnSuccessResponse_26() { ThrowSuccessResponse(); } - - CHIP_ERROR TestReadsBackMandatoryAttributeColorLoopDirection_27() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_27, OnFailureCallback_27, true)); - return CHIP_NO_ERROR; - } + ~Test_TC_FLW_2_2Suite() {} - void OnFailureResponse_27(CHIP_ERROR error) + chip::System::Clock::Timeout GetWaitDuration() const override { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } - void OnSuccessResponse_27(uint8_t colorLoopDirection) - { - VerifyOrReturn(CheckConstraintType("colorLoopDirection", "", "uint8")); - NextTest(); - } +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; - CHIP_ERROR TestValidateConstraintsOfAttributeColorLoopTime_28() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_28, OnFailureCallback_28, true)); - return CHIP_NO_ERROR; - } + // + // Tests methods + // - void OnFailureResponse_28(CHIP_ERROR error) + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } + bool shouldContinue = false; - void OnSuccessResponse_28(uint16_t colorLoopTime) - { - VerifyOrReturn(CheckConstraintType("colorLoopTime", "", "uint16")); - NextTest(); + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + } + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } + + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } } - CHIP_ERROR TestWriteTheDefaultValuesToMandatoryAttributeColorLoopTime_29() + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - uint16_t colorLoopTimeArgument; - colorLoopTimeArgument = 25U; - - ReturnErrorOnFailure(cluster.WriteAttribute( - colorLoopTimeArgument, this, OnSuccessCallback_29, OnFailureCallback_29)); + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "read the mandatory attribute: MeasuredValue"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FlowMeasurement::Id, + FlowMeasurement::Attributes::MeasuredValue::Id); + } + case 2: { + LogStep(2, "read the mandatory attribute: MeasuredValue"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FlowMeasurement::Id, + FlowMeasurement::Attributes::MeasuredValue::Id); + } + } return CHIP_NO_ERROR; } +}; - void OnFailureResponse_29(CHIP_ERROR error) +class Test_TC_GC_1_1Suite : public TestCommand +{ +public: + Test_TC_GC_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_GC_1_1", 6, credsIssuerConfig) { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - NextTest(); + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - void OnSuccessResponse_29() { ThrowSuccessResponse(); } + ~Test_TC_GC_1_1Suite() {} - CHIP_ERROR TestReadsBackMandatoryAttributeColorLoopTime_30() + chip::System::Clock::Timeout GetWaitDuration() const override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_30, OnFailureCallback_30, true)); - return CHIP_NO_ERROR; + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } - void OnFailureResponse_30(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; - void OnSuccessResponse_30(uint16_t colorLoopTime) - { - VerifyOrReturn(CheckConstraintType("colorLoopTime", "", "uint16")); - NextTest(); - } + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } - CHIP_ERROR TestValidateConstraintsOfAttributeColorLoopStartEnhancedHue_31() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_31, OnFailureCallback_31, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_31(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_31(uint16_t colorLoopStartEnhancedHue) - { - VerifyOrReturn(CheckConstraintType("colorLoopStartEnhancedHue", "", "uint16")); - NextTest(); - } + // + // Tests methods + // - CHIP_ERROR TestWriteTheDefaultValuesToMandatoryAttributeColorLoopStartEnhancedHue_32() + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - uint16_t colorLoopStartEnhancedHueArgument; - colorLoopStartEnhancedHueArgument = 8960U; + bool shouldContinue = false; - ReturnErrorOnFailure( - cluster.WriteAttribute( - colorLoopStartEnhancedHueArgument, this, OnSuccessCallback_32, OnFailureCallback_32)); - return CHIP_NO_ERROR; - } + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint64_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("breadcrumb", value, 0ULL)); + } + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint64_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("breadcrumb", value, 1ULL)); + } + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::GeneralCommissioning::RegulatoryLocationType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 2)); + } + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::GeneralCommissioning::RegulatoryLocationType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 2)); + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } - void OnFailureResponse_32(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - NextTest(); + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } } - void OnSuccessResponse_32() { ThrowSuccessResponse(); } - - CHIP_ERROR TestReadsBackMandatoryAttributeColorLoopStartEnhancedHue_33() + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_33, OnFailureCallback_33, true)); + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "TH1 reads the BreadCrumb Attribute from the DUT"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), GeneralCommissioning::Id, + GeneralCommissioning::Attributes::Breadcrumb::Id); + } + case 2: { + LogStep(2, "TH1 writes the BreadCrumb attribute as 1 to the DUT"); + uint64_t value; + value = 1ULL; + return WriteAttribute(kIdentityAlpha, GetEndpoint(0), GeneralCommissioning::Id, + GeneralCommissioning::Attributes::Breadcrumb::Id, value); + } + case 3: { + LogStep(3, "TH1 reads the BreadCrumb attribute from the DUT"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), GeneralCommissioning::Id, + GeneralCommissioning::Attributes::Breadcrumb::Id); + } + case 4: { + LogStep(4, "TH1 reads the RegulatoryConfig attribute from the DUT"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), GeneralCommissioning::Id, + GeneralCommissioning::Attributes::RegulatoryConfig::Id); + } + case 5: { + LogStep(5, "TH1 reads the LocationCapability attribute from the DUT"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), GeneralCommissioning::Id, + GeneralCommissioning::Attributes::LocationCapability::Id); + } + } return CHIP_NO_ERROR; } +}; - void OnFailureResponse_33(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_33(uint16_t colorLoopStartEnhancedHue) - { - VerifyOrReturn(CheckConstraintType("colorLoopStartEnhancedHue", "", "uint16")); - NextTest(); - } - - CHIP_ERROR TestValidateConstraintsOfAttributeColorLoopStoredEnhancedHue_34() +class Test_TC_I_1_1Suite : public TestCommand +{ +public: + Test_TC_I_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_I_1_1", 5, credsIssuerConfig) { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_34, OnFailureCallback_34, true)); - return CHIP_NO_ERROR; + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - void OnFailureResponse_34(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } + ~Test_TC_I_1_1Suite() {} - void OnSuccessResponse_34(uint16_t colorLoopStoredEnhancedHue) + chip::System::Clock::Timeout GetWaitDuration() const override { - VerifyOrReturn(CheckConstraintType("colorLoopStoredEnhancedHue", "", "uint16")); - NextTest(); + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } - CHIP_ERROR TestWriteTheDefaultValuesToMandatoryAttributeColorLoopStoredEnhancedHue_35() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - uint16_t colorLoopStoredEnhancedHueArgument; - colorLoopStoredEnhancedHueArgument = 0U; - - ReturnErrorOnFailure( - cluster.WriteAttribute( - colorLoopStoredEnhancedHueArgument, this, OnSuccessCallback_35, OnFailureCallback_35)); - return CHIP_NO_ERROR; - } +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; - void OnFailureResponse_35(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - NextTest(); - } + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } - void OnSuccessResponse_35() { ThrowSuccessResponse(); } + // + // Tests methods + // - CHIP_ERROR TestReadsBackMandatoryAttributeColorLoopStoredEnhancedHue_36() + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_36, OnFailureCallback_36, true)); - return CHIP_NO_ERROR; - } + bool shouldContinue = false; - void OnFailureResponse_36(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + } + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "list")); + } + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "list")); + } + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "list")); + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } - void OnSuccessResponse_36(uint16_t colorLoopStoredEnhancedHue) - { - VerifyOrReturn(CheckConstraintType("colorLoopStoredEnhancedHue", "", "uint16")); - NextTest(); + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } } - CHIP_ERROR TestValidateConstraintsOfAttributeColorCapabilities_37() + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_37, OnFailureCallback_37, true)); + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "Reads constraints of ClusterRevision attribute"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Identify::Id, Identify::Attributes::ClusterRevision::Id); + } + case 2: { + LogStep(2, "Read the global attribute: AttributeList"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Identify::Id, Identify::Attributes::AttributeList::Id); + } + case 3: { + LogStep(3, "Read the global attribute: AcceptedCommandList"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Identify::Id, Identify::Attributes::AcceptedCommandList::Id); + } + case 4: { + LogStep(4, "Read the global attribute: GeneratedCommandList"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Identify::Id, Identify::Attributes::GeneratedCommandList::Id); + } + } return CHIP_NO_ERROR; } +}; - void OnFailureResponse_37(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_37(uint16_t colorCapabilities) +class Test_TC_I_2_1Suite : public TestCommand +{ +public: + Test_TC_I_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_I_2_1", 3, credsIssuerConfig) { - VerifyOrReturn(CheckConstraintType("colorCapabilities", "", "map16")); - VerifyOrReturn(CheckConstraintMinValue("colorCapabilities", colorCapabilities, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("colorCapabilities", colorCapabilities, 31U)); - NextTest(); + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - CHIP_ERROR TestWriteTheDefaultValuesToMandatoryAttributeColorCapabilities_38() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - uint16_t colorCapabilitiesArgument; - colorCapabilitiesArgument = 0U; - - ReturnErrorOnFailure(cluster.WriteAttribute( - colorCapabilitiesArgument, this, OnSuccessCallback_38, OnFailureCallback_38)); - return CHIP_NO_ERROR; - } + ~Test_TC_I_2_1Suite() {} - void OnFailureResponse_38(CHIP_ERROR error) + chip::System::Clock::Timeout GetWaitDuration() const override { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - NextTest(); + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } - void OnSuccessResponse_38() { ThrowSuccessResponse(); } - - CHIP_ERROR TestReadsBackMandatoryAttributeColorCapabilities_39() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_39, OnFailureCallback_39, true)); - return CHIP_NO_ERROR; - } + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } - void OnFailureResponse_39(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } + // + // Tests methods + // - void OnSuccessResponse_39(uint16_t colorCapabilities) + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { - VerifyOrReturn(CheckConstraintType("colorCapabilities", "", "map16")); - VerifyOrReturn(CheckConstraintMinValue("colorCapabilities", colorCapabilities, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("colorCapabilities", colorCapabilities, 31U)); - NextTest(); - } + bool shouldContinue = false; - CHIP_ERROR TestValidateConstraintsOfAttributeColorTempPhysicalMinMireds_40() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + } + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 5)); + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_40, OnFailureCallback_40, true)); - return CHIP_NO_ERROR; + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } } - void OnFailureResponse_40(CHIP_ERROR error) + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "TH reads the IdentifyTime attribute from the DUT"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Identify::Id, Identify::Attributes::IdentifyTime::Id); + } + case 2: { + LogStep(2, "TH reads the IdentifyType attribute from the DUT"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Identify::Id, Identify::Attributes::IdentifyType::Id); + } + } + return CHIP_NO_ERROR; } +}; - void OnSuccessResponse_40(uint16_t colorTempPhysicalMin) +class Test_TC_I_2_3Suite : public TestCommand +{ +public: + Test_TC_I_2_3Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_I_2_3", 21, credsIssuerConfig) { - VerifyOrReturn(CheckConstraintType("colorTempPhysicalMin", "", "uint16")); - VerifyOrReturn(CheckConstraintMinValue("colorTempPhysicalMin", colorTempPhysicalMin, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("colorTempPhysicalMin", colorTempPhysicalMin, 65279U)); - NextTest(); + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - CHIP_ERROR TestWriteTheDefaultValuesToMandatoryAttributeColorTempPhysicalMinMireds_41() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - uint16_t colorTempPhysicalMinArgument; - colorTempPhysicalMinArgument = 0U; - - ReturnErrorOnFailure(cluster.WriteAttribute( - colorTempPhysicalMinArgument, this, OnSuccessCallback_41, OnFailureCallback_41)); - return CHIP_NO_ERROR; - } + ~Test_TC_I_2_3Suite() {} - void OnFailureResponse_41(CHIP_ERROR error) + chip::System::Clock::Timeout GetWaitDuration() const override { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - NextTest(); + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } - void OnSuccessResponse_41() { ThrowSuccessResponse(); } - - CHIP_ERROR TestReadsBackMandatoryAttributeColorTempPhysicalMinMireds_42() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_42, OnFailureCallback_42, true)); - return CHIP_NO_ERROR; - } + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } - void OnFailureResponse_42(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } + // + // Tests methods + // - void OnSuccessResponse_42(uint16_t colorTempPhysicalMin) + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { - VerifyOrReturn(CheckConstraintType("colorTempPhysicalMin", "", "uint16")); - VerifyOrReturn(CheckConstraintMinValue("colorTempPhysicalMin", colorTempPhysicalMin, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("colorTempPhysicalMin", colorTempPhysicalMin, 65279U)); - NextTest(); - } + bool shouldContinue = false; - CHIP_ERROR TestValidateConstraintsOfAttributeColorTempPhysicalMaxMireds_43() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 8: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 9: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 10: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 11: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 12: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 13: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 14: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 15: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 16: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 17: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 18: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 19: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 20: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_43, OnFailureCallback_43, true)); - return CHIP_NO_ERROR; + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } } - void OnFailureResponse_43(CHIP_ERROR error) + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "1.Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, + "TH sends TriggerEffect command to DUT with the effect identifier field set to 0x00 blink and the effect " + "variant field set to 0x00 default"); + chip::app::Clusters::Identify::Commands::TriggerEffect::Type value; + value.effectIdentifier = static_cast(0); + value.effectVariant = static_cast(0); + return SendCommand(kIdentityAlpha, GetEndpoint(1), Identify::Id, Identify::Commands::TriggerEffect::Id, value); + } + case 2: { + LogStep(2, "Manually check DUT executes a blink effect"); + SetIdentity(kIdentityAlpha); + return UserPrompt("DUT executes a blink effect"); + } + case 3: { + LogStep(3, + "TH sends TriggerEffect command to DUT with the effect identifier field set to 0x01 breathe and the effect " + "variant field set to 0x00 default"); + chip::app::Clusters::Identify::Commands::TriggerEffect::Type value; + value.effectIdentifier = static_cast(1); + value.effectVariant = static_cast(0); + return SendCommand(kIdentityAlpha, GetEndpoint(1), Identify::Id, Identify::Commands::TriggerEffect::Id, value); + } + case 4: { + LogStep(4, "check DUT executes a breathe effect"); + SetIdentity(kIdentityAlpha); + return UserPrompt("DUT executes a breathe effect"); + } + case 5: { + LogStep(5, + "TH sends TriggerEffect command to DUT with the effect identifier field set to 0x02 okay and the effect " + "variant field set to 0x00 default"); + chip::app::Clusters::Identify::Commands::TriggerEffect::Type value; + value.effectIdentifier = static_cast(2); + value.effectVariant = static_cast(0); + return SendCommand(kIdentityAlpha, GetEndpoint(1), Identify::Id, Identify::Commands::TriggerEffect::Id, value); + } + case 6: { + LogStep(6, "check DUT executes an okay effect"); + SetIdentity(kIdentityAlpha); + return UserPrompt("DUT executes an okay effect"); + } + case 7: { + LogStep(7, + "TH sends TriggerEffect command to DUT with the effect identifier field set to 0x0b channel change and the " + "effect variant field set to 0x00 default"); + chip::app::Clusters::Identify::Commands::TriggerEffect::Type value; + value.effectIdentifier = static_cast(11); + value.effectVariant = static_cast(0); + return SendCommand(kIdentityAlpha, GetEndpoint(1), Identify::Id, Identify::Commands::TriggerEffect::Id, value); + } + case 8: { + LogStep(8, "check DUT executes a channel change effect"); + SetIdentity(kIdentityAlpha); + return UserPrompt("DUT executes a channel change effect"); + } + case 9: { + LogStep(9, + "TH sends TriggerEffect command to DUT with the effect identifier field set to 0x01 breathe and the effect " + "variant field set to 0x00 default"); + chip::app::Clusters::Identify::Commands::TriggerEffect::Type value; + value.effectIdentifier = static_cast(1); + value.effectVariant = static_cast(0); + return SendCommand(kIdentityAlpha, GetEndpoint(1), Identify::Id, Identify::Commands::TriggerEffect::Id, value); + } + case 10: { + LogStep(10, "check DUT executes a breathe effect"); + SetIdentity(kIdentityAlpha); + return UserPrompt("DUT executes a breathe effect"); + } + case 11: { + LogStep(11, + "TH sends TriggerEffect command to DUT with the effect identifier field set to 0xfe finish effect and the " + "effect variant field set to 0x00 default"); + chip::app::Clusters::Identify::Commands::TriggerEffect::Type value; + value.effectIdentifier = static_cast(254); + value.effectVariant = static_cast(0); + return SendCommand(kIdentityAlpha, GetEndpoint(1), Identify::Id, Identify::Commands::TriggerEffect::Id, value); + } + case 12: { + LogStep(12, "Manually check DUT stops the breathe effect after the current effect sequence"); + SetIdentity(kIdentityAlpha); + return UserPrompt("DUT stops the breathe effect after the current effect sequence"); + } + case 13: { + LogStep(13, + "TH sends TriggerEffect command to DUT with the effect identifier field set to 0x01 breathe and the effect " + "variant field set to 0x00 default"); + chip::app::Clusters::Identify::Commands::TriggerEffect::Type value; + value.effectIdentifier = static_cast(1); + value.effectVariant = static_cast(0); + return SendCommand(kIdentityAlpha, GetEndpoint(1), Identify::Id, Identify::Commands::TriggerEffect::Id, value); + } + case 14: { + LogStep(14, "Manually check DUT executes a breathe effect"); + SetIdentity(kIdentityAlpha); + return UserPrompt("DUT executes a breathe effect"); + } + case 15: { + LogStep(15, + "TH sends TriggerEffect command to DUT with the effect identifier field set to 0xff stop effect and the effect " + "variant field set to 0x00 default"); + chip::app::Clusters::Identify::Commands::TriggerEffect::Type value; + value.effectIdentifier = static_cast(255); + value.effectVariant = static_cast(0); + return SendCommand(kIdentityAlpha, GetEndpoint(1), Identify::Id, Identify::Commands::TriggerEffect::Id, value); + } + case 16: { + LogStep(16, "Check DUT stops the breathe effect as soon as possible."); + SetIdentity(kIdentityAlpha); + return UserPrompt("DUT stops the breathe effect as soon as possible"); + } + case 17: { + LogStep(17, + "TH sends TriggerEffect command to DUT with the effect identifier field set to 0x00 blink and the effect " + "variant field set to 0x42 unknown"); + chip::app::Clusters::Identify::Commands::TriggerEffect::Type value; + value.effectIdentifier = static_cast(0); + value.effectVariant = static_cast(66); + return SendCommand(kIdentityAlpha, GetEndpoint(1), Identify::Id, Identify::Commands::TriggerEffect::Id, value); + } + case 18: { + LogStep(18, "Check DUT executes a blink effect."); + SetIdentity(kIdentityAlpha); + return UserPrompt("DUT executes a blink effect"); + } + case 19: { + LogStep(19, + "TH sends TriggerEffect command to DUT with the effect identifier field set to 0xff stop effect and the effect " + "variant field set to 0x00 default"); + chip::app::Clusters::Identify::Commands::TriggerEffect::Type value; + value.effectIdentifier = static_cast(255); + value.effectVariant = static_cast(0); + return SendCommand(kIdentityAlpha, GetEndpoint(1), Identify::Id, Identify::Commands::TriggerEffect::Id, value); + } + case 20: { + LogStep(20, "Check DUT stops any effect that may be still running as soon as possible"); + SetIdentity(kIdentityAlpha); + return UserPrompt("DUT stops any effect that may be still running as soon as possible"); + } + } + return CHIP_NO_ERROR; } +}; - void OnSuccessResponse_43(uint16_t colorTempPhysicalMax) +class Test_TC_ILL_1_1Suite : public TestCommand +{ +public: + Test_TC_ILL_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_ILL_1_1", 5, credsIssuerConfig) { - VerifyOrReturn(CheckConstraintType("colorTempPhysicalMax", "", "uint16")); - VerifyOrReturn(CheckConstraintMinValue("colorTempPhysicalMax", colorTempPhysicalMax, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("colorTempPhysicalMax", colorTempPhysicalMax, 65279U)); - NextTest(); + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - CHIP_ERROR TestWriteTheDefaultValuesToMandatoryAttributeColorTempPhysicalMaxMireds_44() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - uint16_t colorTempPhysicalMaxArgument; - colorTempPhysicalMaxArgument = 65279U; - - ReturnErrorOnFailure(cluster.WriteAttribute( - colorTempPhysicalMaxArgument, this, OnSuccessCallback_44, OnFailureCallback_44)); - return CHIP_NO_ERROR; - } + ~Test_TC_ILL_1_1Suite() {} - void OnFailureResponse_44(CHIP_ERROR error) + chip::System::Clock::Timeout GetWaitDuration() const override { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - NextTest(); + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } - void OnSuccessResponse_44() { ThrowSuccessResponse(); } +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; - CHIP_ERROR TestReadsBackMandatoryAttributeColorTempPhysicalMaxMireds_45() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_45, OnFailureCallback_45, true)); - return CHIP_NO_ERROR; - } + // + // Tests methods + // - void OnFailureResponse_45(CHIP_ERROR error) + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } + bool shouldContinue = false; - void OnSuccessResponse_45(uint16_t colorTempPhysicalMax) - { - VerifyOrReturn(CheckConstraintType("colorTempPhysicalMax", "", "uint16")); - VerifyOrReturn(CheckConstraintMinValue("colorTempPhysicalMax", colorTempPhysicalMax, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("colorTempPhysicalMax", colorTempPhysicalMax, 65279U)); - NextTest(); + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + } + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "list")); + } + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "list")); + } + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "list")); + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } + + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } } - CHIP_ERROR TestReadTheOptionalAttributeCoupleColorTempToLevelMinMireds_46() + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_46, OnFailureCallback_46, true)); + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "Read the global attribute constraints: ClusterRevision"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), IlluminanceMeasurement::Id, + IlluminanceMeasurement::Attributes::ClusterRevision::Id); + } + case 2: { + LogStep(2, "Read the global attribute: AttributeList"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), IlluminanceMeasurement::Id, + IlluminanceMeasurement::Attributes::AttributeList::Id); + } + case 3: { + LogStep(3, "Read the global attribute: AcceptedCommandList"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), IlluminanceMeasurement::Id, + IlluminanceMeasurement::Attributes::AcceptedCommandList::Id); + } + case 4: { + LogStep(4, "Read the global attribute: GeneratedCommandList"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), IlluminanceMeasurement::Id, + IlluminanceMeasurement::Attributes::GeneratedCommandList::Id); + } + } return CHIP_NO_ERROR; } +}; - void OnFailureResponse_46(CHIP_ERROR error) +class Test_TC_ILL_2_1Suite : public TestCommand +{ +public: + Test_TC_ILL_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_ILL_2_1", 5, credsIssuerConfig) { - chip::app::StatusIB status(error); - (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() - : ThrowFailureResponse(error); + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - void OnSuccessResponse_46(uint16_t coupleColorTempToLevelMinMireds) + ~Test_TC_ILL_2_1Suite() {} + + chip::System::Clock::Timeout GetWaitDuration() const override { - VerifyOrReturn(CheckConstraintType("coupleColorTempToLevelMinMireds", "", "uint16")); - NextTest(); + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } - CHIP_ERROR TestWriteTheDefaultValuesToOptionalAttributeCoupleColorTempToLevelMinMireds_47() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; - uint16_t coupleColorTempToLevelMinMiredsArgument; - coupleColorTempToLevelMinMiredsArgument = 0U; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } - ReturnErrorOnFailure( - cluster.WriteAttribute( - coupleColorTempToLevelMinMiredsArgument, this, OnSuccessCallback_47, OnFailureCallback_47)); - return CHIP_NO_ERROR; - } + // + // Tests methods + // - void OnFailureResponse_47(CHIP_ERROR error) + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { - chip::app::StatusIB status(error); - if (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) + bool shouldContinue = false; + + switch (mTestIndex - 1) { - NextTest(); + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 1U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 65533U)); + } + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 2U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 65534U)); + } + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 2048U)); + } + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "enum8")); + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); } - else + + if (shouldContinue) { - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - NextTest(); + ContinueOnChipMainThread(CHIP_NO_ERROR); } } - void OnSuccessResponse_47() { ThrowSuccessResponse(); } - - CHIP_ERROR TestReadsBackOptionalAttributeCoupleColorTempToLevelMinMireds_48() + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_48, OnFailureCallback_48, true)); + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "TH reads MinMeasuredValue attribute from DUT"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), IlluminanceMeasurement::Id, + IlluminanceMeasurement::Attributes::MinMeasuredValue::Id); + } + case 2: { + LogStep(2, "TH reads MaxMeasuredValue attribute from DUT"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), IlluminanceMeasurement::Id, + IlluminanceMeasurement::Attributes::MaxMeasuredValue::Id); + } + case 3: { + LogStep(3, "TH reads Tolerance attribute from DUT"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), IlluminanceMeasurement::Id, + IlluminanceMeasurement::Attributes::Tolerance::Id); + } + case 4: { + LogStep(4, "TH reads LightSensorType attribute from DUT"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), IlluminanceMeasurement::Id, + IlluminanceMeasurement::Attributes::LightSensorType::Id); + } + } return CHIP_NO_ERROR; } +}; - void OnFailureResponse_48(CHIP_ERROR error) +class Test_TC_LVL_1_1Suite : public TestCommand +{ +public: + Test_TC_LVL_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_LVL_1_1", 12, credsIssuerConfig) { - chip::app::StatusIB status(error); - (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() - : ThrowFailureResponse(error); + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - void OnSuccessResponse_48(uint16_t coupleColorTempToLevelMinMireds) - { - VerifyOrReturn(CheckConstraintType("coupleColorTempToLevelMinMireds", "", "uint16")); - NextTest(); - } + ~Test_TC_LVL_1_1Suite() {} - CHIP_ERROR TestReadTheOptionalAttributeStartUpColorTemperatureMireds_49() + chip::System::Clock::Timeout GetWaitDuration() const override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_49, OnFailureCallback_49, true)); - return CHIP_NO_ERROR; + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } - void OnFailureResponse_49(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() - : ThrowFailureResponse(error); - } - - void OnSuccessResponse_49(uint16_t startUpColorTemperatureMireds) - { - VerifyOrReturn(CheckConstraintType("startUpColorTemperatureMireds", "", "uint16")); - VerifyOrReturn(CheckConstraintMinValue("startUpColorTemperatureMireds", startUpColorTemperatureMireds, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("startUpColorTemperatureMireds", startUpColorTemperatureMireds, 65279U)); - NextTest(); - } - - CHIP_ERROR TestWriteTheDefaultValuesToOptionalAttributeStartUpColorTemperatureMireds_50() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - uint16_t startUpColorTemperatureMiredsArgument; - startUpColorTemperatureMiredsArgument = 0U; - - ReturnErrorOnFailure( - cluster.WriteAttribute( - startUpColorTemperatureMiredsArgument, this, OnSuccessCallback_50, OnFailureCallback_50)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_50(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() - : ThrowFailureResponse(error); - } - - void OnSuccessResponse_50() { NextTest(); } +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; - CHIP_ERROR TestReadsBackOptionalAttributeStartUpColorTemperatureMireds_51() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_51, OnFailureCallback_51, true)); - return CHIP_NO_ERROR; - } + // + // Tests methods + // - void OnFailureResponse_51(CHIP_ERROR error) + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { - chip::app::StatusIB status(error); - (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() - : ThrowFailureResponse(error); - } + bool shouldContinue = false; - void OnSuccessResponse_51(uint16_t startUpColorTemperatureMireds) - { - VerifyOrReturn(CheckValue("startUpColorTemperatureMireds", startUpColorTemperatureMireds, 0U)); + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("clusterRevision", value, 5U)); + } + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + } + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("clusterRevision", value, 5U)); + } + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "list")); + } + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "list")); + } + break; + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "list")); + } + break; + case 8: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("featureMap", value, 3UL)); + } + break; + case 9: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "map32")); + } + break; + case 10: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); + break; + case 11: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "map32")); + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } - NextTest(); + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } } - CHIP_ERROR TestValidateConstraintsOfAttributeRemainingTime_52() + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_52, OnFailureCallback_52, true)); + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "read the global attribute: ClusterRevision"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::ClusterRevision::Id); + } + case 2: { + LogStep(2, "Read the global attribute constraints: ClusterRevision"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::ClusterRevision::Id); + } + case 3: { + LogStep(3, "write the default values to mandatory global attribute: ClusterRevision"); + uint16_t value; + value = 4U; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::ClusterRevision::Id, + value); + } + case 4: { + LogStep(4, "reads back global attribute: ClusterRevision"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::ClusterRevision::Id); + } + case 5: { + LogStep(5, "Read the global attribute: AttributeList"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::AttributeList::Id); + } + case 6: { + LogStep(6, "Read the global attribute: AcceptedCommandList"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, + LevelControl::Attributes::AcceptedCommandList::Id); + } + case 7: { + LogStep(7, "Read the global attribute: GeneratedCommandList"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, + LevelControl::Attributes::GeneratedCommandList::Id); + } + case 8: { + LogStep(8, "read the optional global attribute: FeatureMap"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::FeatureMap::Id); + } + case 9: { + LogStep(9, "Read the optional global attribute : FeatureMap"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::FeatureMap::Id); + } + case 10: { + LogStep(10, "write the default values to optional global attribute: FeatureMap"); + uint32_t value; + value = 0UL; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::FeatureMap::Id, + value); + } + case 11: { + LogStep(11, "reads back optional global attribute: FeatureMap"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::FeatureMap::Id); + } + } return CHIP_NO_ERROR; } +}; - void OnFailureResponse_52(CHIP_ERROR error) +class Test_TC_LVL_2_1Suite : public TestCommand +{ +public: + Test_TC_LVL_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_LVL_2_1", 16, credsIssuerConfig) { - chip::app::StatusIB status(error); - (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() - : ThrowFailureResponse(error); + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - void OnSuccessResponse_52(uint16_t remainingTime) + ~Test_TC_LVL_2_1Suite() {} + + chip::System::Clock::Timeout GetWaitDuration() const override { - VerifyOrReturn(CheckConstraintType("remainingTime", "", "uint16")); - NextTest(); + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } - CHIP_ERROR TestWriteTheDefaultValuesToOptionalAttributeRemainingTime_53() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; - uint16_t remainingTimeArgument; - remainingTimeArgument = 0U; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } - ReturnErrorOnFailure(cluster.WriteAttribute( - remainingTimeArgument, this, OnSuccessCallback_53, OnFailureCallback_53)); - return CHIP_NO_ERROR; - } + // + // Tests methods + // - void OnFailureResponse_53(CHIP_ERROR error) + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { - chip::app::StatusIB status(error); - if (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) + bool shouldContinue = false; + + switch (mTestIndex - 1) { - NextTest(); + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("currentLevel", value, 254)); + VerifyOrReturn(CheckConstraintType("value", "", "uint8")); + } + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("remainingTime", value, 0U)); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + } + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("minLevel", value, 0)); + VerifyOrReturn(CheckConstraintType("value", "", "uint8")); + } + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint8")); + } + break; + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("currentFrequency", value, 0U)); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + } + break; + case 8: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("minFrequency", value, 0U)); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + } + break; + case 9: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("maxFrequency", value, 0U)); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + } + break; + case 10: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("onOffTransitionTime", value, 0U)); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + } + break; + case 11: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint8")); + } + break; + case 12: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + } + break; + case 13: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + } + break; + case 14: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint8")); + } + break; + case 15: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("options", value, 0)); + VerifyOrReturn(CheckConstraintType("value", "", "map8")); + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); } - else + + if (shouldContinue) { - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - NextTest(); + ContinueOnChipMainThread(CHIP_NO_ERROR); } } - void OnSuccessResponse_53() { ThrowSuccessResponse(); } - - CHIP_ERROR TestReadsBackOptionalAttributeRemainingTime_54() + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_54, OnFailureCallback_54, true)); + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "Reset level to 254"); + chip::app::Clusters::LevelControl::Commands::MoveToLevel::Type value; + value.level = 254; + value.transitionTime = 0U; + value.optionMask = 1; + value.optionOverride = 1; + return SendCommand(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Commands::MoveToLevel::Id, value); + } + case 2: { + LogStep(2, "Wait 100ms"); + SetIdentity(kIdentityAlpha); + return WaitForMs(100); + } + case 3: { + LogStep(3, "Reads the CurrentLevel attribute"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::CurrentLevel::Id); + } + case 4: { + LogStep(4, "Reads the RemainingTime attribute"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::RemainingTime::Id); + } + case 5: { + LogStep(5, "Reads the MinLevel attribute"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::MinLevel::Id); + } + case 6: { + LogStep(6, "Reads the MaxLevel attribute"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::MaxLevel::Id); + } + case 7: { + LogStep(7, "Reads the CurrentFrequency attribute"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::CurrentFrequency::Id); + } + case 8: { + LogStep(8, "Reads the MinFrequency attribute"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::MinFrequency::Id); + } + case 9: { + LogStep(9, "Reads the MaxFrequency attribute"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::MaxFrequency::Id); + } + case 10: { + LogStep(10, "Reads the OnOffTransitionTime attribute"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, + LevelControl::Attributes::OnOffTransitionTime::Id); + } + case 11: { + LogStep(11, "Reads the OnLevel attribute "); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::OnLevel::Id); + } + case 12: { + LogStep(12, "Reads the OnTransitionTime attribute "); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::OnTransitionTime::Id); + } + case 13: { + LogStep(13, "Reads the OffTransitionTime attribute "); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::OffTransitionTime::Id); + } + case 14: { + LogStep(14, "Reads the DefaultMoveRate attribute "); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::DefaultMoveRate::Id); + } + case 15: { + LogStep(15, "Reads the Options attribute "); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::Options::Id); + } + } return CHIP_NO_ERROR; } +}; - void OnFailureResponse_54(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() - : ThrowFailureResponse(error); - } - - void OnSuccessResponse_54(uint16_t remainingTime) - { - VerifyOrReturn(CheckConstraintType("remainingTime", "", "uint16")); - NextTest(); - } - - CHIP_ERROR TestReadTheOptionalAttributeDriftCompensation_55() +class Test_TC_LVL_2_2Suite : public TestCommand +{ +public: + Test_TC_LVL_2_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_LVL_2_2", 16, credsIssuerConfig) { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_55, OnFailureCallback_55, true)); - return CHIP_NO_ERROR; + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - void OnFailureResponse_55(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() - : ThrowFailureResponse(error); - } + ~Test_TC_LVL_2_2Suite() {} - void OnSuccessResponse_55(uint8_t driftCompensation) + chip::System::Clock::Timeout GetWaitDuration() const override { - VerifyOrReturn(CheckConstraintType("driftCompensation", "", "enum8")); - VerifyOrReturn(CheckConstraintMinValue("driftCompensation", driftCompensation, 0)); - VerifyOrReturn(CheckConstraintMaxValue("driftCompensation", driftCompensation, 4)); - NextTest(); + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } - CHIP_ERROR TestWriteTheDefaultValuesToOptionalAttributeDriftCompensation_56() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; - uint8_t driftCompensationArgument; - driftCompensationArgument = 0; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } - ReturnErrorOnFailure(cluster.WriteAttribute( - driftCompensationArgument, this, OnSuccessCallback_56, OnFailureCallback_56)); - return CHIP_NO_ERROR; - } + // + // Tests methods + // - void OnFailureResponse_56(CHIP_ERROR error) + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { - chip::app::StatusIB status(error); - if (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) + bool shouldContinue = false; + + switch (mTestIndex - 1) { - NextTest(); + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("onOffTransitionTime", value, 0U)); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + } + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("onOffTransitionTime", value, 10U)); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + } + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNonNull("onLevel", value)); + VerifyOrReturn(CheckValue("onLevel.Value()", value.Value(), 254)); + VerifyOrReturn(CheckConstraintType("value", "", "uint8")); + } + break; + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 8: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNonNull("onTransitionTime", value)); + VerifyOrReturn(CheckValue("onTransitionTime.Value()", value.Value(), 100U)); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + } + break; + case 9: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 10: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNonNull("offTransitionTime", value)); + VerifyOrReturn(CheckValue("offTransitionTime.Value()", value.Value(), 100U)); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + } + break; + case 11: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNonNull("defaultMoveRate", value)); + VerifyOrReturn(CheckValue("defaultMoveRate.Value()", value.Value(), 50)); + VerifyOrReturn(CheckConstraintType("value", "", "uint8")); + } + break; + case 12: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 13: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNonNull("defaultMoveRate", value)); + VerifyOrReturn(CheckValue("defaultMoveRate.Value()", value.Value(), 100)); + VerifyOrReturn(CheckConstraintType("value", "", "uint8")); + } + break; + case 14: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 15: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNonNull("startUpCurrentLevel", value)); + VerifyOrReturn(CheckValue("startUpCurrentLevel.Value()", value.Value(), 254)); + VerifyOrReturn(CheckConstraintType("value", "", "uint8")); + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); } - else + + if (shouldContinue) { - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - NextTest(); + ContinueOnChipMainThread(CHIP_NO_ERROR); } } - void OnSuccessResponse_56() { ThrowSuccessResponse(); } - - CHIP_ERROR TestReadsBackOptionalAttributeDriftCompensation_57() + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_57, OnFailureCallback_57, true)); + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "Reads the OnOffTransitionTime attribute from the DUT"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, + LevelControl::Attributes::OnOffTransitionTime::Id); + } + case 2: { + LogStep(2, "writes the OnOffTransitionTime attribute on the DUT"); + uint16_t value; + value = 10U; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, + LevelControl::Attributes::OnOffTransitionTime::Id, value); + } + case 3: { + LogStep(3, "Reads the OnOffTransitionTime attribute from the DUT"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, + LevelControl::Attributes::OnOffTransitionTime::Id); + } + case 4: { + LogStep(4, "writes default value of OnOffTransitionTime attribute"); + uint16_t value; + value = 0U; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, + LevelControl::Attributes::OnOffTransitionTime::Id, value); + } + case 5: { + LogStep(5, "writes the OnLevel attribute on the DUT"); + chip::app::DataModel::Nullable value; + value.SetNonNull(); + value.Value() = 254; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::OnLevel::Id, value); + } + case 6: { + LogStep(6, "Reads the OnLevel attribute from the DUT"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::OnLevel::Id); + } + case 7: { + LogStep(7, "Writes the OnTransitionTime attribute on the DUT"); + chip::app::DataModel::Nullable value; + value.SetNonNull(); + value.Value() = 100U; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::OnTransitionTime::Id, + value); + } + case 8: { + LogStep(8, "Reads the OnTransitionTime attribute from the DUT"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::OnTransitionTime::Id); + } + case 9: { + LogStep(9, "Writes the OffTransitionTime attribute on the DUT"); + chip::app::DataModel::Nullable value; + value.SetNonNull(); + value.Value() = 100U; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::OffTransitionTime::Id, + value); + } + case 10: { + LogStep(10, "Reads the OffTransitionTime attribute from the DUT"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::OffTransitionTime::Id); + } + case 11: { + LogStep(11, "Reads the DefaultMoveRate attribute from the DUT"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::DefaultMoveRate::Id); + } + case 12: { + LogStep(12, "Writes the DefaultMoveRate attribute on the DUT"); + chip::app::DataModel::Nullable value; + value.SetNonNull(); + value.Value() = 100; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::DefaultMoveRate::Id, + value); + } + case 13: { + LogStep(13, "Reads the DefaultMoveRate attribute from the DUT"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::DefaultMoveRate::Id); + } + case 14: { + LogStep(14, "writes the StartUpCurrentLevel attribute on the DUT"); + chip::app::DataModel::Nullable value; + value.SetNonNull(); + value.Value() = 254; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, + LevelControl::Attributes::StartUpCurrentLevel::Id, value); + } + case 15: { + LogStep(15, "reads the StartUpCurrentLevel attribute from the DUT"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, + LevelControl::Attributes::StartUpCurrentLevel::Id); + } + } return CHIP_NO_ERROR; } +}; - void OnFailureResponse_57(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() - : ThrowFailureResponse(error); - } - - void OnSuccessResponse_57(uint8_t driftCompensation) - { - VerifyOrReturn(CheckConstraintType("driftCompensation", "", "enum8")); - VerifyOrReturn(CheckConstraintMinValue("driftCompensation", driftCompensation, 0)); - VerifyOrReturn(CheckConstraintMaxValue("driftCompensation", driftCompensation, 4)); - NextTest(); - } - - CHIP_ERROR TestReadTheOptionalAttributeCompensationText_58() +class Test_TC_LVL_3_1Suite : public TestCommand +{ +public: + Test_TC_LVL_3_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_LVL_3_1", 16, credsIssuerConfig) { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_58, OnFailureCallback_58, true)); - return CHIP_NO_ERROR; + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - void OnFailureResponse_58(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() - : ThrowFailureResponse(error); - } + ~Test_TC_LVL_3_1Suite() {} - void OnSuccessResponse_58(chip::CharSpan compensationText) + chip::System::Clock::Timeout GetWaitDuration() const override { - VerifyOrReturn(CheckConstraintType("compensationText", "", "string")); - VerifyOrReturn(CheckConstraintMaxLength("compensationText", compensationText.size(), 254)); - NextTest(); + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } - CHIP_ERROR TestWriteTheDefaultValuesToOptionalAttributeCompensationText_59() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; - chip::CharSpan compensationTextArgument; - compensationTextArgument = chip::Span("garbage: not in length on purpose", 0); + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } - ReturnErrorOnFailure(cluster.WriteAttribute( - compensationTextArgument, this, OnSuccessCallback_59, OnFailureCallback_59)); - return CHIP_NO_ERROR; - } + // + // Tests methods + // - void OnFailureResponse_59(CHIP_ERROR error) + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { - chip::app::StatusIB status(error); - if (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) + bool shouldContinue = false; + + switch (mTestIndex - 1) { - NextTest(); + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint8")); + } + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint8")); + } + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint8")); + } + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("currentLevel", value, 64)); + } + break; + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 8: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 9: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("currentLevel", value, 100)); + } + break; + case 10: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + } + break; + case 11: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 12: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 13: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("currentLevel", value, 128)); + } + break; + case 14: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 15: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); } - else + + if (shouldContinue) { - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - NextTest(); + ContinueOnChipMainThread(CHIP_NO_ERROR); } } - void OnSuccessResponse_59() { ThrowSuccessResponse(); } - - CHIP_ERROR TestReadsBackOptionalAttributeCompensationText_60() + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_60, OnFailureCallback_60, true)); + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "reads CurrentLevel attribute from DUT"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::CurrentLevel::Id); + } + case 2: { + LogStep(2, "Reads the MinLevel attribute"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::MinLevel::Id); + } + case 3: { + LogStep(3, "Reads the MaxLevel attribute"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::MaxLevel::Id); + } + case 4: { + LogStep(4, "sends a Move to level command"); + chip::app::Clusters::LevelControl::Commands::MoveToLevel::Type value; + value.level = 64; + value.transitionTime = 65535U; + value.optionMask = 1; + value.optionOverride = 1; + return SendCommand(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Commands::MoveToLevel::Id, value); + } + case 5: { + LogStep(5, "Wait 100ms"); + SetIdentity(kIdentityAlpha); + return WaitForMs(100); + } + case 6: { + LogStep(6, "reads CurrentLevel attribute from DUT"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::CurrentLevel::Id); + } + case 7: { + LogStep(7, "sends a Move to level command"); + chip::app::Clusters::LevelControl::Commands::MoveToLevel::Type value; + value.level = 100; + value.transitionTime = 100U; + value.optionMask = 1; + value.optionOverride = 1; + return SendCommand(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Commands::MoveToLevel::Id, value); + } + case 8: { + LogStep(8, "Wait 11000 second"); + SetIdentity(kIdentityAlpha); + return WaitForMs(11000); + } + case 9: { + LogStep(9, "reads CurrentLevel attribute from DUT"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::CurrentLevel::Id); + } + case 10: { + LogStep(10, "reads On Off Transition Time attribute from DUT"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, + LevelControl::Attributes::OnOffTransitionTime::Id); + } + case 11: { + LogStep(11, "sends a Move to level command"); + chip::app::Clusters::LevelControl::Commands::MoveToLevel::Type value; + value.level = 128; + value.transitionTime = 65535U; + value.optionMask = 1; + value.optionOverride = 1; + return SendCommand(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Commands::MoveToLevel::Id, value); + } + case 12: { + LogStep(12, "Wait 1000ms"); + SetIdentity(kIdentityAlpha); + return WaitForMs(1000); + } + case 13: { + LogStep(13, "reads CurrentLevel attribute from DUT"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::CurrentLevel::Id); + } + case 14: { + LogStep(14, "Reset level to 254"); + chip::app::Clusters::LevelControl::Commands::MoveToLevel::Type value; + value.level = 254; + value.transitionTime = 0U; + value.optionMask = 1; + value.optionOverride = 1; + return SendCommand(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Commands::MoveToLevel::Id, value); + } + case 15: { + LogStep(15, "Wait 100ms"); + SetIdentity(kIdentityAlpha); + return WaitForMs(100); + } + } return CHIP_NO_ERROR; } +}; - void OnFailureResponse_60(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() - : ThrowFailureResponse(error); - } - - void OnSuccessResponse_60(chip::CharSpan compensationText) - { - VerifyOrReturn(CheckConstraintType("compensationText", "", "string")); - VerifyOrReturn(CheckConstraintMaxLength("compensationText", compensationText.size(), 254)); - NextTest(); - } - - CHIP_ERROR TestReadTheMandatoryAttributeNumberOfPrimaries_61() +class Test_TC_LVL_4_1Suite : public TestCommand +{ +public: + Test_TC_LVL_4_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_LVL_4_1", 18, credsIssuerConfig) { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_61, OnFailureCallback_61, true)); - return CHIP_NO_ERROR; + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - void OnFailureResponse_61(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } + ~Test_TC_LVL_4_1Suite() {} - void OnSuccessResponse_61(uint8_t numberOfPrimaries) + chip::System::Clock::Timeout GetWaitDuration() const override { - VerifyOrReturn(CheckConstraintType("numberOfPrimaries", "", "uint8")); - VerifyOrReturn(CheckConstraintMinValue("numberOfPrimaries", numberOfPrimaries, 0)); - VerifyOrReturn(CheckConstraintMaxValue("numberOfPrimaries", numberOfPrimaries, 6)); - NextTest(); + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } - CHIP_ERROR TestWriteTheDefaultMandatoryAttributeNumberOfPrimaries_62() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - uint8_t numberOfPrimariesArgument; - numberOfPrimariesArgument = 0; +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; - ReturnErrorOnFailure(cluster.WriteAttribute( - numberOfPrimariesArgument, this, OnSuccessCallback_62, OnFailureCallback_62)); - return CHIP_NO_ERROR; - } + uint8_t MaxlevelValue; + uint8_t MinlevelValue; + chip::app::DataModel::Nullable DefaultMoveRateValue; - void OnFailureResponse_62(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - NextTest(); - } + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } - void OnSuccessResponse_62() { ThrowSuccessResponse(); } + // + // Tests methods + // - CHIP_ERROR TestReadBackTheMandatoryAttributeNumberOfPrimaries_63() + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_63, OnFailureCallback_63, true)); - return CHIP_NO_ERROR; - } + bool shouldContinue = false; - void OnFailureResponse_63(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint8")); + MaxlevelValue = value; + } + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("currentLevel", value, MaxlevelValue)); + } + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint8")); + MinlevelValue = value; + } + break; + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 8: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 9: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 10: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("currentLevel", value, 1)); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 1)); + } + break; + case 11: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint8")); + DefaultMoveRateValue = value; + } + break; + case 12: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 13: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 14: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintNotValue("value", value, 255)); + } + break; + case 15: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 16: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 17: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } - void OnSuccessResponse_63(uint8_t numberOfPrimaries) - { - VerifyOrReturn(CheckConstraintType("numberOfPrimaries", "", "uint8")); - VerifyOrReturn(CheckConstraintMinValue("numberOfPrimaries", numberOfPrimaries, 0)); - VerifyOrReturn(CheckConstraintMaxValue("numberOfPrimaries", numberOfPrimaries, 6)); - NextTest(); + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } } - CHIP_ERROR TestReadTheMandatoryAttributePrimary1X_64() + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_64, OnFailureCallback_64, true)); + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "reads max level attribute from DUT"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::MaxLevel::Id); + } + case 2: { + LogStep(2, "sends a Move up command"); + chip::app::Clusters::LevelControl::Commands::Move::Type value; + value.moveMode = static_cast(0); + value.rate = 32; + value.optionMask = 1; + value.optionOverride = 1; + return SendCommand(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Commands::Move::Id, value); + } + case 3: { + LogStep(3, "user prompt message"); + SetIdentity(kIdentityAlpha); + return UserPrompt("Physically verify that the DUT moves at a rate of 32 units per second or as close as possible to " + "this rate and completes moving to its maximum level"); + } + case 4: { + LogStep(4, "Wait 3000ms"); + SetIdentity(kIdentityAlpha); + return WaitForMs(3000); + } + case 5: { + LogStep(5, "reads CurrentLevel attribute from DUT"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::CurrentLevel::Id); + } + case 6: { + LogStep(6, "reads min level attribute from DUT"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::MinLevel::Id); + } + case 7: { + LogStep(7, "sends a Move down command"); + chip::app::Clusters::LevelControl::Commands::Move::Type value; + value.moveMode = static_cast(1); + value.rate = 64; + value.optionMask = 1; + value.optionOverride = 1; + return SendCommand(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Commands::Move::Id, value); + } + case 8: { + LogStep(8, "user prompt message"); + SetIdentity(kIdentityAlpha); + return UserPrompt("Physically verify that the DUT moves at a rate of 64 units per second or as close as possible to " + "this rate and complete moving to its minimum level"); + } + case 9: { + LogStep(9, "Wait 5000ms"); + SetIdentity(kIdentityAlpha); + return WaitForMs(5000); + } + case 10: { + LogStep(10, "reads CurrentLevel attribute from DUT"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::CurrentLevel::Id); + } + case 11: { + LogStep(11, "reads default move rate attribute from DUT"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::DefaultMoveRate::Id); + } + case 12: { + LogStep(12, "sends a Move up command at default move rate"); + chip::app::Clusters::LevelControl::Commands::Move::Type value; + value.moveMode = static_cast(0); + value.rate = 255; + value.optionMask = 1; + value.optionOverride = 1; + return SendCommand(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Commands::Move::Id, value); + } + case 13: { + LogStep(13, "Wait 100ms"); + SetIdentity(kIdentityAlpha); + return WaitForMs(100); + } + case 14: { + LogStep(14, "reads CurrentLevel attribute from DUT"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::CurrentLevel::Id); + } + case 15: { + LogStep(15, "user prompt message"); + SetIdentity(kIdentityAlpha); + return UserPrompt("Physically verify that the device moves at the rate recorded in step 3a and completes moving to its " + "maximum level."); + } + case 16: { + LogStep(16, "Reset level to 254"); + chip::app::Clusters::LevelControl::Commands::MoveToLevel::Type value; + value.level = 254; + value.transitionTime = 0U; + value.optionMask = 1; + value.optionOverride = 1; + return SendCommand(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Commands::MoveToLevel::Id, value); + } + case 17: { + LogStep(17, "Wait 100ms"); + SetIdentity(kIdentityAlpha); + return WaitForMs(100); + } + } return CHIP_NO_ERROR; } +}; - void OnFailureResponse_64(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_64(uint16_t primary1X) +class Test_TC_LVL_5_1Suite : public TestCommand +{ +public: + Test_TC_LVL_5_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_LVL_5_1", 14, credsIssuerConfig) { - VerifyOrReturn(CheckConstraintType("primary1X", "", "uint16")); - VerifyOrReturn(CheckConstraintMinValue("primary1X", primary1X, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("primary1X", primary1X, 65279U)); - NextTest(); + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - CHIP_ERROR TestWriteTheDefaultMandatoryAttributePrimary1X_65() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - uint16_t primary1XArgument; - primary1XArgument = 0U; - - ReturnErrorOnFailure(cluster.WriteAttribute( - primary1XArgument, this, OnSuccessCallback_65, OnFailureCallback_65)); - return CHIP_NO_ERROR; - } + ~Test_TC_LVL_5_1Suite() {} - void OnFailureResponse_65(CHIP_ERROR error) + chip::System::Clock::Timeout GetWaitDuration() const override { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - NextTest(); + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } - void OnSuccessResponse_65() { ThrowSuccessResponse(); } - - CHIP_ERROR TestReadBackTheMandatoryAttributePrimary1X_66() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_66, OnFailureCallback_66, true)); - return CHIP_NO_ERROR; - } + uint8_t CurrentlevelValue; - void OnFailureResponse_66(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } - void OnSuccessResponse_66(uint16_t primary1X) - { - VerifyOrReturn(CheckConstraintType("primary1X", "", "uint16")); - VerifyOrReturn(CheckConstraintMinValue("primary1X", primary1X, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("primary1X", primary1X, 65279U)); - NextTest(); - } + // + // Tests methods + // - CHIP_ERROR TestReadTheMandatoryAttributePrimary1Y_67() + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_67, OnFailureCallback_67, true)); - return CHIP_NO_ERROR; - } + bool shouldContinue = false; - void OnFailureResponse_67(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint8")); + CurrentlevelValue = value; + } + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintNotValue("value", value, CurrentlevelValue)); + } + break; + case 8: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 9: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 10: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("currentLevel", value, CurrentlevelValue)); + } + break; + case 11: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 12: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 13: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } - void OnSuccessResponse_67(uint16_t primary1Y) - { - VerifyOrReturn(CheckConstraintType("primary1Y", "", "uint16")); - VerifyOrReturn(CheckConstraintMinValue("primary1Y", primary1Y, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("primary1Y", primary1Y, 65279U)); - NextTest(); + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } } - CHIP_ERROR TestWriteTheDefaultMandatoryAttributePrimary1Y_68() + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - uint16_t primary1YArgument; - primary1YArgument = 0U; - - ReturnErrorOnFailure(cluster.WriteAttribute( - primary1YArgument, this, OnSuccessCallback_68, OnFailureCallback_68)); + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "Sending on command"); + chip::app::Clusters::OnOff::Commands::On::Type value; + return SendCommand(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Commands::On::Id, value); + } + case 2: { + LogStep(2, "Precondition: DUT level is set to its lowest point"); + chip::app::Clusters::LevelControl::Commands::Step::Type value; + value.stepMode = static_cast(1); + value.stepSize = 100; + value.transitionTime = 20U; + value.optionMask = 0; + value.optionOverride = 0; + return SendCommand(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Commands::Step::Id, value); + } + case 3: { + LogStep(3, "Wait 3000ms"); + SetIdentity(kIdentityAlpha); + return WaitForMs(3000); + } + case 4: { + LogStep(4, "Reads current level attribute from DUT"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::CurrentLevel::Id); + } + case 5: { + LogStep(5, "Sends step up command to DUT"); + chip::app::Clusters::LevelControl::Commands::Step::Type value; + value.stepMode = static_cast(0); + value.stepSize = 64; + value.transitionTime = 2U; + value.optionMask = 0; + value.optionOverride = 0; + return SendCommand(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Commands::Step::Id, value); + } + case 6: { + LogStep(6, "Wait 5000ms"); + SetIdentity(kIdentityAlpha); + return WaitForMs(5000); + } + case 7: { + LogStep(7, "Reads current level attribute from DUT"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::CurrentLevel::Id); + } + case 8: { + LogStep(8, "Sends a Step down command"); + chip::app::Clusters::LevelControl::Commands::Step::Type value; + value.stepMode = static_cast(1); + value.stepSize = 64; + value.transitionTime = 2U; + value.optionMask = 0; + value.optionOverride = 0; + return SendCommand(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Commands::Step::Id, value); + } + case 9: { + LogStep(9, "Wait 4000ms"); + SetIdentity(kIdentityAlpha); + return WaitForMs(4000); + } + case 10: { + LogStep(10, "Reads current level attribute from DUT"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::CurrentLevel::Id); + } + case 11: { + LogStep(11, "Reset level to 254"); + chip::app::Clusters::LevelControl::Commands::MoveToLevel::Type value; + value.level = 254; + value.transitionTime = 0U; + value.optionMask = 1; + value.optionOverride = 1; + return SendCommand(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Commands::MoveToLevel::Id, value); + } + case 12: { + LogStep(12, "Wait 100ms"); + SetIdentity(kIdentityAlpha); + return WaitForMs(100); + } + case 13: { + LogStep(13, "Sending off command"); + chip::app::Clusters::OnOff::Commands::Off::Type value; + return SendCommand(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Commands::Off::Id, value); + } + } return CHIP_NO_ERROR; } +}; - void OnFailureResponse_68(CHIP_ERROR error) +class Test_TC_LVL_6_1Suite : public TestCommand +{ +public: + Test_TC_LVL_6_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_LVL_6_1", 12, credsIssuerConfig) { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - NextTest(); + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - void OnSuccessResponse_68() { ThrowSuccessResponse(); } - - CHIP_ERROR TestReadBackTheMandatoryAttributePrimary1Y_69() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_69, OnFailureCallback_69, true)); - return CHIP_NO_ERROR; - } + ~Test_TC_LVL_6_1Suite() {} - void OnFailureResponse_69(CHIP_ERROR error) + chip::System::Clock::Timeout GetWaitDuration() const override { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } - void OnSuccessResponse_69(uint16_t primary1Y) - { - VerifyOrReturn(CheckConstraintType("primary1Y", "", "uint16")); - VerifyOrReturn(CheckConstraintMinValue("primary1Y", primary1Y, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("primary1Y", primary1Y, 65279U)); - NextTest(); - } +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; - CHIP_ERROR TestReadTheMandatoryAttributePrimary1Intensity_70() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); + uint8_t CurrentLevelValue; - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_70, OnFailureCallback_70, true)); - return CHIP_NO_ERROR; - } + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } - void OnFailureResponse_70(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } + // + // Tests methods + // - void OnSuccessResponse_70(uint8_t primary1Intensity) + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { - VerifyOrReturn(CheckConstraintType("primary1Intensity", "", "uint8")); - NextTest(); - } + bool shouldContinue = false; - CHIP_ERROR TestReadTheMandatoryAttributePrimary2X_71() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 1)); + CurrentLevelValue = value; + } + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 8: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintNotValue("value", value, CurrentLevelValue)); + } + break; + case 9: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 10: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 11: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_71, OnFailureCallback_71, true)); - return CHIP_NO_ERROR; + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } } - void OnFailureResponse_71(CHIP_ERROR error) + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "Sending on command"); + chip::app::Clusters::OnOff::Commands::On::Type value; + return SendCommand(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Commands::On::Id, value); + } + case 2: { + LogStep(2, "Precondition: set DUT to lowest point"); + chip::app::Clusters::LevelControl::Commands::MoveToLevel::Type value; + value.level = 0; + value.transitionTime = 0U; + value.optionMask = 1; + value.optionOverride = 1; + return SendCommand(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Commands::MoveToLevel::Id, value); + } + case 3: { + LogStep(3, "Wait 100ms"); + SetIdentity(kIdentityAlpha); + return WaitForMs(100); + } + case 4: { + LogStep(4, "Reads CurrentLevel attribute from DUT"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::CurrentLevel::Id); + } + case 5: { + LogStep(5, "Sends a move up command to DUT"); + chip::app::Clusters::LevelControl::Commands::Move::Type value; + value.moveMode = static_cast(0); + value.rate = 1; + value.optionMask = 1; + value.optionOverride = 1; + return SendCommand(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Commands::Move::Id, value); + } + case 6: { + LogStep(6, "Wait 2000ms"); + SetIdentity(kIdentityAlpha); + return WaitForMs(2000); + } + case 7: { + LogStep(7, "Sends stop command to DUT"); + chip::app::Clusters::LevelControl::Commands::Stop::Type value; + value.optionMask = 0; + value.optionOverride = 0; + return SendCommand(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Commands::Stop::Id, value); + } + case 8: { + LogStep(8, "Reads CurrentLevel attribute from DUT"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::CurrentLevel::Id); + } + case 9: { + LogStep(9, "Reset level to 254"); + chip::app::Clusters::LevelControl::Commands::MoveToLevel::Type value; + value.level = 254; + value.transitionTime = 0U; + value.optionMask = 1; + value.optionOverride = 1; + return SendCommand(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Commands::MoveToLevel::Id, value); + } + case 10: { + LogStep(10, "Wait 100ms"); + SetIdentity(kIdentityAlpha); + return WaitForMs(100); + } + case 11: { + LogStep(11, "Sending off command"); + chip::app::Clusters::OnOff::Commands::Off::Type value; + return SendCommand(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Commands::Off::Id, value); + } + } + return CHIP_NO_ERROR; } +}; - void OnSuccessResponse_71(uint16_t primary2X) +class Test_TC_MC_1_1Suite : public TestCommand +{ +public: + Test_TC_MC_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_MC_1_1", 4, credsIssuerConfig) { - VerifyOrReturn(CheckConstraintType("primary2X", "", "uint16")); - VerifyOrReturn(CheckConstraintMinValue("primary2X", primary2X, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("primary2X", primary2X, 65279U)); - NextTest(); + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - CHIP_ERROR TestWriteTheDefaultMandatoryAttributePrimary2X_72() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - uint16_t primary2XArgument; - primary2XArgument = 0U; - - ReturnErrorOnFailure(cluster.WriteAttribute( - primary2XArgument, this, OnSuccessCallback_72, OnFailureCallback_72)); - return CHIP_NO_ERROR; - } + ~Test_TC_MC_1_1Suite() {} - void OnFailureResponse_72(CHIP_ERROR error) + chip::System::Clock::Timeout GetWaitDuration() const override { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - NextTest(); + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } - void OnSuccessResponse_72() { ThrowSuccessResponse(); } - - CHIP_ERROR TestReadBackTheMandatoryAttributePrimary2X_73() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_73, OnFailureCallback_73, true)); - return CHIP_NO_ERROR; - } + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } - void OnFailureResponse_73(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } + // + // Tests methods + // - void OnSuccessResponse_73(uint16_t primary2X) + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { - VerifyOrReturn(CheckConstraintType("primary2X", "", "uint16")); - VerifyOrReturn(CheckConstraintMinValue("primary2X", primary2X, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("primary2X", primary2X, 65279U)); - NextTest(); - } + bool shouldContinue = false; - CHIP_ERROR TestReadTheMandatoryAttributePrimary2Y_74() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("clusterRevision", value, 1U)); + } + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + } + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "list")); + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_74, OnFailureCallback_74, true)); - return CHIP_NO_ERROR; + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } } - void OnFailureResponse_74(CHIP_ERROR error) + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "read the global attribute: ClusterRevision"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LowPower::Id, LowPower::Attributes::ClusterRevision::Id); + } + case 2: { + LogStep(2, "Read the global attribute constraints: ClusterRevision"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LowPower::Id, LowPower::Attributes::ClusterRevision::Id); + } + case 3: { + LogStep(3, "Read the global attribute: AttributeList"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LowPower::Id, LowPower::Attributes::AttributeList::Id); + } + } + return CHIP_NO_ERROR; } +}; - void OnSuccessResponse_74(uint16_t primary2Y) +class Test_TC_MC_1_2Suite : public TestCommand +{ +public: + Test_TC_MC_1_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_MC_1_2", 4, credsIssuerConfig) { - VerifyOrReturn(CheckConstraintType("primary2Y", "", "uint16")); - VerifyOrReturn(CheckConstraintMinValue("primary2Y", primary2Y, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("primary2Y", primary2Y, 65279U)); - NextTest(); + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - CHIP_ERROR TestWriteTheDefaultMandatoryAttributePrimary2Y_75() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - uint16_t primary2YArgument; - primary2YArgument = 0U; - - ReturnErrorOnFailure(cluster.WriteAttribute( - primary2YArgument, this, OnSuccessCallback_75, OnFailureCallback_75)); - return CHIP_NO_ERROR; - } + ~Test_TC_MC_1_2Suite() {} - void OnFailureResponse_75(CHIP_ERROR error) + chip::System::Clock::Timeout GetWaitDuration() const override { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - NextTest(); + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } - void OnSuccessResponse_75() { ThrowSuccessResponse(); } +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; - CHIP_ERROR TestReadBackTheMandatoryAttributePrimary2Y_76() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_76, OnFailureCallback_76, true)); - return CHIP_NO_ERROR; - } + // + // Tests methods + // - void OnFailureResponse_76(CHIP_ERROR error) + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } + bool shouldContinue = false; - void OnSuccessResponse_76(uint16_t primary2Y) - { - VerifyOrReturn(CheckConstraintType("primary2Y", "", "uint16")); - VerifyOrReturn(CheckConstraintMinValue("primary2Y", primary2Y, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("primary2Y", primary2Y, 65279U)); - NextTest(); - } - - CHIP_ERROR TestValidateConstraintsOfAttributePrimary2Intensity_77() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_77, OnFailureCallback_77, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_77(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("clusterRevision", value, 1U)); + } + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + } + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "list")); + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } - void OnSuccessResponse_77(uint8_t primary2Intensity) - { - VerifyOrReturn(CheckConstraintType("primary2Intensity", "", "uint8")); - NextTest(); + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } } - CHIP_ERROR TestReadTheMandatoryAttributePrimary3X_78() + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_78, OnFailureCallback_78, true)); + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "read the global attribute: ClusterRevision"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), KeypadInput::Id, KeypadInput::Attributes::ClusterRevision::Id); + } + case 2: { + LogStep(2, "Read the global attribute constraints: ClusterRevision"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), KeypadInput::Id, KeypadInput::Attributes::ClusterRevision::Id); + } + case 3: { + LogStep(3, "Read the global attribute: AttributeList"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), KeypadInput::Id, KeypadInput::Attributes::AttributeList::Id); + } + } return CHIP_NO_ERROR; } +}; - void OnFailureResponse_78(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_78(uint16_t primary3X) +class Test_TC_MC_1_3Suite : public TestCommand +{ +public: + Test_TC_MC_1_3Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_MC_1_3", 4, credsIssuerConfig) { - VerifyOrReturn(CheckConstraintType("primary3X", "", "uint16")); - VerifyOrReturn(CheckConstraintMinValue("primary3X", primary3X, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("primary3X", primary3X, 65279U)); - NextTest(); + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - CHIP_ERROR TestWriteTheDefaultMandatoryAttributePrimary3X_79() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - uint16_t primary3XArgument; - primary3XArgument = 0U; - - ReturnErrorOnFailure(cluster.WriteAttribute( - primary3XArgument, this, OnSuccessCallback_79, OnFailureCallback_79)); - return CHIP_NO_ERROR; - } + ~Test_TC_MC_1_3Suite() {} - void OnFailureResponse_79(CHIP_ERROR error) + chip::System::Clock::Timeout GetWaitDuration() const override { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - NextTest(); + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } - void OnSuccessResponse_79() { ThrowSuccessResponse(); } - - CHIP_ERROR TestReadBackTheMandatoryAttributePrimary3X_80() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_80, OnFailureCallback_80, true)); - return CHIP_NO_ERROR; - } + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } - void OnFailureResponse_80(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } + // + // Tests methods + // - void OnSuccessResponse_80(uint16_t primary3X) + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { - VerifyOrReturn(CheckConstraintType("primary3X", "", "uint16")); - VerifyOrReturn(CheckConstraintMinValue("primary3X", primary3X, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("primary3X", primary3X, 65279U)); - NextTest(); - } + bool shouldContinue = false; - CHIP_ERROR TestReadTheMandatoryAttributePrimary3Y_81() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("clusterRevision", value, 1U)); + } + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + } + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "list")); + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_81, OnFailureCallback_81, true)); - return CHIP_NO_ERROR; + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } } - void OnFailureResponse_81(CHIP_ERROR error) + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "read the global attribute: ClusterRevision"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ApplicationLauncher::Id, + ApplicationLauncher::Attributes::ClusterRevision::Id); + } + case 2: { + LogStep(2, "Read the global attribute constraints: ClusterRevision"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ApplicationLauncher::Id, + ApplicationLauncher::Attributes::ClusterRevision::Id); + } + case 3: { + LogStep(3, "Read the global attribute: AttributeList"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ApplicationLauncher::Id, + ApplicationLauncher::Attributes::AttributeList::Id); + } + } + return CHIP_NO_ERROR; } +}; - void OnSuccessResponse_81(uint16_t primary3Y) +class Test_TC_MC_1_4Suite : public TestCommand +{ +public: + Test_TC_MC_1_4Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_MC_1_4", 4, credsIssuerConfig) { - VerifyOrReturn(CheckConstraintType("primary3Y", "", "uint16")); - VerifyOrReturn(CheckConstraintMinValue("primary3Y", primary3Y, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("primary3Y", primary3Y, 65279U)); - NextTest(); + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - CHIP_ERROR TestWriteTheDefaultMandatoryAttributePrimary3Y_82() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - uint16_t primary3YArgument; - primary3YArgument = 0U; - - ReturnErrorOnFailure(cluster.WriteAttribute( - primary3YArgument, this, OnSuccessCallback_82, OnFailureCallback_82)); - return CHIP_NO_ERROR; - } + ~Test_TC_MC_1_4Suite() {} - void OnFailureResponse_82(CHIP_ERROR error) + chip::System::Clock::Timeout GetWaitDuration() const override { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - NextTest(); + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } - void OnSuccessResponse_82() { ThrowSuccessResponse(); } +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; - CHIP_ERROR TestReadBackTheMandatoryAttributePrimary3Y_83() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_83, OnFailureCallback_83, true)); - return CHIP_NO_ERROR; - } + // + // Tests methods + // - void OnFailureResponse_83(CHIP_ERROR error) + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } + bool shouldContinue = false; - void OnSuccessResponse_83(uint16_t primary3Y) - { - VerifyOrReturn(CheckConstraintType("primary3Y", "", "uint16")); - VerifyOrReturn(CheckConstraintMinValue("primary3Y", primary3Y, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("primary3Y", primary3Y, 65279U)); - NextTest(); + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("clusterRevision", value, 1U)); + } + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + } + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "list")); + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } + + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } } - CHIP_ERROR TestReadTheMandatoryAttributePrimary3Intensity_84() + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_84, OnFailureCallback_84, true)); + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "read the global attribute: ClusterRevision"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), MediaInput::Id, MediaInput::Attributes::ClusterRevision::Id); + } + case 2: { + LogStep(2, "Read the global attribute constraints: ClusterRevision"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), MediaInput::Id, MediaInput::Attributes::ClusterRevision::Id); + } + case 3: { + LogStep(3, "Read the global attribute: AttributeList"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), MediaInput::Id, MediaInput::Attributes::AttributeList::Id); + } + } return CHIP_NO_ERROR; } +}; - void OnFailureResponse_84(CHIP_ERROR error) +class Test_TC_MC_1_5Suite : public TestCommand +{ +public: + Test_TC_MC_1_5Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_MC_1_5", 4, credsIssuerConfig) { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - void OnSuccessResponse_84(uint8_t primary3Intensity) - { - VerifyOrReturn(CheckConstraintType("primary3Intensity", "", "uint8")); - NextTest(); - } + ~Test_TC_MC_1_5Suite() {} - CHIP_ERROR TestReadTheMandatoryAttributePrimary4X_85() + chip::System::Clock::Timeout GetWaitDuration() const override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_85, OnFailureCallback_85, true)); - return CHIP_NO_ERROR; + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } - void OnFailureResponse_85(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; - void OnSuccessResponse_85(uint16_t primary4X) - { - VerifyOrReturn(CheckConstraintType("primary4X", "", "uint16")); - VerifyOrReturn(CheckConstraintMinValue("primary4X", primary4X, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("primary4X", primary4X, 65279U)); - NextTest(); - } + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } - CHIP_ERROR TestWriteTheDefaultMandatoryAttributePrimary4X_86() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); + // + // Tests methods + // - uint16_t primary4XArgument; - primary4XArgument = 0U; + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override + { + bool shouldContinue = false; - ReturnErrorOnFailure(cluster.WriteAttribute( - primary4XArgument, this, OnSuccessCallback_86, OnFailureCallback_86)); - return CHIP_NO_ERROR; - } + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("clusterRevision", value, 1U)); + } + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + } + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "list")); + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } - void OnFailureResponse_86(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - NextTest(); + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } } - void OnSuccessResponse_86() { ThrowSuccessResponse(); } - - CHIP_ERROR TestReadBackTheMandatoryAttributePrimary4X_87() + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_87, OnFailureCallback_87, true)); + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "read the global attribute: ClusterRevision"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WakeOnLan::Id, WakeOnLan::Attributes::ClusterRevision::Id); + } + case 2: { + LogStep(2, "Read the global attribute constraints: ClusterRevision"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WakeOnLan::Id, WakeOnLan::Attributes::ClusterRevision::Id); + } + case 3: { + LogStep(3, "Read the global attribute: AttributeList"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WakeOnLan::Id, WakeOnLan::Attributes::AttributeList::Id); + } + } return CHIP_NO_ERROR; } +}; - void OnFailureResponse_87(CHIP_ERROR error) +class Test_TC_MC_1_6Suite : public TestCommand +{ +public: + Test_TC_MC_1_6Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_MC_1_6", 4, credsIssuerConfig) { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - void OnSuccessResponse_87(uint16_t primary4X) - { - VerifyOrReturn(CheckConstraintType("primary4X", "", "uint16")); - VerifyOrReturn(CheckConstraintMinValue("primary4X", primary4X, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("primary4X", primary4X, 65279U)); - NextTest(); - } + ~Test_TC_MC_1_6Suite() {} - CHIP_ERROR TestReadTheMandatoryAttributePrimary4Y_88() + chip::System::Clock::Timeout GetWaitDuration() const override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_88, OnFailureCallback_88, true)); - return CHIP_NO_ERROR; + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } - void OnFailureResponse_88(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; - void OnSuccessResponse_88(uint16_t primary4Y) - { - VerifyOrReturn(CheckConstraintType("primary4Y", "", "uint16")); - VerifyOrReturn(CheckConstraintMinValue("primary4Y", primary4Y, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("primary4Y", primary4Y, 65279U)); - NextTest(); - } + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } - CHIP_ERROR TestWriteTheDefaultMandatoryAttributePrimary4Y_89() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); + // + // Tests methods + // - uint16_t primary4YArgument; - primary4YArgument = 0U; + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override + { + bool shouldContinue = false; - ReturnErrorOnFailure(cluster.WriteAttribute( - primary4YArgument, this, OnSuccessCallback_89, OnFailureCallback_89)); - return CHIP_NO_ERROR; - } + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("clusterRevision", value, 1U)); + } + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + } + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "list")); + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } - void OnFailureResponse_89(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - NextTest(); + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } } - void OnSuccessResponse_89() { ThrowSuccessResponse(); } - - CHIP_ERROR TestReadBackTheMandatoryAttributePrimary4Y_90() + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_90, OnFailureCallback_90, true)); + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "read the global attribute: ClusterRevision"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Channel::Id, Channel::Attributes::ClusterRevision::Id); + } + case 2: { + LogStep(2, "Read the global attribute constraints: ClusterRevision"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Channel::Id, Channel::Attributes::ClusterRevision::Id); + } + case 3: { + LogStep(3, "Read the global attribute: AttributeList"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Channel::Id, Channel::Attributes::AttributeList::Id); + } + } return CHIP_NO_ERROR; } +}; - void OnFailureResponse_90(CHIP_ERROR error) +class Test_TC_MC_1_7Suite : public TestCommand +{ +public: + Test_TC_MC_1_7Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_MC_1_7", 4, credsIssuerConfig) { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - void OnSuccessResponse_90(uint16_t primary4Y) + ~Test_TC_MC_1_7Suite() {} + + chip::System::Clock::Timeout GetWaitDuration() const override { - VerifyOrReturn(CheckConstraintType("primary4Y", "", "uint16")); - VerifyOrReturn(CheckConstraintMinValue("primary4Y", primary4Y, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("primary4Y", primary4Y, 65279U)); - NextTest(); + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } - CHIP_ERROR TestReadTheMandatoryAttributePrimary4Intensity_91() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_91, OnFailureCallback_91, true)); - return CHIP_NO_ERROR; - } + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } - void OnFailureResponse_91(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } + // + // Tests methods + // - void OnSuccessResponse_91(uint8_t primary4Intensity) + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { - VerifyOrReturn(CheckConstraintType("primary4Intensity", "", "uint8")); - NextTest(); - } + bool shouldContinue = false; - CHIP_ERROR TestReadTheMandatoryAttributePrimary5X_92() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("clusterRevision", value, 1U)); + } + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + } + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "list")); + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_92, OnFailureCallback_92, true)); - return CHIP_NO_ERROR; + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } } - void OnFailureResponse_92(CHIP_ERROR error) + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "read the global attribute: ClusterRevision"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), MediaPlayback::Id, MediaPlayback::Attributes::ClusterRevision::Id); + } + case 2: { + LogStep(2, "Read the global attribute constraints: ClusterRevision"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), MediaPlayback::Id, MediaPlayback::Attributes::ClusterRevision::Id); + } + case 3: { + LogStep(3, "Read the global attribute: AttributeList"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), MediaPlayback::Id, MediaPlayback::Attributes::AttributeList::Id); + } + } + return CHIP_NO_ERROR; } +}; - void OnSuccessResponse_92(uint16_t primary5X) +class Test_TC_MC_1_8Suite : public TestCommand +{ +public: + Test_TC_MC_1_8Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_MC_1_8", 4, credsIssuerConfig) { - VerifyOrReturn(CheckConstraintType("primary5X", "", "uint16")); - VerifyOrReturn(CheckConstraintMinValue("primary5X", primary5X, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("primary5X", primary5X, 65279U)); - NextTest(); + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - CHIP_ERROR TestWriteTheDefaultMandatoryAttributePrimary5X_93() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - uint16_t primary5XArgument; - primary5XArgument = 0U; - - ReturnErrorOnFailure(cluster.WriteAttribute( - primary5XArgument, this, OnSuccessCallback_93, OnFailureCallback_93)); - return CHIP_NO_ERROR; - } + ~Test_TC_MC_1_8Suite() {} - void OnFailureResponse_93(CHIP_ERROR error) + chip::System::Clock::Timeout GetWaitDuration() const override { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - NextTest(); + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } - void OnSuccessResponse_93() { ThrowSuccessResponse(); } - - CHIP_ERROR TestReadBackTheMandatoryAttributePrimary5X_94() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_94, OnFailureCallback_94, true)); - return CHIP_NO_ERROR; - } + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } - void OnFailureResponse_94(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } + // + // Tests methods + // - void OnSuccessResponse_94(uint16_t primary5X) + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { - VerifyOrReturn(CheckConstraintType("primary5X", "", "uint16")); - VerifyOrReturn(CheckConstraintMinValue("primary5X", primary5X, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("primary5X", primary5X, 65279U)); - NextTest(); - } + bool shouldContinue = false; - CHIP_ERROR TestReadTheMandatoryAttributePrimary5Y_95() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("clusterRevision", value, 1U)); + } + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + } + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "list")); + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_95, OnFailureCallback_95, true)); - return CHIP_NO_ERROR; + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } } - void OnFailureResponse_95(CHIP_ERROR error) + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "read the global attribute: ClusterRevision"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), AudioOutput::Id, AudioOutput::Attributes::ClusterRevision::Id); + } + case 2: { + LogStep(2, "Read the global attribute constraints: ClusterRevision"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), AudioOutput::Id, AudioOutput::Attributes::ClusterRevision::Id); + } + case 3: { + LogStep(3, "Read the global attribute: AttributeList"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), AudioOutput::Id, AudioOutput::Attributes::AttributeList::Id); + } + } + return CHIP_NO_ERROR; } +}; - void OnSuccessResponse_95(uint16_t primary5Y) +class Test_TC_MC_1_9Suite : public TestCommand +{ +public: + Test_TC_MC_1_9Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_MC_1_9", 4, credsIssuerConfig) { - VerifyOrReturn(CheckConstraintType("primary5Y", "", "uint16")); - VerifyOrReturn(CheckConstraintMinValue("primary5Y", primary5Y, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("primary5Y", primary5Y, 65279U)); - NextTest(); + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - CHIP_ERROR TestWriteTheDefaultMandatoryAttributePrimary5Y_96() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - uint16_t primary5YArgument; - primary5YArgument = 0U; - - ReturnErrorOnFailure(cluster.WriteAttribute( - primary5YArgument, this, OnSuccessCallback_96, OnFailureCallback_96)); - return CHIP_NO_ERROR; - } + ~Test_TC_MC_1_9Suite() {} - void OnFailureResponse_96(CHIP_ERROR error) + chip::System::Clock::Timeout GetWaitDuration() const override { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - NextTest(); + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } - void OnSuccessResponse_96() { ThrowSuccessResponse(); } +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; - CHIP_ERROR TestReadBackTheMandatoryAttributePrimary5Y_97() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_97, OnFailureCallback_97, true)); - return CHIP_NO_ERROR; - } + // + // Tests methods + // - void OnFailureResponse_97(CHIP_ERROR error) + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } + bool shouldContinue = false; - void OnSuccessResponse_97(uint16_t primary5Y) - { - VerifyOrReturn(CheckConstraintType("primary5Y", "", "uint16")); - VerifyOrReturn(CheckConstraintMinValue("primary5Y", primary5Y, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("primary5Y", primary5Y, 65279U)); - NextTest(); + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("clusterRevision", value, 1U)); + } + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + } + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "list")); + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } + + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } } - CHIP_ERROR TestReadTheMandatoryAttributePrimary5Intensity_98() + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_98, OnFailureCallback_98, true)); + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "read the global attribute: ClusterRevision"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TargetNavigator::Id, + TargetNavigator::Attributes::ClusterRevision::Id); + } + case 2: { + LogStep(2, "Read the global attribute constraints: ClusterRevision"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TargetNavigator::Id, + TargetNavigator::Attributes::ClusterRevision::Id); + } + case 3: { + LogStep(3, "Read the global attribute: AttributeList"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TargetNavigator::Id, + TargetNavigator::Attributes::AttributeList::Id); + } + } return CHIP_NO_ERROR; } +}; - void OnFailureResponse_98(CHIP_ERROR error) +class Test_TC_MC_1_10Suite : public TestCommand +{ +public: + Test_TC_MC_1_10Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_MC_1_10", 4, credsIssuerConfig) { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - void OnSuccessResponse_98(uint8_t primary5Intensity) - { - VerifyOrReturn(CheckConstraintType("primary5Intensity", "", "uint8")); - NextTest(); - } + ~Test_TC_MC_1_10Suite() {} - CHIP_ERROR TestReadTheMandatoryAttributePrimary6X_99() + chip::System::Clock::Timeout GetWaitDuration() const override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_99, OnFailureCallback_99, true)); - return CHIP_NO_ERROR; + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } - void OnFailureResponse_99(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; - void OnSuccessResponse_99(uint16_t primary6X) - { - VerifyOrReturn(CheckConstraintType("primary6X", "", "uint16")); - VerifyOrReturn(CheckConstraintMinValue("primary6X", primary6X, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("primary6X", primary6X, 65279U)); - NextTest(); - } + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } - CHIP_ERROR TestWriteTheDefaultMandatoryAttributePrimary6X_100() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); + // + // Tests methods + // - uint16_t primary6XArgument; - primary6XArgument = 0U; + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override + { + bool shouldContinue = false; - ReturnErrorOnFailure(cluster.WriteAttribute( - primary6XArgument, this, OnSuccessCallback_100, OnFailureCallback_100)); - return CHIP_NO_ERROR; - } + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("clusterRevision", value, 1U)); + } + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + } + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "list")); + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } - void OnFailureResponse_100(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - NextTest(); + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } } - void OnSuccessResponse_100() { ThrowSuccessResponse(); } - - CHIP_ERROR TestReadBackTheMandatoryAttributePrimary6X_101() + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_101, OnFailureCallback_101, true)); + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "read the global attribute: ClusterRevision"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ApplicationBasic::Id, + ApplicationBasic::Attributes::ClusterRevision::Id); + } + case 2: { + LogStep(2, "Read the global attribute constraints: ClusterRevision"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ApplicationBasic::Id, + ApplicationBasic::Attributes::ClusterRevision::Id); + } + case 3: { + LogStep(3, "Read the global attribute: AttributeList"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ApplicationBasic::Id, + ApplicationBasic::Attributes::AttributeList::Id); + } + } return CHIP_NO_ERROR; } +}; - void OnFailureResponse_101(CHIP_ERROR error) +class Test_TC_MC_1_11Suite : public TestCommand +{ +public: + Test_TC_MC_1_11Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_MC_1_11", 4, credsIssuerConfig) { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - void OnSuccessResponse_101(uint16_t primary6X) - { - VerifyOrReturn(CheckConstraintType("primary6X", "", "uint16")); - VerifyOrReturn(CheckConstraintMinValue("primary6X", primary6X, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("primary6X", primary6X, 65279U)); - NextTest(); - } + ~Test_TC_MC_1_11Suite() {} - CHIP_ERROR TestReadTheMandatoryAttributePrimary6Y_102() + chip::System::Clock::Timeout GetWaitDuration() const override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_102, OnFailureCallback_102, true)); - return CHIP_NO_ERROR; + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } - void OnFailureResponse_102(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; - void OnSuccessResponse_102(uint16_t primary6Y) - { - VerifyOrReturn(CheckConstraintType("primary6Y", "", "uint16")); - VerifyOrReturn(CheckConstraintMinValue("primary6Y", primary6Y, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("primary6Y", primary6Y, 65279U)); - NextTest(); - } + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } - CHIP_ERROR TestWriteTheDefaultMandatoryAttributePrimary6Y_103() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); + // + // Tests methods + // - uint16_t primary6YArgument; - primary6YArgument = 0U; + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override + { + bool shouldContinue = false; - ReturnErrorOnFailure(cluster.WriteAttribute( - primary6YArgument, this, OnSuccessCallback_103, OnFailureCallback_103)); - return CHIP_NO_ERROR; - } + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("clusterRevision", value, 1U)); + } + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + } + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "list")); + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } - void OnFailureResponse_103(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - NextTest(); + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } } - void OnSuccessResponse_103() { ThrowSuccessResponse(); } - - CHIP_ERROR TestReadBackTheMandatoryAttributePrimary6Y_104() + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_104, OnFailureCallback_104, true)); + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "read the global attribute: ClusterRevision"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ContentLauncher::Id, + ContentLauncher::Attributes::ClusterRevision::Id); + } + case 2: { + LogStep(2, "Read the global attribute constraints: ClusterRevision"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ContentLauncher::Id, + ContentLauncher::Attributes::ClusterRevision::Id); + } + case 3: { + LogStep(3, "Read the global attribute: AttributeList"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ContentLauncher::Id, + ContentLauncher::Attributes::AttributeList::Id); + } + } return CHIP_NO_ERROR; } +}; - void OnFailureResponse_104(CHIP_ERROR error) +class Test_TC_MC_1_12Suite : public TestCommand +{ +public: + Test_TC_MC_1_12Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_MC_1_12", 4, credsIssuerConfig) { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - void OnSuccessResponse_104(uint16_t primary6Y) + ~Test_TC_MC_1_12Suite() {} + + chip::System::Clock::Timeout GetWaitDuration() const override { - VerifyOrReturn(CheckConstraintType("primary6Y", "", "uint16")); - VerifyOrReturn(CheckConstraintMinValue("primary6Y", primary6Y, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("primary6Y", primary6Y, 65279U)); - NextTest(); + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } - CHIP_ERROR TestReadTheMandatoryAttributePrimary6Intensity_105() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_105, OnFailureCallback_105, true)); - return CHIP_NO_ERROR; - } + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } - void OnFailureResponse_105(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } + // + // Tests methods + // - void OnSuccessResponse_105(uint8_t primary6Intensity) + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { - VerifyOrReturn(CheckConstraintType("primary6Intensity", "", "uint8")); - NextTest(); - } + bool shouldContinue = false; - CHIP_ERROR TestReadTheOptionalAttributeWhitePointX_106() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("clusterRevision", value, 1U)); + } + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + } + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "list")); + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_106, OnFailureCallback_106, true)); - return CHIP_NO_ERROR; + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } } - void OnFailureResponse_106(CHIP_ERROR error) + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - chip::app::StatusIB status(error); - (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() - : ThrowFailureResponse(error); + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "read the global attribute: ClusterRevision"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), AccountLogin::Id, AccountLogin::Attributes::ClusterRevision::Id); + } + case 2: { + LogStep(2, "Read the global attribute constraints: ClusterRevision"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), AccountLogin::Id, AccountLogin::Attributes::ClusterRevision::Id); + } + case 3: { + LogStep(3, "Read the global attribute: AttributeList"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), AccountLogin::Id, AccountLogin::Attributes::AttributeList::Id); + } + } + return CHIP_NO_ERROR; } +}; - void OnSuccessResponse_106(uint16_t whitePointX) +class Test_TC_MC_2_1Suite : public TestCommand +{ +public: + Test_TC_MC_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_MC_2_1", 2, credsIssuerConfig) { - VerifyOrReturn(CheckConstraintType("whitePointX", "", "uint16")); - VerifyOrReturn(CheckConstraintMinValue("whitePointX", whitePointX, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("whitePointX", whitePointX, 65279U)); - NextTest(); + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - CHIP_ERROR TestWriteTheDefaultOptionalAttributeWhitePointX_107() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - uint16_t whitePointXArgument; - whitePointXArgument = 0U; - - ReturnErrorOnFailure(cluster.WriteAttribute( - whitePointXArgument, this, OnSuccessCallback_107, OnFailureCallback_107)); - return CHIP_NO_ERROR; - } + ~Test_TC_MC_2_1Suite() {} - void OnFailureResponse_107(CHIP_ERROR error) + chip::System::Clock::Timeout GetWaitDuration() const override { - chip::app::StatusIB status(error); - (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() - : ThrowFailureResponse(error); + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } - void OnSuccessResponse_107() { NextTest(); } +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; - CHIP_ERROR TestReadBackTheOptionalAttributeWhitePointX_108() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_108, OnFailureCallback_108, true)); - return CHIP_NO_ERROR; - } + // + // Tests methods + // - void OnFailureResponse_108(CHIP_ERROR error) + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { - chip::app::StatusIB status(error); - (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() - : ThrowFailureResponse(error); - } + bool shouldContinue = false; - void OnSuccessResponse_108(uint16_t whitePointX) - { - VerifyOrReturn(CheckValue("whitePointX", whitePointX, 0U)); + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } - NextTest(); + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } } - CHIP_ERROR TestReadTheOptionalAttributeWhitePointY_109() + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_109, OnFailureCallback_109, true)); + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "Put the device into low power mode"); + chip::app::Clusters::LowPower::Commands::Sleep::Type value; + return SendCommand(kIdentityAlpha, GetEndpoint(1), LowPower::Id, LowPower::Commands::Sleep::Id, value); + } + } return CHIP_NO_ERROR; } +}; - void OnFailureResponse_109(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() - : ThrowFailureResponse(error); - } - - void OnSuccessResponse_109(uint16_t whitePointY) +class Test_TC_MC_3_1Suite : public TestCommand +{ +public: + Test_TC_MC_3_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_MC_3_1", 1, credsIssuerConfig) { - VerifyOrReturn(CheckConstraintType("whitePointY", "", "uint16")); - VerifyOrReturn(CheckConstraintMinValue("whitePointY", whitePointY, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("whitePointY", whitePointY, 65279U)); - NextTest(); + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - CHIP_ERROR TestWriteTheDefaultOptionalAttributeWhitePointY_110() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - uint16_t whitePointYArgument; - whitePointYArgument = 0U; - - ReturnErrorOnFailure(cluster.WriteAttribute( - whitePointYArgument, this, OnSuccessCallback_110, OnFailureCallback_110)); - return CHIP_NO_ERROR; - } + ~Test_TC_MC_3_1Suite() {} - void OnFailureResponse_110(CHIP_ERROR error) + chip::System::Clock::Timeout GetWaitDuration() const override { - chip::app::StatusIB status(error); - (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() - : ThrowFailureResponse(error); + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } - void OnSuccessResponse_110() { NextTest(); } +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; - CHIP_ERROR TestReadBackTheOptionalAttributeWhitePointY_111() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_111, OnFailureCallback_111, true)); - return CHIP_NO_ERROR; - } + // + // Tests methods + // - void OnFailureResponse_111(CHIP_ERROR error) + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { - chip::app::StatusIB status(error); - (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() - : ThrowFailureResponse(error); - } + bool shouldContinue = false; - void OnSuccessResponse_111(uint16_t whitePointY) - { - VerifyOrReturn(CheckValue("whitePointY", whitePointY, 0U)); + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } - NextTest(); + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } } - CHIP_ERROR TestReadTheOptionalAttributeColorPointRX_112() + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_112, OnFailureCallback_112, true)); + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + } return CHIP_NO_ERROR; } +}; - void OnFailureResponse_112(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() - : ThrowFailureResponse(error); - } - - void OnSuccessResponse_112(uint16_t colorPointRX) +class Test_TC_MC_3_2Suite : public TestCommand +{ +public: + Test_TC_MC_3_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_MC_3_2", 1, credsIssuerConfig) { - VerifyOrReturn(CheckConstraintType("colorPointRX", "", "uint16")); - VerifyOrReturn(CheckConstraintMinValue("colorPointRX", colorPointRX, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("colorPointRX", colorPointRX, 65279U)); - NextTest(); + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - CHIP_ERROR TestWriteTheDefaultOptionalAttributeColorPointRX_113() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - uint16_t colorPointRXArgument; - colorPointRXArgument = 0U; - - ReturnErrorOnFailure(cluster.WriteAttribute( - colorPointRXArgument, this, OnSuccessCallback_113, OnFailureCallback_113)); - return CHIP_NO_ERROR; - } + ~Test_TC_MC_3_2Suite() {} - void OnFailureResponse_113(CHIP_ERROR error) + chip::System::Clock::Timeout GetWaitDuration() const override { - chip::app::StatusIB status(error); - (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() - : ThrowFailureResponse(error); + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } - void OnSuccessResponse_113() { NextTest(); } +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; - CHIP_ERROR TestReadBackTheOptionalAttributeColorPointRX_114() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_114, OnFailureCallback_114, true)); - return CHIP_NO_ERROR; - } + // + // Tests methods + // - void OnFailureResponse_114(CHIP_ERROR error) + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { - chip::app::StatusIB status(error); - (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() - : ThrowFailureResponse(error); - } + bool shouldContinue = false; - void OnSuccessResponse_114(uint16_t colorPointRX) - { - VerifyOrReturn(CheckValue("colorPointRX", colorPointRX, 0U)); + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } - NextTest(); + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } } - CHIP_ERROR TestReadTheOptionalAttributeColorPointRY_115() + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_115, OnFailureCallback_115, true)); + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + } return CHIP_NO_ERROR; } +}; - void OnFailureResponse_115(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() - : ThrowFailureResponse(error); - } - - void OnSuccessResponse_115(uint16_t colorPointRY) +class Test_TC_MC_3_3Suite : public TestCommand +{ +public: + Test_TC_MC_3_3Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_MC_3_3", 1, credsIssuerConfig) { - VerifyOrReturn(CheckConstraintType("colorPointRY", "", "uint16")); - VerifyOrReturn(CheckConstraintMinValue("colorPointRY", colorPointRY, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("colorPointRY", colorPointRY, 65279U)); - NextTest(); + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - CHIP_ERROR TestWriteTheDefaultOptionalAttributeColorPointRY_116() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - uint16_t colorPointRYArgument; - colorPointRYArgument = 0U; - - ReturnErrorOnFailure(cluster.WriteAttribute( - colorPointRYArgument, this, OnSuccessCallback_116, OnFailureCallback_116)); - return CHIP_NO_ERROR; - } + ~Test_TC_MC_3_3Suite() {} - void OnFailureResponse_116(CHIP_ERROR error) + chip::System::Clock::Timeout GetWaitDuration() const override { - chip::app::StatusIB status(error); - (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() - : ThrowFailureResponse(error); + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } - void OnSuccessResponse_116() { NextTest(); } +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; - CHIP_ERROR TestReadBackTheOptionalAttributeColorPointRY_117() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_117, OnFailureCallback_117, true)); - return CHIP_NO_ERROR; - } + // + // Tests methods + // - void OnFailureResponse_117(CHIP_ERROR error) + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { - chip::app::StatusIB status(error); - (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() - : ThrowFailureResponse(error); - } + bool shouldContinue = false; - void OnSuccessResponse_117(uint16_t colorPointRY) - { - VerifyOrReturn(CheckValue("colorPointRY", colorPointRY, 0U)); + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } - NextTest(); + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } } - CHIP_ERROR TestReadTheOptionalAttributeColorPointRIntensity_118() + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_118, OnFailureCallback_118, true)); + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + } return CHIP_NO_ERROR; } +}; - void OnFailureResponse_118(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() - : ThrowFailureResponse(error); - } - - void OnSuccessResponse_118(uint8_t colorPointRIntensity) +class Test_TC_MC_3_4Suite : public TestCommand +{ +public: + Test_TC_MC_3_4Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_MC_3_4", 1, credsIssuerConfig) { - VerifyOrReturn(CheckConstraintType("colorPointRIntensity", "", "uint8")); - NextTest(); + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - CHIP_ERROR TestWriteTheDefaultOptionalAttributeColorPointRIntensity_119() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - uint8_t colorPointRIntensityArgument; - colorPointRIntensityArgument = 0; - - ReturnErrorOnFailure(cluster.WriteAttribute( - colorPointRIntensityArgument, this, OnSuccessCallback_119, OnFailureCallback_119)); - return CHIP_NO_ERROR; - } + ~Test_TC_MC_3_4Suite() {} - void OnFailureResponse_119(CHIP_ERROR error) + chip::System::Clock::Timeout GetWaitDuration() const override { - chip::app::StatusIB status(error); - (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() - : ThrowFailureResponse(error); + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } - void OnSuccessResponse_119() { NextTest(); } +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; - CHIP_ERROR TestReadBackTheOptionalAttributeColorPointRIntensity_120() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_120, OnFailureCallback_120, true)); - return CHIP_NO_ERROR; - } + // + // Tests methods + // - void OnFailureResponse_120(CHIP_ERROR error) + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { - chip::app::StatusIB status(error); - (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() - : ThrowFailureResponse(error); - } + bool shouldContinue = false; - void OnSuccessResponse_120(uint8_t colorPointRIntensity) - { - VerifyOrReturn(CheckValue("colorPointRIntensity", colorPointRIntensity, 0)); + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } - NextTest(); + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } } - CHIP_ERROR TestReadTheOptionalAttributeColorPointGX_121() + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_121, OnFailureCallback_121, true)); + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + } return CHIP_NO_ERROR; } +}; - void OnFailureResponse_121(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() - : ThrowFailureResponse(error); - } - - void OnSuccessResponse_121(uint16_t colorPointGX) +class Test_TC_MC_3_5Suite : public TestCommand +{ +public: + Test_TC_MC_3_5Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_MC_3_5", 1, credsIssuerConfig) { - VerifyOrReturn(CheckConstraintType("colorPointGX", "", "uint16")); - VerifyOrReturn(CheckConstraintMinValue("colorPointGX", colorPointGX, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("colorPointGX", colorPointGX, 65279U)); - NextTest(); + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - CHIP_ERROR TestWriteTheDefaultOptionalAttributeColorPointGX_122() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - uint16_t colorPointGXArgument; - colorPointGXArgument = 0U; - - ReturnErrorOnFailure(cluster.WriteAttribute( - colorPointGXArgument, this, OnSuccessCallback_122, OnFailureCallback_122)); - return CHIP_NO_ERROR; - } + ~Test_TC_MC_3_5Suite() {} - void OnFailureResponse_122(CHIP_ERROR error) + chip::System::Clock::Timeout GetWaitDuration() const override { - chip::app::StatusIB status(error); - (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() - : ThrowFailureResponse(error); + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } - void OnSuccessResponse_122() { NextTest(); } +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; - CHIP_ERROR TestReadBackTheOptionalAttributeColorPointGX_123() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_123, OnFailureCallback_123, true)); - return CHIP_NO_ERROR; - } + // + // Tests methods + // - void OnFailureResponse_123(CHIP_ERROR error) + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { - chip::app::StatusIB status(error); - (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() - : ThrowFailureResponse(error); - } + bool shouldContinue = false; - void OnSuccessResponse_123(uint16_t colorPointGX) - { - VerifyOrReturn(CheckValue("colorPointGX", colorPointGX, 0U)); + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } - NextTest(); + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } } - CHIP_ERROR TestReadTheOptionalAttributeColorPointGY_124() + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_124, OnFailureCallback_124, true)); + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + } return CHIP_NO_ERROR; } +}; - void OnFailureResponse_124(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() - : ThrowFailureResponse(error); - } - - void OnSuccessResponse_124(uint16_t colorPointGY) +class Test_TC_MC_3_6Suite : public TestCommand +{ +public: + Test_TC_MC_3_6Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_MC_3_6", 1, credsIssuerConfig) { - VerifyOrReturn(CheckConstraintType("colorPointGY", "", "uint16")); - VerifyOrReturn(CheckConstraintMinValue("colorPointGY", colorPointGY, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("colorPointGY", colorPointGY, 65279U)); - NextTest(); + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - CHIP_ERROR TestWriteTheDefaultOptionalAttributeColorPointGY_125() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - uint16_t colorPointGYArgument; - colorPointGYArgument = 0U; - - ReturnErrorOnFailure(cluster.WriteAttribute( - colorPointGYArgument, this, OnSuccessCallback_125, OnFailureCallback_125)); - return CHIP_NO_ERROR; - } + ~Test_TC_MC_3_6Suite() {} - void OnFailureResponse_125(CHIP_ERROR error) + chip::System::Clock::Timeout GetWaitDuration() const override { - chip::app::StatusIB status(error); - (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() - : ThrowFailureResponse(error); + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } - void OnSuccessResponse_125() { NextTest(); } +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; - CHIP_ERROR TestReadBackTheOptionalAttributeColorPointGY_126() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_126, OnFailureCallback_126, true)); - return CHIP_NO_ERROR; - } + // + // Tests methods + // - void OnFailureResponse_126(CHIP_ERROR error) + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { - chip::app::StatusIB status(error); - (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() - : ThrowFailureResponse(error); - } + bool shouldContinue = false; - void OnSuccessResponse_126(uint16_t colorPointGY) - { - VerifyOrReturn(CheckValue("colorPointGY", colorPointGY, 0U)); + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } - NextTest(); + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } } - CHIP_ERROR TestReadTheOptionalAttributeColorPointGIntensity_127() + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_127, OnFailureCallback_127, true)); + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + } return CHIP_NO_ERROR; } +}; - void OnFailureResponse_127(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() - : ThrowFailureResponse(error); - } - - void OnSuccessResponse_127(uint8_t colorPointGIntensity) +class Test_TC_MC_3_7Suite : public TestCommand +{ +public: + Test_TC_MC_3_7Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_MC_3_7", 1, credsIssuerConfig) { - VerifyOrReturn(CheckConstraintType("colorPointGIntensity", "", "uint8")); - NextTest(); + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - CHIP_ERROR TestWriteTheDefaultOptionalAttributeColorPointGIntensity_128() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - uint8_t colorPointGIntensityArgument; - colorPointGIntensityArgument = 0; - - ReturnErrorOnFailure(cluster.WriteAttribute( - colorPointGIntensityArgument, this, OnSuccessCallback_128, OnFailureCallback_128)); - return CHIP_NO_ERROR; - } + ~Test_TC_MC_3_7Suite() {} - void OnFailureResponse_128(CHIP_ERROR error) + chip::System::Clock::Timeout GetWaitDuration() const override { - chip::app::StatusIB status(error); - (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() - : ThrowFailureResponse(error); + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } - void OnSuccessResponse_128() { NextTest(); } +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; - CHIP_ERROR TestReadBackTheOptionalAttributeColorPointGIntensity_129() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_129, OnFailureCallback_129, true)); - return CHIP_NO_ERROR; - } + // + // Tests methods + // - void OnFailureResponse_129(CHIP_ERROR error) + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { - chip::app::StatusIB status(error); - (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() - : ThrowFailureResponse(error); - } + bool shouldContinue = false; - void OnSuccessResponse_129(uint8_t colorPointGIntensity) - { - VerifyOrReturn(CheckValue("colorPointGIntensity", colorPointGIntensity, 0)); + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } - NextTest(); + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } } - CHIP_ERROR TestReadTheOptionalAttributeColorPointBX_130() + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_130, OnFailureCallback_130, true)); + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + } return CHIP_NO_ERROR; } +}; - void OnFailureResponse_130(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() - : ThrowFailureResponse(error); - } - - void OnSuccessResponse_130(uint16_t colorPointBX) +class Test_TC_MC_3_8Suite : public TestCommand +{ +public: + Test_TC_MC_3_8Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_MC_3_8", 1, credsIssuerConfig) { - VerifyOrReturn(CheckConstraintType("colorPointBX", "", "uint16")); - VerifyOrReturn(CheckConstraintMinValue("colorPointBX", colorPointBX, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("colorPointBX", colorPointBX, 65279U)); - NextTest(); + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - CHIP_ERROR TestWriteTheDefaultOptionalAttributeColorPointBX_131() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - uint16_t colorPointBXArgument; - colorPointBXArgument = 0U; - - ReturnErrorOnFailure(cluster.WriteAttribute( - colorPointBXArgument, this, OnSuccessCallback_131, OnFailureCallback_131)); - return CHIP_NO_ERROR; - } + ~Test_TC_MC_3_8Suite() {} - void OnFailureResponse_131(CHIP_ERROR error) + chip::System::Clock::Timeout GetWaitDuration() const override { - chip::app::StatusIB status(error); - (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() - : ThrowFailureResponse(error); + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } - void OnSuccessResponse_131() { NextTest(); } +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; - CHIP_ERROR TestReadBackTheOptionalAttributeColorPointBX_132() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_132, OnFailureCallback_132, true)); - return CHIP_NO_ERROR; - } + // + // Tests methods + // - void OnFailureResponse_132(CHIP_ERROR error) + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { - chip::app::StatusIB status(error); - (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() - : ThrowFailureResponse(error); - } + bool shouldContinue = false; - void OnSuccessResponse_132(uint16_t colorPointBX) - { - VerifyOrReturn(CheckValue("colorPointBX", colorPointBX, 0U)); + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } - NextTest(); + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } } - CHIP_ERROR TestReadTheOptionalAttributeColorPointBY_133() + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_133, OnFailureCallback_133, true)); + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + } return CHIP_NO_ERROR; } +}; - void OnFailureResponse_133(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() - : ThrowFailureResponse(error); - } - - void OnSuccessResponse_133(uint16_t colorPointBY) +class Test_TC_MC_3_9Suite : public TestCommand +{ +public: + Test_TC_MC_3_9Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_MC_3_9", 1, credsIssuerConfig) { - VerifyOrReturn(CheckConstraintType("colorPointBY", "", "uint16")); - VerifyOrReturn(CheckConstraintMinValue("colorPointBY", colorPointBY, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("colorPointBY", colorPointBY, 65279U)); - NextTest(); + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - CHIP_ERROR TestWriteTheDefaultOptionalAttributeColorPointBY_134() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - uint16_t colorPointBYArgument; - colorPointBYArgument = 0U; - - ReturnErrorOnFailure(cluster.WriteAttribute( - colorPointBYArgument, this, OnSuccessCallback_134, OnFailureCallback_134)); - return CHIP_NO_ERROR; - } + ~Test_TC_MC_3_9Suite() {} - void OnFailureResponse_134(CHIP_ERROR error) + chip::System::Clock::Timeout GetWaitDuration() const override { - chip::app::StatusIB status(error); - (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() - : ThrowFailureResponse(error); + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } - void OnSuccessResponse_134() { NextTest(); } +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; - CHIP_ERROR TestReadBackTheOptionalAttributeColorPointBY_135() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_135, OnFailureCallback_135, true)); - return CHIP_NO_ERROR; - } + // + // Tests methods + // - void OnFailureResponse_135(CHIP_ERROR error) + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { - chip::app::StatusIB status(error); - (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() - : ThrowFailureResponse(error); - } + bool shouldContinue = false; - void OnSuccessResponse_135(uint16_t colorPointBY) - { - VerifyOrReturn(CheckValue("colorPointBY", colorPointBY, 0U)); + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } - NextTest(); + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } } - CHIP_ERROR TestReadTheOptionalAttributeColorPointBIntensity_136() + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_136, OnFailureCallback_136, true)); + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + } return CHIP_NO_ERROR; } +}; - void OnFailureResponse_136(CHIP_ERROR error) +class Test_TC_MC_3_10Suite : public TestCommand +{ +public: + Test_TC_MC_3_10Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_MC_3_10", 1, credsIssuerConfig) { - chip::app::StatusIB status(error); - (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() - : ThrowFailureResponse(error); + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - void OnSuccessResponse_136(uint8_t colorPointBIntensity) - { - VerifyOrReturn(CheckConstraintType("colorPointBIntensity", "", "uint8")); - NextTest(); - } + ~Test_TC_MC_3_10Suite() {} - CHIP_ERROR TestWriteTheDefaultOptionalAttributeColorPointBIntensity_137() + chip::System::Clock::Timeout GetWaitDuration() const override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - uint8_t colorPointBIntensityArgument; - colorPointBIntensityArgument = 0; - - ReturnErrorOnFailure(cluster.WriteAttribute( - colorPointBIntensityArgument, this, OnSuccessCallback_137, OnFailureCallback_137)); - return CHIP_NO_ERROR; + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } - void OnFailureResponse_137(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() - : ThrowFailureResponse(error); - } +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } - void OnSuccessResponse_137() { NextTest(); } + // + // Tests methods + // - CHIP_ERROR TestReadBackTheOptionalAttributeColorPointBIntensity_138() + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); + bool shouldContinue = false; - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_138, OnFailureCallback_138, true)); - return CHIP_NO_ERROR; - } + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } - void OnFailureResponse_138(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() - : ThrowFailureResponse(error); + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } } - void OnSuccessResponse_138(uint8_t colorPointBIntensity) + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - VerifyOrReturn(CheckValue("colorPointBIntensity", colorPointBIntensity, 0)); - - NextTest(); + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + } + return CHIP_NO_ERROR; } }; -class Test_TC_CC_3_1Suite : public TestCommand +class Test_TC_MC_3_11Suite : public TestCommand { public: - Test_TC_CC_3_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_CC_3_1", credsIssuerConfig), mTestIndex(0) + Test_TC_MC_3_11Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_MC_3_11", 1, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -9482,96 +14167,90 @@ class Test_TC_CC_3_1Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_CC_3_1Suite() {} + ~Test_TC_MC_3_11Suite() {} - /////////// TestCommand Interface ///////// - void NextTest() override + chip::System::Clock::Timeout GetWaitDuration() const override { - CHIP_ERROR err = CHIP_NO_ERROR; + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_CC_3_1\n"); - } +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_CC_3_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // - Wait(); + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override + { + bool shouldContinue = false; - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) + switch (mTestIndex - 1) { case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Turn on light for color control tests\n"); - err = TestTurnOnLightForColorControlTests_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Check on/off attribute value is true after on command\n"); - err = TestCheckOnOffAttributeValueIsTrueAfterOnCommand_2(); - break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Reads CurrentHue attribute from DUT.\n"); - err = TestReadsCurrentHueAttributeFromDut_3(); - break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Move to hue shortest distance command\n"); - err = TestMoveToHueShortestDistanceCommand_4(); - break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Move to hue longest distance command\n"); - err = TestMoveToHueLongestDistanceCommand_5(); - break; - case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : Move to hue up command\n"); - err = TestMoveToHueUpCommand_6(); - break; - case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : Move to hue down command\n"); - err = TestMoveToHueDownCommand_7(); - break; - case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : Turn off light that we turned on\n"); - err = TestTurnOffLightThatWeTurnedOn_8(); - break; - case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : Check on/off attribute value is false after off command\n"); - err = TestCheckOnOffAttributeValueIsFalseAfterOffCommand_9(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } + + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); } + } - if (CHIP_NO_ERROR != err) + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } } + return CHIP_NO_ERROR; + } +}; + +class Test_TC_MC_5_1Suite : public TestCommand +{ +public: + Test_TC_MC_5_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_MC_5_1", 2, credsIssuerConfig) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } + ~Test_TC_MC_5_1Suite() {} + chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 10; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -9582,6 +14261,14 @@ class Test_TC_CC_3_1Suite : public TestCommand VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); shouldContinue = true; break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "list")); + } + break; default: LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); } @@ -9592,307 +14279,290 @@ class Test_TC_CC_3_1Suite : public TestCommand } } - static void OnFailureCallback_2(void * context, CHIP_ERROR error) + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - (static_cast(context))->OnFailureResponse_2(error); + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "Reads the ChannelList attribute from the DUT"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Channel::Id, Channel::Attributes::ChannelList::Id); + } + } + return CHIP_NO_ERROR; } +}; - static void OnSuccessCallback_2(void * context, bool onOff) +class Test_TC_MC_5_2Suite : public TestCommand +{ +public: + Test_TC_MC_5_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_MC_5_2", 2, credsIssuerConfig) { - (static_cast(context))->OnSuccessResponse_2(onOff); + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - static void OnFailureCallback_3(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_3(error); - } + ~Test_TC_MC_5_2Suite() {} - static void OnSuccessCallback_3(void * context, uint8_t currentHue) + chip::System::Clock::Timeout GetWaitDuration() const override { - (static_cast(context))->OnSuccessResponse_3(currentHue); + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } - static void OnFailureCallback_9(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_9(error); - } +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; - static void OnSuccessCallback_9(void * context, bool onOff) - { - (static_cast(context))->OnSuccessResponse_9(onOff); - } + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } // // Tests methods // - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestTurnOnLightForColorControlTests_1() + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::OnOff::Commands::On::Type; - - RequestType request; + bool shouldContinue = false; - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_1(); - }; + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_1(error); - }; + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } + } - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "log a command"); + SetIdentity(kIdentityAlpha); + return UserPrompt("verify that the channel has changed on the device."); + } + } return CHIP_NO_ERROR; } +}; - void OnFailureResponse_1(CHIP_ERROR error) +class Test_TC_MC_5_3Suite : public TestCommand +{ +public: + Test_TC_MC_5_3Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_MC_5_3", 2, credsIssuerConfig) { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - void OnSuccessResponse_1() { NextTest(); } + ~Test_TC_MC_5_3Suite() {} - CHIP_ERROR TestCheckOnOffAttributeValueIsTrueAfterOnCommand_2() + chip::System::Clock::Timeout GetWaitDuration() const override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::OnOffClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_2, OnFailureCallback_2, true)); - return CHIP_NO_ERROR; + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } - void OnFailureResponse_2(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; - void OnSuccessResponse_2(bool onOff) - { - VerifyOrReturn(CheckValue("onOff", onOff, 1)); + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } - NextTest(); - } + // + // Tests methods + // - CHIP_ERROR TestReadsCurrentHueAttributeFromDut_3() + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_3, OnFailureCallback_3, true)); - return CHIP_NO_ERROR; - } + bool shouldContinue = false; - void OnFailureResponse_3(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } - void OnSuccessResponse_3(uint8_t currentHue) - { - VerifyOrReturn(CheckConstraintType("currentHue", "", "uint8")); - VerifyOrReturn(CheckConstraintMinValue("currentHue", currentHue, 0)); - VerifyOrReturn(CheckConstraintMaxValue("currentHue", currentHue, 254)); - NextTest(); + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } } - CHIP_ERROR TestMoveToHueShortestDistanceCommand_4() + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::ColorControl::Commands::MoveToHue::Type; - - RequestType request; - request.hue = 150; - request.direction = static_cast(0); - request.transitionTime = 300U; - request.optionsMask = 0; - request.optionsOverride = 0; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_4(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_4(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "log a command"); + SetIdentity(kIdentityAlpha); + return UserPrompt("verify that the channel has changed on the device"); + } + } return CHIP_NO_ERROR; } +}; - void OnFailureResponse_4(CHIP_ERROR error) +class Test_TC_MC_6_1Suite : public TestCommand +{ +public: + Test_TC_MC_6_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_MC_6_1", 6, credsIssuerConfig) { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - void OnSuccessResponse_4() { NextTest(); } + ~Test_TC_MC_6_1Suite() {} - CHIP_ERROR TestMoveToHueLongestDistanceCommand_5() + chip::System::Clock::Timeout GetWaitDuration() const override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::ColorControl::Commands::MoveToHue::Type; - - RequestType request; - request.hue = 200; - request.direction = static_cast(1); - request.transitionTime = 300U; - request.optionsMask = 0; - request.optionsOverride = 0; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_5(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_5(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } - void OnFailureResponse_5(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_5() { NextTest(); } - - CHIP_ERROR TestMoveToHueUpCommand_6() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::ColorControl::Commands::MoveToHue::Type; - - RequestType request; - request.hue = 250; - request.direction = static_cast(2); - request.transitionTime = 300U; - request.optionsMask = 0; - request.optionsOverride = 0; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_6(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_6(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_6(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_6() { NextTest(); } - - CHIP_ERROR TestMoveToHueDownCommand_7() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::ColorControl::Commands::MoveToHue::Type; - - RequestType request; - request.hue = 225; - request.direction = static_cast(3); - request.transitionTime = 300U; - request.optionsMask = 0; - request.optionsOverride = 0; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_7(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_7(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; - void OnFailureResponse_7(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } - void OnSuccessResponse_7() { NextTest(); } + // + // Tests methods + // - CHIP_ERROR TestTurnOffLightThatWeTurnedOn_8() + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::OnOff::Commands::Off::Type; - - RequestType request; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_8(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_8(error); - }; + bool shouldContinue = false; - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::MediaPlayback::PlaybackStateEnum value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("currentState", value, 0)); + } + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } - void OnFailureResponse_8(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } } - void OnSuccessResponse_8() { NextTest(); } - - CHIP_ERROR TestCheckOnOffAttributeValueIsFalseAfterOffCommand_9() + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::OnOffClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_9, OnFailureCallback_9, true)); + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "log a command"); + SetIdentity(kIdentityAlpha); + return UserPrompt("Verify that media is paused"); + } + case 2: { + LogStep(2, "log a command"); + SetIdentity(kIdentityAlpha); + return UserPrompt("Physically verify that the media is playing"); + } + case 3: { + LogStep(3, "Reads the playback state attribute"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), MediaPlayback::Id, MediaPlayback::Attributes::CurrentState::Id); + } + case 4: { + LogStep(4, "log a command"); + SetIdentity(kIdentityAlpha); + return UserPrompt("Physically verify that the media is paused"); + } + case 5: { + LogStep(5, "log a command"); + SetIdentity(kIdentityAlpha); + return UserPrompt("Physically verify that the media is stoped"); + } + } return CHIP_NO_ERROR; } - - void OnFailureResponse_9(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_9(bool onOff) - { - VerifyOrReturn(CheckValue("onOff", onOff, 0)); - - NextTest(); - } }; -class Test_TC_CC_3_2Suite : public TestCommand +class Test_TC_MC_6_2Suite : public TestCommand { public: - Test_TC_CC_3_2Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_CC_3_2", credsIssuerConfig), mTestIndex(0) + Test_TC_MC_6_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_MC_6_2", 9, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -9900,92 +14570,165 @@ class Test_TC_CC_3_2Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_CC_3_2Suite() {} + ~Test_TC_MC_6_2Suite() {} - /////////// TestCommand Interface ///////// - void NextTest() override + chip::System::Clock::Timeout GetWaitDuration() const override { - CHIP_ERROR err = CHIP_NO_ERROR; + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_CC_3_2\n"); - } +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_CC_3_2\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // - Wait(); + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override + { + bool shouldContinue = false; - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) + switch (mTestIndex - 1) { case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; break; case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Turn on light for color control tests\n"); - err = TestTurnOnLightForColorControlTests_1(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; break; case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Check on/off attribute value is true after on command\n"); - err = TestCheckOnOffAttributeValueIsTrueAfterOnCommand_2(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; break; case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Move hue up command\n"); - err = TestMoveHueUpCommand_3(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::MediaPlayback::PlaybackStateEnum value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("currentState", value, 0)); + } break; case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Move hue stop command\n"); - err = TestMoveHueStopCommand_4(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; break; case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Move hue down command\n"); - err = TestMoveHueDownCommand_5(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; break; case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : Move hue stop command\n"); - err = TestMoveHueStopCommand_6(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; break; case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : Turn off light that we turned on\n"); - err = TestTurnOffLightThatWeTurnedOn_7(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; break; case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : Check on/off attribute value is false after off command\n"); - err = TestCheckOnOffAttributeValueIsFalseAfterOffCommand_8(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } + + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); } + } - if (CHIP_NO_ERROR != err) + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "log a command"); + SetIdentity(kIdentityAlpha); + return UserPrompt("Verify that media is paused"); + } + case 2: { + LogStep(2, "log a command"); + SetIdentity(kIdentityAlpha); + return UserPrompt("Physically verify that the media is playing"); + } + case 3: { + LogStep(3, "Reads the CurrentState attribute"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), MediaPlayback::Id, MediaPlayback::Attributes::CurrentState::Id); + } + case 4: { + LogStep(4, "log a command"); + SetIdentity(kIdentityAlpha); + return UserPrompt("Physically verify that the media is started over"); + } + case 5: { + LogStep(5, "log a command"); + SetIdentity(kIdentityAlpha); + return UserPrompt("Verify that the next media item in the queue has been loaded"); + } + case 6: { + LogStep(6, "log a command"); + SetIdentity(kIdentityAlpha); + return UserPrompt("Verify that the previous media item in the queue has been loaded"); } + case 7: { + LogStep(7, "log a command"); + SetIdentity(kIdentityAlpha); + return UserPrompt("Verify that the media has skipped forward 10 seconds"); + } + case 8: { + LogStep(8, "log a command"); + SetIdentity(kIdentityAlpha); + return UserPrompt("Verify that the media has skipped backward 10 seconds"); + } + } + return CHIP_NO_ERROR; + } +}; + +class Test_TC_MC_6_3Suite : public TestCommand +{ +public: + Test_TC_MC_6_3Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_MC_6_3", 4, credsIssuerConfig) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } + ~Test_TC_MC_6_3Suite() {} + chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 9; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -9996,6 +14739,18 @@ class Test_TC_CC_3_2Suite : public TestCommand VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); shouldContinue = true; break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; default: LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); } @@ -10006,268 +14761,325 @@ class Test_TC_CC_3_2Suite : public TestCommand } } - static void OnFailureCallback_2(void * context, CHIP_ERROR error) + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - (static_cast(context))->OnFailureResponse_2(error); + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "log a command"); + SetIdentity(kIdentityAlpha); + return UserPrompt("Verify that media is paused"); + } + case 2: { + LogStep(2, "log a command"); + SetIdentity(kIdentityAlpha); + return UserPrompt("Verify that the media has moved to 10 seconds from the starting point."); + } + case 3: { + LogStep(3, "log a command"); + SetIdentity(kIdentityAlpha); + return UserPrompt("User prompt needed to enter the value beyond the furthest valid position"); + } + } + return CHIP_NO_ERROR; } +}; - static void OnSuccessCallback_2(void * context, bool onOff) +class Test_TC_MC_6_4Suite : public TestCommand +{ +public: + Test_TC_MC_6_4Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_MC_6_4", 10, credsIssuerConfig) { - (static_cast(context))->OnSuccessResponse_2(onOff); + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - static void OnFailureCallback_8(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_8(error); - } + ~Test_TC_MC_6_4Suite() {} - static void OnSuccessCallback_8(void * context, bool onOff) + chip::System::Clock::Timeout GetWaitDuration() const override { - (static_cast(context))->OnSuccessResponse_8(onOff); + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + // // Tests methods // - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestTurnOnLightForColorControlTests_1() + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::OnOff::Commands::On::Type; - - RequestType request; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_1(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_1(error); - }; + bool shouldContinue = false; - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + float value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("playbackSpeed", value, 0.0f)); + } + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::MediaPlayback::PlaybackStateEnum value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("currentState", value, 0)); + } + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::MediaPlayback::PlaybackStateEnum value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("currentState", value, 0)); + } + break; + case 8: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 9: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } } - void OnSuccessResponse_1() { NextTest(); } - - CHIP_ERROR TestCheckOnOffAttributeValueIsTrueAfterOnCommand_2() + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::OnOffClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_2, OnFailureCallback_2, true)); + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "log a command"); + SetIdentity(kIdentityAlpha); + return UserPrompt("Verify that media is paused"); + } + case 2: { + LogStep(2, "Reads the PlaybackSpeed attribute from the DUT"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), MediaPlayback::Id, MediaPlayback::Attributes::PlaybackSpeed::Id); + } + case 3: { + LogStep(3, "log a command"); + SetIdentity(kIdentityAlpha); + return UserPrompt("Verify that the media is playing"); + } + case 4: { + LogStep(4, "Reads the CurrentState attribute"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), MediaPlayback::Id, MediaPlayback::Attributes::CurrentState::Id); + } + case 5: { + LogStep(5, "log a command"); + SetIdentity(kIdentityAlpha); + return UserPrompt("Verify that the media play speed has increased"); + } + case 6: { + LogStep(6, "log a command"); + SetIdentity(kIdentityAlpha); + return UserPrompt("Verify that the media play has reversed direction"); + } + case 7: { + LogStep(7, "Reads the CurrentState attribute"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), MediaPlayback::Id, MediaPlayback::Attributes::CurrentState::Id); + } + case 8: { + LogStep(8, "log a command"); + SetIdentity(kIdentityAlpha); + return UserPrompt("Verify that the media play has reversed direction"); + } + case 9: { + LogStep(9, "log a command"); + SetIdentity(kIdentityAlpha); + return UserPrompt("Verify that the media is has resumed playing forward at the default speed"); + } + } return CHIP_NO_ERROR; } +}; - void OnFailureResponse_2(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_2(bool onOff) +class Test_TC_MC_7_1Suite : public TestCommand +{ +public: + Test_TC_MC_7_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_MC_7_1", 1, credsIssuerConfig) { - VerifyOrReturn(CheckValue("onOff", onOff, 1)); - - NextTest(); + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - CHIP_ERROR TestMoveHueUpCommand_3() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::ColorControl::Commands::MoveHue::Type; - - RequestType request; - request.moveMode = static_cast(1); - request.rate = 50; - request.optionsMask = 0; - request.optionsOverride = 0; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_3(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_3(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } + ~Test_TC_MC_7_1Suite() {} - void OnFailureResponse_3(CHIP_ERROR error) + chip::System::Clock::Timeout GetWaitDuration() const override { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } - void OnSuccessResponse_3() { NextTest(); } - - CHIP_ERROR TestMoveHueStopCommand_4() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::ColorControl::Commands::MoveHue::Type; - - RequestType request; - request.moveMode = static_cast(0); - request.rate = 50; - request.optionsMask = 0; - request.optionsOverride = 0; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_4(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_4(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; - void OnFailureResponse_4(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } - void OnSuccessResponse_4() { NextTest(); } + // + // Tests methods + // - CHIP_ERROR TestMoveHueDownCommand_5() + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::ColorControl::Commands::MoveHue::Type; - - RequestType request; - request.moveMode = static_cast(3); - request.rate = 50; - request.optionsMask = 0; - request.optionsOverride = 0; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_5(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_5(error); - }; + bool shouldContinue = false; - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } - void OnFailureResponse_5(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } } - void OnSuccessResponse_5() { NextTest(); } - - CHIP_ERROR TestMoveHueStopCommand_6() + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::ColorControl::Commands::MoveHue::Type; - - RequestType request; - request.moveMode = static_cast(0); - request.rate = 50; - request.optionsMask = 0; - request.optionsOverride = 0; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_6(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_6(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + } return CHIP_NO_ERROR; } +}; - void OnFailureResponse_6(CHIP_ERROR error) +class Test_TC_MC_7_2Suite : public TestCommand +{ +public: + Test_TC_MC_7_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_MC_7_2", 1, credsIssuerConfig) { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - void OnSuccessResponse_6() { NextTest(); } + ~Test_TC_MC_7_2Suite() {} - CHIP_ERROR TestTurnOffLightThatWeTurnedOn_7() + chip::System::Clock::Timeout GetWaitDuration() const override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::OnOff::Commands::Off::Type; - - RequestType request; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_7(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_7(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } - void OnFailureResponse_7(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; - void OnSuccessResponse_7() { NextTest(); } + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // - CHIP_ERROR TestCheckOnOffAttributeValueIsFalseAfterOffCommand_8() + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::OnOffClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); + bool shouldContinue = false; - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_8, OnFailureCallback_8, true)); - return CHIP_NO_ERROR; - } + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } - void OnFailureResponse_8(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } } - void OnSuccessResponse_8(bool onOff) + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - VerifyOrReturn(CheckValue("onOff", onOff, 0)); - - NextTest(); + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + } + return CHIP_NO_ERROR; } }; -class Test_TC_CC_3_3Suite : public TestCommand +class Test_TC_MC_8_1Suite : public TestCommand { public: - Test_TC_CC_3_3Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_CC_3_3", credsIssuerConfig), mTestIndex(0) + Test_TC_MC_8_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_MC_8_1", 3, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -10275,69 +15087,7 @@ class Test_TC_CC_3_3Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_CC_3_3Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_CC_3_3\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_CC_3_3\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Turn on light for color control tests\n"); - err = TestTurnOnLightForColorControlTests_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Check on/off attribute value is true after on command\n"); - err = TestCheckOnOffAttributeValueIsTrueAfterOnCommand_2(); - break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Step hue up command\n"); - err = TestStepHueUpCommand_3(); - break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Step hue down command\n"); - err = TestStepHueDownCommand_4(); - break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Turn off light that we turned on\n"); - err = TestTurnOffLightThatWeTurnedOn_5(); - break; - case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : Check on/off attribute value is false after off command\n"); - err = TestCheckOnOffAttributeValueIsFalseAfterOffCommand_6(); - break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } + ~Test_TC_MC_8_1Suite() {} chip::System::Clock::Timeout GetWaitDuration() const override { @@ -10345,14 +15095,17 @@ class Test_TC_CC_3_3Suite : public TestCommand } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 7; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -10363,6 +15116,22 @@ class Test_TC_CC_3_3Suite : public TestCommand VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); shouldContinue = true; break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint8")); + } + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "list")); + } + break; default: LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); } @@ -10373,208 +15142,277 @@ class Test_TC_CC_3_3Suite : public TestCommand } } - static void OnFailureCallback_2(void * context, CHIP_ERROR error) + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - (static_cast(context))->OnFailureResponse_2(error); + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "Reads the CurrentTarget attribute"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TargetNavigator::Id, + TargetNavigator::Attributes::CurrentTarget::Id); + } + case 2: { + LogStep(2, "Reads the TargetList attribute"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TargetNavigator::Id, TargetNavigator::Attributes::TargetList::Id); + } + } + return CHIP_NO_ERROR; } +}; - static void OnSuccessCallback_2(void * context, bool onOff) +class Test_TC_MC_9_1Suite : public TestCommand +{ +public: + Test_TC_MC_9_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_MC_9_1", 8, credsIssuerConfig) { - (static_cast(context))->OnSuccessResponse_2(onOff); + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - static void OnFailureCallback_6(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_6(error); - } + ~Test_TC_MC_9_1Suite() {} - static void OnSuccessCallback_6(void * context, bool onOff) + chip::System::Clock::Timeout GetWaitDuration() const override { - (static_cast(context))->OnSuccessResponse_6(onOff); + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + // // Tests methods // - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestTurnOnLightForColorControlTests_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::OnOff::Commands::On::Type; - - RequestType request; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_1(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_1(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_1() { NextTest(); } - - CHIP_ERROR TestCheckOnOffAttributeValueIsTrueAfterOnCommand_2() + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::OnOffClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_2, OnFailureCallback_2, true)); - return CHIP_NO_ERROR; - } + bool shouldContinue = false; - void OnFailureResponse_2(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_2(bool onOff) - { - VerifyOrReturn(CheckValue("onOff", onOff, 1)); + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::CharSpan value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "string")); + VerifyOrReturn(CheckConstraintMaxLength("value", value.size(), 32)); + } + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "vendor-id")); + } + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::CharSpan value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "string")); + VerifyOrReturn(CheckConstraintMaxLength("value", value.size(), 256)); + } + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + } + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::ApplicationBasic::ApplicationStatusEnum value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("status", value, 0)); + } + break; + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::CharSpan value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "string")); + VerifyOrReturn(CheckConstraintMaxLength("value", value.size(), 32)); + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } - NextTest(); + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } } - CHIP_ERROR TestStepHueUpCommand_3() + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::ColorControl::Commands::StepHue::Type; - - RequestType request; - request.stepMode = static_cast(1); - request.stepSize = 5; - request.transitionTime = 25; - request.optionsMask = 0; - request.optionsOverride = 0; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_3(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_3(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "Precondition"); + SetIdentity(kIdentityAlpha); + return Log("DUT has one or more Content Apps available"); + } + case 2: { + LogStep(2, "Reads the VendorName attribute"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ApplicationBasic::Id, + ApplicationBasic::Attributes::VendorName::Id); + } + case 3: { + LogStep(3, "Reads the VendorID attribute"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ApplicationBasic::Id, ApplicationBasic::Attributes::VendorID::Id); + } + case 4: { + LogStep(4, "Reads the ApplicationName attribute"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ApplicationBasic::Id, + ApplicationBasic::Attributes::ApplicationName::Id); + } + case 5: { + LogStep(5, "Reads the ProductID attribute"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ApplicationBasic::Id, ApplicationBasic::Attributes::ProductID::Id); + } + case 6: { + LogStep(6, "Reads the Status attribute"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ApplicationBasic::Id, ApplicationBasic::Attributes::Status::Id); + } + case 7: { + LogStep(7, "Reads the ApplicationVersion attribute"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ApplicationBasic::Id, + ApplicationBasic::Attributes::ApplicationVersion::Id); + } + } return CHIP_NO_ERROR; } +}; - void OnFailureResponse_3(CHIP_ERROR error) +class Test_TC_MC_10_1Suite : public TestCommand +{ +public: + Test_TC_MC_10_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_MC_10_1", 3, credsIssuerConfig) { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - void OnSuccessResponse_3() { NextTest(); } - - CHIP_ERROR TestStepHueDownCommand_4() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::ColorControl::Commands::StepHue::Type; - - RequestType request; - request.stepMode = static_cast(3); - request.stepSize = 5; - request.transitionTime = 25; - request.optionsMask = 0; - request.optionsOverride = 0; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_4(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_4(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } + ~Test_TC_MC_10_1Suite() {} - void OnFailureResponse_4(CHIP_ERROR error) + chip::System::Clock::Timeout GetWaitDuration() const override { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } - void OnSuccessResponse_4() { NextTest(); } - - CHIP_ERROR TestTurnOffLightThatWeTurnedOn_5() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::OnOff::Commands::Off::Type; - - RequestType request; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_5(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_5(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; - void OnFailureResponse_5(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } - void OnSuccessResponse_5() { NextTest(); } + // + // Tests methods + // - CHIP_ERROR TestCheckOnOffAttributeValueIsFalseAfterOffCommand_6() + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::OnOffClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); + bool shouldContinue = false; - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_6, OnFailureCallback_6, true)); - return CHIP_NO_ERROR; - } + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "list")); + } + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "map32")); + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } - void OnFailureResponse_6(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } } - void OnSuccessResponse_6(bool onOff) + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - VerifyOrReturn(CheckValue("onOff", onOff, 0)); - - NextTest(); + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "TH reads the AcceptHeader attribute from the DUT"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ContentLauncher::Id, + ContentLauncher::Attributes::AcceptHeader::Id); + } + case 2: { + LogStep(2, "TH reads the SupportedStreamingProtocols attribute from the DUT"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ContentLauncher::Id, + ContentLauncher::Attributes::SupportedStreamingProtocols::Id); + } + } + return CHIP_NO_ERROR; } }; -class Test_TC_CC_4_1Suite : public TestCommand +class Test_TC_MOD_1_1Suite : public TestCommand { public: - Test_TC_CC_4_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_CC_4_1", credsIssuerConfig), mTestIndex(0) + Test_TC_MOD_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_MOD_1_1", 5, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -10582,80 +15420,143 @@ class Test_TC_CC_4_1Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_CC_4_1Suite() {} + ~Test_TC_MOD_1_1Suite() {} - /////////// TestCommand Interface ///////// - void NextTest() override + chip::System::Clock::Timeout GetWaitDuration() const override { - CHIP_ERROR err = CHIP_NO_ERROR; + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_CC_4_1\n"); - } +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_CC_4_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } - Wait(); + // + // Tests methods + // + + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override + { + bool shouldContinue = false; - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) + switch (mTestIndex - 1) { case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; break; case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Turn on light for color control tests\n"); - err = TestTurnOnLightForColorControlTests_1(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("clusterRevision", value, 1U)); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + } break; case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Check on/off attribute value is true after on command\n"); - err = TestCheckOnOffAttributeValueIsTrueAfterOnCommand_2(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "list")); + } break; case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Move to saturation command\n"); - err = TestMoveToSaturationCommand_3(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "list")); + } break; case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Turn off light that we turned on\n"); - err = TestTurnOffLightThatWeTurnedOn_4(); - break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Check on/off attribute value is false after off command\n"); - err = TestCheckOnOffAttributeValueIsFalseAfterOffCommand_5(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "list")); + } break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } + + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); } + } - if (CHIP_NO_ERROR != err) + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "TH reads the ClusterRevision attribute from the DUT"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ModeSelect::Id, ModeSelect::Attributes::ClusterRevision::Id); + } + case 2: { + LogStep(2, "TH reads the AttributeList attribute from the DUT"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ModeSelect::Id, ModeSelect::Attributes::AttributeList::Id); + } + case 3: { + LogStep(3, "Read the global attribute: AcceptedCommandList"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ModeSelect::Id, ModeSelect::Attributes::AcceptedCommandList::Id); } + case 4: { + LogStep(4, "Read the global attribute: GeneratedCommandList"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ModeSelect::Id, ModeSelect::Attributes::GeneratedCommandList::Id); + } + } + return CHIP_NO_ERROR; + } +}; + +class Test_TC_MF_1_4Suite : public TestCommand +{ +public: + Test_TC_MF_1_4Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_MF_1_4", 13, credsIssuerConfig) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("nodeId2", 0, UINT64_MAX, &mNodeId2); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("discriminator", 0, UINT16_MAX, &mDiscriminator); + AddArgument("payload", &mPayload); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } + ~Test_TC_MF_1_4Suite() {} + chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 6; - chip::Optional mNodeId; - chip::Optional mCluster; + chip::Optional mNodeId2; chip::Optional mEndpoint; + chip::Optional mDiscriminator; + chip::Optional mPayload; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -10666,6 +15567,89 @@ class Test_TC_CC_4_1Suite : public TestCommand VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); shouldContinue = true; break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::CharSpan value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "string")); + VerifyOrReturn(CheckConstraintMaxLength("value", value.size(), 32)); + } + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList< + chip::app::Clusters::OperationalCredentials::Structs::FabricDescriptor::DecodableType> + value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + { + auto iter_0 = value.begin(); + VerifyOrReturn(CheckNextListItemDecodes("fabrics", iter_0, 0)); + VerifyOrReturn(CheckValueAsString("fabrics[0].label", iter_0.GetValue().label, chip::CharSpan("", 0))); + VerifyOrReturn(CheckNoMoreListItems("fabrics", iter_0, 1)); + } + VerifyOrReturn(CheckConstraintType("value", "", "list")); + } + break; + case 8: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList< + chip::app::Clusters::OperationalCredentials::Structs::FabricDescriptor::DecodableType> + value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + { + auto iter_0 = value.begin(); + VerifyOrReturn(CheckNextListItemDecodes("fabrics", iter_0, 0)); + VerifyOrReturn(CheckValueAsString("fabrics[0].label", iter_0.GetValue().label, chip::CharSpan("", 0))); + VerifyOrReturn(CheckNoMoreListItems("fabrics", iter_0, 1)); + } + VerifyOrReturn(CheckConstraintType("value", "", "list")); + } + break; + case 9: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 10: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::CharSpan value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "string")); + VerifyOrReturn(CheckConstraintMaxLength("value", value.size(), 32)); + } + break; + case 11: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 12: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::CharSpan value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "string")); + VerifyOrReturn(CheckConstraintMaxLength("value", value.size(), 32)); + } + break; default: LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); } @@ -10676,276 +15660,320 @@ class Test_TC_CC_4_1Suite : public TestCommand } } - static void OnFailureCallback_2(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_2(error); - } - - static void OnSuccessCallback_2(void * context, bool onOff) - { - (static_cast(context))->OnSuccessResponse_2(onOff); - } - - static void OnFailureCallback_5(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_5(error); - } - - static void OnSuccessCallback_5(void * context, bool onOff) - { - (static_cast(context))->OnSuccessResponse_5(onOff); - } - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestTurnOnLightForColorControlTests_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::OnOff::Commands::On::Type; - - RequestType request; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_1(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_1(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_1() { NextTest(); } - - CHIP_ERROR TestCheckOnOffAttributeValueIsTrueAfterOnCommand_2() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::OnOffClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_2, OnFailureCallback_2, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_2(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_2(bool onOff) - { - VerifyOrReturn(CheckValue("onOff", onOff, 1)); - - NextTest(); - } - - CHIP_ERROR TestMoveToSaturationCommand_3() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::ColorControl::Commands::MoveToSaturation::Type; - - RequestType request; - request.saturation = 90; - request.transitionTime = 10U; - request.optionsMask = 0; - request.optionsOverride = 0; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_3(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_3(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_3(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_3() { NextTest(); } - - CHIP_ERROR TestTurnOffLightThatWeTurnedOn_4() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::OnOff::Commands::Off::Type; - - RequestType request; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_4(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_4(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_4(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_4() { NextTest(); } - - CHIP_ERROR TestCheckOnOffAttributeValueIsFalseAfterOffCommand_5() + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::OnOffClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_5, OnFailureCallback_5, true)); + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Reboot target device"); + SetIdentity(kIdentityAlpha); + return Reboot(mDiscriminator.HasValue() ? mDiscriminator.Value() : 3840U); + } + case 1: { + LogStep(1, "TH_CR1 starts a commissioning process with DUT_CE"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 2: { + LogStep(2, "TH_CR1 opens a commissioning window on DUT_CE"); + chip::app::Clusters::AdministratorCommissioning::Commands::OpenBasicCommissioningWindow::Type value; + value.commissioningTimeout = 180U; + return SendCommand(kIdentityAlpha, GetEndpoint(0), AdministratorCommissioning::Id, + AdministratorCommissioning::Commands::OpenBasicCommissioningWindow::Id, value, + chip::Optional(10000)); + } + case 3: { + LogStep(3, "TH_CR1 writes the Basic Information Clusters NodeLabel mandatory attribute of DUT_CE"); + chip::CharSpan value; + value = chip::Span("chiptestgarbage: not in length on purpose", 8); + return WriteAttribute(kIdentityAlpha, GetEndpoint(0), Basic::Id, Basic::Attributes::NodeLabel::Id, value); + } + case 4: { + LogStep(4, "TH_CR1 reads the Basic Information Clusters NodeLabel mandatory attribute of DUT_CE"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), Basic::Id, Basic::Attributes::NodeLabel::Id); + } + case 5: { + LogStep(5, "Commission from beta"); + SetIdentity(kIdentityBeta); + return PairWithQRCode(mNodeId2.HasValue() ? mNodeId2.Value() : 51966ULL, + mPayload.HasValue() ? mPayload.Value() + : chip::CharSpan::fromCharString("MT:-24J0AFN00KA0648G00")); + } + case 6: { + LogStep(6, "TH_CR2 starts a commissioning process with DUT_CE"); + SetIdentity(kIdentityBeta); + return WaitForCommissionee(mNodeId2.HasValue() ? mNodeId2.Value() : 51966ULL); + } + case 7: { + LogStep(7, "Query fabrics list"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), OperationalCredentials::Id, + OperationalCredentials::Attributes::Fabrics::Id); + } + case 8: { + LogStep(8, "Query fabrics list"); + return ReadAttribute(kIdentityBeta, GetEndpoint(0), OperationalCredentials::Id, + OperationalCredentials::Attributes::Fabrics::Id); + } + case 9: { + LogStep(9, "TH_CR1 writes the Basic Information Clusters NodeLabel mandatory attribute of DUT_CE"); + chip::CharSpan value; + value = chip::Span("chiptestgarbage: not in length on purpose", 8); + return WriteAttribute(kIdentityAlpha, GetEndpoint(0), Basic::Id, Basic::Attributes::NodeLabel::Id, value); + } + case 10: { + LogStep(10, "TH_CR1 reads the Basic Information Clusters NodeLabel mandatory attribute of DUT_CE"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), Basic::Id, Basic::Attributes::NodeLabel::Id); + } + case 11: { + LogStep(11, "TH_CR1 writes the Basic Information Clusters NodeLabel mandatory attribute of DUT_CE"); + chip::CharSpan value; + value = chip::Span("chiptestgarbage: not in length on purpose", 8); + return WriteAttribute(kIdentityBeta, GetEndpoint(0), Basic::Id, Basic::Attributes::NodeLabel::Id, value); + } + case 12: { + LogStep(12, "TH_CR1 reads the Basic Information Clusters NodeLabel mandatory attribute of DUT_CE"); + return ReadAttribute(kIdentityBeta, GetEndpoint(0), Basic::Id, Basic::Attributes::NodeLabel::Id); + } + } return CHIP_NO_ERROR; } - - void OnFailureResponse_5(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_5(bool onOff) - { - VerifyOrReturn(CheckValue("onOff", onOff, 0)); - - NextTest(); - } }; -class Test_TC_CC_4_2Suite : public TestCommand +class Test_TC_MF_1_6Suite : public TestCommand { public: - Test_TC_CC_4_2Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_CC_4_2", credsIssuerConfig), mTestIndex(0) + Test_TC_MF_1_6Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_MF_1_6", 14, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); + AddArgument("nodeIdForDuplicateCommissioning", 0, UINT64_MAX, &mNodeIdForDuplicateCommissioning); + AddArgument("nodeId2", 0, UINT64_MAX, &mNodeId2); + AddArgument("nodeId3", 0, UINT64_MAX, &mNodeId3); AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("discriminator", 0, UINT16_MAX, &mDiscriminator); + AddArgument("payload", &mPayload); AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_CC_4_2Suite() {} + ~Test_TC_MF_1_6Suite() {} - /////////// TestCommand Interface ///////// - void NextTest() override + chip::System::Clock::Timeout GetWaitDuration() const override { - CHIP_ERROR err = CHIP_NO_ERROR; + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_CC_4_2\n"); - } +private: + chip::Optional mNodeId; + chip::Optional mNodeIdForDuplicateCommissioning; + chip::Optional mNodeId2; + chip::Optional mNodeId3; + chip::Optional mEndpoint; + chip::Optional mDiscriminator; + chip::Optional mPayload; + chip::Optional mTimeout; - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_CC_4_2\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // - Wait(); + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override + { + bool shouldContinue = false; - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) + switch (mTestIndex - 1) { case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; break; case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Turn on light for color control tests\n"); - err = TestTurnOnLightForColorControlTests_1(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; break; case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Check on/off attribute value is true after on command\n"); - err = TestCheckOnOffAttributeValueIsTrueAfterOnCommand_2(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Move saturation up command\n"); - err = TestMoveSaturationUpCommand_3(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; break; case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Move saturation down command\n"); - err = TestMoveSaturationDownCommand_4(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; break; case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Move saturation up command\n"); - err = TestMoveSaturationUpCommand_5(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : Move saturation stop command\n"); - err = TestMoveSaturationStopCommand_6(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : Move saturation down command\n"); - err = TestMoveSaturationDownCommand_7(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; break; case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : Move saturation stop command\n"); - err = TestMoveSaturationStopCommand_8(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : Turn off light that we turned on\n"); - err = TestTurnOffLightThatWeTurnedOn_9(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::CharSpan value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueAsString("nodeLabel", value, chip::CharSpan("chiptest", 8))); + } break; case 10: - ChipLogProgress(chipTool, " ***** Test Step 10 : Check on/off attribute value is false after off command\n"); - err = TestCheckOnOffAttributeValueIsFalseAfterOffCommand_10(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 11: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 12: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 13: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); + shouldContinue = true; break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } + + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); } + } - if (CHIP_NO_ERROR != err) + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); + case 0: { + LogStep(0, "Reboot target device"); + SetIdentity(kIdentityAlpha); + return Reboot(mDiscriminator.HasValue() ? mDiscriminator.Value() : 3840U); + } + case 1: { + LogStep(1, "TH_CR1 starts a commissioning process with DUT_CE"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 2: { + LogStep(2, "TH_CR1 opens a commissioning window on DUT_CE"); + chip::app::Clusters::AdministratorCommissioning::Commands::OpenBasicCommissioningWindow::Type value; + value.commissioningTimeout = 180U; + return SendCommand(kIdentityAlpha, GetEndpoint(0), AdministratorCommissioning::Id, + AdministratorCommissioning::Commands::OpenBasicCommissioningWindow::Id, value, + chip::Optional(10000)); + } + case 3: { + LogStep(3, "Commission from beta"); + SetIdentity(kIdentityBeta); + return PairWithQRCode(mNodeId2.HasValue() ? mNodeId2.Value() : 51966ULL, + mPayload.HasValue() ? mPayload.Value() + : chip::CharSpan::fromCharString("MT:-24J0AFN00KA0648G00")); + } + case 4: { + LogStep(4, "TH_CR2 starts a commissioning process on DUT_CE"); + SetIdentity(kIdentityBeta); + return WaitForCommissionee(mNodeId2.HasValue() ? mNodeId2.Value() : 51966ULL); + } + case 5: { + LogStep(5, "Open Commissioning Window from alpha"); + chip::app::Clusters::AdministratorCommissioning::Commands::OpenBasicCommissioningWindow::Type value; + value.commissioningTimeout = 180U; + return SendCommand(kIdentityAlpha, GetEndpoint(0), AdministratorCommissioning::Id, + AdministratorCommissioning::Commands::OpenBasicCommissioningWindow::Id, value, + chip::Optional(10000)); + } + case 6: { + LogStep(6, "TH_CR1 revokes the commissioning window on DUT_CE"); + chip::app::Clusters::AdministratorCommissioning::Commands::RevokeCommissioning::Type value; + return SendCommand(kIdentityAlpha, GetEndpoint(0), AdministratorCommissioning::Id, + AdministratorCommissioning::Commands::RevokeCommissioning::Id, value, + chip::Optional(10000)); + } + case 7: { + LogStep(7, "TH_CR2 starts a commissioning process on DUT_CE"); + SetIdentity(kIdentityBeta); + return WaitForCommissionee(mNodeId2.HasValue() ? mNodeId2.Value() : 51966ULL); + } + case 8: { + LogStep(8, "TH_CR1 writes the mandatory attribute NodeLabel of DUT_CE"); + chip::CharSpan value; + value = chip::Span("chiptestgarbage: not in length on purpose", 8); + return WriteAttribute(kIdentityAlpha, GetEndpoint(0), Basic::Id, Basic::Attributes::NodeLabel::Id, value); + } + case 9: { + LogStep(9, "TH_CR1 read the mandatory attribute NodeLabel of DUT_CE"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), Basic::Id, Basic::Attributes::NodeLabel::Id); + } + case 10: { + LogStep(10, "TH_CR1 opens a commissioning window on DUT_CE"); + chip::app::Clusters::AdministratorCommissioning::Commands::OpenBasicCommissioningWindow::Type value; + value.commissioningTimeout = 180U; + return SendCommand(kIdentityAlpha, GetEndpoint(0), AdministratorCommissioning::Id, + AdministratorCommissioning::Commands::OpenBasicCommissioningWindow::Id, value, + chip::Optional(10000)); + } + case 11: { + LogStep(11, "TH_CR2 starts a commissioning process on DUT_CE"); + SetIdentity(kIdentityBeta); + return WaitForCommissionee(mNodeId2.HasValue() ? mNodeId2.Value() : 51966ULL); + } + case 12: { + LogStep(12, "TH_CR3 starts a commissioning process with DUT_CE"); + SetIdentity(kIdentityGamma); + return PairWithQRCode(mNodeId3.HasValue() ? mNodeId3.Value() : 12586990ULL, + mPayload.HasValue() ? mPayload.Value() + : chip::CharSpan::fromCharString("MT:-24J0AFN00KA0648G00")); + } + case 13: { + LogStep(13, "Wait for the commissioned device to be retrieved for gamma"); + SetIdentity(kIdentityGamma); + return WaitForCommissionee(mNodeId3.HasValue() ? mNodeId3.Value() : 12586990ULL); + } } + return CHIP_NO_ERROR; + } +}; + +class Test_TC_OCC_1_1Suite : public TestCommand +{ +public: + Test_TC_OCC_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_OCC_1_1", 4, credsIssuerConfig) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } + ~Test_TC_OCC_1_1Suite() {} + chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 11; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -10956,6 +15984,25 @@ class Test_TC_CC_4_2Suite : public TestCommand VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); shouldContinue = true; break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + } + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "list")); + } + break; default: LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); } @@ -10966,330 +16013,42 @@ class Test_TC_CC_4_2Suite : public TestCommand } } - static void OnFailureCallback_2(void * context, CHIP_ERROR error) + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - (static_cast(context))->OnFailureResponse_2(error); + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "Read the global attribute constraints: ClusterRevision"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OccupancySensing::Id, + OccupancySensing::Attributes::ClusterRevision::Id); + } + case 2: { + LogStep(2, "write the default values to mandatory global attribute: ClusterRevision"); + uint16_t value; + value = 3U; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), OccupancySensing::Id, + OccupancySensing::Attributes::ClusterRevision::Id, value); + } + case 3: { + LogStep(3, "Read the global attribute: AttributeList"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OccupancySensing::Id, + OccupancySensing::Attributes::AttributeList::Id); + } + } + return CHIP_NO_ERROR; } +}; - static void OnSuccessCallback_2(void * context, bool onOff) - { - (static_cast(context))->OnSuccessResponse_2(onOff); - } - - static void OnFailureCallback_10(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_10(error); - } - - static void OnSuccessCallback_10(void * context, bool onOff) - { - (static_cast(context))->OnSuccessResponse_10(onOff); - } - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestTurnOnLightForColorControlTests_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::OnOff::Commands::On::Type; - - RequestType request; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_1(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_1(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_1() { NextTest(); } - - CHIP_ERROR TestCheckOnOffAttributeValueIsTrueAfterOnCommand_2() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::OnOffClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_2, OnFailureCallback_2, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_2(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_2(bool onOff) - { - VerifyOrReturn(CheckValue("onOff", onOff, 1)); - - NextTest(); - } - - CHIP_ERROR TestMoveSaturationUpCommand_3() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::ColorControl::Commands::MoveSaturation::Type; - - RequestType request; - request.moveMode = static_cast(1); - request.rate = 5; - request.optionsMask = 0; - request.optionsOverride = 0; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_3(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_3(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_3(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_3() { NextTest(); } - - CHIP_ERROR TestMoveSaturationDownCommand_4() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::ColorControl::Commands::MoveSaturation::Type; - - RequestType request; - request.moveMode = static_cast(3); - request.rate = 5; - request.optionsMask = 0; - request.optionsOverride = 0; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_4(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_4(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_4(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_4() { NextTest(); } - - CHIP_ERROR TestMoveSaturationUpCommand_5() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::ColorControl::Commands::MoveSaturation::Type; - - RequestType request; - request.moveMode = static_cast(1); - request.rate = 5; - request.optionsMask = 0; - request.optionsOverride = 0; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_5(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_5(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_5(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_5() { NextTest(); } - - CHIP_ERROR TestMoveSaturationStopCommand_6() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::ColorControl::Commands::MoveSaturation::Type; - - RequestType request; - request.moveMode = static_cast(0); - request.rate = 5; - request.optionsMask = 0; - request.optionsOverride = 0; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_6(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_6(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_6(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_6() { NextTest(); } - - CHIP_ERROR TestMoveSaturationDownCommand_7() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::ColorControl::Commands::MoveSaturation::Type; - - RequestType request; - request.moveMode = static_cast(3); - request.rate = 5; - request.optionsMask = 0; - request.optionsOverride = 0; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_7(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_7(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_7(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_7() { NextTest(); } - - CHIP_ERROR TestMoveSaturationStopCommand_8() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::ColorControl::Commands::MoveSaturation::Type; - - RequestType request; - request.moveMode = static_cast(0); - request.rate = 5; - request.optionsMask = 0; - request.optionsOverride = 0; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_8(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_8(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_8(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_8() { NextTest(); } - - CHIP_ERROR TestTurnOffLightThatWeTurnedOn_9() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::OnOff::Commands::Off::Type; - - RequestType request; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_9(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_9(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_9(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_9() { NextTest(); } - - CHIP_ERROR TestCheckOnOffAttributeValueIsFalseAfterOffCommand_10() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::OnOffClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_10, OnFailureCallback_10, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_10(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_10(bool onOff) - { - VerifyOrReturn(CheckValue("onOff", onOff, 0)); - - NextTest(); - } -}; - -class Test_TC_CC_4_3Suite : public TestCommand -{ -public: - Test_TC_CC_4_3Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_CC_4_3", credsIssuerConfig), mTestIndex(0) +class Test_TC_OCC_2_1Suite : public TestCommand +{ +public: + Test_TC_OCC_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_OCC_2_1", 10, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -11297,84 +16056,204 @@ class Test_TC_CC_4_3Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_CC_4_3Suite() {} + ~Test_TC_OCC_2_1Suite() {} - /////////// TestCommand Interface ///////// - void NextTest() override + chip::System::Clock::Timeout GetWaitDuration() const override { - CHIP_ERROR err = CHIP_NO_ERROR; + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_CC_4_3\n"); - } +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_CC_4_3\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } - Wait(); + // + // Tests methods + // + + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override + { + bool shouldContinue = false; - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) + switch (mTestIndex - 1) { case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; break; case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Turn on light for color control tests\n"); - err = TestTurnOnLightForColorControlTests_1(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "map8")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 1)); + } break; case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Check on/off attribute value is true after on command\n"); - err = TestCheckOnOffAttributeValueIsTrueAfterOnCommand_2(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); break; case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Step saturation up command\n"); - err = TestStepSaturationUpCommand_3(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("occupancy", value, 0)); + } break; case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Step saturation down command\n"); - err = TestStepSaturationDownCommand_4(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 3)); + } break; case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Turn off light that we turned on\n"); - err = TestTurnOffLightThatWeTurnedOn_5(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); break; case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : Check on/off attribute value is false after off command\n"); - err = TestCheckOnOffAttributeValueIsFalseAfterOffCommand_6(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("occupancySensorType", value, 0)); + } + break; + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "map8")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 1)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 7)); + } + break; + case 8: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); + break; + case 9: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("occupancySensorTypeBitmap", value, 1)); + } break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } + + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); } + } - if (CHIP_NO_ERROR != err) + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "Reads mandatory attribute constrains: Occupancy"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OccupancySensing::Id, OccupancySensing::Attributes::Occupancy::Id); + } + case 2: { + LogStep(2, "Writes the respective default value to mandatory attribute: Occupancy"); + uint8_t value; + value = 0; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), OccupancySensing::Id, OccupancySensing::Attributes::Occupancy::Id, + value); + } + case 3: { + LogStep(3, "Reads back mandatory attribute: Occupancy"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OccupancySensing::Id, OccupancySensing::Attributes::Occupancy::Id); + } + case 4: { + LogStep(4, "Reads mandatory attribute constrains: OccupancySensorType"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OccupancySensing::Id, + OccupancySensing::Attributes::OccupancySensorType::Id); } + case 5: { + LogStep(5, "Writes the respective default value to mandatory attribute: OccupancySensorType"); + uint8_t value; + value = 0; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), OccupancySensing::Id, + OccupancySensing::Attributes::OccupancySensorType::Id, value); + } + case 6: { + LogStep(6, "Reads back mandatory attribute: OccupancySensorType"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OccupancySensing::Id, + OccupancySensing::Attributes::OccupancySensorType::Id); + } + case 7: { + LogStep(7, "Reads mandatory attribute constrains: OccupancySensorTypeBitmap"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OccupancySensing::Id, + OccupancySensing::Attributes::OccupancySensorTypeBitmap::Id); + } + case 8: { + LogStep(8, "Writes the respective default value to mandatory attribute: OccupancySensorTypeBitmap"); + uint8_t value; + value = 1; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), OccupancySensing::Id, + OccupancySensing::Attributes::OccupancySensorTypeBitmap::Id, value); + } + case 9: { + LogStep(9, "Reads back mandatory attribute: OccupancySensorTypeBitmap"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OccupancySensing::Id, + OccupancySensing::Attributes::OccupancySensorTypeBitmap::Id); + } + } + return CHIP_NO_ERROR; + } +}; + +class Test_TC_OCC_2_2Suite : public TestCommand +{ +public: + Test_TC_OCC_2_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_OCC_2_2", 3, credsIssuerConfig) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } + ~Test_TC_OCC_2_2Suite() {} + chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 7; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + uint8_t OccupancyValue; + + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -11385,6 +16264,23 @@ class Test_TC_CC_4_3Suite : public TestCommand VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); shouldContinue = true; break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("occupancy", value, 0)); + + OccupancyValue = value; + } + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + } + break; default: LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); } @@ -11395,208 +16291,35 @@ class Test_TC_CC_4_3Suite : public TestCommand } } - static void OnFailureCallback_2(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_2(error); - } - - static void OnSuccessCallback_2(void * context, bool onOff) - { - (static_cast(context))->OnSuccessResponse_2(onOff); - } - - static void OnFailureCallback_6(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_6(error); - } - - static void OnSuccessCallback_6(void * context, bool onOff) - { - (static_cast(context))->OnSuccessResponse_6(onOff); - } - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestTurnOnLightForColorControlTests_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::OnOff::Commands::On::Type; - - RequestType request; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_1(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_1(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_1() { NextTest(); } - - CHIP_ERROR TestCheckOnOffAttributeValueIsTrueAfterOnCommand_2() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::OnOffClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_2, OnFailureCallback_2, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_2(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_2(bool onOff) - { - VerifyOrReturn(CheckValue("onOff", onOff, 1)); - - NextTest(); - } - - CHIP_ERROR TestStepSaturationUpCommand_3() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::ColorControl::Commands::StepSaturation::Type; - - RequestType request; - request.stepMode = static_cast(1); - request.stepSize = 15; - request.transitionTime = 10; - request.optionsMask = 0; - request.optionsOverride = 0; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_3(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_3(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_3(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_3() { NextTest(); } - - CHIP_ERROR TestStepSaturationDownCommand_4() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::ColorControl::Commands::StepSaturation::Type; - - RequestType request; - request.stepMode = static_cast(3); - request.stepSize = 20; - request.transitionTime = 10; - request.optionsMask = 0; - request.optionsOverride = 0; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_4(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_4(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_4(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_4() { NextTest(); } - - CHIP_ERROR TestTurnOffLightThatWeTurnedOn_5() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::OnOff::Commands::Off::Type; - - RequestType request; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_5(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_5(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_5(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_5() { NextTest(); } - - CHIP_ERROR TestCheckOnOffAttributeValueIsFalseAfterOffCommand_6() + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::OnOffClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_6, OnFailureCallback_6, true)); + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "Reads Occupancy attribute from DUT"); + VerifyOrdo(!ShouldSkip("A_OCCUPANCY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OccupancySensing::Id, OccupancySensing::Attributes::Occupancy::Id); + } + case 2: { + LogStep(2, "Reads back Occupancy attribute from DUT after few seconds"); + VerifyOrdo(!ShouldSkip("A_OCCUPANCY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OccupancySensing::Id, OccupancySensing::Attributes::Occupancy::Id); + } + } return CHIP_NO_ERROR; } - - void OnFailureResponse_6(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_6(bool onOff) - { - VerifyOrReturn(CheckValue("onOff", onOff, 0)); - - NextTest(); - } }; -class Test_TC_CC_4_4Suite : public TestCommand +class Test_TC_OO_1_1Suite : public TestCommand { public: - Test_TC_CC_4_4Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_CC_4_4", credsIssuerConfig), mTestIndex(0) + Test_TC_OO_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_OO_1_1", 10, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -11604,80 +16327,192 @@ class Test_TC_CC_4_4Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_CC_4_4Suite() {} + ~Test_TC_OO_1_1Suite() {} - /////////// TestCommand Interface ///////// - void NextTest() override + chip::System::Clock::Timeout GetWaitDuration() const override { - CHIP_ERROR err = CHIP_NO_ERROR; + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_CC_4_4\n"); - } +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_CC_4_4\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // - Wait(); + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override + { + bool shouldContinue = false; - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) + switch (mTestIndex - 1) { case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; break; case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Turn on light for color control tests\n"); - err = TestTurnOnLightForColorControlTests_1(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("clusterRevision", value, 4U)); + } break; case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Check on/off attribute value is true after on command\n"); - err = TestCheckOnOffAttributeValueIsTrueAfterOnCommand_2(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + } break; case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Move To current hue and saturation command\n"); - err = TestMoveToCurrentHueAndSaturationCommand_3(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); break; case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Turn off light that we turned on\n"); - err = TestTurnOffLightThatWeTurnedOn_4(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("clusterRevision", value, 4U)); + } break; case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Check on/off attribute value is false after off command\n"); - err = TestCheckOnOffAttributeValueIsFalseAfterOffCommand_5(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "list")); + } break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("featureMap", value, 1UL)); + } + break; + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "map32")); + } + break; + case 8: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); + break; + case 9: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("featureMap", value, 1UL)); + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } + + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); } + } - if (CHIP_NO_ERROR != err) + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "read the global attribute: ClusterRevision"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::ClusterRevision::Id); + } + case 2: { + LogStep(2, "Read the global attribute constraints: ClusterRevision"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::ClusterRevision::Id); } + case 3: { + LogStep(3, "write the default values to mandatory global attribute: ClusterRevision"); + uint16_t value; + value = 3U; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::ClusterRevision::Id, value); + } + case 4: { + LogStep(4, "reads back global attribute: ClusterRevision"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::ClusterRevision::Id); + } + case 5: { + LogStep(5, "Read the global attribute: AttributeList"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::AttributeList::Id); + } + case 6: { + LogStep(6, "read the optional global attribute: FeatureMap"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::FeatureMap::Id); + } + case 7: { + LogStep(7, "Read the optional global attribute : FeatureMap"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::FeatureMap::Id); + } + case 8: { + LogStep(8, "write the default values to optional global attribute: FeatureMap"); + uint32_t value; + value = 0UL; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::FeatureMap::Id, value); + } + case 9: { + LogStep(9, "reads back optional global attribute: FeatureMap"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::FeatureMap::Id); + } + } + return CHIP_NO_ERROR; + } +}; + +class Test_TC_OO_2_1Suite : public TestCommand +{ +public: + Test_TC_OO_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_OO_2_1", 6, credsIssuerConfig) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } + ~Test_TC_OO_2_1Suite() {} + chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 6; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -11688,6 +16523,62 @@ class Test_TC_CC_4_4Suite : public TestCommand VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); shouldContinue = true; break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + bool value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "bool")); + } + break; + case 2: + if (IsUnsupported(status.mStatus)) + { + return; + } + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + bool value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "bool")); + } + break; + case 3: + if (IsUnsupported(status.mStatus)) + { + return; + } + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + } + break; + case 4: + if (IsUnsupported(status.mStatus)) + { + return; + } + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + } + break; + case 5: + if (IsUnsupported(status.mStatus)) + { + return; + } + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "enum8")); + } + break; default: LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); } @@ -11698,267 +16589,185 @@ class Test_TC_CC_4_4Suite : public TestCommand } } - static void OnFailureCallback_2(void * context, CHIP_ERROR error) + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - (static_cast(context))->OnFailureResponse_2(error); + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "read the mandatory attribute: OnOff"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnOff::Id); + } + case 2: { + LogStep(2, "read LT attribute: GlobalSceneControl"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::GlobalSceneControl::Id); + } + case 3: { + LogStep(3, "read LT attribute: OnTime"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnTime::Id); + } + case 4: { + LogStep(4, "read LT attribute: OffWaitTime"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OffWaitTime::Id); + } + case 5: { + LogStep(5, "read LT attribute: StartUpOnOff"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::StartUpOnOff::Id); + } + } + return CHIP_NO_ERROR; } +}; - static void OnSuccessCallback_2(void * context, bool onOff) +class Test_TC_OO_2_2Suite : public TestCommand +{ +public: + Test_TC_OO_2_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_OO_2_2", 21, credsIssuerConfig) { - (static_cast(context))->OnSuccessResponse_2(onOff); + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - static void OnFailureCallback_5(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_5(error); - } + ~Test_TC_OO_2_2Suite() {} - static void OnSuccessCallback_5(void * context, bool onOff) + chip::System::Clock::Timeout GetWaitDuration() const override { - (static_cast(context))->OnSuccessResponse_5(onOff); + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + // // Tests methods // - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestTurnOnLightForColorControlTests_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::OnOff::Commands::On::Type; - - RequestType request; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_1(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_1(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_1() { NextTest(); } - - CHIP_ERROR TestCheckOnOffAttributeValueIsTrueAfterOnCommand_2() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::OnOffClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_2, OnFailureCallback_2, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_2(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_2(bool onOff) - { - VerifyOrReturn(CheckValue("onOff", onOff, 1)); - - NextTest(); - } - - CHIP_ERROR TestMoveToCurrentHueAndSaturationCommand_3() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::ColorControl::Commands::MoveToHueAndSaturation::Type; - - RequestType request; - request.hue = 40; - request.saturation = 160; - request.transitionTime = 10U; - request.optionsMask = 0; - request.optionsOverride = 0; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_3(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_3(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_3(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_3() { NextTest(); } - - CHIP_ERROR TestTurnOffLightThatWeTurnedOn_4() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::OnOff::Commands::Off::Type; - - RequestType request; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_4(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_4(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_4(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_4() { NextTest(); } - - CHIP_ERROR TestCheckOnOffAttributeValueIsFalseAfterOffCommand_5() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::OnOffClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_5, OnFailureCallback_5, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_5(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_5(bool onOff) - { - VerifyOrReturn(CheckValue("onOff", onOff, 0)); - - NextTest(); - } -}; - -class Test_TC_CC_5_1Suite : public TestCommand -{ -public: - Test_TC_CC_5_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_CC_5_1", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_CC_5_1Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_CC_5_1\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_CC_5_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); + bool shouldContinue = false; - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) + switch (mTestIndex - 1) { case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; break; case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Turn on light for color control tests\n"); - err = TestTurnOnLightForColorControlTests_1(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Check on/off attribute value is true after on command\n"); - err = TestCheckOnOffAttributeValueIsTrueAfterOnCommand_2(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + bool value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("onOff", value, 0)); + } break; case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Move to Color command\n"); - err = TestMoveToColorCommand_3(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Turn off light that we turned on\n"); - err = TestTurnOffLightThatWeTurnedOn_4(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + bool value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("onOff", value, 1)); + } break; case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Check on/off attribute value is false after off command\n"); - err = TestCheckOnOffAttributeValueIsFalseAfterOffCommand_5(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 6; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + bool value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("onOff", value, 1)); + } + break; + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 8: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + bool value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("onOff", value, 0)); + } + break; + case 9: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 10: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + bool value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("onOff", value, 0)); + } + break; + case 11: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 12: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 13: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + bool value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("onOff", value, 1)); + } + break; + case 14: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 15: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 16: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + bool value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("onOff", value, 0)); + } + break; + case 17: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 18: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); shouldContinue = true; break; + case 19: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 20: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + bool value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("onOff", value, 0)); + } + break; default: LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); } @@ -11969,176 +16778,117 @@ class Test_TC_CC_5_1Suite : public TestCommand } } - static void OnFailureCallback_2(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_2(error); - } - - static void OnSuccessCallback_2(void * context, bool onOff) - { - (static_cast(context))->OnSuccessResponse_2(onOff); - } - - static void OnFailureCallback_5(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_5(error); - } - - static void OnSuccessCallback_5(void * context, bool onOff) - { - (static_cast(context))->OnSuccessResponse_5(onOff); - } - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestTurnOnLightForColorControlTests_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::OnOff::Commands::On::Type; - - RequestType request; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_1(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_1(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_1() { NextTest(); } - - CHIP_ERROR TestCheckOnOffAttributeValueIsTrueAfterOnCommand_2() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::OnOffClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_2, OnFailureCallback_2, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_2(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_2(bool onOff) - { - VerifyOrReturn(CheckValue("onOff", onOff, 1)); - - NextTest(); - } - - CHIP_ERROR TestMoveToColorCommand_3() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::ColorControl::Commands::MoveToColor::Type; - - RequestType request; - request.colorX = 200U; - request.colorY = 300U; - request.transitionTime = 20U; - request.optionsMask = 0; - request.optionsOverride = 0; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_3(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_3(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_3(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_3() { NextTest(); } - - CHIP_ERROR TestTurnOffLightThatWeTurnedOn_4() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::OnOff::Commands::Off::Type; - - RequestType request; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_4(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_4(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_4(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_4() { NextTest(); } - - CHIP_ERROR TestCheckOnOffAttributeValueIsFalseAfterOffCommand_5() + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::OnOffClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_5, OnFailureCallback_5, true)); + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "Send Off Command"); + chip::app::Clusters::OnOff::Commands::Off::Type value; + return SendCommand(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Commands::Off::Id, value); + } + case 2: { + LogStep(2, "Check on/off attribute value is false after off command"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnOff::Id); + } + case 3: { + LogStep(3, "Send On Command"); + chip::app::Clusters::OnOff::Commands::On::Type value; + return SendCommand(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Commands::On::Id, value); + } + case 4: { + LogStep(4, "Check on/off attribute value is true after on command"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnOff::Id); + } + case 5: { + LogStep(5, "Send On Command"); + chip::app::Clusters::OnOff::Commands::On::Type value; + return SendCommand(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Commands::On::Id, value); + } + case 6: { + LogStep(6, "Check on/off attribute value is true after on command"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnOff::Id); + } + case 7: { + LogStep(7, "Send Off Command"); + chip::app::Clusters::OnOff::Commands::Off::Type value; + return SendCommand(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Commands::Off::Id, value); + } + case 8: { + LogStep(8, "Check on/off attribute value is false after off command"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnOff::Id); + } + case 9: { + LogStep(9, "Send Off Command"); + chip::app::Clusters::OnOff::Commands::Off::Type value; + return SendCommand(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Commands::Off::Id, value); + } + case 10: { + LogStep(10, "Check on/off attribute value is false after off command"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnOff::Id); + } + case 11: { + LogStep(11, "Send Toggle Command"); + chip::app::Clusters::OnOff::Commands::Toggle::Type value; + return SendCommand(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Commands::Toggle::Id, value); + } + case 12: { + LogStep(12, "Wait 1000ms"); + SetIdentity(kIdentityAlpha); + return WaitForMs(1000); + } + case 13: { + LogStep(13, "Check on/off attribute value is true after toggle command"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnOff::Id); + } + case 14: { + LogStep(14, "Send Toggle Command"); + chip::app::Clusters::OnOff::Commands::Toggle::Type value; + return SendCommand(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Commands::Toggle::Id, value); + } + case 15: { + LogStep(15, "Wait 1000ms"); + SetIdentity(kIdentityAlpha); + return WaitForMs(1000); + } + case 16: { + LogStep(16, "Check on/off attribute value is false after toggle command"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnOff::Id); + } + case 17: { + LogStep(17, "User prompt Set OnOff attribute manually to on"); + SetIdentity(kIdentityAlpha); + return UserPrompt("Operate on device to set OnOff attribute manually to on"); + } + case 18: { + LogStep(18, "User prompt Set OnOff attribute manually to off"); + SetIdentity(kIdentityAlpha); + return UserPrompt("Operate on device to set OnOff attribute manually to off"); + } + case 19: { + LogStep(19, "Reset Off Command"); + chip::app::Clusters::OnOff::Commands::Off::Type value; + return SendCommand(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Commands::Off::Id, value); + } + case 20: { + LogStep(20, "Check on/off attribute value is false after off command"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnOff::Id); + } + } return CHIP_NO_ERROR; } - - void OnFailureResponse_5(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_5(bool onOff) - { - VerifyOrReturn(CheckValue("onOff", onOff, 0)); - - NextTest(); - } }; -class Test_TC_CC_5_2Suite : public TestCommand +class Test_TC_OO_2_3Suite : public TestCommand { public: - Test_TC_CC_5_2Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_CC_5_2", credsIssuerConfig), mTestIndex(0) + Test_TC_OO_2_3Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_OO_2_3", 47, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -12146,69 +16896,7 @@ class Test_TC_CC_5_2Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_CC_5_2Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_CC_5_2\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_CC_5_2\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Turn on light for color control tests\n"); - err = TestTurnOnLightForColorControlTests_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Check on/off attribute value is true after on command\n"); - err = TestCheckOnOffAttributeValueIsTrueAfterOnCommand_2(); - break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Move Color command\n"); - err = TestMoveColorCommand_3(); - break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Stop Move Step command\n"); - err = TestStopMoveStepCommand_4(); - break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Turn off light that we turned on\n"); - err = TestTurnOffLightThatWeTurnedOn_5(); - break; - case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : Check on/off attribute value is false after off command\n"); - err = TestCheckOnOffAttributeValueIsFalseAfterOffCommand_6(); - break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } + ~Test_TC_OO_2_3Suite() {} chip::System::Clock::Timeout GetWaitDuration() const override { @@ -12216,584 +16904,943 @@ class Test_TC_CC_5_2Suite : public TestCommand } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 7; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - static void OnFailureCallback_2(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_2(error); - } - - static void OnSuccessCallback_2(void * context, bool onOff) - { - (static_cast(context))->OnSuccessResponse_2(onOff); - } - - static void OnFailureCallback_6(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_6(error); - } - - static void OnSuccessCallback_6(void * context, bool onOff) - { - (static_cast(context))->OnSuccessResponse_6(onOff); - } + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } // // Tests methods // - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestTurnOnLightForColorControlTests_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::OnOff::Commands::On::Type; - - RequestType request; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_1(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_1(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_1() { NextTest(); } - - CHIP_ERROR TestCheckOnOffAttributeValueIsTrueAfterOnCommand_2() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::OnOffClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_2, OnFailureCallback_2, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_2(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_2(bool onOff) - { - VerifyOrReturn(CheckValue("onOff", onOff, 1)); - - NextTest(); - } - - CHIP_ERROR TestMoveColorCommand_3() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::ColorControl::Commands::MoveColor::Type; - - RequestType request; - request.rateX = 15; - request.rateY = 20; - request.optionsMask = 0; - request.optionsOverride = 0; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_3(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_3(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_3(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_3() { NextTest(); } - - CHIP_ERROR TestStopMoveStepCommand_4() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::ColorControl::Commands::StopMoveStep::Type; - - RequestType request; - request.optionsMask = 0; - request.optionsOverride = 0; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_4(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_4(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_4(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_4() { NextTest(); } - - CHIP_ERROR TestTurnOffLightThatWeTurnedOn_5() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::OnOff::Commands::Off::Type; - - RequestType request; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_5(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_5(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_5(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_5() { NextTest(); } - - CHIP_ERROR TestCheckOnOffAttributeValueIsFalseAfterOffCommand_6() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::OnOffClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_6, OnFailureCallback_6, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_6(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_6(bool onOff) - { - VerifyOrReturn(CheckValue("onOff", onOff, 0)); - - NextTest(); - } -}; - -class Test_TC_CC_5_3Suite : public TestCommand -{ -public: - Test_TC_CC_5_3Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_CC_5_3", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_CC_5_3Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_CC_5_3\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_CC_5_3\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); + bool shouldContinue = false; - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) + switch (mTestIndex - 1) { case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; break; case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Turn on light for color control tests\n"); - err = TestTurnOnLightForColorControlTests_1(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Check on/off attribute value is true after on command\n"); - err = TestCheckOnOffAttributeValueIsTrueAfterOnCommand_2(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; break; case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Step Color command\n"); - err = TestStepColorCommand_3(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + bool value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("onOff", value, 1)); + } break; case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Turn off light that we turned on\n"); - err = TestTurnOffLightThatWeTurnedOn_4(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + bool value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("globalSceneControl", value, 1)); + } break; case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Check on/off attribute value is false after off command\n"); - err = TestCheckOnOffAttributeValueIsFalseAfterOffCommand_5(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 6; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: + case 6: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); shouldContinue = true; break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - static void OnFailureCallback_2(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_2(error); - } - - static void OnSuccessCallback_2(void * context, bool onOff) - { - (static_cast(context))->OnSuccessResponse_2(onOff); - } - - static void OnFailureCallback_5(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_5(error); - } - - static void OnSuccessCallback_5(void * context, bool onOff) - { - (static_cast(context))->OnSuccessResponse_5(onOff); - } - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestTurnOnLightForColorControlTests_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::OnOff::Commands::On::Type; - - RequestType request; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_1(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_1(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_1() { NextTest(); } - - CHIP_ERROR TestCheckOnOffAttributeValueIsTrueAfterOnCommand_2() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::OnOffClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_2, OnFailureCallback_2, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_2(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_2(bool onOff) - { - VerifyOrReturn(CheckValue("onOff", onOff, 1)); - - NextTest(); - } - - CHIP_ERROR TestStepColorCommand_3() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::ColorControl::Commands::StepColor::Type; - - RequestType request; - request.stepX = 15; - request.stepY = 20; - request.transitionTime = 50U; - request.optionsMask = 0; - request.optionsOverride = 0; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_3(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_3(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_3(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_3() { NextTest(); } - - CHIP_ERROR TestTurnOffLightThatWeTurnedOn_4() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::OnOff::Commands::Off::Type; - - RequestType request; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_4(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_4(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + bool value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("onOff", value, 1)); + } + break; + case 8: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + bool value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("globalSceneControl", value, 1)); + } + break; + case 9: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 10: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 11: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + bool value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("onOff", value, 1)); + } + break; + case 12: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + bool value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("globalSceneControl", value, 1)); + } + break; + case 13: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("onTime", value, 0U)); + } + break; + case 14: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("offWaitTime", value, 0U)); + } + break; + case 15: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 16: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + bool value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("onOff", value, 1)); + } + break; + case 17: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("onTime", value, 0U)); + } + break; + case 18: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("offWaitTime", value, 0U)); + } + break; + case 19: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 20: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + bool value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("onOff", value, 0)); + } + break; + case 21: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("onTime", value, 0U)); + } + break; + case 22: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + bool value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("onOff", value, 0)); + } + break; + case 23: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("onTime", value, 0U)); + } + break; + case 24: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("offWaitTime", value, 0U)); + } + break; + case 25: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 26: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("onTime", value, 0U)); + } + break; + case 27: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("offWaitTime", value, 0U)); + } + break; + case 28: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 29: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + bool value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("onOff", value, 0)); + } + break; + case 30: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("onTime", value, 0U)); + } + break; + case 31: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + bool value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("onOff", value, 0)); + } + break; + case 32: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("onTime", value, 0U)); + } + break; + case 33: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 34: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + bool value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("onOff", value, 1)); + } + break; + case 35: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("onTime", value, 0U)); + } + break; + case 36: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("offWaitTime", value, 0U)); + } + break; + case 37: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 38: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + bool value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("onOff", value, 0)); + } + break; + case 39: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("onTime", value, 0U)); + } + break; + case 40: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + bool value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("onOff", value, 0)); + } + break; + case 41: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("onTime", value, 0U)); + } + break; + case 42: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("offWaitTime", value, 0U)); + } + break; + case 43: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + bool value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("onOff", value, 0)); + } + break; + case 44: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("onTime", value, 0U)); + } + break; + case 45: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("offWaitTime", value, 0U)); + } + break; + case 46: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } - void OnFailureResponse_4(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } } - void OnSuccessResponse_4() { NextTest(); } - - CHIP_ERROR TestCheckOnOffAttributeValueIsFalseAfterOffCommand_5() + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::OnOffClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_5, OnFailureCallback_5, true)); + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "Send On Command"); + VerifyOrdo(!ShouldSkip("CR_ON"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + chip::app::Clusters::OnOff::Commands::On::Type value; + return SendCommand(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Commands::On::Id, value); + } + case 2: { + LogStep(2, "Wait 1000ms"); + SetIdentity(kIdentityAlpha); + return WaitForMs(1000); + } + case 3: { + LogStep(3, "Reads OnOff attribute from DUT"); + VerifyOrdo(!ShouldSkip("A_ONOFF"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnOff::Id); + } + case 4: { + LogStep(4, "Reads GlobalSceneControl attribute from DUT"); + VerifyOrdo(!ShouldSkip("A_GLOBALSCENECONTROL"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::GlobalSceneControl::Id); + } + case 5: { + LogStep(5, "Send On Command"); + VerifyOrdo(!ShouldSkip("CR_ON"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + chip::app::Clusters::OnOff::Commands::On::Type value; + return SendCommand(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Commands::On::Id, value); + } + case 6: { + LogStep(6, "Wait 1000ms"); + SetIdentity(kIdentityAlpha); + return WaitForMs(1000); + } + case 7: { + LogStep(7, "Reads OnOff attribute from DUT"); + VerifyOrdo(!ShouldSkip("A_ONOFF"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnOff::Id); + } + case 8: { + LogStep(8, "Reads GlobalSceneControl attribute from DUT"); + VerifyOrdo(!ShouldSkip("A_GLOBALSCENECONTROL"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::GlobalSceneControl::Id); + } + case 9: { + LogStep(9, "Send On Command"); + VerifyOrdo(!ShouldSkip("CR_ON"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + chip::app::Clusters::OnOff::Commands::On::Type value; + return SendCommand(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Commands::On::Id, value); + } + case 10: { + LogStep(10, "Wait 1000ms"); + SetIdentity(kIdentityAlpha); + return WaitForMs(1000); + } + case 11: { + LogStep(11, "Reads OnOff attribute from DUT"); + VerifyOrdo(!ShouldSkip("A_ONOFF"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnOff::Id); + } + case 12: { + LogStep(12, "Reads GlobalSceneControl attribute from DUT"); + VerifyOrdo(!ShouldSkip("A_GLOBALSCENECONTROL"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::GlobalSceneControl::Id); + } + case 13: { + LogStep(13, "Reads OnTime attribute from DUT"); + VerifyOrdo(!ShouldSkip("A_ONTIME"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnTime::Id); + } + case 14: { + LogStep(14, "Reads OffWaitTime attribute from DUT"); + VerifyOrdo(!ShouldSkip("A_OFFWAITTIME"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OffWaitTime::Id); + } + case 15: { + LogStep(15, "Send On Command"); + VerifyOrdo(!ShouldSkip("CR_ON"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + chip::app::Clusters::OnOff::Commands::On::Type value; + return SendCommand(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Commands::On::Id, value); + } + case 16: { + LogStep(16, "Reads OnOff attribute from DUT"); + VerifyOrdo(!ShouldSkip("A_ONOFF"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnOff::Id); + } + case 17: { + LogStep(17, "Reads OnTime attribute from DUT"); + VerifyOrdo(!ShouldSkip("A_ONTIME"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnTime::Id); + } + case 18: { + LogStep(18, "Reads OffWaitTime attribute from DUT"); + VerifyOrdo(!ShouldSkip("A_OFFWAITTIME"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OffWaitTime::Id); + } + case 19: { + LogStep(19, "Send Off Command"); + VerifyOrdo(!ShouldSkip("CR_OFF"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + chip::app::Clusters::OnOff::Commands::Off::Type value; + return SendCommand(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Commands::Off::Id, value); + } + case 20: { + LogStep(20, "Reads OnOff attribute from DUT"); + VerifyOrdo(!ShouldSkip("A_ONOFF"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnOff::Id); + } + case 21: { + LogStep(21, "Reads OnTime attribute from DUT"); + VerifyOrdo(!ShouldSkip("A_ONTIME"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnTime::Id); + } + case 22: { + LogStep(22, "Reads OnOff attribute from DUT"); + VerifyOrdo(!ShouldSkip("A_ONOFF"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnOff::Id); + } + case 23: { + LogStep(23, "Reads OnTime attribute from DUT"); + VerifyOrdo(!ShouldSkip("A_ONTIME"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnTime::Id); + } + case 24: { + LogStep(24, "Reads OffWaitTime attribute from DUT"); + VerifyOrdo(!ShouldSkip("A_OFFWAITTIME"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OffWaitTime::Id); + } + case 25: { + LogStep(25, "Send On Command"); + VerifyOrdo(!ShouldSkip("CR_ON"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + chip::app::Clusters::OnOff::Commands::On::Type value; + return SendCommand(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Commands::On::Id, value); + } + case 26: { + LogStep(26, "Reads OnTime attribute from DUT"); + VerifyOrdo(!ShouldSkip("A_ONTIME"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnTime::Id); + } + case 27: { + LogStep(27, "Reads OffWaitTime attribute from DUT"); + VerifyOrdo(!ShouldSkip("A_OFFWAITTIME"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OffWaitTime::Id); + } + case 28: { + LogStep(28, "Send Off Command"); + VerifyOrdo(!ShouldSkip("CR_OFF"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + chip::app::Clusters::OnOff::Commands::Off::Type value; + return SendCommand(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Commands::Off::Id, value); + } + case 29: { + LogStep(29, "Reads OnOff attribute from DUT"); + VerifyOrdo(!ShouldSkip("A_ONOFF"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnOff::Id); + } + case 30: { + LogStep(30, "Reads OnTime attribute from DUT"); + VerifyOrdo(!ShouldSkip("A_ONTIME"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnTime::Id); + } + case 31: { + LogStep(31, "Reads OnOff attribute from DUT"); + VerifyOrdo(!ShouldSkip("A_ONOFF"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnOff::Id); + } + case 32: { + LogStep(32, "Reads OnTime attribute from DUT"); + VerifyOrdo(!ShouldSkip("A_ONTIME"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnTime::Id); + } + case 33: { + LogStep(33, "Send On Command"); + VerifyOrdo(!ShouldSkip("CR_ON"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + chip::app::Clusters::OnOff::Commands::On::Type value; + return SendCommand(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Commands::On::Id, value); + } + case 34: { + LogStep(34, "Reads OnOff attribute from DUT"); + VerifyOrdo(!ShouldSkip("A_ONOFF"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnOff::Id); + } + case 35: { + LogStep(35, "Reads OnTime attribute from DUT"); + VerifyOrdo(!ShouldSkip("A_ONTIME"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnTime::Id); + } + case 36: { + LogStep(36, "Reads OffWaitTime attribute from DUT"); + VerifyOrdo(!ShouldSkip("A_OFFWAITTIME"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OffWaitTime::Id); + } + case 37: { + LogStep(37, "Send Off Command"); + VerifyOrdo(!ShouldSkip("CR_OFF"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + chip::app::Clusters::OnOff::Commands::Off::Type value; + return SendCommand(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Commands::Off::Id, value); + } + case 38: { + LogStep(38, "Reads OnOff attribute from DUT"); + VerifyOrdo(!ShouldSkip("A_ONOFF"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnOff::Id); + } + case 39: { + LogStep(39, "Reads OnTime attribute from DUT"); + VerifyOrdo(!ShouldSkip("A_ONTIME"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnTime::Id); + } + case 40: { + LogStep(40, "Reads OnOff attribute from DUT"); + VerifyOrdo(!ShouldSkip("A_ONOFF"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnOff::Id); + } + case 41: { + LogStep(41, "Reads OnTime attribute from DUT"); + VerifyOrdo(!ShouldSkip("A_ONTIME"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnTime::Id); + } + case 42: { + LogStep(42, "Reads OffWaitTime attribute from DUT"); + VerifyOrdo(!ShouldSkip("A_OFFWAITTIME"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OffWaitTime::Id); + } + case 43: { + LogStep(43, "Reads OnOff attribute from DUT"); + VerifyOrdo(!ShouldSkip("A_ONOFF"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnOff::Id); + } + case 44: { + LogStep(44, "Reads OnTime attribute from DUT"); + VerifyOrdo(!ShouldSkip("A_ONTIME"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnTime::Id); + } + case 45: { + LogStep(45, "Reads OffWaitTime attribute from DUT"); + VerifyOrdo(!ShouldSkip("A_OFFWAITTIME"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OffWaitTime::Id); + } + case 46: { + LogStep(46, "Send Off Command"); + VerifyOrdo(!ShouldSkip("CR_OFF"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + chip::app::Clusters::OnOff::Commands::Off::Type value; + return SendCommand(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Commands::Off::Id, value); + } + } return CHIP_NO_ERROR; } - - void OnFailureResponse_5(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_5(bool onOff) - { - VerifyOrReturn(CheckValue("onOff", onOff, 0)); - - NextTest(); - } }; -class Test_TC_CC_6_1Suite : public TestCommand +class Test_TC_OO_2_4Suite : public TestCommand { public: - Test_TC_CC_6_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_CC_6_1", credsIssuerConfig), mTestIndex(0) + Test_TC_OO_2_4Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_OO_2_4", 26, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("discriminator", 0, UINT16_MAX, &mDiscriminator); AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_CC_6_1Suite() {} + ~Test_TC_OO_2_4Suite() {} - /////////// TestCommand Interface ///////// - void NextTest() override + chip::System::Clock::Timeout GetWaitDuration() const override { - CHIP_ERROR err = CHIP_NO_ERROR; + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_CC_6_1\n"); - } +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mDiscriminator; + chip::Optional mTimeout; - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_CC_6_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // - Wait(); + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override + { + bool shouldContinue = false; - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) + switch (mTestIndex - 1) { case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; break; case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Turn on light for color control tests\n"); - err = TestTurnOnLightForColorControlTests_1(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Check on/off attribute value is true after on command\n"); - err = TestCheckOnOffAttributeValueIsTrueAfterOnCommand_2(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Move To Color Temperature command\n"); - err = TestMoveToColorTemperatureCommand_3(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNonNull("startUpOnOff", value)); + VerifyOrReturn(CheckValue("startUpOnOff.Value()", value.Value(), 0)); + } break; case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Turn off light that we turned on\n"); - err = TestTurnOffLightThatWeTurnedOn_4(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; break; case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Check on/off attribute value is false after off command\n"); - err = TestCheckOnOffAttributeValueIsFalseAfterOffCommand_5(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + bool value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("onOff", value, 0)); + } + break; + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 8: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 9: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 10: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + bool value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("onOff", value, 1)); + } + break; + case 11: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 12: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 13: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 14: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + bool value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("onOff", value, 0)); + } break; + case 15: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 16: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 17: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + bool value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("onOff", value, 1)); + } + break; + case 18: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 19: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 20: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 21: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + bool value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("onOff", value, 1)); + } + break; + case 22: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 23: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 24: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 25: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + bool value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("onOff", value, 0)); + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } + + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); } + } - if (CHIP_NO_ERROR != err) + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "TH sends On command to DUT"); + chip::app::Clusters::OnOff::Commands::On::Type value; + return SendCommand(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Commands::On::Id, value); + } + case 2: { + LogStep(2, "TH writes a value of 0 to StartUpOnOff attribute of DUT"); + chip::app::DataModel::Nullable value; + value.SetNonNull(); + value.Value() = static_cast(0); + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::StartUpOnOff::Id, value); + } + case 3: { + LogStep(3, "TH reads the StartUpOnOff attribute from the DUT"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::StartUpOnOff::Id); + } + case 4: { + LogStep(4, "Power off DUT"); + SetIdentity(kIdentityAlpha); + return Reboot(mDiscriminator.HasValue() ? mDiscriminator.Value() : 3840U); + } + case 5: { + LogStep(5, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 6: { + LogStep(6, "TH reads the OnOff attribute from the DUT"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnOff::Id); + } + case 7: { + LogStep(7, "TH writes a value of 1 to StartUpOnOff attribute of DUT"); + chip::app::DataModel::Nullable value; + value.SetNonNull(); + value.Value() = static_cast(1); + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::StartUpOnOff::Id, value); } + case 8: { + LogStep(8, "Power off DUT"); + SetIdentity(kIdentityAlpha); + return Reboot(mDiscriminator.HasValue() ? mDiscriminator.Value() : 3840U); + } + case 9: { + LogStep(9, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 10: { + LogStep(10, "TH reads the OnOff attribute from the DUT"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnOff::Id); + } + case 11: { + LogStep(11, "TH writes a value of 2 to StartUpOnOff attribute of DUT"); + chip::app::DataModel::Nullable value; + value.SetNonNull(); + value.Value() = static_cast(2); + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::StartUpOnOff::Id, value); + } + case 12: { + LogStep(12, "Power off DUT"); + SetIdentity(kIdentityAlpha); + return Reboot(mDiscriminator.HasValue() ? mDiscriminator.Value() : 3840U); + } + case 13: { + LogStep(13, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 14: { + LogStep(14, "TH reads the OnOff attribute from the DUT"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnOff::Id); + } + case 15: { + LogStep(15, "Power off DUT"); + SetIdentity(kIdentityAlpha); + return Reboot(mDiscriminator.HasValue() ? mDiscriminator.Value() : 3840U); + } + case 16: { + LogStep(16, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 17: { + LogStep(17, "TH reads the OnOff attribute from the DUT"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnOff::Id); + } + case 18: { + LogStep(18, "TH writes NULL to StartUpOnOff attribute of DUT"); + chip::app::DataModel::Nullable value; + value.SetNull(); + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::StartUpOnOff::Id, value); + } + case 19: { + LogStep(19, "Power off DUT"); + SetIdentity(kIdentityAlpha); + return Reboot(mDiscriminator.HasValue() ? mDiscriminator.Value() : 3840U); + } + case 20: { + LogStep(20, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 21: { + LogStep(21, "TH reads the OnOff attribute from the DUT"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnOff::Id); + } + case 22: { + LogStep(22, "TH sends Off command to DUT"); + chip::app::Clusters::OnOff::Commands::Off::Type value; + return SendCommand(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Commands::Off::Id, value); + } + case 23: { + LogStep(23, "Power off DUT"); + SetIdentity(kIdentityAlpha); + return Reboot(mDiscriminator.HasValue() ? mDiscriminator.Value() : 3840U); + } + case 24: { + LogStep(24, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 25: { + LogStep(25, "TH reads the OnOff attribute from the DUT"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnOff::Id); + } + } + return CHIP_NO_ERROR; + } +}; + +class Test_TC_PS_1_1Suite : public TestCommand +{ +public: + Test_TC_PS_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_PS_1_1", 5, credsIssuerConfig) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } + ~Test_TC_PS_1_1Suite() {} + chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 6; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -12804,6 +17851,38 @@ class Test_TC_CC_6_1Suite : public TestCommand VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); shouldContinue = true; break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("clusterRevision", value, 1U)); + } + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "list")); + } + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "list")); + } + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "list")); + } + break; default: LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); } @@ -12814,175 +17893,42 @@ class Test_TC_CC_6_1Suite : public TestCommand } } - static void OnFailureCallback_2(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_2(error); - } - - static void OnSuccessCallback_2(void * context, bool onOff) - { - (static_cast(context))->OnSuccessResponse_2(onOff); - } - - static void OnFailureCallback_5(void * context, CHIP_ERROR error) + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - (static_cast(context))->OnFailureResponse_5(error); - } - - static void OnSuccessCallback_5(void * context, bool onOff) - { - (static_cast(context))->OnSuccessResponse_5(onOff); - } - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestTurnOnLightForColorControlTests_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::OnOff::Commands::On::Type; - - RequestType request; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_1(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_1(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_1() { NextTest(); } - - CHIP_ERROR TestCheckOnOffAttributeValueIsTrueAfterOnCommand_2() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::OnOffClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_2, OnFailureCallback_2, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_2(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_2(bool onOff) - { - VerifyOrReturn(CheckValue("onOff", onOff, 1)); - - NextTest(); - } - - CHIP_ERROR TestMoveToColorTemperatureCommand_3() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::ColorControl::Commands::MoveToColorTemperature::Type; - - RequestType request; - request.colorTemperature = 100U; - request.transitionTime = 10U; - request.optionsMask = 0; - request.optionsOverride = 0; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_3(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_3(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_3(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_3() { NextTest(); } - - CHIP_ERROR TestTurnOffLightThatWeTurnedOn_4() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::OnOff::Commands::Off::Type; - - RequestType request; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_4(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_4(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_4(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_4() { NextTest(); } - - CHIP_ERROR TestCheckOnOffAttributeValueIsFalseAfterOffCommand_5() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::OnOffClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_5, OnFailureCallback_5, true)); + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "read the global attribute: ClusterRevision"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PowerSource::Id, PowerSource::Attributes::ClusterRevision::Id); + } + case 2: { + LogStep(2, "Read the global attribute: AttributeList"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PowerSource::Id, PowerSource::Attributes::AttributeList::Id); + } + case 3: { + LogStep(3, "Read the global attribute: AcceptedCommandList"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PowerSource::Id, PowerSource::Attributes::AcceptedCommandList::Id); + } + case 4: { + LogStep(4, "Read the global attribute: GeneratedCommandList"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PowerSource::Id, + PowerSource::Attributes::GeneratedCommandList::Id); + } + } return CHIP_NO_ERROR; } - - void OnFailureResponse_5(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_5(bool onOff) - { - VerifyOrReturn(CheckValue("onOff", onOff, 0)); - - NextTest(); - } }; -class Test_TC_CC_6_2Suite : public TestCommand +class Test_TC_PS_2_1Suite : public TestCommand { public: - Test_TC_CC_6_2Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_CC_6_2", credsIssuerConfig), mTestIndex(0) + Test_TC_PS_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_PS_2_1", 10, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -12990,104 +17936,208 @@ class Test_TC_CC_6_2Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_CC_6_2Suite() {} + ~Test_TC_PS_2_1Suite() {} - /////////// TestCommand Interface ///////// - void NextTest() override + chip::System::Clock::Timeout GetWaitDuration() const override { - CHIP_ERROR err = CHIP_NO_ERROR; + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_CC_6_2\n"); - } +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_CC_6_2\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // - Wait(); + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override + { + bool shouldContinue = false; - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) + switch (mTestIndex - 1) { case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; break; case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Turn on light for color control tests\n"); - err = TestTurnOnLightForColorControlTests_1(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 3)); + } break; case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Check on/off attribute value is true after on command\n"); - err = TestCheckOnOffAttributeValueIsTrueAfterOnCommand_2(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint8")); + } break; case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Read current color temprature\n"); - err = TestReadCurrentColorTemprature_3(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::CharSpan value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "string")); + } break; case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Move up color temperature command\n"); - err = TestMoveUpColorTemperatureCommand_4(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint32")); + } break; case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Move down color temperature command\n"); - err = TestMoveDownColorTemperatureCommand_5(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint8")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 200)); + } break; case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : Move up color temperature command\n"); - err = TestMoveUpColorTemperatureCommand_6(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint32")); + } break; case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : Stop Color Temperature command\n"); - err = TestStopColorTemperatureCommand_7(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 2)); + } break; case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : Move down color temperature command\n"); - err = TestMoveDownColorTemperatureCommand_8(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "list")); + } break; case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : Stop Color Temperature command\n"); - err = TestStopColorTemperatureCommand_9(); - break; - case 10: - ChipLogProgress(chipTool, " ***** Test Step 10 : Turn off light that we turned on\n"); - err = TestTurnOffLightThatWeTurnedOn_10(); - break; - case 11: - ChipLogProgress(chipTool, " ***** Test Step 11 : Check on/off attribute value is false after off command\n"); - err = TestCheckOnOffAttributeValueIsFalseAfterOffCommand_11(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 3)); + } break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); } - if (CHIP_NO_ERROR != err) + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } + } + + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "Test Harness Client reads Status attribute from Server DUT"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PowerSource::Id, PowerSource::Attributes::Status::Id); + } + case 2: { + LogStep(2, "Test Harness Client reads Order attribute from Server DUT"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PowerSource::Id, PowerSource::Attributes::Order::Id); + } + case 3: { + LogStep(3, "Test Harness Client reads Description attribute from Server DUT"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PowerSource::Id, PowerSource::Attributes::Description::Id); + } + case 4: { + LogStep(4, "Test Harness Client reads BatVoltage from Server DUT"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PowerSource::Id, PowerSource::Attributes::BatteryVoltage::Id); + } + case 5: { + LogStep(5, "Test Harness Client reads BatPercentRemaining from Server DUT"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PowerSource::Id, + PowerSource::Attributes::BatteryPercentRemaining::Id); + } + case 6: { + LogStep(6, "Test Harness Client reads BatTimeRemaining from Server DUT"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PowerSource::Id, + PowerSource::Attributes::BatteryTimeRemaining::Id); + } + case 7: { + LogStep(7, "Test Harness Client reads BatChargeLevel from Server DUT"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PowerSource::Id, PowerSource::Attributes::BatteryChargeLevel::Id); + } + case 8: { + LogStep(8, "Test Harness Client reads ActiveBatFaults from Server DUT"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PowerSource::Id, PowerSource::Attributes::ActiveBatteryFaults::Id); + } + case 9: { + LogStep(9, "Test Harness Client reads BatChargeState from Server DUT"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PowerSource::Id, PowerSource::Attributes::BatteryChargeState::Id); } + } + return CHIP_NO_ERROR; + } +}; + +class Test_TC_PRS_1_1Suite : public TestCommand +{ +public: + Test_TC_PRS_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_PRS_1_1", 4, credsIssuerConfig) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } + ~Test_TC_PRS_1_1Suite() {} + chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 12; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -13098,6 +18148,25 @@ class Test_TC_CC_6_2Suite : public TestCommand VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); shouldContinue = true; break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + } + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "list")); + } + break; default: LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); } @@ -13108,377 +18177,42 @@ class Test_TC_CC_6_2Suite : public TestCommand } } - static void OnFailureCallback_2(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_2(error); - } - - static void OnSuccessCallback_2(void * context, bool onOff) - { - (static_cast(context))->OnSuccessResponse_2(onOff); - } - - static void OnFailureCallback_3(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_3(error); - } - - static void OnSuccessCallback_3(void * context, uint16_t colorTemperature) - { - (static_cast(context))->OnSuccessResponse_3(colorTemperature); - } - - static void OnFailureCallback_11(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_11(error); - } - - static void OnSuccessCallback_11(void * context, bool onOff) - { - (static_cast(context))->OnSuccessResponse_11(onOff); - } - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestTurnOnLightForColorControlTests_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::OnOff::Commands::On::Type; - - RequestType request; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_1(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_1(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_1() { NextTest(); } - - CHIP_ERROR TestCheckOnOffAttributeValueIsTrueAfterOnCommand_2() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::OnOffClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_2, OnFailureCallback_2, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_2(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_2(bool onOff) - { - VerifyOrReturn(CheckValue("onOff", onOff, 1)); - - NextTest(); - } - - CHIP_ERROR TestReadCurrentColorTemprature_3() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_3, OnFailureCallback_3, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_3(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_3(uint16_t colorTemperature) - { - VerifyOrReturn(CheckConstraintType("colorTemperature", "", "uint16")); - VerifyOrReturn(CheckConstraintMinValue("colorTemperature", colorTemperature, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("colorTemperature", colorTemperature, 65279U)); - NextTest(); - } - - CHIP_ERROR TestMoveUpColorTemperatureCommand_4() + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::ColorControl::Commands::MoveColorTemperature::Type; - - RequestType request; - request.moveMode = static_cast(1); - request.rate = 10U; - request.colorTemperatureMinimum = 1U; - request.colorTemperatureMaximum = 255U; - request.optionsMask = 0; - request.optionsOverride = 0; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_4(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_4(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_4(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_4() { NextTest(); } - - CHIP_ERROR TestMoveDownColorTemperatureCommand_5() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::ColorControl::Commands::MoveColorTemperature::Type; - - RequestType request; - request.moveMode = static_cast(3); - request.rate = 20U; - request.colorTemperatureMinimum = 1U; - request.colorTemperatureMaximum = 255U; - request.optionsMask = 0; - request.optionsOverride = 0; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_5(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_5(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_5(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_5() { NextTest(); } - - CHIP_ERROR TestMoveUpColorTemperatureCommand_6() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::ColorControl::Commands::MoveColorTemperature::Type; - - RequestType request; - request.moveMode = static_cast(1); - request.rate = 10U; - request.colorTemperatureMinimum = 1U; - request.colorTemperatureMaximum = 255U; - request.optionsMask = 0; - request.optionsOverride = 0; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_6(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_6(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_6(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_6() { NextTest(); } - - CHIP_ERROR TestStopColorTemperatureCommand_7() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::ColorControl::Commands::MoveColorTemperature::Type; - - RequestType request; - request.moveMode = static_cast(0); - request.rate = 10U; - request.colorTemperatureMinimum = 1U; - request.colorTemperatureMaximum = 255U; - request.optionsMask = 0; - request.optionsOverride = 0; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_7(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_7(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_7(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_7() { NextTest(); } - - CHIP_ERROR TestMoveDownColorTemperatureCommand_8() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::ColorControl::Commands::MoveColorTemperature::Type; - - RequestType request; - request.moveMode = static_cast(3); - request.rate = 20U; - request.colorTemperatureMinimum = 1U; - request.colorTemperatureMaximum = 255U; - request.optionsMask = 0; - request.optionsOverride = 0; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_8(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_8(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_8(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_8() { NextTest(); } - - CHIP_ERROR TestStopColorTemperatureCommand_9() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::ColorControl::Commands::MoveColorTemperature::Type; - - RequestType request; - request.moveMode = static_cast(0); - request.rate = 10U; - request.colorTemperatureMinimum = 1U; - request.colorTemperatureMaximum = 255U; - request.optionsMask = 0; - request.optionsOverride = 0; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_9(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_9(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_9(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_9() { NextTest(); } - - CHIP_ERROR TestTurnOffLightThatWeTurnedOn_10() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::OnOff::Commands::Off::Type; - - RequestType request; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_10(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_10(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_10(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_10() { NextTest(); } - - CHIP_ERROR TestCheckOnOffAttributeValueIsFalseAfterOffCommand_11() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::OnOffClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_11, OnFailureCallback_11, true)); + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "Read the global attribute constraints: ClusterRevision"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PressureMeasurement::Id, + PressureMeasurement::Attributes::ClusterRevision::Id); + } + case 2: { + LogStep(2, "Write the default values to mandatory global attribute: ClusterRevision"); + uint16_t value; + value = 3U; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), PressureMeasurement::Id, + PressureMeasurement::Attributes::ClusterRevision::Id, value); + } + case 3: { + LogStep(3, "Read the global attribute constraints: AttributeList"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PressureMeasurement::Id, + PressureMeasurement::Attributes::AttributeList::Id); + } + } return CHIP_NO_ERROR; } - - void OnFailureResponse_11(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_11(bool onOff) - { - VerifyOrReturn(CheckValue("onOff", onOff, 0)); - - NextTest(); - } }; -class Test_TC_CC_6_3Suite : public TestCommand +class Test_TC_PRS_2_1Suite : public TestCommand { public: - Test_TC_CC_6_3Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_CC_6_3", credsIssuerConfig), mTestIndex(0) + Test_TC_PRS_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_PRS_2_1", 10, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -13486,84 +18220,204 @@ class Test_TC_CC_6_3Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_CC_6_3Suite() {} + ~Test_TC_PRS_2_1Suite() {} - /////////// TestCommand Interface ///////// - void NextTest() override + chip::System::Clock::Timeout GetWaitDuration() const override { - CHIP_ERROR err = CHIP_NO_ERROR; + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_CC_6_3\n"); - } +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_CC_6_3\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // - Wait(); + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override + { + bool shouldContinue = false; - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) + switch (mTestIndex - 1) { case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; break; case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Turn on light for color control tests\n"); - err = TestTurnOnLightForColorControlTests_1(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "int16")); + } break; case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Check on/off attribute value is true after on command\n"); - err = TestCheckOnOffAttributeValueIsTrueAfterOnCommand_2(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); break; case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Step up color temperature command\n"); - err = TestStepUpColorTemperatureCommand_3(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNonNull("measuredValue", value)); + VerifyOrReturn(CheckValue("measuredValue.Value()", value.Value(), 0)); + } break; case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Step down color temperature command\n"); - err = TestStepDownColorTemperatureCommand_4(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "int16")); + } break; case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Turn off light that we turned on\n"); - err = TestTurnOffLightThatWeTurnedOn_5(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); break; case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : Check on/off attribute value is false after off command\n"); - err = TestCheckOnOffAttributeValueIsFalseAfterOffCommand_6(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNonNull("minMeasuredValue", value)); + VerifyOrReturn(CheckValue("minMeasuredValue.Value()", value.Value(), 0)); + } + break; + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "int16")); + } + break; + case 8: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); + break; + case 9: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNonNull("maxMeasuredValue", value)); + VerifyOrReturn(CheckValue("maxMeasuredValue.Value()", value.Value(), 0)); + } break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } + + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); } + } - if (CHIP_NO_ERROR != err) + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "Read the mandatory attribute constraints: MeasuredValue"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PressureMeasurement::Id, + PressureMeasurement::Attributes::MeasuredValue::Id); + } + case 2: { + LogStep(2, "Write the default values to mandatory attribute: MeasuredValue"); + chip::app::DataModel::Nullable value; + value.SetNonNull(); + value.Value() = 0; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), PressureMeasurement::Id, + PressureMeasurement::Attributes::MeasuredValue::Id, value); + } + case 3: { + LogStep(3, "Reads back mandatory attribute: MeasuredValue"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PressureMeasurement::Id, + PressureMeasurement::Attributes::MeasuredValue::Id); + } + case 4: { + LogStep(4, "Read the mandatory attribute constraints: MinMeasuredValue"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PressureMeasurement::Id, + PressureMeasurement::Attributes::MinMeasuredValue::Id); + } + case 5: { + LogStep(5, "Write the default values to mandatory attribute: MinMeasuredValue"); + chip::app::DataModel::Nullable value; + value.SetNonNull(); + value.Value() = 0; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), PressureMeasurement::Id, + PressureMeasurement::Attributes::MinMeasuredValue::Id, value); + } + case 6: { + LogStep(6, "Reads back mandatory attribute: MinMeasuredValue"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PressureMeasurement::Id, + PressureMeasurement::Attributes::MinMeasuredValue::Id); + } + case 7: { + LogStep(7, "Read the mandatory attribute constraints: MaxMeasuredValue"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PressureMeasurement::Id, + PressureMeasurement::Attributes::MaxMeasuredValue::Id); + } + case 8: { + LogStep(8, "Write the default values to mandatory attribute: MaxMeasuredValue"); + chip::app::DataModel::Nullable value; + value.SetNonNull(); + value.Value() = 0; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), PressureMeasurement::Id, + PressureMeasurement::Attributes::MaxMeasuredValue::Id, value); + } + case 9: { + LogStep(9, "Reads back mandatory attribute: MaxMeasuredValue"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PressureMeasurement::Id, + PressureMeasurement::Attributes::MaxMeasuredValue::Id); + } } + return CHIP_NO_ERROR; + } +}; + +class Test_TC_PCC_1_1Suite : public TestCommand +{ +public: + Test_TC_PCC_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_PCC_1_1", 10, credsIssuerConfig) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } + ~Test_TC_PCC_1_1Suite() {} + chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 7; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -13574,6 +18428,69 @@ class Test_TC_CC_6_3Suite : public TestCommand VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); shouldContinue = true; break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + } + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "list")); + } + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "list")); + } + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "list")); + } + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("featureMap", value, 0UL)); + } + break; + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "map32")); + } + break; + case 8: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); + break; + case 9: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("featureMap", value, 0UL)); + VerifyOrReturn(CheckConstraintType("value", "", "map32")); + } + break; default: LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); } @@ -13584,212 +18501,74 @@ class Test_TC_CC_6_3Suite : public TestCommand } } - static void OnFailureCallback_2(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_2(error); - } - - static void OnSuccessCallback_2(void * context, bool onOff) - { - (static_cast(context))->OnSuccessResponse_2(onOff); - } - - static void OnFailureCallback_6(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_6(error); - } - - static void OnSuccessCallback_6(void * context, bool onOff) + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - (static_cast(context))->OnSuccessResponse_6(onOff); - } - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestTurnOnLightForColorControlTests_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::OnOff::Commands::On::Type; - - RequestType request; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_1(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_1(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_1() { NextTest(); } - - CHIP_ERROR TestCheckOnOffAttributeValueIsTrueAfterOnCommand_2() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::OnOffClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_2, OnFailureCallback_2, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_2(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_2(bool onOff) - { - VerifyOrReturn(CheckValue("onOff", onOff, 1)); - - NextTest(); - } - - CHIP_ERROR TestStepUpColorTemperatureCommand_3() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::ColorControl::Commands::StepColorTemperature::Type; - - RequestType request; - request.stepMode = static_cast(1); - request.stepSize = 5U; - request.transitionTime = 50U; - request.colorTemperatureMinimum = 5U; - request.colorTemperatureMaximum = 100U; - request.optionsMask = 0; - request.optionsOverride = 0; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_3(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_3(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_3(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_3() { NextTest(); } - - CHIP_ERROR TestStepDownColorTemperatureCommand_4() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::ColorControl::Commands::StepColorTemperature::Type; - - RequestType request; - request.stepMode = static_cast(3); - request.stepSize = 5U; - request.transitionTime = 50U; - request.colorTemperatureMinimum = 5U; - request.colorTemperatureMaximum = 100U; - request.optionsMask = 0; - request.optionsOverride = 0; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_4(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_4(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_4(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_4() { NextTest(); } - - CHIP_ERROR TestTurnOffLightThatWeTurnedOn_5() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::OnOff::Commands::Off::Type; - - RequestType request; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_5(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_5(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_5(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_5() { NextTest(); } - - CHIP_ERROR TestCheckOnOffAttributeValueIsFalseAfterOffCommand_6() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::OnOffClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_6, OnFailureCallback_6, true)); + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "Read the global attribute constraints: ClusterRevision"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, + PumpConfigurationAndControl::Attributes::ClusterRevision::Id); + } + case 2: { + LogStep(2, "write the default values to mandatory global attribute: ClusterRevision"); + uint16_t value; + value = 3U; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, + PumpConfigurationAndControl::Attributes::ClusterRevision::Id, value); + } + case 3: { + LogStep(3, "Read the global attribute: AttributeList"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, + PumpConfigurationAndControl::Attributes::AttributeList::Id); + } + case 4: { + LogStep(4, "Read the global attribute: AcceptedCommandList"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, + PumpConfigurationAndControl::Attributes::AcceptedCommandList::Id); + } + case 5: { + LogStep(5, "Read the global attribute: GeneratedCommandList"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, + PumpConfigurationAndControl::Attributes::GeneratedCommandList::Id); + } + case 6: { + LogStep(6, "read the optional global attribute: FeatureMap"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, + PumpConfigurationAndControl::Attributes::FeatureMap::Id); + } + case 7: { + LogStep(7, "read the optional global attribute: FeatureMap"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, + PumpConfigurationAndControl::Attributes::FeatureMap::Id); + } + case 8: { + LogStep(8, "write the default values to optional global attribute: FeatureMap"); + uint32_t value; + value = 0UL; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, + PumpConfigurationAndControl::Attributes::FeatureMap::Id, value); + } + case 9: { + LogStep(9, "reads back optional global attribute: FeatureMap"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, + PumpConfigurationAndControl::Attributes::FeatureMap::Id); + } + } return CHIP_NO_ERROR; } - - void OnFailureResponse_6(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_6(bool onOff) - { - VerifyOrReturn(CheckValue("onOff", onOff, 0)); - - NextTest(); - } }; -class Test_TC_CC_7_1Suite : public TestCommand +class Test_TC_PCC_2_1Suite : public TestCommand { public: - Test_TC_CC_7_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_CC_7_1", credsIssuerConfig), mTestIndex(0) + Test_TC_PCC_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_PCC_2_1", 50, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -13797,81 +18576,7 @@ class Test_TC_CC_7_1Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_CC_7_1Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_CC_7_1\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_CC_7_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Turn on light for color control tests\n"); - err = TestTurnOnLightForColorControlTests_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Check on/off attribute value is true after on command\n"); - err = TestCheckOnOffAttributeValueIsTrueAfterOnCommand_2(); - break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Enhanced Move To Hue command\n"); - err = TestEnhancedMoveToHueCommand_3(); - break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Enhanced Move To Hue command\n"); - err = TestEnhancedMoveToHueCommand_4(); - break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Enhanced Move To Hue command\n"); - err = TestEnhancedMoveToHueCommand_5(); - break; - case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : Enhanced Move To Hue command\n"); - err = TestEnhancedMoveToHueCommand_6(); - break; - case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : Enhanced Move To Hue command\n"); - err = TestEnhancedMoveToHueCommand_7(); - break; - case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : Turn off light that we turned on\n"); - err = TestTurnOffLightThatWeTurnedOn_8(); - break; - case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : Check on/off attribute value is false after off command\n"); - err = TestCheckOnOffAttributeValueIsFalseAfterOffCommand_9(); - break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } + ~Test_TC_PCC_2_1Suite() {} chip::System::Clock::Timeout GetWaitDuration() const override { @@ -13879,816 +18584,853 @@ class Test_TC_CC_7_1Suite : public TestCommand } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 10; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - static void OnFailureCallback_2(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_2(error); - } - - static void OnSuccessCallback_2(void * context, bool onOff) - { - (static_cast(context))->OnSuccessResponse_2(onOff); - } - - static void OnFailureCallback_9(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_9(error); - } - - static void OnSuccessCallback_9(void * context, bool onOff) - { - (static_cast(context))->OnSuccessResponse_9(onOff); - } + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } // // Tests methods // - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestTurnOnLightForColorControlTests_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::OnOff::Commands::On::Type; - - RequestType request; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_1(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_1(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_1() { NextTest(); } - - CHIP_ERROR TestCheckOnOffAttributeValueIsTrueAfterOnCommand_2() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::OnOffClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_2, OnFailureCallback_2, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_2(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_2(bool onOff) - { - VerifyOrReturn(CheckValue("onOff", onOff, 1)); - - NextTest(); - } - - CHIP_ERROR TestEnhancedMoveToHueCommand_3() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::ColorControl::Commands::EnhancedMoveToHue::Type; - - RequestType request; - request.enhancedHue = 1025U; - request.direction = static_cast(0); - request.transitionTime = 1U; - request.optionsMask = 0; - request.optionsOverride = 0; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_3(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_3(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_3(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_3() { NextTest(); } - - CHIP_ERROR TestEnhancedMoveToHueCommand_4() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::ColorControl::Commands::EnhancedMoveToHue::Type; - - RequestType request; - request.enhancedHue = 1100U; - request.direction = static_cast(0); - request.transitionTime = 300U; - request.optionsMask = 0; - request.optionsOverride = 0; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_4(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_4(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_4(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_4() { NextTest(); } - - CHIP_ERROR TestEnhancedMoveToHueCommand_5() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::ColorControl::Commands::EnhancedMoveToHue::Type; - - RequestType request; - request.enhancedHue = 1150U; - request.direction = static_cast(1); - request.transitionTime = 300U; - request.optionsMask = 0; - request.optionsOverride = 0; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_5(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_5(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_5(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_5() { NextTest(); } - - CHIP_ERROR TestEnhancedMoveToHueCommand_6() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::ColorControl::Commands::EnhancedMoveToHue::Type; - - RequestType request; - request.enhancedHue = 1200U; - request.direction = static_cast(2); - request.transitionTime = 300U; - request.optionsMask = 0; - request.optionsOverride = 0; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_6(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_6(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_6(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_6() { NextTest(); } - - CHIP_ERROR TestEnhancedMoveToHueCommand_7() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::ColorControl::Commands::EnhancedMoveToHue::Type; - - RequestType request; - request.enhancedHue = 1300U; - request.direction = static_cast(3); - request.transitionTime = 300U; - request.optionsMask = 0; - request.optionsOverride = 0; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_7(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_7(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_7(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_7() { NextTest(); } - - CHIP_ERROR TestTurnOffLightThatWeTurnedOn_8() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::OnOff::Commands::Off::Type; - - RequestType request; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_8(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_8(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_8(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_8() { NextTest(); } - - CHIP_ERROR TestCheckOnOffAttributeValueIsFalseAfterOffCommand_9() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::OnOffClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_9, OnFailureCallback_9, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_9(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_9(bool onOff) - { - VerifyOrReturn(CheckValue("onOff", onOff, 0)); - - NextTest(); - } -}; - -class Test_TC_CC_7_2Suite : public TestCommand -{ -public: - Test_TC_CC_7_2Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_CC_7_2", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_CC_7_2Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_CC_7_2\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_CC_7_2\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); + bool shouldContinue = false; - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) + switch (mTestIndex - 1) { case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; break; case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Turn on light for color control tests\n"); - err = TestTurnOnLightForColorControlTests_1(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "int16")); + } break; case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Check on/off attribute value is true after on command\n"); - err = TestCheckOnOffAttributeValueIsTrueAfterOnCommand_2(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + } break; case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Check EnhancedCurrentHue attribute from DUT\n"); - err = TestCheckEnhancedCurrentHueAttributeFromDut_3(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + } break; case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Enhanced Move Hue Up command\n"); - err = TestEnhancedMoveHueUpCommand_4(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::PumpConfigurationAndControl::PumpOperationMode value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "enum8")); + } break; case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Enhanced Move Hue Stop command\n"); - err = TestEnhancedMoveHueStopCommand_5(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::PumpConfigurationAndControl::PumpControlMode value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "enum8")); + } break; case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : Enhanced Move Hue Down command \n"); - err = TestEnhancedMoveHueDownCommand_6(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "int16")); + } break; case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : Enhanced Move Hue Stop command\n"); - err = TestEnhancedMoveHueStopCommand_7(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "int16")); + } break; case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : Turn off light that we turned on\n"); - err = TestTurnOffLightThatWeTurnedOn_8(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + } break; case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : Check on/off attribute value is false after off command\n"); - err = TestCheckOnOffAttributeValueIsFalseAfterOffCommand_9(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + } break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 10; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: + case 10: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; + { + chip::app::Clusters::PumpConfigurationAndControl::PumpOperationMode value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "enum8")); + } break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - static void OnFailureCallback_2(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_2(error); - } - - static void OnSuccessCallback_2(void * context, bool onOff) - { - (static_cast(context))->OnSuccessResponse_2(onOff); - } - - static void OnFailureCallback_3(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_3(error); - } - - static void OnSuccessCallback_3(void * context, uint16_t enhancedCurrentHue) - { - (static_cast(context))->OnSuccessResponse_3(enhancedCurrentHue); - } - - static void OnFailureCallback_9(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_9(error); - } - - static void OnSuccessCallback_9(void * context, bool onOff) - { - (static_cast(context))->OnSuccessResponse_9(onOff); - } - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestTurnOnLightForColorControlTests_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::OnOff::Commands::On::Type; - - RequestType request; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_1(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_1(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_1() { NextTest(); } - - CHIP_ERROR TestCheckOnOffAttributeValueIsTrueAfterOnCommand_2() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::OnOffClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_2, OnFailureCallback_2, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_2(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_2(bool onOff) - { - VerifyOrReturn(CheckValue("onOff", onOff, 1)); - - NextTest(); - } - - CHIP_ERROR TestCheckEnhancedCurrentHueAttributeFromDut_3() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_3, OnFailureCallback_3, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_3(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_3(uint16_t enhancedCurrentHue) - { - VerifyOrReturn(CheckConstraintType("enhancedCurrentHue", "", "uint16")); - VerifyOrReturn(CheckConstraintMinValue("enhancedCurrentHue", enhancedCurrentHue, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("enhancedCurrentHue", enhancedCurrentHue, 65535U)); - NextTest(); - } - - CHIP_ERROR TestEnhancedMoveHueUpCommand_4() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::ColorControl::Commands::EnhancedMoveHue::Type; - - RequestType request; - request.moveMode = static_cast(1); - request.rate = 50U; - request.optionsMask = 0; - request.optionsOverride = 0; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_4(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_4(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_4(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_4() { NextTest(); } - - CHIP_ERROR TestEnhancedMoveHueStopCommand_5() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::ColorControl::Commands::EnhancedMoveHue::Type; - - RequestType request; - request.moveMode = static_cast(0); - request.rate = 0U; - request.optionsMask = 0; - request.optionsOverride = 0; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_5(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_5(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_5(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_5() { NextTest(); } - - CHIP_ERROR TestEnhancedMoveHueDownCommand_6() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::ColorControl::Commands::EnhancedMoveHue::Type; - - RequestType request; - request.moveMode = static_cast(3); - request.rate = 5U; - request.optionsMask = 0; - request.optionsOverride = 0; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_6(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_6(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_6(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_6() { NextTest(); } - - CHIP_ERROR TestEnhancedMoveHueStopCommand_7() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::ColorControl::Commands::EnhancedMoveHue::Type; - - RequestType request; - request.moveMode = static_cast(0); - request.rate = 0U; - request.optionsMask = 0; - request.optionsOverride = 0; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_7(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_7(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_7(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_7() { NextTest(); } - - CHIP_ERROR TestTurnOffLightThatWeTurnedOn_8() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::OnOff::Commands::Off::Type; - - RequestType request; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_8(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_8(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_8(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_8() { NextTest(); } - - CHIP_ERROR TestCheckOnOffAttributeValueIsFalseAfterOffCommand_9() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::OnOffClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_9, OnFailureCallback_9, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_9(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_9(bool onOff) - { - VerifyOrReturn(CheckValue("onOff", onOff, 0)); - - NextTest(); - } -}; - -class Test_TC_CC_7_3Suite : public TestCommand -{ -public: - Test_TC_CC_7_3Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_CC_7_3", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_CC_7_3Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_CC_7_3\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_CC_7_3\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + case 11: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::PumpConfigurationAndControl::PumpControlMode value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "enum8")); + } break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Turn on light for color control tests\n"); - err = TestTurnOnLightForColorControlTests_1(); + case 12: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "int16")); + } break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Check on/off attribute value is true after on command\n"); - err = TestCheckOnOffAttributeValueIsTrueAfterOnCommand_2(); + case 13: + if (IsUnsupported(status.mStatus)) + { + return; + } + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "int16")); + } break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Enhanced Step Hue Up command\n"); - err = TestEnhancedStepHueUpCommand_3(); + case 14: + if (IsUnsupported(status.mStatus)) + { + return; + } + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "int16")); + } break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Enhanced Step Hue Down command\n"); - err = TestEnhancedStepHueDownCommand_4(); + case 15: + if (IsUnsupported(status.mStatus)) + { + return; + } + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "int16")); + } break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Turn off light that we turned on\n"); - err = TestTurnOffLightThatWeTurnedOn_5(); + case 16: + if (IsUnsupported(status.mStatus)) + { + return; + } + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "int16")); + } break; - case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : Check on/off attribute value is false after off command\n"); - err = TestCheckOnOffAttributeValueIsFalseAfterOffCommand_6(); + case 17: + if (IsUnsupported(status.mStatus)) + { + return; + } + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + } + break; + case 18: + if (IsUnsupported(status.mStatus)) + { + return; + } + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + } + break; + case 19: + if (IsUnsupported(status.mStatus)) + { + return; + } + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + } + break; + case 20: + if (IsUnsupported(status.mStatus)) + { + return; + } + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + } + break; + case 21: + if (IsUnsupported(status.mStatus)) + { + return; + } + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "int16")); + VerifyOrReturn(CheckConstraintMinValue("value", value, -27315)); + } + break; + case 22: + if (IsUnsupported(status.mStatus)) + { + return; + } + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "int16")); + VerifyOrReturn(CheckConstraintMinValue("value", value, -27315)); + } + break; + case 23: + if (IsUnsupported(status.mStatus)) + { + return; + } + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("pumpStatus", value, 0U)); + } + break; + case 24: + if (IsUnsupported(status.mStatus)) + { + return; + } + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "map16")); + } + break; + case 25: + if (IsUnsupported(status.mStatus)) + { + return; + } + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + } + break; + case 26: + if (IsUnsupported(status.mStatus)) + { + return; + } + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNonNull("lifetimeRunningHours", value)); + VerifyOrReturn(CheckValue("lifetimeRunningHours.Value()", value.Value(), 0UL)); + } + break; + case 27: + if (IsUnsupported(status.mStatus)) + { + return; + } + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint24")); + } + break; + case 28: + if (IsUnsupported(status.mStatus)) + { + return; + } + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint24")); + } + break; + case 29: + if (IsUnsupported(status.mStatus)) + { + return; + } + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNonNull("lifetimeEnergyConsumed", value)); + VerifyOrReturn(CheckValue("lifetimeEnergyConsumed.Value()", value.Value(), 0UL)); + } + break; + case 30: + if (IsUnsupported(status.mStatus)) + { + return; + } + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint32")); + } + break; + case 31: + if (IsUnsupported(status.mStatus)) + { + return; + } + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 32: + if (IsUnsupported(status.mStatus)) + { + return; + } + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "int16")); + } + break; + case 33: + if (IsUnsupported(status.mStatus)) + { + return; + } + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "int16")); + } + break; + case 34: + if (IsUnsupported(status.mStatus)) + { + return; + } + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "int16")); + } + break; + case 35: + if (IsUnsupported(status.mStatus)) + { + return; + } + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "int16")); + } + break; + case 36: + if (IsUnsupported(status.mStatus)) + { + return; + } + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + } + break; + case 37: + if (IsUnsupported(status.mStatus)) + { + return; + } + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + } + break; + case 38: + if (IsUnsupported(status.mStatus)) + { + return; + } + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + } + break; + case 39: + if (IsUnsupported(status.mStatus)) + { + return; + } + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + } + break; + case 40: + if (IsUnsupported(status.mStatus)) + { + return; + } + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "int16")); + VerifyOrReturn(CheckConstraintMinValue("value", value, -27315)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 32767)); + } + break; + case 41: + if (IsUnsupported(status.mStatus)) + { + return; + } + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "int16")); + VerifyOrReturn(CheckConstraintMinValue("value", value, -27315)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 32767)); + } + break; + case 42: + if (IsUnsupported(status.mStatus)) + { + return; + } + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("pumpStatus", value, 0U)); + } + break; + case 43: + if (IsUnsupported(status.mStatus)) + { + return; + } + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "map16")); + } + break; + case 44: + if (IsUnsupported(status.mStatus)) + { + return; + } + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + } + break; + case 45: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNonNull("lifetimeRunningHours", value)); + VerifyOrReturn(CheckValue("lifetimeRunningHours.Value()", value.Value(), 0UL)); + } + break; + case 46: + if (IsUnsupported(status.mStatus)) + { + return; + } + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint24")); + } + break; + case 47: + if (IsUnsupported(status.mStatus)) + { + return; + } + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint24")); + } + break; + case 48: + if (IsUnsupported(status.mStatus)) + { + return; + } + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNonNull("lifetimeEnergyConsumed", value)); + VerifyOrReturn(CheckValue("lifetimeEnergyConsumed.Value()", value.Value(), 0UL)); + } + break; + case 49: + if (IsUnsupported(status.mStatus)) + { + return; + } + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint32")); + } break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } + + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); } + } - if (CHIP_NO_ERROR != err) + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "read the mandatory attribute: MaxPressure"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, + PumpConfigurationAndControl::Attributes::MaxPressure::Id); + } + case 2: { + LogStep(2, "read the mandatory attribute: MaxSpeed"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, + PumpConfigurationAndControl::Attributes::MaxSpeed::Id); } + case 3: { + LogStep(3, "read the mandatory attribute: MaxFlow"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, + PumpConfigurationAndControl::Attributes::MaxFlow::Id); + } + case 4: { + LogStep(4, "read the mandatory attribute: EffectiveOperationMode"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, + PumpConfigurationAndControl::Attributes::EffectiveOperationMode::Id); + } + case 5: { + LogStep(5, "read the mandatory attribute: EffectiveControlMode"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, + PumpConfigurationAndControl::Attributes::EffectiveControlMode::Id); + } + case 6: { + LogStep(6, "read the mandatory attribute: Capacity"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, + PumpConfigurationAndControl::Attributes::Capacity::Id); + } + case 7: { + LogStep(7, "read the mandatory attribute: MaxPressure"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, + PumpConfigurationAndControl::Attributes::MaxPressure::Id); + } + case 8: { + LogStep(8, "read the mandatory attribute: MaxSpeed"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, + PumpConfigurationAndControl::Attributes::MaxSpeed::Id); + } + case 9: { + LogStep(9, "read the mandatory attribute: MaxFlow"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, + PumpConfigurationAndControl::Attributes::MaxFlow::Id); + } + case 10: { + LogStep(10, "read the mandatory attribute: EffectiveOperationMode"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, + PumpConfigurationAndControl::Attributes::EffectiveOperationMode::Id); + } + case 11: { + LogStep(11, "read the mandatory attribute: EffectiveControlMode"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, + PumpConfigurationAndControl::Attributes::EffectiveControlMode::Id); + } + case 12: { + LogStep(12, "read the mandatory attribute: Capacity"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, + PumpConfigurationAndControl::Attributes::Capacity::Id); + } + case 13: { + LogStep(13, "read the optional attribute: MinConstPressure"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, + PumpConfigurationAndControl::Attributes::MinConstPressure::Id); + } + case 14: { + LogStep(14, "read the optional attribute: MaxConstPressure"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, + PumpConfigurationAndControl::Attributes::MaxConstPressure::Id); + } + case 15: { + LogStep(15, "read the optional attribute: MinCompPressure"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, + PumpConfigurationAndControl::Attributes::MinCompPressure::Id); + } + case 16: { + LogStep(16, "read the optional attribute: MaxCompPressure"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, + PumpConfigurationAndControl::Attributes::MaxCompPressure::Id); + } + case 17: { + LogStep(17, "read the optional attribute: MinConstSpeed"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, + PumpConfigurationAndControl::Attributes::MinConstSpeed::Id); + } + case 18: { + LogStep(18, "read the optional attribute: MaxConstSpeed"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, + PumpConfigurationAndControl::Attributes::MaxConstSpeed::Id); + } + case 19: { + LogStep(19, "read the optional attribute: MinConstFlow"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, + PumpConfigurationAndControl::Attributes::MinConstFlow::Id); + } + case 20: { + LogStep(20, "read the optional attribute: MaxConstFlow"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, + PumpConfigurationAndControl::Attributes::MaxConstFlow::Id); + } + case 21: { + LogStep(21, "read the optional attribute: MinConstTemp"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, + PumpConfigurationAndControl::Attributes::MinConstTemp::Id); + } + case 22: { + LogStep(22, "read the optional attribute: MaxConstTemp"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, + PumpConfigurationAndControl::Attributes::MaxConstTemp::Id); + } + case 23: { + LogStep(23, "read the optional attribute: PumpStatus"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, + PumpConfigurationAndControl::Attributes::PumpStatus::Id); + } + case 24: { + LogStep(24, "read the optional attribute: PumpStatus"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, + PumpConfigurationAndControl::Attributes::PumpStatus::Id); + } + case 25: { + LogStep(25, "read the optional attribute: Speed"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, + PumpConfigurationAndControl::Attributes::Speed::Id); + } + case 26: { + LogStep(26, "read the optional attribute: LifetimeRunningHours"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, + PumpConfigurationAndControl::Attributes::LifetimeRunningHours::Id); + } + case 27: { + LogStep(27, "read the optional attribute: LifetimeRunningHours"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, + PumpConfigurationAndControl::Attributes::LifetimeRunningHours::Id); + } + case 28: { + LogStep(28, "read the optional attribute: Power"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, + PumpConfigurationAndControl::Attributes::Power::Id); + } + case 29: { + LogStep(29, "read the optional attribute: LifetimeEnergyConsumed"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, + PumpConfigurationAndControl::Attributes::LifetimeEnergyConsumed::Id); + } + case 30: { + LogStep(30, "read the optional attribute: LifetimeEnergyConsumed"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, + PumpConfigurationAndControl::Attributes::LifetimeEnergyConsumed::Id); + } + case 31: { + LogStep(31, "write to the optional attribute: LifetimeEnergyConsumed"); + chip::app::DataModel::Nullable value; + value.SetNonNull(); + value.Value() = 0UL; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, + PumpConfigurationAndControl::Attributes::LifetimeEnergyConsumed::Id, value); + } + case 32: { + LogStep(32, "read the optional attribute: MinConstPressure"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, + PumpConfigurationAndControl::Attributes::MinConstPressure::Id); + } + case 33: { + LogStep(33, "read the optional attribute: MaxConstPressure"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, + PumpConfigurationAndControl::Attributes::MaxConstPressure::Id); + } + case 34: { + LogStep(34, "read the optional attribute: MinCompPressure"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, + PumpConfigurationAndControl::Attributes::MinCompPressure::Id); + } + case 35: { + LogStep(35, "read the optional attribute: MaxCompPressure"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, + PumpConfigurationAndControl::Attributes::MaxCompPressure::Id); + } + case 36: { + LogStep(36, "read the optional attribute: MinConstSpeed"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, + PumpConfigurationAndControl::Attributes::MinConstSpeed::Id); + } + case 37: { + LogStep(37, "read the optional attribute: MaxConstSpeed"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, + PumpConfigurationAndControl::Attributes::MaxConstSpeed::Id); + } + case 38: { + LogStep(38, "read the optional attribute: MinConstFlow"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, + PumpConfigurationAndControl::Attributes::MinConstFlow::Id); + } + case 39: { + LogStep(39, "read the optional attribute: MaxConstFlow"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, + PumpConfigurationAndControl::Attributes::MaxConstFlow::Id); + } + case 40: { + LogStep(40, "read the optional attribute: MinConstTemp"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, + PumpConfigurationAndControl::Attributes::MinConstTemp::Id); + } + case 41: { + LogStep(41, "read the optional attribute: MaxConstTemp"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, + PumpConfigurationAndControl::Attributes::MaxConstTemp::Id); + } + case 42: { + LogStep(42, "read the optional attribute: PumpStatus"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, + PumpConfigurationAndControl::Attributes::PumpStatus::Id); + } + case 43: { + LogStep(43, "read the optional attribute: PumpStatus"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, + PumpConfigurationAndControl::Attributes::PumpStatus::Id); + } + case 44: { + LogStep(44, "read the optional attribute: Speed"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, + PumpConfigurationAndControl::Attributes::Speed::Id); + } + case 45: { + LogStep(45, "read the optional attribute: LifetimeRunningHours"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, + PumpConfigurationAndControl::Attributes::LifetimeRunningHours::Id); + } + case 46: { + LogStep(46, "read the optional attribute: LifetimeRunningHours"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, + PumpConfigurationAndControl::Attributes::LifetimeRunningHours::Id); + } + case 47: { + LogStep(47, "read the optional attribute: Power"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, + PumpConfigurationAndControl::Attributes::Power::Id); + } + case 48: { + LogStep(48, "read the optional attribute: LifetimeEnergyConsumed"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, + PumpConfigurationAndControl::Attributes::LifetimeEnergyConsumed::Id); + } + case 49: { + LogStep(49, "read the optional attribute: LifetimeEnergyConsumed"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, + PumpConfigurationAndControl::Attributes::LifetimeEnergyConsumed::Id); + } + } + return CHIP_NO_ERROR; } +}; + +class Test_TC_PCC_2_2Suite : public TestCommand +{ +public: + Test_TC_PCC_2_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_PCC_2_2", 7, credsIssuerConfig) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } + + ~Test_TC_PCC_2_2Suite() {} chip::System::Clock::Timeout GetWaitDuration() const override { @@ -14696,14 +19438,17 @@ class Test_TC_CC_7_3Suite : public TestCommand } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 7; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -14714,6 +19459,39 @@ class Test_TC_CC_7_3Suite : public TestCommand VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); shouldContinue = true; break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::PumpConfigurationAndControl::PumpOperationMode value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("effectiveOperationMode", value, 1)); + } + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::PumpConfigurationAndControl::PumpOperationMode value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("effectiveOperationMode", value, 2)); + } + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::PumpConfigurationAndControl::PumpOperationMode value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("effectiveOperationMode", value, 3)); + } + break; default: LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); } @@ -14724,208 +19502,307 @@ class Test_TC_CC_7_3Suite : public TestCommand } } - static void OnFailureCallback_2(void * context, CHIP_ERROR error) + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - (static_cast(context))->OnFailureResponse_2(error); + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "Write 1 to the OperationMode attribute to DUT: OperationMode"); + VerifyOrdo(!ShouldSkip("A_OPERATIONMODE"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + chip::app::Clusters::PumpConfigurationAndControl::PumpOperationMode value; + value = static_cast(1); + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, + PumpConfigurationAndControl::Attributes::OperationMode::Id, value); + } + case 2: { + LogStep(2, "Reads the attribute: EffectiveOperationMode"); + VerifyOrdo(!ShouldSkip("A_EFFECTIVEOPERATIONMODE"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, + PumpConfigurationAndControl::Attributes::EffectiveOperationMode::Id); + } + case 3: { + LogStep(3, "Write 2 to the OperationMode attribute to DUT: OperationMode"); + VerifyOrdo(!ShouldSkip("A_OPERATIONMODE"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + chip::app::Clusters::PumpConfigurationAndControl::PumpOperationMode value; + value = static_cast(2); + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, + PumpConfigurationAndControl::Attributes::OperationMode::Id, value); + } + case 4: { + LogStep(4, "Reads the attribute: EffectiveOperationMode"); + VerifyOrdo(!ShouldSkip("A_EFFECTIVEOPERATIONMODE"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, + PumpConfigurationAndControl::Attributes::EffectiveOperationMode::Id); + } + case 5: { + LogStep(5, "Write 3 to the OperationMode attribute to DUT: OperationMode"); + VerifyOrdo(!ShouldSkip("A_OPERATIONMODE"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + chip::app::Clusters::PumpConfigurationAndControl::PumpOperationMode value; + value = static_cast(3); + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, + PumpConfigurationAndControl::Attributes::OperationMode::Id, value); + } + case 6: { + LogStep(6, "Reads the attribute: EffectiveOperationMode"); + VerifyOrdo(!ShouldSkip("A_EFFECTIVEOPERATIONMODE"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, + PumpConfigurationAndControl::Attributes::EffectiveOperationMode::Id); + } + } + return CHIP_NO_ERROR; } +}; - static void OnSuccessCallback_2(void * context, bool onOff) +class Test_TC_PCC_2_3Suite : public TestCommand +{ +public: + Test_TC_PCC_2_3Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_PCC_2_3", 15, credsIssuerConfig) { - (static_cast(context))->OnSuccessResponse_2(onOff); + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - static void OnFailureCallback_6(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_6(error); - } + ~Test_TC_PCC_2_3Suite() {} - static void OnSuccessCallback_6(void * context, bool onOff) + chip::System::Clock::Timeout GetWaitDuration() const override { - (static_cast(context))->OnSuccessResponse_6(onOff); + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + // // Tests methods // - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestTurnOnLightForColorControlTests_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::OnOff::Commands::On::Type; - - RequestType request; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_1(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_1(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_1() { NextTest(); } - - CHIP_ERROR TestCheckOnOffAttributeValueIsTrueAfterOnCommand_2() + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::OnOffClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_2, OnFailureCallback_2, true)); - return CHIP_NO_ERROR; - } + bool shouldContinue = false; - void OnFailureResponse_2(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_2(bool onOff) - { - VerifyOrReturn(CheckValue("onOff", onOff, 1)); - - NextTest(); - } - - CHIP_ERROR TestEnhancedStepHueUpCommand_3() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::ColorControl::Commands::EnhancedStepHue::Type; - - RequestType request; - request.stepMode = static_cast(0); - request.stepSize = 50U; - request.transitionTime = 1U; - request.optionsMask = 0; - request.optionsOverride = 0; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_3(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_3(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_3(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_3() { NextTest(); } - - CHIP_ERROR TestEnhancedStepHueDownCommand_4() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::ColorControl::Commands::EnhancedStepHue::Type; - - RequestType request; - request.stepMode = static_cast(1); - request.stepSize = 75U; - request.transitionTime = 1U; - request.optionsMask = 0; - request.optionsOverride = 0; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_4(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_4(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_4(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_4() { NextTest(); } - - CHIP_ERROR TestTurnOffLightThatWeTurnedOn_5() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::OnOff::Commands::Off::Type; - - RequestType request; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_5(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_5(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_5(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_5() { NextTest(); } + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::PumpConfigurationAndControl::PumpOperationMode value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("effectiveOperationMode", value, 0)); + } + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::PumpConfigurationAndControl::PumpControlMode value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("effectiveControlMode", value, 0)); + } + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::PumpConfigurationAndControl::PumpControlMode value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("effectiveControlMode", value, 1)); + } + break; + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 8: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::PumpConfigurationAndControl::PumpControlMode value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("effectiveControlMode", value, 2)); + } + break; + case 9: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 10: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::PumpConfigurationAndControl::PumpControlMode value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("effectiveControlMode", value, 3)); + } + break; + case 11: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 12: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::PumpConfigurationAndControl::PumpControlMode value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("effectiveControlMode", value, 5)); + } + break; + case 13: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 14: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::PumpConfigurationAndControl::PumpControlMode value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("effectiveControlMode", value, 7)); + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } - CHIP_ERROR TestCheckOnOffAttributeValueIsFalseAfterOffCommand_6() + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } + } + + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::OnOffClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_6, OnFailureCallback_6, true)); + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "Write 0 to the OperationMode attribute to DUT"); + VerifyOrdo(!ShouldSkip("A_OPERATIONMODE"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + chip::app::Clusters::PumpConfigurationAndControl::PumpOperationMode value; + value = static_cast(0); + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, + PumpConfigurationAndControl::Attributes::OperationMode::Id, value); + } + case 2: { + LogStep(2, "Reads the attribute: EffectiveOperationMode"); + VerifyOrdo(!ShouldSkip("A_EFFECTIVEOPERATIONMODE"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, + PumpConfigurationAndControl::Attributes::EffectiveOperationMode::Id); + } + case 3: { + LogStep(3, "Write 0 to the ControlMode attribute to DUT"); + VerifyOrdo(!ShouldSkip("A_CONTROLMODE"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + chip::app::Clusters::PumpConfigurationAndControl::PumpControlMode value; + value = static_cast(0); + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, + PumpConfigurationAndControl::Attributes::ControlMode::Id, value); + } + case 4: { + LogStep(4, "Reads the attribute: EffectiveControlMode"); + VerifyOrdo(!ShouldSkip("A_EFFECTIVECONTROLMODE"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, + PumpConfigurationAndControl::Attributes::EffectiveControlMode::Id); + } + case 5: { + LogStep(5, "Write 1 to the ControlMode attribute to DUT"); + VerifyOrdo(!ShouldSkip("A_CONTROLMODE"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + chip::app::Clusters::PumpConfigurationAndControl::PumpControlMode value; + value = static_cast(1); + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, + PumpConfigurationAndControl::Attributes::ControlMode::Id, value); + } + case 6: { + LogStep(6, "Reads the attribute: EffectiveControlMode"); + VerifyOrdo(!ShouldSkip("A_EFFECTIVECONTROLMODE"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, + PumpConfigurationAndControl::Attributes::EffectiveControlMode::Id); + } + case 7: { + LogStep(7, "Write 2 to the ControlMode attribute to DUT"); + VerifyOrdo(!ShouldSkip("A_CONTROLMODE"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + chip::app::Clusters::PumpConfigurationAndControl::PumpControlMode value; + value = static_cast(2); + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, + PumpConfigurationAndControl::Attributes::ControlMode::Id, value); + } + case 8: { + LogStep(8, "Reads the attribute: EffectiveControlMode"); + VerifyOrdo(!ShouldSkip("A_EFFECTIVECONTROLMODE"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, + PumpConfigurationAndControl::Attributes::EffectiveControlMode::Id); + } + case 9: { + LogStep(9, "Write 3 to the ControlMode attribute to DUT"); + VerifyOrdo(!ShouldSkip("A_CONTROLMODE"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + chip::app::Clusters::PumpConfigurationAndControl::PumpControlMode value; + value = static_cast(3); + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, + PumpConfigurationAndControl::Attributes::ControlMode::Id, value); + } + case 10: { + LogStep(10, "Reads the attribute: EffectiveControlMode"); + VerifyOrdo(!ShouldSkip("A_EFFECTIVECONTROLMODE"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, + PumpConfigurationAndControl::Attributes::EffectiveControlMode::Id); + } + case 11: { + LogStep(11, "Write 5 to the ControlMode attribute to DUT"); + VerifyOrdo(!ShouldSkip("A_CONTROLMODE"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + chip::app::Clusters::PumpConfigurationAndControl::PumpControlMode value; + value = static_cast(5); + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, + PumpConfigurationAndControl::Attributes::ControlMode::Id, value); + } + case 12: { + LogStep(12, "Reads the attribute: EffectiveControlMode"); + VerifyOrdo(!ShouldSkip("A_EFFECTIVECONTROLMODE"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, + PumpConfigurationAndControl::Attributes::EffectiveControlMode::Id); + } + case 13: { + LogStep(13, "Write 7 to the ControlMode attribute to DUT"); + VerifyOrdo(!ShouldSkip("A_CONTROLMODE"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + chip::app::Clusters::PumpConfigurationAndControl::PumpControlMode value; + value = static_cast(7); + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, + PumpConfigurationAndControl::Attributes::ControlMode::Id, value); + } + case 14: { + LogStep(14, "Reads the attribute: EffectiveControlMode"); + VerifyOrdo(!ShouldSkip("A_EFFECTIVECONTROLMODE"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, + PumpConfigurationAndControl::Attributes::EffectiveControlMode::Id); + } + } return CHIP_NO_ERROR; } - - void OnFailureResponse_6(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_6(bool onOff) - { - VerifyOrReturn(CheckValue("onOff", onOff, 0)); - - NextTest(); - } }; -class Test_TC_CC_7_4Suite : public TestCommand +class Test_TC_PCC_2_4Suite : public TestCommand { public: - Test_TC_CC_7_4Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_CC_7_4", credsIssuerConfig), mTestIndex(0) + Test_TC_PCC_2_4Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_PCC_2_4", 13, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -14933,80 +19810,240 @@ class Test_TC_CC_7_4Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_CC_7_4Suite() {} + ~Test_TC_PCC_2_4Suite() {} - /////////// TestCommand Interface ///////// - void NextTest() override + chip::System::Clock::Timeout GetWaitDuration() const override { - CHIP_ERROR err = CHIP_NO_ERROR; + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_CC_7_4\n"); - } +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_CC_7_4\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // - Wait(); + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override + { + bool shouldContinue = false; - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) + switch (mTestIndex - 1) { case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; break; case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Turn on light for color control tests\n"); - err = TestTurnOnLightForColorControlTests_1(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Check on/off attribute value is true after on command\n"); - err = TestCheckOnOffAttributeValueIsTrueAfterOnCommand_2(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNonNull("lifetimeRunningHours", value)); + VerifyOrReturn(CheckValue("lifetimeRunningHours.Value()", value.Value(), 1UL)); + } break; case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Enhanced move to hue and saturation command\n"); - err = TestEnhancedMoveToHueAndSaturationCommand_3(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Turn off light that we turned on\n"); - err = TestTurnOffLightThatWeTurnedOn_4(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNonNull("lifetimeRunningHours", value)); + VerifyOrReturn(CheckValue("lifetimeRunningHours.Value()", value.Value(), 2UL)); + } break; case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Check on/off attribute value is false after off command\n"); - err = TestCheckOnOffAttributeValueIsFalseAfterOffCommand_5(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNonNull("lifetimeRunningHours", value)); + VerifyOrReturn(CheckValue("lifetimeRunningHours.Value()", value.Value(), 3UL)); + } + break; + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 8: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNonNull("lifetimeEnergyConsumed", value)); + VerifyOrReturn(CheckValue("lifetimeEnergyConsumed.Value()", value.Value(), 1UL)); + } break; + case 9: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 10: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNonNull("lifetimeEnergyConsumed", value)); + VerifyOrReturn(CheckValue("lifetimeEnergyConsumed.Value()", value.Value(), 2UL)); + } + break; + case 11: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 12: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNonNull("lifetimeEnergyConsumed", value)); + VerifyOrReturn(CheckValue("lifetimeEnergyConsumed.Value()", value.Value(), 3UL)); + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } + + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); } + } - if (CHIP_NO_ERROR != err) + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "Write 1 to the LifetimeRunningHours attribute to DUT"); + chip::app::DataModel::Nullable value; + value.SetNonNull(); + value.Value() = 1UL; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, + PumpConfigurationAndControl::Attributes::LifetimeRunningHours::Id, value); + } + case 2: { + LogStep(2, "Reads the attribute: LifetimeRunningHours"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, + PumpConfigurationAndControl::Attributes::LifetimeRunningHours::Id); + } + case 3: { + LogStep(3, "Write 2 to the LifetimeRunningHours attribute to DUT"); + chip::app::DataModel::Nullable value; + value.SetNonNull(); + value.Value() = 2UL; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, + PumpConfigurationAndControl::Attributes::LifetimeRunningHours::Id, value); + } + case 4: { + LogStep(4, "Reads the attribute: LifetimeRunningHours"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, + PumpConfigurationAndControl::Attributes::LifetimeRunningHours::Id); + } + case 5: { + LogStep(5, "Write 3 to the LifetimeRunningHours attribute to DUT"); + chip::app::DataModel::Nullable value; + value.SetNonNull(); + value.Value() = 3UL; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, + PumpConfigurationAndControl::Attributes::LifetimeRunningHours::Id, value); } + case 6: { + LogStep(6, "Reads the attribute: LifetimeRunningHours"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, + PumpConfigurationAndControl::Attributes::LifetimeRunningHours::Id); + } + case 7: { + LogStep(7, "Write 1 to the LifetimeEnergyConsumed attribute to DUT"); + chip::app::DataModel::Nullable value; + value.SetNonNull(); + value.Value() = 1UL; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, + PumpConfigurationAndControl::Attributes::LifetimeEnergyConsumed::Id, value); + } + case 8: { + LogStep(8, "Reads the attribute: LifetimeEnergyConsumed"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, + PumpConfigurationAndControl::Attributes::LifetimeEnergyConsumed::Id); + } + case 9: { + LogStep(9, "Write 2 to the LifetimeEnergyConsumed attribute to DUT"); + chip::app::DataModel::Nullable value; + value.SetNonNull(); + value.Value() = 2UL; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, + PumpConfigurationAndControl::Attributes::LifetimeEnergyConsumed::Id, value); + } + case 10: { + LogStep(10, "Reads the attribute: LifetimeEnergyConsumed"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, + PumpConfigurationAndControl::Attributes::LifetimeEnergyConsumed::Id); + } + case 11: { + LogStep(11, "Write 3 to the LifetimeEnergyConsumed attribute to DUT"); + chip::app::DataModel::Nullable value; + value.SetNonNull(); + value.Value() = 3UL; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, + PumpConfigurationAndControl::Attributes::LifetimeEnergyConsumed::Id, value); + } + case 12: { + LogStep(12, "Reads the attribute: LifetimeEnergyConsumed"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, + PumpConfigurationAndControl::Attributes::LifetimeEnergyConsumed::Id); + } + } + return CHIP_NO_ERROR; + } +}; + +class Test_TC_PSCFG_1_1Suite : public TestCommand +{ +public: + Test_TC_PSCFG_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_PSCFG_1_1", 5, credsIssuerConfig) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } + ~Test_TC_PSCFG_1_1Suite() {} + chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 6; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -15017,6 +20054,38 @@ class Test_TC_CC_7_4Suite : public TestCommand VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); shouldContinue = true; break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("clusterRevision", value, 1U)); + } + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "list")); + } + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "list")); + } + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "list")); + } + break; default: LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); } @@ -15027,176 +20096,45 @@ class Test_TC_CC_7_4Suite : public TestCommand } } - static void OnFailureCallback_2(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_2(error); - } - - static void OnSuccessCallback_2(void * context, bool onOff) - { - (static_cast(context))->OnSuccessResponse_2(onOff); - } - - static void OnFailureCallback_5(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_5(error); - } - - static void OnSuccessCallback_5(void * context, bool onOff) - { - (static_cast(context))->OnSuccessResponse_5(onOff); - } - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestTurnOnLightForColorControlTests_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::OnOff::Commands::On::Type; - - RequestType request; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_1(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_1(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_1() { NextTest(); } - - CHIP_ERROR TestCheckOnOffAttributeValueIsTrueAfterOnCommand_2() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::OnOffClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_2, OnFailureCallback_2, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_2(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_2(bool onOff) - { - VerifyOrReturn(CheckValue("onOff", onOff, 1)); - - NextTest(); - } - - CHIP_ERROR TestEnhancedMoveToHueAndSaturationCommand_3() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::ColorControl::Commands::EnhancedMoveToHueAndSaturation::Type; - - RequestType request; - request.enhancedHue = 1200U; - request.saturation = 90; - request.transitionTime = 10U; - request.optionsMask = 0; - request.optionsOverride = 0; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_3(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_3(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_3(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_3() { NextTest(); } - - CHIP_ERROR TestTurnOffLightThatWeTurnedOn_4() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::OnOff::Commands::Off::Type; - - RequestType request; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_4(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_4(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_4(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_4() { NextTest(); } - - CHIP_ERROR TestCheckOnOffAttributeValueIsFalseAfterOffCommand_5() + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::OnOffClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_5, OnFailureCallback_5, true)); + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Commission DUT to TH"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "TH reads the ClusterRevision attribute from the DUT"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), PowerSourceConfiguration::Id, + PowerSourceConfiguration::Attributes::ClusterRevision::Id); + } + case 2: { + LogStep(2, "TH reads the AttributeList attribute from the DUT"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), PowerSourceConfiguration::Id, + PowerSourceConfiguration::Attributes::AttributeList::Id); + } + case 3: { + LogStep(3, "TH reads the AcceptedCommandList attribute from the DUT"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), PowerSourceConfiguration::Id, + PowerSourceConfiguration::Attributes::AcceptedCommandList::Id); + } + case 4: { + LogStep(4, "TH reads the GeneratedCommandList attribute from the DUT"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), PowerSourceConfiguration::Id, + PowerSourceConfiguration::Attributes::GeneratedCommandList::Id); + } + } return CHIP_NO_ERROR; } - - void OnFailureResponse_5(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_5(bool onOff) - { - VerifyOrReturn(CheckValue("onOff", onOff, 0)); - - NextTest(); - } }; -class Test_TC_CC_8_1Suite : public TestCommand +class Test_TC_RH_1_1Suite : public TestCommand { public: - Test_TC_CC_8_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_CC_8_1", credsIssuerConfig), mTestIndex(0) + Test_TC_RH_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_RH_1_1", 5, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -15204,124 +20142,142 @@ class Test_TC_CC_8_1Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_CC_8_1Suite() {} + ~Test_TC_RH_1_1Suite() {} - /////////// TestCommand Interface ///////// - void NextTest() override + chip::System::Clock::Timeout GetWaitDuration() const override { - CHIP_ERROR err = CHIP_NO_ERROR; + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_CC_8_1\n"); - } +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_CC_8_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // - Wait(); + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override + { + bool shouldContinue = false; - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) + switch (mTestIndex - 1) { case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; break; case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Turn on light for color control tests\n"); - err = TestTurnOnLightForColorControlTests_1(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + } break; case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Check on/off attribute value is true after on command\n"); - err = TestCheckOnOffAttributeValueIsTrueAfterOnCommand_2(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "list")); + } break; case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Color Loop Set Command - Set all Attributes\n"); - err = TestColorLoopSetCommandSetAllAttributes_3(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "list")); + } break; case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Check ColorLoopDirection Value\n"); - err = TestCheckColorLoopDirectionValue_4(); - break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Check ColorLoopTime Value\n"); - err = TestCheckColorLoopTimeValue_5(); - break; - case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : Check ColorLoopStartEnhancedHue Value\n"); - err = TestCheckColorLoopStartEnhancedHueValue_6(); - break; - case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : Check ColorLoopActive Value\n"); - err = TestCheckColorLoopActiveValue_7(); - break; - case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : Color Loop Set Command - Start Color Loop\n"); - err = TestColorLoopSetCommandStartColorLoop_8(); - break; - case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : Check ColorLoopActive Value\n"); - err = TestCheckColorLoopActiveValue_9(); - break; - case 10: - ChipLogProgress(chipTool, " ***** Test Step 10 : Color Loop Set Command - Set direction and time while running\n"); - err = TestColorLoopSetCommandSetDirectionAndTimeWhileRunning_10(); - break; - case 11: - ChipLogProgress(chipTool, " ***** Test Step 11 : Check ColorLoopDirection Value\n"); - err = TestCheckColorLoopDirectionValue_11(); - break; - case 12: - ChipLogProgress(chipTool, " ***** Test Step 12 : Check ColorLoopTime Value\n"); - err = TestCheckColorLoopTimeValue_12(); - break; - case 13: - ChipLogProgress(chipTool, " ***** Test Step 13 : Color Loop Set Command - Set direction while running\n"); - err = TestColorLoopSetCommandSetDirectionWhileRunning_13(); - break; - case 14: - ChipLogProgress(chipTool, " ***** Test Step 14 : Check ColorLoopDirection Value\n"); - err = TestCheckColorLoopDirectionValue_14(); - break; - case 15: - ChipLogProgress(chipTool, " ***** Test Step 15 : Turn off light that we turned on\n"); - err = TestTurnOffLightThatWeTurnedOn_15(); - break; - case 16: - ChipLogProgress(chipTool, " ***** Test Step 16 : Check on/off attribute value is false after off command\n"); - err = TestCheckOnOffAttributeValueIsFalseAfterOffCommand_16(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "list")); + } break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } + + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); } + } - if (CHIP_NO_ERROR != err) + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "Read the global attribute constraints: ClusterRevision"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RelativeHumidityMeasurement::Id, + RelativeHumidityMeasurement::Attributes::ClusterRevision::Id); + } + case 2: { + LogStep(2, "Read the global attribute: AttributeList"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RelativeHumidityMeasurement::Id, + RelativeHumidityMeasurement::Attributes::AttributeList::Id); + } + case 3: { + LogStep(3, "Read the global attribute: AcceptedCommandList"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RelativeHumidityMeasurement::Id, + RelativeHumidityMeasurement::Attributes::AcceptedCommandList::Id); } + case 4: { + LogStep(4, "Read the global attribute: GeneratedCommandList"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RelativeHumidityMeasurement::Id, + RelativeHumidityMeasurement::Attributes::GeneratedCommandList::Id); + } + } + return CHIP_NO_ERROR; + } +}; + +class Test_TC_RH_2_1Suite : public TestCommand +{ +public: + Test_TC_RH_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_RH_2_1", 4, credsIssuerConfig) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } + ~Test_TC_RH_2_1Suite() {} + chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 17; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -15332,6 +20288,40 @@ class Test_TC_CC_8_1Suite : public TestCommand VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); shouldContinue = true; break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "int16")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 10000U)); + } + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "int16")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 9999U)); + } + break; + case 3: + if (IsUnsupported(status.mStatus)) + { + return; + } + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 2048U)); + } + break; default: LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); } @@ -15342,1074 +20332,1096 @@ class Test_TC_CC_8_1Suite : public TestCommand } } - static void OnFailureCallback_2(void * context, CHIP_ERROR error) + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - (static_cast(context))->OnFailureResponse_2(error); - } - - static void OnSuccessCallback_2(void * context, bool onOff) - { - (static_cast(context))->OnSuccessResponse_2(onOff); + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "Reads constraints of attribute: MeasuredValue"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RelativeHumidityMeasurement::Id, + RelativeHumidityMeasurement::Attributes::MeasuredValue::Id); + } + case 2: { + LogStep(2, "Reads constraints of attribute: MinMeasuredValue"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RelativeHumidityMeasurement::Id, + RelativeHumidityMeasurement::Attributes::MinMeasuredValue::Id); + } + case 3: { + LogStep(3, "Reads constraints of attribute: Tolerance"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RelativeHumidityMeasurement::Id, + RelativeHumidityMeasurement::Attributes::Tolerance::Id); + } + } + return CHIP_NO_ERROR; } +}; - static void OnFailureCallback_4(void * context, CHIP_ERROR error) +class Test_TC_RH_2_2Suite : public TestCommand +{ +public: + Test_TC_RH_2_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_RH_2_2", 4, credsIssuerConfig) { - (static_cast(context))->OnFailureResponse_4(error); + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - static void OnSuccessCallback_4(void * context, uint8_t colorLoopDirection) - { - (static_cast(context))->OnSuccessResponse_4(colorLoopDirection); - } + ~Test_TC_RH_2_2Suite() {} - static void OnFailureCallback_5(void * context, CHIP_ERROR error) + chip::System::Clock::Timeout GetWaitDuration() const override { - (static_cast(context))->OnFailureResponse_5(error); + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } - static void OnSuccessCallback_5(void * context, uint16_t colorLoopTime) - { - (static_cast(context))->OnSuccessResponse_5(colorLoopTime); - } +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; - static void OnFailureCallback_6(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_6(error); - } - - static void OnSuccessCallback_6(void * context, uint16_t colorLoopStartEnhancedHue) - { - (static_cast(context))->OnSuccessResponse_6(colorLoopStartEnhancedHue); - } - - static void OnFailureCallback_7(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_7(error); - } - - static void OnSuccessCallback_7(void * context, uint8_t colorLoopActive) - { - (static_cast(context))->OnSuccessResponse_7(colorLoopActive); - } - - static void OnFailureCallback_9(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_9(error); - } - - static void OnSuccessCallback_9(void * context, uint8_t colorLoopActive) - { - (static_cast(context))->OnSuccessResponse_9(colorLoopActive); - } - - static void OnFailureCallback_11(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_11(error); - } - - static void OnSuccessCallback_11(void * context, uint8_t colorLoopDirection) - { - (static_cast(context))->OnSuccessResponse_11(colorLoopDirection); - } - - static void OnFailureCallback_12(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_12(error); - } - - static void OnSuccessCallback_12(void * context, uint16_t colorLoopTime) - { - (static_cast(context))->OnSuccessResponse_12(colorLoopTime); - } - - static void OnFailureCallback_14(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_14(error); - } - - static void OnSuccessCallback_14(void * context, uint8_t colorLoopDirection) - { - (static_cast(context))->OnSuccessResponse_14(colorLoopDirection); - } - - static void OnFailureCallback_16(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_16(error); - } - - static void OnSuccessCallback_16(void * context, bool onOff) - { - (static_cast(context))->OnSuccessResponse_16(onOff); - } + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } // // Tests methods // - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestTurnOnLightForColorControlTests_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::OnOff::Commands::On::Type; - - RequestType request; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_1(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_1(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_1() { NextTest(); } - - CHIP_ERROR TestCheckOnOffAttributeValueIsTrueAfterOnCommand_2() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::OnOffClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_2, OnFailureCallback_2, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_2(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_2(bool onOff) - { - VerifyOrReturn(CheckValue("onOff", onOff, 1)); - - NextTest(); - } - - CHIP_ERROR TestColorLoopSetCommandSetAllAttributes_3() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type; - - RequestType request; - request.updateFlags = static_cast>(14); - request.action = static_cast(0); - request.direction = static_cast(1); - request.time = 100U; - request.startHue = 500U; - request.optionsMask = 0; - request.optionsOverride = 0; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_3(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_3(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_3(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_3() { NextTest(); } - - CHIP_ERROR TestCheckColorLoopDirectionValue_4() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_4, OnFailureCallback_4, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_4(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_4(uint8_t colorLoopDirection) - { - VerifyOrReturn(CheckValue("colorLoopDirection", colorLoopDirection, 1)); - - NextTest(); - } - - CHIP_ERROR TestCheckColorLoopTimeValue_5() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_5, OnFailureCallback_5, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_5(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_5(uint16_t colorLoopTime) - { - VerifyOrReturn(CheckValue("colorLoopTime", colorLoopTime, 100U)); - - NextTest(); - } - - CHIP_ERROR TestCheckColorLoopStartEnhancedHueValue_6() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_6, OnFailureCallback_6, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_6(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_6(uint16_t colorLoopStartEnhancedHue) - { - VerifyOrReturn(CheckValue("colorLoopStartEnhancedHue", colorLoopStartEnhancedHue, 500U)); - - NextTest(); - } - - CHIP_ERROR TestCheckColorLoopActiveValue_7() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_7, OnFailureCallback_7, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_7(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_7(uint8_t colorLoopActive) - { - VerifyOrReturn(CheckValue("colorLoopActive", colorLoopActive, 0)); - - NextTest(); - } - - CHIP_ERROR TestColorLoopSetCommandStartColorLoop_8() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type; - - RequestType request; - request.updateFlags = static_cast>(1); - request.action = static_cast(1); - request.direction = static_cast(0); - request.time = 0U; - request.startHue = 0U; - request.optionsMask = 0; - request.optionsOverride = 0; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_8(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_8(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_8(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_8() { NextTest(); } - - CHIP_ERROR TestCheckColorLoopActiveValue_9() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_9, OnFailureCallback_9, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_9(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_9(uint8_t colorLoopActive) - { - VerifyOrReturn(CheckValue("colorLoopActive", colorLoopActive, 1)); - - NextTest(); - } - - CHIP_ERROR TestColorLoopSetCommandSetDirectionAndTimeWhileRunning_10() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type; - - RequestType request; - request.updateFlags = static_cast>(6); - request.action = static_cast(0); - request.direction = static_cast(0); - request.time = 3500U; - request.startHue = 0U; - request.optionsMask = 0; - request.optionsOverride = 0; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_10(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_10(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_10(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_10() { NextTest(); } - - CHIP_ERROR TestCheckColorLoopDirectionValue_11() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_11, OnFailureCallback_11, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_11(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_11(uint8_t colorLoopDirection) - { - VerifyOrReturn(CheckValue("colorLoopDirection", colorLoopDirection, 0)); - - NextTest(); - } - - CHIP_ERROR TestCheckColorLoopTimeValue_12() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_12, OnFailureCallback_12, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_12(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_12(uint16_t colorLoopTime) - { - VerifyOrReturn(CheckValue("colorLoopTime", colorLoopTime, 3500U)); - - NextTest(); - } - - CHIP_ERROR TestColorLoopSetCommandSetDirectionWhileRunning_13() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type; - - RequestType request; - request.updateFlags = static_cast>(2); - request.action = static_cast(0); - request.direction = static_cast(1); - request.time = 0U; - request.startHue = 0U; - request.optionsMask = 0; - request.optionsOverride = 0; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_13(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_13(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_13(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_13() { NextTest(); } - - CHIP_ERROR TestCheckColorLoopDirectionValue_14() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_14, OnFailureCallback_14, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_14(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_14(uint8_t colorLoopDirection) - { - VerifyOrReturn(CheckValue("colorLoopDirection", colorLoopDirection, 1)); - - NextTest(); - } - - CHIP_ERROR TestTurnOffLightThatWeTurnedOn_15() + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::OnOff::Commands::Off::Type; - - RequestType request; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_15(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_15(error); - }; + bool shouldContinue = false; - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "int16")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 9999U)); + } + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "int16")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 10000U)); + } + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } - void OnFailureResponse_15(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } } - void OnSuccessResponse_15() { NextTest(); } - - CHIP_ERROR TestCheckOnOffAttributeValueIsFalseAfterOffCommand_16() + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::OnOffClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_16, OnFailureCallback_16, true)); + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "Reads constraints of attribute: MinMeasuredValue"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RelativeHumidityMeasurement::Id, + RelativeHumidityMeasurement::Attributes::MinMeasuredValue::Id); + } + case 2: { + LogStep(2, "Reads MeasuredValue attribute from DUT"); + VerifyOrdo(!ShouldSkip("A_RELATIVEHUMIDITY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RelativeHumidityMeasurement::Id, + RelativeHumidityMeasurement::Attributes::MeasuredValue::Id); + } + case 3: { + LogStep(3, "Read the mandatory attribute: MeasuredValue"); + VerifyOrdo(!ShouldSkip("A_RELATIVEHUMIDITY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RelativeHumidityMeasurement::Id, + RelativeHumidityMeasurement::Attributes::MeasuredValue::Id); + } + } return CHIP_NO_ERROR; } - - void OnFailureResponse_16(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_16(bool onOff) - { - VerifyOrReturn(CheckValue("onOff", onOff, 0)); - - NextTest(); - } }; -class Test_TC_CC_9_1Suite : public TestCommand +class Test_TC_SC_4_2Suite : public TestCommand { public: - Test_TC_CC_9_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_CC_9_1", credsIssuerConfig), mTestIndex(0) + Test_TC_SC_4_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_SC_4_2", 21, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("discriminator", 0, UINT16_MAX, &mDiscriminator); + AddArgument("vendorId", 0, UINT16_MAX, &mVendorId); + AddArgument("productId", 0, UINT16_MAX, &mProductId); + AddArgument("deviceType", 0, UINT16_MAX, &mDeviceType); AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_CC_9_1Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override + ~Test_TC_SC_4_2Suite() { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) + if (deviceInstanceNameBeforeReboot1Buffer != nullptr) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_CC_9_1\n"); + chip::Platform::MemoryFree(deviceInstanceNameBeforeReboot1Buffer); + deviceInstanceNameBeforeReboot1Buffer = nullptr; } + } - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_CC_9_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } + +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mDiscriminator; + chip::Optional mVendorId; + chip::Optional mProductId; + chip::Optional mDeviceType; + chip::Optional mTimeout; + + char * deviceInstanceNameBeforeReboot1Buffer = nullptr; + chip::CharSpan deviceInstanceNameBeforeReboot1; + + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // - Wait(); + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override + { + bool shouldContinue = false; - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) + switch (mTestIndex - 1) { case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; break; case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Precondition : Turn on light for color control tests\n"); - err = TestPreconditionTurnOnLightForColorControlTests_1(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; break; case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Check on/off attribute value is true after on command\n"); - err = TestCheckOnOffAttributeValueIsTrueAfterOnCommand_2(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Sends ColorLoopSet Command - Set all Attributes\n"); - if (ShouldSkip("CR_COLORLOOPSET")) + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { - NextTest(); - return; + chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + + VerifyOrReturn(CheckConstraintIsUpperCase("value.instanceName", value.instanceName, true)); + VerifyOrReturn(CheckConstraintIsHexString("value.instanceName", value.instanceName, true)); + VerifyOrReturn(CheckConstraintMinLength("value.instanceName", value.instanceName.size(), 16)); + VerifyOrReturn(CheckConstraintMaxLength("value.instanceName", value.instanceName.size(), 16)); + if (deviceInstanceNameBeforeReboot1Buffer != nullptr) + { + chip::Platform::MemoryFree(deviceInstanceNameBeforeReboot1Buffer); + } + deviceInstanceNameBeforeReboot1Buffer = static_cast(chip::Platform::MemoryAlloc(value.instanceName.size())); + memcpy(deviceInstanceNameBeforeReboot1Buffer, value.instanceName.data(), value.instanceName.size()); + deviceInstanceNameBeforeReboot1 = chip::CharSpan(deviceInstanceNameBeforeReboot1Buffer, value.instanceName.size()); } - err = TestSendsColorLoopSetCommandSetAllAttributes_3(); + shouldContinue = true; break; case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Read ColorLoopActive attribute from DUT\n"); - if (ShouldSkip("A_COLORLOOPACTIVE")) + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { - NextTest(); - return; + chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); } - err = TestReadColorLoopActiveAttributeFromDut_4(); + shouldContinue = true; break; case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Sends ColorLoopSet Command - Set all Attributes\n"); - if (ShouldSkip("CR_COLORLOOPSET")) + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { - NextTest(); - return; + chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); } - err = TestSendsColorLoopSetCommandSetAllAttributes_5(); + shouldContinue = true; break; case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : Read ColorLoopDirection attribute from DUT\n"); - if (ShouldSkip("A_COLORLOOPDIRECTION")) + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { - NextTest(); - return; + chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); } - err = TestReadColorLoopDirectionAttributeFromDut_6(); + shouldContinue = true; break; case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : Sends ColorLoopSet Command - Set all Attributes\n"); - if (ShouldSkip("CR_COLORLOOPSET")) + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { - NextTest(); - return; + chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); } - err = TestSendsColorLoopSetCommandSetAllAttributes_7(); + shouldContinue = true; break; case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : Read ColorLoopTime attribute from DUT\n"); - if (ShouldSkip("A_COLORLOOPTIME")) + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { - NextTest(); - return; + chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + + VerifyOrReturn(CheckValue("vendorId", value.vendorId, mVendorId.HasValue() ? mVendorId.Value() : 65521U)); } - err = TestReadColorLoopTimeAttributeFromDut_8(); + shouldContinue = true; break; case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : Sends ColorLoopSet Command - Set all Attributes\n"); - if (ShouldSkip("CR_COLORLOOPSET")) + if (IsUnsupported(status.mStatus)) { - NextTest(); + shouldContinue = true; return; } - err = TestSendsColorLoopSetCommandSetAllAttributes_9(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + + VerifyOrReturn(CheckValue("productId", value.productId, mProductId.HasValue() ? mProductId.Value() : 32769U)); + } + shouldContinue = true; break; case 10: - ChipLogProgress(chipTool, " ***** Test Step 10 : Read ColorLoopStartEnhancedHue attribute from DUT\n"); - if (ShouldSkip("A_COLORLOOPSTARTENHANCEDHUE")) + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { - NextTest(); - return; + chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + + VerifyOrReturn(CheckValuePresent("value.mrpRetryIntervalIdle", value.mrpRetryIntervalIdle)); + VerifyOrReturn( + CheckConstraintMaxValue("value.mrpRetryIntervalIdle.Value()", value.mrpRetryIntervalIdle.Value(), 3600000UL)); } - err = TestReadColorLoopStartEnhancedHueAttributeFromDut_10(); + shouldContinue = true; break; case 11: - ChipLogProgress(chipTool, " ***** Test Step 11 : Sends ColorLoopSet Command - Set all Attributes\n"); - if (ShouldSkip("CR_COLORLOOPSET")) + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { - NextTest(); - return; + chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + + VerifyOrReturn(CheckValuePresent("value.mrpRetryIntervalActive", value.mrpRetryIntervalActive)); + VerifyOrReturn(CheckConstraintMaxValue("value.mrpRetryIntervalActive.Value()", value.mrpRetryIntervalActive.Value(), + 3600000UL)); } - err = TestSendsColorLoopSetCommandSetAllAttributes_11(); + shouldContinue = true; break; case 12: - ChipLogProgress(chipTool, " ***** Test Step 12 : Read ColorLoopActive attribute from DUT\n"); - if (ShouldSkip("A_COLORLOOPACTIVE")) + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { - NextTest(); - return; + chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + + VerifyOrReturn(CheckValue("commissioningMode", value.commissioningMode, 1)); } - err = TestReadColorLoopActiveAttributeFromDut_12(); + shouldContinue = true; break; case 13: - ChipLogProgress(chipTool, " ***** Test Step 13 : Read EnhancedCurrentHue attribute from DUT\n"); - if (ShouldSkip("A_ENHANCEDCURRENTHUE")) + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { - NextTest(); - return; + chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + + VerifyOrReturn(CheckConstraintMaxLength("value.deviceName", value.deviceName.size(), 32)); } - err = TestReadEnhancedCurrentHueAttributeFromDut_13(); + shouldContinue = true; break; case 14: - ChipLogProgress(chipTool, " ***** Test Step 14 : Read ColorLoopStoredEnhancedHue attribute from DUT.\n"); - if (ShouldSkip("A_COLORLOOPSTOREDENHANCEDHUE")) + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { - NextTest(); - return; + chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + + VerifyOrReturn(CheckConstraintMaxValue("value.rotatingIdLen", value.rotatingIdLen, 100ULL)); } - err = TestReadColorLoopStoredEnhancedHueAttributeFromDut_14(); + shouldContinue = true; break; case 15: - ChipLogProgress(chipTool, " ***** Test Step 15 : Sends ColorLoopSet Command - Set all Attributes\n"); - if (ShouldSkip("CR_COLORLOOPSET")) + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { - NextTest(); - return; + chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + + VerifyOrReturn(CheckConstraintNotValue("value.pairingHint", value.pairingHint, 0U)); } - err = TestSendsColorLoopSetCommandSetAllAttributes_15(); + shouldContinue = true; break; case 16: - ChipLogProgress(chipTool, " ***** Test Step 16 : Read ColorLoopActive attribute from DUT\n"); - if (ShouldSkip("A_COLORLOOPACTIVE")) + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { - NextTest(); - return; + chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + + VerifyOrReturn(CheckConstraintMaxLength("value.pairingInstruction", value.pairingInstruction.size(), 128)); } - err = TestReadColorLoopActiveAttributeFromDut_16(); + shouldContinue = true; break; case 17: - ChipLogProgress(chipTool, " ***** Test Step 17 : Read ColorLoopStoredEnhancedHue attribute from DUT.\n"); - if (ShouldSkip("A_COLORLOOPSTOREDENHANCEDHUE")) + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { - NextTest(); - return; + chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + + VerifyOrReturn(CheckConstraintMinValue("value.numIPs", value.numIPs, 1)); } - err = TestReadColorLoopStoredEnhancedHueAttributeFromDut_17(); + shouldContinue = true; break; case 18: - ChipLogProgress(chipTool, " ***** Test Step 18 : Read EnhancedCurrentHue attribute from DUT\n"); - if (ShouldSkip("A_ENHANCEDCURRENTHUE")) - { - NextTest(); - return; - } - err = TestReadEnhancedCurrentHueAttributeFromDut_18(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; break; case 19: - ChipLogProgress(chipTool, " ***** Test Step 19 : Sends ColorLoopSet Command - Set all Attributes\n"); - if (ShouldSkip("CR_COLORLOOPSET")) - { - NextTest(); - return; - } - err = TestSendsColorLoopSetCommandSetAllAttributes_19(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; break; case 20: - ChipLogProgress(chipTool, " ***** Test Step 20 : Read ColorLoopDirection attribute from DUT\n"); - if (ShouldSkip("A_COLORLOOPDIRECTION")) - { - NextTest(); - return; - } - err = TestReadColorLoopDirectionAttributeFromDut_20(); - break; - case 21: - ChipLogProgress(chipTool, " ***** Test Step 21 : Sends ColorLoopSet Command - Set all Attributes\n"); - if (ShouldSkip("CR_COLORLOOPSET")) - { - NextTest(); - return; - } - err = TestSendsColorLoopSetCommandSetAllAttributes_21(); - break; - case 22: - ChipLogProgress(chipTool, " ***** Test Step 22 : Read ColorLoopActive attribute from DUT\n"); - if (ShouldSkip("A_COLORLOOPACTIVE")) - { - NextTest(); - return; - } - err = TestReadColorLoopActiveAttributeFromDut_22(); - break; - case 23: - ChipLogProgress(chipTool, " ***** Test Step 23 : Read EnhancedCurrentHue attribute from DUT\n"); - if (ShouldSkip("A_ENHANCEDCURRENTHUE")) - { - NextTest(); - return; - } - err = TestReadEnhancedCurrentHueAttributeFromDut_23(); - break; - case 24: - ChipLogProgress(chipTool, " ***** Test Step 24 : Read ColorLoopStoredEnhancedHue attribute from DUT\n"); - if (ShouldSkip("A_COLORLOOPSTOREDENHANCEDHUE")) - { - NextTest(); - return; - } - err = TestReadColorLoopStoredEnhancedHueAttributeFromDut_24(); - break; - case 25: - ChipLogProgress(chipTool, " ***** Test Step 25 : Sends ColorLoopSet Command - Set all Attributes\n"); - if (ShouldSkip("CR_COLORLOOPSET")) - { - NextTest(); - return; - } - err = TestSendsColorLoopSetCommandSetAllAttributes_25(); - break; - case 26: - ChipLogProgress(chipTool, " ***** Test Step 26 : Read ColorLoopActive attribute from DUT\n"); - if (ShouldSkip("A_COLORLOOPACTIVE")) - { - NextTest(); - return; - } - err = TestReadColorLoopActiveAttributeFromDut_26(); - break; - case 27: - ChipLogProgress(chipTool, " ***** Test Step 27 : Read ColorLoopStoredEnhancedHue attribute from DUT.\n"); - if (ShouldSkip("A_COLORLOOPSTOREDENHANCEDHUE")) - { - NextTest(); - return; - } - err = TestReadColorLoopStoredEnhancedHueAttributeFromDut_27(); - break; - case 28: - ChipLogProgress(chipTool, " ***** Test Step 28 : Read EnhancedCurrentHue attribute from DUT\n"); - if (ShouldSkip("A_ENHANCEDCURRENTHUE")) - { - NextTest(); - return; - } - err = TestReadEnhancedCurrentHueAttributeFromDut_28(); - break; - case 29: - ChipLogProgress(chipTool, " ***** Test Step 29 : Enhanced Move To Hue command\n"); - if (ShouldSkip("CR_ENHANCEDMOVETOHUE")) - { - NextTest(); - return; - } - err = TestEnhancedMoveToHueCommand_29(); - break; - case 30: - ChipLogProgress(chipTool, " ***** Test Step 30 : Wait 2000ms\n"); - err = TestWait2000ms_30(); - break; - case 31: - ChipLogProgress(chipTool, " ***** Test Step 31 : Read EnhancedCurrentHue attribute from DUT\n"); - if (ShouldSkip("A_ENHANCEDCURRENTHUE")) - { - NextTest(); - return; - } - err = TestReadEnhancedCurrentHueAttributeFromDut_31(); - break; - case 32: - ChipLogProgress(chipTool, " ***** Test Step 32 : Sends ColorLoopSet Command - Set all Attributes\n"); - if (ShouldSkip("CR_COLORLOOPSET")) - { - NextTest(); - return; - } - err = TestSendsColorLoopSetCommandSetAllAttributes_32(); - break; - case 33: - ChipLogProgress(chipTool, " ***** Test Step 33 : Read ColorLoopDirection attribute from DUT\n"); - if (ShouldSkip("A_COLORLOOPDIRECTION")) - { - NextTest(); - return; - } - err = TestReadColorLoopDirectionAttributeFromDut_33(); - break; - case 34: - ChipLogProgress(chipTool, " ***** Test Step 34 : Sends ColorLoopSet Command - Set all Attributes\n"); - if (ShouldSkip("CR_COLORLOOPSET")) - { - NextTest(); - return; - } - err = TestSendsColorLoopSetCommandSetAllAttributes_34(); - break; - case 35: - ChipLogProgress(chipTool, " ***** Test Step 35 : Read ColorLoopActive attribute from DUT\n"); - if (ShouldSkip("A_COLORLOOPACTIVE")) - { - NextTest(); - return; - } - err = TestReadColorLoopActiveAttributeFromDut_35(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; break; - case 36: - ChipLogProgress(chipTool, " ***** Test Step 36 : Read EnhancedCurrentHue attribute from DUT\n"); - if (ShouldSkip("A_ENHANCEDCURRENTHUE")) - { - NextTest(); - return; - } - err = TestReadEnhancedCurrentHueAttributeFromDut_36(); + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } + + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } + } + + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Reboot target device"); + SetIdentity(kIdentityAlpha); + return Reboot(mDiscriminator.HasValue() ? mDiscriminator.Value() : 3840U); + } + case 1: { + LogStep(1, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 2: { + LogStep(2, + "TH is put in Commissioning Mode using Open Basic Commissioning Window command and starts advertising " + "Commissionable Node Discovery service using DNS-SD"); + chip::app::Clusters::AdministratorCommissioning::Commands::OpenBasicCommissioningWindow::Type value; + value.commissioningTimeout = 180U; + return SendCommand(kIdentityAlpha, GetEndpoint(0), AdministratorCommissioning::Id, + AdministratorCommissioning::Commands::OpenBasicCommissioningWindow::Id, value, + chip::Optional(10000)); + } + case 3: { + LogStep(3, "Check Instance Name"); + SetIdentity(kIdentityAlpha); + return FindCommissionable(); + } + case 4: { + LogStep(4, "Check Long Discriminator _L"); + SetIdentity(kIdentityAlpha); + return FindCommissionableByLongDiscriminator(mDiscriminator.HasValue() ? mDiscriminator.Value() : 3840U); + } + case 5: { + LogStep(5, "Check Short Discriminator (_S)"); + SetIdentity(kIdentityAlpha); + return FindCommissionableByShortDiscriminator(mDiscriminator.HasValue() ? mDiscriminator.Value() : 3840U); + } + case 6: { + LogStep(6, "Check Vendor ID (_V)"); + VerifyOrdo(!ShouldSkip("VENDOR_SUBTYPE"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + SetIdentity(kIdentityAlpha); + return FindCommissionableByVendorId(mVendorId.HasValue() ? mVendorId.Value() : 65521U); + } + case 7: { + LogStep(7, "Check Commissioning Mode (_CM)"); + SetIdentity(kIdentityAlpha); + return FindCommissionableByCommissioningMode(); + } + case 8: { + LogStep(8, "TXT key for Vendor ID and Product ID (VP)"); + VerifyOrdo(!ShouldSkip("VP_KEY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + SetIdentity(kIdentityAlpha); + return FindCommissionable(); + } + case 9: { + LogStep(9, "TXT key for Vendor ID and Product ID (VP)"); + VerifyOrdo(!ShouldSkip("VP_KEY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + SetIdentity(kIdentityAlpha); + return FindCommissionable(); + } + case 10: { + LogStep(10, "Optional TXT key for MRP Retry Interval Idle (CRI)"); + VerifyOrdo(!ShouldSkip("CRI_COMM_DISCOVERY_KEY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + SetIdentity(kIdentityAlpha); + return FindCommissionable(); + } + case 11: { + LogStep(11, "Optional TXT key for MRP Retry Interval Active (CRA)"); + VerifyOrdo(!ShouldSkip("CRA_COMM_DISCOVERY_KEY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + SetIdentity(kIdentityAlpha); + return FindCommissionable(); + } + case 12: { + LogStep(12, "TXT key for commissioning mode (CM)"); + SetIdentity(kIdentityAlpha); + return FindCommissionable(); + } + case 13: { + LogStep(13, "Optional TXT key for device name (DN)"); + VerifyOrdo(!ShouldSkip("DN_KEY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + SetIdentity(kIdentityAlpha); + return FindCommissionable(); + } + case 14: { + LogStep(14, "Optional TXT key for rotating device identifier (RI)"); + VerifyOrdo(!ShouldSkip("RI_KEY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + SetIdentity(kIdentityAlpha); + return FindCommissionable(); + } + case 15: { + LogStep(15, "Optional TXT key for pairing hint (PH)"); + VerifyOrdo(!ShouldSkip("PH_KEY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + SetIdentity(kIdentityAlpha); + return FindCommissionable(); + } + case 16: { + LogStep(16, "Optional TXT key for pairing instructions (PI)"); + VerifyOrdo(!ShouldSkip("PI_KEY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + SetIdentity(kIdentityAlpha); + return FindCommissionable(); + } + case 17: { + LogStep(17, "Check IPs"); + SetIdentity(kIdentityAlpha); + return FindCommissionable(); + } + case 18: { + LogStep(18, "Reboot target device"); + SetIdentity(kIdentityAlpha); + return Reboot(mDiscriminator.HasValue() ? mDiscriminator.Value() : 3840U); + } + case 19: { + LogStep(19, "Log commands"); + SetIdentity(kIdentityAlpha); + return Log("TH adds an unknown key/value pair in the advertised data"); + } + case 20: { + LogStep(20, "Log commands"); + SetIdentity(kIdentityAlpha); + return Log("Scan for DNS-SD commissioner advertisements from TH"); + } + } + return CHIP_NO_ERROR; + } +}; + +class Test_TC_SWTCH_2_1Suite : public TestCommand +{ +public: + Test_TC_SWTCH_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_SWTCH_2_1", 7, credsIssuerConfig) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } + + ~Test_TC_SWTCH_2_1Suite() {} + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } + +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override + { + bool shouldContinue = false; + + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; break; - case 37: - ChipLogProgress(chipTool, " ***** Test Step 37 : Read ColorLoopStoredEnhancedHue attribute from DUT\n"); - if (ShouldSkip("A_COLORLOOPSTOREDENHANCEDHUE")) + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { - NextTest(); - return; + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("numberOfPositions", value, 2)); } - err = TestReadColorLoopStoredEnhancedHueAttributeFromDut_37(); break; - case 38: - ChipLogProgress(chipTool, " ***** Test Step 38 : Sends ColorLoopSet Command - Set all Attributes\n"); - if (ShouldSkip("CR_COLORLOOPSET")) + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { - NextTest(); - return; + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint8")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 2)); } - err = TestSendsColorLoopSetCommandSetAllAttributes_38(); break; - case 39: - ChipLogProgress(chipTool, " ***** Test Step 39 : Read ColorLoopActive attribute from DUT\n"); - if (ShouldSkip("A_COLORLOOPACTIVE")) + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { - NextTest(); - return; + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("currentPosition", value, 0)); } - err = TestReadColorLoopActiveAttributeFromDut_39(); break; - case 40: - ChipLogProgress(chipTool, " ***** Test Step 40 : Read ColorLoopStoredEnhancedHue attribute from DUT.\n"); - if (ShouldSkip("A_COLORLOOPSTOREDENHANCEDHUE")) + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { - NextTest(); - return; + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint8")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0)); } - err = TestReadColorLoopStoredEnhancedHueAttributeFromDut_40(); break; - case 41: - ChipLogProgress(chipTool, " ***** Test Step 41 : Read EnhancedCurrentHue attribute from DUT\n"); - if (ShouldSkip("A_ENHANCEDCURRENTHUE")) + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { - NextTest(); - return; + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("multiPressMax", value, 2)); } - err = TestReadEnhancedCurrentHueAttributeFromDut_41(); break; - case 42: - ChipLogProgress(chipTool, " ***** Test Step 42 : Sends ColorLoopSet Command - Set all Attributes\n"); - if (ShouldSkip("CR_COLORLOOPSET")) + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { - NextTest(); - return; + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint8")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 2)); } - err = TestSendsColorLoopSetCommandSetAllAttributes_42(); break; - case 43: - ChipLogProgress(chipTool, " ***** Test Step 43 : Read ColorLoopDirection attribute from DUT\n"); - if (ShouldSkip("A_COLORLOOPDIRECTION")) - { - NextTest(); - return; - } - err = TestReadColorLoopDirectionAttributeFromDut_43(); + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } + + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } + } + + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "Read NumberOfPositions attribute"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Switch::Id, Switch::Attributes::NumberOfPositions::Id); + } + case 2: { + LogStep(2, "Read NumberOfPositions attribute"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Switch::Id, Switch::Attributes::NumberOfPositions::Id); + } + case 3: { + LogStep(3, "Read CurrentPosition attribute"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Switch::Id, Switch::Attributes::CurrentPosition::Id); + } + case 4: { + LogStep(4, "Read CurrentPosition attribute"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Switch::Id, Switch::Attributes::CurrentPosition::Id); + } + case 5: { + LogStep(5, "Read MultiPressMax attribute"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Switch::Id, Switch::Attributes::MultiPressMax::Id); + } + case 6: { + LogStep(6, "Read MultiPressMax attribute"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Switch::Id, Switch::Attributes::MultiPressMax::Id); + } + } + return CHIP_NO_ERROR; + } +}; + +class Test_TC_SWTCH_2_2Suite : public TestCommand +{ +public: + Test_TC_SWTCH_2_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_SWTCH_2_2", 38, credsIssuerConfig) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } + + ~Test_TC_SWTCH_2_2Suite() {} + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } + +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override + { + bool shouldContinue = false; + + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; break; - case 44: - ChipLogProgress(chipTool, " ***** Test Step 44 : Sends ColorLoopSet Command - Set all Attributes\n"); - if (ShouldSkip("CR_COLORLOOPSET")) - { - NextTest(); - return; - } - err = TestSendsColorLoopSetCommandSetAllAttributes_44(); + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; break; - case 45: - ChipLogProgress(chipTool, " ***** Test Step 45 : Read ColorLoopActive attribute from DUT\n"); - if (ShouldSkip("A_COLORLOOPACTIVE")) - { - NextTest(); - return; - } - err = TestReadColorLoopActiveAttributeFromDut_45(); + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; break; - case 46: - ChipLogProgress(chipTool, " ***** Test Step 46 : Read EnhancedCurrentHue attribute from DUT\n"); - if (ShouldSkip("A_ENHANCEDCURRENTHUE")) + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { - NextTest(); - return; + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("currentPosition", value, 0)); } - err = TestReadEnhancedCurrentHueAttributeFromDut_46(); break; - case 47: - ChipLogProgress(chipTool, " ***** Test Step 47 : Read ColorLoopStoredEnhancedHue attribute from DUT\n"); - if (ShouldSkip("A_COLORLOOPSTOREDENHANCEDHUE")) - { - NextTest(); - return; - } - err = TestReadColorLoopStoredEnhancedHueAttributeFromDut_47(); + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; break; - case 48: - ChipLogProgress(chipTool, " ***** Test Step 48 : Sends ColorLoopSet Command - Set all Attributes\n"); - if (ShouldSkip("CR_COLORLOOPSET")) - { - NextTest(); - return; - } - err = TestSendsColorLoopSetCommandSetAllAttributes_48(); + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; break; - case 49: - ChipLogProgress(chipTool, " ***** Test Step 49 : Read ColorLoopActive attribute from DUT\n"); - if (ShouldSkip("A_COLORLOOPACTIVE")) - { - NextTest(); - return; - } - err = TestReadColorLoopActiveAttributeFromDut_49(); + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; break; - case 50: - ChipLogProgress(chipTool, " ***** Test Step 50 : Read ColorLoopStoredEnhancedHue attribute from DUT.\n"); - if (ShouldSkip("A_COLORLOOPSTOREDENHANCEDHUE")) + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { - NextTest(); - return; + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("currentPosition", value, 0)); } - err = TestReadColorLoopStoredEnhancedHueAttributeFromDut_50(); break; - case 51: - ChipLogProgress(chipTool, " ***** Test Step 51 : Read EnhancedCurrentHue attribute from DUT\n"); - if (ShouldSkip("A_ENHANCEDCURRENTHUE")) - { - NextTest(); - return; - } - err = TestReadEnhancedCurrentHueAttributeFromDut_51(); + case 8: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; break; - case 52: - ChipLogProgress(chipTool, " ***** Test Step 52 : Turn Off light for color control tests\n"); - err = TestTurnOffLightForColorControlTests_52(); + case 9: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; break; - case 53: - ChipLogProgress(chipTool, " ***** Test Step 53 : Check on/off attribute value is false after off command\n"); - err = TestCheckOnOffAttributeValueIsFalseAfterOffCommand_53(); + case 10: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 11: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 12: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 13: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 14: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 15: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 16: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 17: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 18: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 19: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 20: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 21: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 22: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 23: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 24: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 25: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 26: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 27: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 28: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 29: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 30: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 31: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 32: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 33: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 34: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 35: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 36: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 37: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } + + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); } + } - if (CHIP_NO_ERROR != err) + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "User interaction needed"); + SetIdentity(kIdentityAlpha); + return UserPrompt("Set up subscription to SwitchLatched event"); + } + case 2: { + LogStep(2, "User interaction needed"); + SetIdentity(kIdentityAlpha); + return UserPrompt("Operator sets switch to first position"); + } + case 3: { + LogStep(3, "Read CurrentPosition attribute"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Switch::Id, Switch::Attributes::CurrentPosition::Id); + } + case 4: { + LogStep(4, "User interaction needed"); + SetIdentity(kIdentityAlpha); + return UserPrompt("Operator sets switch to second position"); + } + case 5: { + LogStep(5, "User interaction needed"); + SetIdentity(kIdentityAlpha); + return UserPrompt("Set up subscription to InitialPress event"); + } + case 6: { + LogStep(6, "User interaction needed"); + SetIdentity(kIdentityAlpha); + return UserPrompt("Operator does not operate switch"); } + case 7: { + LogStep(7, "Read CurrentPosition attribute"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Switch::Id, Switch::Attributes::CurrentPosition::Id); + } + case 8: { + LogStep(8, "User interaction needed"); + SetIdentity(kIdentityAlpha); + return UserPrompt("Operator sets switch to second position"); + } + case 9: { + LogStep(9, "User interaction needed"); + SetIdentity(kIdentityAlpha); + return UserPrompt("Operator does not operate switch (release switch)"); + } + case 10: { + LogStep(10, "User interaction needed"); + SetIdentity(kIdentityAlpha); + return UserPrompt("Set up subscription to InitialPress and ShortRelease events"); + } + case 11: { + LogStep(11, "User interaction needed"); + SetIdentity(kIdentityAlpha); + return UserPrompt("Operator does not operate switch"); + } + case 12: { + LogStep(12, "User interaction needed"); + SetIdentity(kIdentityAlpha); + return UserPrompt("Operator operates switch (press briefly)"); + } + case 13: { + LogStep(13, "User interaction needed"); + SetIdentity(kIdentityAlpha); + return UserPrompt("Operator releases switch"); + } + case 14: { + LogStep(14, "User interaction needed"); + SetIdentity(kIdentityAlpha); + return UserPrompt("Operator operates switch for 5 seconds"); + } + case 15: { + LogStep(15, "Wait 3000ms"); + SetIdentity(kIdentityAlpha); + return WaitForMs(3000); + } + case 16: { + LogStep(16, "User interaction needed"); + SetIdentity(kIdentityAlpha); + return UserPrompt("Operator releases switch"); + } + case 17: { + LogStep(17, "User interaction needed"); + SetIdentity(kIdentityAlpha); + return UserPrompt("Set up subscription to InitialPress, LongPress, ShortRelease, LongRelease events"); + } + case 18: { + LogStep(18, "User interaction needed"); + SetIdentity(kIdentityAlpha); + return UserPrompt("Operator does not operate switch"); + } + case 19: { + LogStep(19, "User interaction needed"); + SetIdentity(kIdentityAlpha); + return UserPrompt("Operator operates switch (press briefly)"); + } + case 20: { + LogStep(20, "User interaction needed"); + SetIdentity(kIdentityAlpha); + return UserPrompt("Operator releases switch"); + } + case 21: { + LogStep(21, "User interaction needed"); + SetIdentity(kIdentityAlpha); + return UserPrompt("Operator operates switch for 5 seconds"); + } + case 22: { + LogStep(22, "Wait 3000ms"); + SetIdentity(kIdentityAlpha); + return WaitForMs(3000); + } + case 23: { + LogStep(23, "User interaction needed"); + SetIdentity(kIdentityAlpha); + return UserPrompt("Operator releases switch"); + } + case 24: { + LogStep(24, "User interaction needed"); + SetIdentity(kIdentityAlpha); + return UserPrompt("Set up subscription to InitialPress, ShortRelease, MultiPressOngoing, MultiPressComplete events"); + } + case 25: { + LogStep(25, "User interaction needed"); + SetIdentity(kIdentityAlpha); + return UserPrompt("Operator does not operate switch"); + } + case 26: { + LogStep(26, "User interaction needed"); + SetIdentity(kIdentityAlpha); + return UserPrompt("Operator operates switch (press briefly)"); + } + case 27: { + LogStep(27, "User interaction needed"); + SetIdentity(kIdentityAlpha); + return UserPrompt("Operator releases switch"); + } + case 28: { + LogStep(28, "User interaction needed"); + SetIdentity(kIdentityAlpha); + return UserPrompt("Operator operates switch (press briefly)"); + } + case 29: { + LogStep(29, "User interaction needed"); + SetIdentity(kIdentityAlpha); + return UserPrompt("Operator releases switch"); + } + case 30: { + LogStep(30, "User interaction needed"); + SetIdentity(kIdentityAlpha); + return UserPrompt("Operator operates switch again (press briefly)"); + } + case 31: { + LogStep(31, "User interaction needed"); + SetIdentity(kIdentityAlpha); + return UserPrompt("Operator releases switch"); + } + case 32: { + LogStep(32, "User interaction needed"); + SetIdentity(kIdentityAlpha); + return UserPrompt("Operator operates switch again (press briefly)"); + } + case 33: { + LogStep(33, "User interaction needed"); + SetIdentity(kIdentityAlpha); + return UserPrompt("Operator releases switch"); + } + case 34: { + LogStep(34, "User interaction needed"); + SetIdentity(kIdentityAlpha); + return UserPrompt("Operator operates switch again (press briefly)"); + } + case 35: { + LogStep(35, "User interaction needed"); + SetIdentity(kIdentityAlpha); + return UserPrompt("Operator releases switch"); + } + case 36: { + LogStep(36, "User interaction needed"); + SetIdentity(kIdentityAlpha); + return UserPrompt("Operator operates switch again (press briefly)"); + } + case 37: { + LogStep(37, "User interaction needed"); + SetIdentity(kIdentityAlpha); + return UserPrompt("Operator releases switch"); + } + } + return CHIP_NO_ERROR; + } +}; + +class Test_TC_TM_1_1Suite : public TestCommand +{ +public: + Test_TC_TM_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_TM_1_1", 3, credsIssuerConfig) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } + ~Test_TC_TM_1_1Suite() {} + chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 54; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; - uint16_t EnhancedCurrentHueValue1; - uint16_t ColorLoopStoredEnhancedHueValue1; - uint16_t EnhancedCurrentHueValue2; - uint16_t ColorLoopStoredEnhancedHueValue2; - uint16_t EnhancedCurrentHueValue3; - uint16_t ColorLoopStoredEnhancedHueValue3; - uint16_t EnhancedCurrentHueValue4; - uint16_t ColorLoopStoredEnhancedHue4; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { @@ -16421,9 +21433,21 @@ class Test_TC_CC_9_1Suite : public TestCommand VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); shouldContinue = true; break; - case 30: + case 1: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + } + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "list")); + } break; default: LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); @@ -16435,1789 +21459,2042 @@ class Test_TC_CC_9_1Suite : public TestCommand } } - static void OnFailureCallback_2(void * context, CHIP_ERROR error) + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - (static_cast(context))->OnFailureResponse_2(error); + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "Read the global attribute constraints: ClusterRevision"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TemperatureMeasurement::Id, + TemperatureMeasurement::Attributes::ClusterRevision::Id); + } + case 2: { + LogStep(2, "Read the global attribute: AttributeList"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TemperatureMeasurement::Id, + TemperatureMeasurement::Attributes::AttributeList::Id); + } + } + return CHIP_NO_ERROR; } +}; - static void OnSuccessCallback_2(void * context, bool onOff) +class Test_TC_TM_2_1Suite : public TestCommand +{ +public: + Test_TC_TM_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_TM_2_1", 5, credsIssuerConfig) { - (static_cast(context))->OnSuccessResponse_2(onOff); + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - static void OnFailureCallback_4(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_4(error); - } + ~Test_TC_TM_2_1Suite() {} - static void OnSuccessCallback_4(void * context, uint8_t colorLoopActive) + chip::System::Clock::Timeout GetWaitDuration() const override { - (static_cast(context))->OnSuccessResponse_4(colorLoopActive); + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } - static void OnFailureCallback_6(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_6(error); - } +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; - static void OnSuccessCallback_6(void * context, uint8_t colorLoopDirection) - { - (static_cast(context))->OnSuccessResponse_6(colorLoopDirection); - } + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } - static void OnFailureCallback_8(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_8(error); - } + // + // Tests methods + // - static void OnSuccessCallback_8(void * context, uint16_t colorLoopTime) + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { - (static_cast(context))->OnSuccessResponse_8(colorLoopTime); - } + bool shouldContinue = false; - static void OnFailureCallback_10(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_10(error); - } + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "int16")); + } + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "int16")); + VerifyOrReturn(CheckConstraintMinValue("value", value, -27315)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 32766)); + } + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "int16")); + VerifyOrReturn(CheckConstraintMinValue("value", value, -27314)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 32767)); + } + break; + case 4: + if (IsUnsupported(status.mStatus)) + { + return; + } + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 2048U)); + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } - static void OnSuccessCallback_10(void * context, uint16_t colorLoopStartEnhancedHue) - { - (static_cast(context))->OnSuccessResponse_10(colorLoopStartEnhancedHue); + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } } - static void OnFailureCallback_12(void * context, CHIP_ERROR error) + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - (static_cast(context))->OnFailureResponse_12(error); + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "read the mandatory attribute: MeasuredValue"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TemperatureMeasurement::Id, + TemperatureMeasurement::Attributes::MeasuredValue::Id); + } + case 2: { + LogStep(2, "read the mandatory attribute: MinMeasuredValue"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TemperatureMeasurement::Id, + TemperatureMeasurement::Attributes::MinMeasuredValue::Id); + } + case 3: { + LogStep(3, "read the mandatory attribute: MaxMeasuredValue"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TemperatureMeasurement::Id, + TemperatureMeasurement::Attributes::MaxMeasuredValue::Id); + } + case 4: { + LogStep(4, "read the optional attribute: Tolerance"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TemperatureMeasurement::Id, + TemperatureMeasurement::Attributes::Tolerance::Id); + } + } + return CHIP_NO_ERROR; } +}; - static void OnSuccessCallback_12(void * context, uint8_t colorLoopActive) +class Test_TC_TM_2_2Suite : public TestCommand +{ +public: + Test_TC_TM_2_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_TM_2_2", 5, credsIssuerConfig) { - (static_cast(context))->OnSuccessResponse_12(colorLoopActive); + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - static void OnFailureCallback_13(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_13(error); - } + ~Test_TC_TM_2_2Suite() {} - static void OnSuccessCallback_13(void * context, uint16_t enhancedCurrentHue) + chip::System::Clock::Timeout GetWaitDuration() const override { - (static_cast(context))->OnSuccessResponse_13(enhancedCurrentHue); + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } - static void OnFailureCallback_14(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_14(error); - } +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; - static void OnSuccessCallback_14(void * context, uint16_t colorLoopStoredEnhancedHue) - { - (static_cast(context))->OnSuccessResponse_14(colorLoopStoredEnhancedHue); - } - - static void OnFailureCallback_16(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_16(error); - } - - static void OnSuccessCallback_16(void * context, uint8_t colorLoopActive) - { - (static_cast(context))->OnSuccessResponse_16(colorLoopActive); - } - - static void OnFailureCallback_17(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_17(error); - } - - static void OnSuccessCallback_17(void * context, uint16_t colorLoopStoredEnhancedHue) - { - (static_cast(context))->OnSuccessResponse_17(colorLoopStoredEnhancedHue); - } - - static void OnFailureCallback_18(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_18(error); - } - - static void OnSuccessCallback_18(void * context, uint16_t enhancedCurrentHue) - { - (static_cast(context))->OnSuccessResponse_18(enhancedCurrentHue); - } - - static void OnFailureCallback_20(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_20(error); - } - - static void OnSuccessCallback_20(void * context, uint8_t colorLoopDirection) - { - (static_cast(context))->OnSuccessResponse_20(colorLoopDirection); - } - - static void OnFailureCallback_22(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_22(error); - } - - static void OnSuccessCallback_22(void * context, uint8_t colorLoopActive) - { - (static_cast(context))->OnSuccessResponse_22(colorLoopActive); - } - - static void OnFailureCallback_23(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_23(error); - } - - static void OnSuccessCallback_23(void * context, uint16_t enhancedCurrentHue) - { - (static_cast(context))->OnSuccessResponse_23(enhancedCurrentHue); - } - - static void OnFailureCallback_24(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_24(error); - } - - static void OnSuccessCallback_24(void * context, uint16_t colorLoopStoredEnhancedHue) - { - (static_cast(context))->OnSuccessResponse_24(colorLoopStoredEnhancedHue); - } - - static void OnFailureCallback_26(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_26(error); - } - - static void OnSuccessCallback_26(void * context, uint8_t colorLoopActive) - { - (static_cast(context))->OnSuccessResponse_26(colorLoopActive); - } - - static void OnFailureCallback_27(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_27(error); - } - - static void OnSuccessCallback_27(void * context, uint16_t colorLoopStoredEnhancedHue) - { - (static_cast(context))->OnSuccessResponse_27(colorLoopStoredEnhancedHue); - } - - static void OnFailureCallback_28(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_28(error); - } - - static void OnSuccessCallback_28(void * context, uint16_t enhancedCurrentHue) - { - (static_cast(context))->OnSuccessResponse_28(enhancedCurrentHue); - } - - static void OnFailureCallback_31(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_31(error); - } - - static void OnSuccessCallback_31(void * context, uint16_t enhancedCurrentHue) - { - (static_cast(context))->OnSuccessResponse_31(enhancedCurrentHue); - } - - static void OnFailureCallback_33(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_33(error); - } - - static void OnSuccessCallback_33(void * context, uint8_t colorLoopDirection) - { - (static_cast(context))->OnSuccessResponse_33(colorLoopDirection); - } - - static void OnFailureCallback_35(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_35(error); - } - - static void OnSuccessCallback_35(void * context, uint8_t colorLoopActive) - { - (static_cast(context))->OnSuccessResponse_35(colorLoopActive); - } - - static void OnFailureCallback_36(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_36(error); - } - - static void OnSuccessCallback_36(void * context, uint16_t enhancedCurrentHue) - { - (static_cast(context))->OnSuccessResponse_36(enhancedCurrentHue); - } - - static void OnFailureCallback_37(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_37(error); - } - - static void OnSuccessCallback_37(void * context, uint16_t colorLoopStoredEnhancedHue) - { - (static_cast(context))->OnSuccessResponse_37(colorLoopStoredEnhancedHue); - } - - static void OnFailureCallback_39(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_39(error); - } - - static void OnSuccessCallback_39(void * context, uint8_t colorLoopActive) - { - (static_cast(context))->OnSuccessResponse_39(colorLoopActive); - } - - static void OnFailureCallback_40(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_40(error); - } - - static void OnSuccessCallback_40(void * context, uint16_t colorLoopStoredEnhancedHue) - { - (static_cast(context))->OnSuccessResponse_40(colorLoopStoredEnhancedHue); - } - - static void OnFailureCallback_41(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_41(error); - } - - static void OnSuccessCallback_41(void * context, uint16_t enhancedCurrentHue) - { - (static_cast(context))->OnSuccessResponse_41(enhancedCurrentHue); - } - - static void OnFailureCallback_43(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_43(error); - } - - static void OnSuccessCallback_43(void * context, uint8_t colorLoopDirection) - { - (static_cast(context))->OnSuccessResponse_43(colorLoopDirection); - } - - static void OnFailureCallback_45(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_45(error); - } - - static void OnSuccessCallback_45(void * context, uint8_t colorLoopActive) - { - (static_cast(context))->OnSuccessResponse_45(colorLoopActive); - } - - static void OnFailureCallback_46(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_46(error); - } - - static void OnSuccessCallback_46(void * context, uint16_t enhancedCurrentHue) - { - (static_cast(context))->OnSuccessResponse_46(enhancedCurrentHue); - } + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } - static void OnFailureCallback_47(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_47(error); - } + // + // Tests methods + // - static void OnSuccessCallback_47(void * context, uint16_t colorLoopStoredEnhancedHue) + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { - (static_cast(context))->OnSuccessResponse_47(colorLoopStoredEnhancedHue); - } + bool shouldContinue = false; - static void OnFailureCallback_49(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_49(error); - } + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "int16")); + VerifyOrReturn(CheckConstraintMinValue("value", value, -27315)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 32766)); + } + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "int16")); + VerifyOrReturn(CheckConstraintMinValue("value", value, -27314)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 32767)); + } + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + } + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } - static void OnSuccessCallback_49(void * context, uint8_t colorLoopActive) - { - (static_cast(context))->OnSuccessResponse_49(colorLoopActive); + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } } - static void OnFailureCallback_50(void * context, CHIP_ERROR error) + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - (static_cast(context))->OnFailureResponse_50(error); + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "read the mandatory attribute: MinMeasuredValue"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TemperatureMeasurement::Id, + TemperatureMeasurement::Attributes::MinMeasuredValue::Id); + } + case 2: { + LogStep(2, "read the mandatory attribute: MaxMeasuredValue"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TemperatureMeasurement::Id, + TemperatureMeasurement::Attributes::MaxMeasuredValue::Id); + } + case 3: { + LogStep(3, "Reads MeasuredValue attribute from DUT"); + VerifyOrdo(!ShouldSkip("A_TEMPERATURE"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TemperatureMeasurement::Id, + TemperatureMeasurement::Attributes::MeasuredValue::Id); + } + case 4: { + LogStep(4, "Read the mandatory attribute: MeasuredValue"); + VerifyOrdo(!ShouldSkip("A_TEMPERATURE"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TemperatureMeasurement::Id, + TemperatureMeasurement::Attributes::MeasuredValue::Id); + } + } + return CHIP_NO_ERROR; } +}; - static void OnSuccessCallback_50(void * context, uint16_t colorLoopStoredEnhancedHue) +class Test_TC_TSTAT_1_1Suite : public TestCommand +{ +public: + Test_TC_TSTAT_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_TSTAT_1_1", 4, credsIssuerConfig) { - (static_cast(context))->OnSuccessResponse_50(colorLoopStoredEnhancedHue); + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - static void OnFailureCallback_51(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_51(error); - } + ~Test_TC_TSTAT_1_1Suite() {} - static void OnSuccessCallback_51(void * context, uint16_t enhancedCurrentHue) + chip::System::Clock::Timeout GetWaitDuration() const override { - (static_cast(context))->OnSuccessResponse_51(enhancedCurrentHue); + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } - static void OnFailureCallback_53(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_53(error); - } +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; - static void OnSuccessCallback_53(void * context, bool onOff) - { - (static_cast(context))->OnSuccessResponse_53(onOff); - } + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } // // Tests methods // - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestPreconditionTurnOnLightForColorControlTests_1() + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::OnOff::Commands::On::Type; - - RequestType request; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_1(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_1(error); - }; + bool shouldContinue = false; - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + } + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "list")); + } + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "map32")); + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } } - void OnSuccessResponse_1() { NextTest(); } - - CHIP_ERROR TestCheckOnOffAttributeValueIsTrueAfterOnCommand_2() + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::OnOffClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_2, OnFailureCallback_2, true)); + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "Read the global attribute constraints: ClusterRevision"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, Thermostat::Attributes::ClusterRevision::Id); + } + case 2: { + LogStep(2, "Read the global attribute: AttributeList"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, Thermostat::Attributes::AttributeList::Id); + } + case 3: { + LogStep(3, "Read the optional global attribute constraints: FeatureMap"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, Thermostat::Attributes::FeatureMap::Id); + } + } return CHIP_NO_ERROR; } +}; - void OnFailureResponse_2(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_2(bool onOff) +class Test_TC_TSTAT_2_1Suite : public TestCommand +{ +public: + Test_TC_TSTAT_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_TSTAT_2_1", 18, credsIssuerConfig) { - VerifyOrReturn(CheckValue("onOff", onOff, 1)); - - NextTest(); + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - CHIP_ERROR TestSendsColorLoopSetCommandSetAllAttributes_3() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type; - - RequestType request; - request.updateFlags = static_cast>(1); - request.action = static_cast(0); - request.direction = static_cast(0); - request.time = 0U; - request.startHue = 0U; - request.optionsMask = 0; - request.optionsOverride = 0; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_3(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_3(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } + ~Test_TC_TSTAT_2_1Suite() {} - void OnFailureResponse_3(CHIP_ERROR error) + chip::System::Clock::Timeout GetWaitDuration() const override { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } - void OnSuccessResponse_3() { NextTest(); } +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; - CHIP_ERROR TestReadColorLoopActiveAttributeFromDut_4() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_4, OnFailureCallback_4, true)); - return CHIP_NO_ERROR; - } + // + // Tests methods + // - void OnFailureResponse_4(CHIP_ERROR error) + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } + bool shouldContinue = false; - void OnSuccessResponse_4(uint8_t colorLoopActive) - { - VerifyOrReturn(CheckValue("colorLoopActive", colorLoopActive, 0)); + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + int16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "int16")); + } + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + int16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "int16")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 700)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 3000)); + } + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + int16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "int16")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 700)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 3000)); + } + break; + case 4: + if (IsUnsupported(status.mStatus)) + { + return; + } + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + int16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "int16")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 1600)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 3200)); + } + break; + case 5: + if (IsUnsupported(status.mStatus)) + { + return; + } + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + int16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "int16")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 1600)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 3200)); + } + break; + case 6: + if (IsUnsupported(status.mStatus)) + { + return; + } + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + int16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "int16")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 1600)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 2600)); + } + break; + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + int16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "int16")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 700)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 2600)); + } + break; + case 8: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + int16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "int16")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 700)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 3000)); + } + break; + case 9: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + int16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "int16")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 700)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 3000)); + } + break; + case 10: + if (IsUnsupported(status.mStatus)) + { + return; + } + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + int16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "int16")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 1600)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 3200)); + } + break; + case 11: + if (IsUnsupported(status.mStatus)) + { + return; + } + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + int16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "int16")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 1600)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 3200)); + } + break; + case 12: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::Thermostat::ThermostatControlSequence value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 5)); + } + break; + case 13: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 9)); + } + break; + case 14: + if (IsUnsupported(status.mStatus)) + { + return; + } + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + int8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "int8")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 25)); + } + break; + case 15: + if (IsUnsupported(status.mStatus)) + { + return; + } + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 6)); + } + break; + case 16: + if (IsUnsupported(status.mStatus)) + { + return; + } + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint8")); + } + break; + case 17: + if (IsUnsupported(status.mStatus)) + { + return; + } + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint8")); + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } - NextTest(); + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } } - CHIP_ERROR TestSendsColorLoopSetCommandSetAllAttributes_5() + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type; - - RequestType request; - request.updateFlags = static_cast>(2); - request.action = static_cast(0); - request.direction = static_cast(0); - request.time = 0U; - request.startHue = 0U; - request.optionsMask = 0; - request.optionsOverride = 0; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_5(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_5(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "Reads constraints of mandatory attributes from DUT: LocalTemperature"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, Thermostat::Attributes::LocalTemperature::Id); + } + case 2: { + LogStep(2, "Reads constraints of mandatory attributes from DUT: AbsMinHeatSetpointLimit"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, + Thermostat::Attributes::AbsMinHeatSetpointLimit::Id); + } + case 3: { + LogStep(3, "Reads constraints of mandatory attributes from DUT: AbsMaxHeatSetpointLimit"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, + Thermostat::Attributes::AbsMaxHeatSetpointLimit::Id); + } + case 4: { + LogStep(4, "Reads constraints of optional attributes from DUT: AbsMinCoolSetpointLimit"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, + Thermostat::Attributes::AbsMinCoolSetpointLimit::Id); + } + case 5: { + LogStep(5, "Reads constraints of optional attributes from DUT: AbsMaxCoolSetpointLimit"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, + Thermostat::Attributes::AbsMaxCoolSetpointLimit::Id); + } + case 6: { + LogStep(6, "Reads constraints of optional attributes from DUT: OccupiedCoolingSetpoint"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, + Thermostat::Attributes::OccupiedCoolingSetpoint::Id); + } + case 7: { + LogStep(7, "Reads constraints of mandatory attributes from DUT: OccupiedHeatingSetpoint"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, + Thermostat::Attributes::OccupiedHeatingSetpoint::Id); + } + case 8: { + LogStep(8, "Reads constraints of mandatory attributes from DUT: MinHeatSetpointLimit"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, Thermostat::Attributes::MinHeatSetpointLimit::Id); + } + case 9: { + LogStep(9, "Reads constraints of mandatory attributes from DUT: MaxHeatSetpointLimit"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, Thermostat::Attributes::MaxHeatSetpointLimit::Id); + } + case 10: { + LogStep(10, "Reads constraints of optional attributes from DUT: MinCoolSetpointLimit"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, Thermostat::Attributes::MinCoolSetpointLimit::Id); + } + case 11: { + LogStep(11, "Reads constraints of optional attributes from DUT: MaxCoolSetpointLimit"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, Thermostat::Attributes::MaxCoolSetpointLimit::Id); + } + case 12: { + LogStep(12, "Reads constraints of mandatory attributes from DUT: ControlSequenceOfOperation"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, + Thermostat::Attributes::ControlSequenceOfOperation::Id); + } + case 13: { + LogStep(13, "Reads constraints of mandatory attributes from DUT: SystemMode"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, Thermostat::Attributes::SystemMode::Id); + } + case 14: { + LogStep(14, "Reads constraints of optional attributes from DUT: MinSetpointDeadBand"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, Thermostat::Attributes::MinSetpointDeadBand::Id); + } + case 15: { + LogStep(15, "Reads constraints of optional attributes from DUT: StartOfWeek"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, Thermostat::Attributes::StartOfWeek::Id); + } + case 16: { + LogStep(16, "Reads constraints of optional attributes from DUT: NumberOfWeeklyTransitions"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, + Thermostat::Attributes::NumberOfWeeklyTransitions::Id); + } + case 17: { + LogStep(17, "Reads constraints of optional attributes from DUT: NumberOfDailyTransitions"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, + Thermostat::Attributes::NumberOfDailyTransitions::Id); + } + } return CHIP_NO_ERROR; } +}; - void OnFailureResponse_5(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_5() { NextTest(); } - - CHIP_ERROR TestReadColorLoopDirectionAttributeFromDut_6() +class Test_TC_TSTAT_2_2Suite : public TestCommand +{ +public: + Test_TC_TSTAT_2_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_TSTAT_2_2", 50, credsIssuerConfig) { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_6, OnFailureCallback_6, true)); - return CHIP_NO_ERROR; + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - void OnFailureResponse_6(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } + ~Test_TC_TSTAT_2_2Suite() {} - void OnSuccessResponse_6(uint8_t colorLoopDirection) + chip::System::Clock::Timeout GetWaitDuration() const override { - VerifyOrReturn(CheckValue("colorLoopDirection", colorLoopDirection, 0)); - - NextTest(); + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } - CHIP_ERROR TestSendsColorLoopSetCommandSetAllAttributes_7() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type; - - RequestType request; - request.updateFlags = static_cast>(4); - request.action = static_cast(0); - request.direction = static_cast(0); - request.time = 30U; - request.startHue = 0U; - request.optionsMask = 0; - request.optionsOverride = 0; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_7(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_7(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; - void OnFailureResponse_7(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } - void OnSuccessResponse_7() { NextTest(); } + // + // Tests methods + // - CHIP_ERROR TestReadColorLoopTimeAttributeFromDut_8() + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_8, OnFailureCallback_8, true)); - return CHIP_NO_ERROR; - } + bool shouldContinue = false; - void OnFailureResponse_8(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_8(uint16_t colorLoopTime) - { - VerifyOrReturn(CheckValue("colorLoopTime", colorLoopTime, 30U)); + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + if (IsUnsupported(status.mStatus)) + { + return; + } + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + int16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("occupiedCoolingSetpoint", value, 2600)); + VerifyOrReturn(CheckConstraintType("value", "", "int16")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 1600)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 2600)); + } + break; + case 2: + if (IsUnsupported(status.mStatus)) + { + return; + } + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 3: + if (IsUnsupported(status.mStatus)) + { + return; + } + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + int16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("occupiedCoolingSetpoint", value, 2000)); + } + break; + case 4: + if (IsUnsupported(status.mStatus)) + { + return; + } + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 5: + if (IsUnsupported(status.mStatus)) + { + return; + } + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + int16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("occupiedHeatingSetpoint", value, 2000)); + VerifyOrReturn(CheckConstraintType("value", "", "int16")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 700)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 3000)); + } + break; + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 8: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + int16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("occupiedHeatingSetpoint", value, 2100)); + } + break; + case 9: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 10: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 11: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + int16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("minHeatSetpointLimit", value, 700)); + VerifyOrReturn(CheckConstraintType("value", "", "int16")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 700)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 3000)); + } + break; + case 12: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 13: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + int16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("minHeatSetpointLimit", value, 2000)); + } + break; + case 14: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 15: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 16: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + int16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("maxHeatSetpointLimit", value, 3000)); + VerifyOrReturn(CheckConstraintType("value", "", "int16")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 700)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 3000)); + } + break; + case 17: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 18: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + int16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("maxHeatSetpointLimit", value, 2000)); + } + break; + case 19: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 20: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 21: + if (IsUnsupported(status.mStatus)) + { + return; + } + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + int16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("minCoolSetpointLimit", value, 1600)); + VerifyOrReturn(CheckConstraintType("value", "", "int16")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 1600)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 3200)); + } + break; + case 22: + if (IsUnsupported(status.mStatus)) + { + return; + } + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 23: + if (IsUnsupported(status.mStatus)) + { + return; + } + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + int16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("minCoolSetpointLimit", value, 2000)); + } + break; + case 24: + if (IsUnsupported(status.mStatus)) + { + return; + } + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 25: + if (IsUnsupported(status.mStatus)) + { + return; + } + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 26: + if (IsUnsupported(status.mStatus)) + { + return; + } + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + int16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("maxCoolSetpointLimit", value, 3200)); + VerifyOrReturn(CheckConstraintType("value", "", "int16")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 1600)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 3200)); + } + break; + case 27: + if (IsUnsupported(status.mStatus)) + { + return; + } + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 28: + if (IsUnsupported(status.mStatus)) + { + return; + } + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + int16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("maxCoolSetpointLimit", value, 2000)); + } + break; + case 29: + if (IsUnsupported(status.mStatus)) + { + return; + } + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 30: + if (IsUnsupported(status.mStatus)) + { + return; + } + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 31: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 32: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 33: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 34: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 35: + if (IsUnsupported(status.mStatus)) + { + return; + } + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 36: + if (IsUnsupported(status.mStatus)) + { + return; + } + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 37: + if (IsUnsupported(status.mStatus)) + { + return; + } + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 38: + if (IsUnsupported(status.mStatus)) + { + return; + } + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 39: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::Thermostat::ThermostatControlSequence value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("controlSequenceOfOperation", value, 4)); + VerifyOrReturn(CheckConstraintType("value", "", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 5)); + } + break; + case 40: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 41: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::Thermostat::ThermostatControlSequence value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("controlSequenceOfOperation", value, 2)); + } + break; + case 42: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 43: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 44: + if (IsUnsupported(status.mStatus)) + { + return; + } + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 45: + if (IsUnsupported(status.mStatus)) + { + return; + } + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 46: + if (IsUnsupported(status.mStatus)) + { + return; + } + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 47: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 48: + if (IsUnsupported(status.mStatus)) + { + return; + } + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 49: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } - NextTest(); + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } } - CHIP_ERROR TestSendsColorLoopSetCommandSetAllAttributes_9() + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type; - - RequestType request; - request.updateFlags = static_cast>(8); - request.action = static_cast(0); - request.direction = static_cast(0); - request.time = 0U; - request.startHue = 160U; - request.optionsMask = 0; - request.optionsOverride = 0; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_9(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_9(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "Reads OccupiedCoolingSetpoint attribute from Server DUT and verifies that the value is within range"); + VerifyOrdo(!ShouldSkip("A_OCCUPIEDCOOLINGSETPOINT"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, + Thermostat::Attributes::OccupiedCoolingSetpoint::Id); + } + case 2: { + LogStep(2, "Writes a value back that is different but valid for OccupiedCoolingSetpoint attribute"); + VerifyOrdo(!ShouldSkip("A_OCCUPIEDCOOLINGSETPOINT"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + int16_t value; + value = 2000; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, + Thermostat::Attributes::OccupiedCoolingSetpoint::Id, value); + } + case 3: { + LogStep(3, "Reads it back again to confirm the successful write of OccupiedCoolingSetpoint attribute"); + VerifyOrdo(!ShouldSkip("A_OCCUPIEDCOOLINGSETPOINT"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, + Thermostat::Attributes::OccupiedCoolingSetpoint::Id); + } + case 4: { + LogStep(4, "Writes the limit of MinCoolSetpointLimit to OccupiedCoolingSetpoint attribute"); + VerifyOrdo(!ShouldSkip("A_OCCUPIEDCOOLINGSETPOINT"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + int16_t value; + value = 1600; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, + Thermostat::Attributes::OccupiedCoolingSetpoint::Id, value); + } + case 5: { + LogStep(5, "Writes the limit of MaxCoolSetpointLimit to OccupiedCoolingSetpoint attribute"); + VerifyOrdo(!ShouldSkip("A_OCCUPIEDCOOLINGSETPOINT"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + int16_t value; + value = 2600; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, + Thermostat::Attributes::OccupiedCoolingSetpoint::Id, value); + } + case 6: { + LogStep(6, "Reads OccupiedHeatingSetpoint attribute from Server DUT and verifies that the value is within range"); + VerifyOrdo(!ShouldSkip("A_OCCUPIEDHEATINGSETPOINT"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, + Thermostat::Attributes::OccupiedHeatingSetpoint::Id); + } + case 7: { + LogStep(7, "Writes a value back that is different but valid for OccupiedHeatingSetpoint attribute"); + VerifyOrdo(!ShouldSkip("A_OCCUPIEDHEATINGSETPOINT"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + int16_t value; + value = 2100; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, + Thermostat::Attributes::OccupiedHeatingSetpoint::Id, value); + } + case 8: { + LogStep(8, "Reads it back again to confirm the successful write of OccupiedHeatingSetpoint attribute"); + VerifyOrdo(!ShouldSkip("A_OCCUPIEDHEATINGSETPOINT"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, + Thermostat::Attributes::OccupiedHeatingSetpoint::Id); + } + case 9: { + LogStep(9, "Writes the limit of MinHeatSetpointLimit to OccupiedHeatingSetpoint attribute"); + VerifyOrdo(!ShouldSkip("A_OCCUPIEDHEATINGSETPOINT"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + int16_t value; + value = 700; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, + Thermostat::Attributes::OccupiedHeatingSetpoint::Id, value); + } + case 10: { + LogStep(10, "Writes the limit of MaxHeatSetpointLimit to OccupiedHeatingSetpoint attribute"); + VerifyOrdo(!ShouldSkip("A_OCCUPIEDHEATINGSETPOINT"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + int16_t value; + value = 3000; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, + Thermostat::Attributes::OccupiedHeatingSetpoint::Id, value); + } + case 11: { + LogStep(11, "Reads MinHeatSetpointLimit attribute from Server DUT and verifies that the value is within range"); + VerifyOrdo(!ShouldSkip("A_MINHEATSETPOINTLIMIT"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, Thermostat::Attributes::MinHeatSetpointLimit::Id); + } + case 12: { + LogStep(12, "Writes a value back that is different but valid for MinHeatSetpointLimit attribute"); + VerifyOrdo(!ShouldSkip("A_MINHEATSETPOINTLIMIT"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + int16_t value; + value = 2000; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, Thermostat::Attributes::MinHeatSetpointLimit::Id, + value); + } + case 13: { + LogStep(13, "Reads it back again to confirm the successful write of MinHeatSetpointLimit attribute"); + VerifyOrdo(!ShouldSkip("A_MINHEATSETPOINTLIMIT"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, Thermostat::Attributes::MinHeatSetpointLimit::Id); + } + case 14: { + LogStep(14, "Writes the limit of AbsMinHeatSetpointLimit to MinHeatSetpointLimit attribute"); + VerifyOrdo(!ShouldSkip("A_MINHEATSETPOINTLIMIT"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + int16_t value; + value = 700; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, Thermostat::Attributes::MinHeatSetpointLimit::Id, + value); + } + case 15: { + LogStep(15, "Writes the limit of AbsMaxHeatSetpointLimit to MinHeatSetpointLimit attribute"); + VerifyOrdo(!ShouldSkip("A_MINHEATSETPOINTLIMIT"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + int16_t value; + value = 3000; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, Thermostat::Attributes::MinHeatSetpointLimit::Id, + value); + } + case 16: { + LogStep(16, "Reads MaxHeatSetpointLimit attribute from Server DUT and verifies that the value is within range"); + VerifyOrdo(!ShouldSkip("A_MAXHEATSETPOINTLIMIT"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, Thermostat::Attributes::MaxHeatSetpointLimit::Id); + } + case 17: { + LogStep(17, "Writes a value back that is different but valid for MaxHeatSetpointLimit attribute"); + VerifyOrdo(!ShouldSkip("A_MAXHEATSETPOINTLIMIT"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + int16_t value; + value = 2000; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, Thermostat::Attributes::MaxHeatSetpointLimit::Id, + value); + } + case 18: { + LogStep(18, "Reads it back again to confirm the successful write of MaxHeatSetpointLimit attribute"); + VerifyOrdo(!ShouldSkip("A_MAXHEATSETPOINTLIMIT"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, Thermostat::Attributes::MaxHeatSetpointLimit::Id); + } + case 19: { + LogStep(19, "Writes the limit of AbsMinHeatSetpointLimit to MaxHeatSetpointLimit attribute"); + VerifyOrdo(!ShouldSkip("A_MAXHEATSETPOINTLIMIT"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + int16_t value; + value = 700; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, Thermostat::Attributes::MaxHeatSetpointLimit::Id, + value); + } + case 20: { + LogStep(20, "Writes the limit of AbsMaxHeatSetpointLimit to MaxHeatSetpointLimit attribute"); + VerifyOrdo(!ShouldSkip("A_MAXHEATSETPOINTLIMIT"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + int16_t value; + value = 3000; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, Thermostat::Attributes::MaxHeatSetpointLimit::Id, + value); + } + case 21: { + LogStep(21, "Reads MinCoolSetpointLimit attribute from Server DUT and verifies that the value is within range"); + VerifyOrdo(!ShouldSkip("A_MINCOOLSETPOINTLIMIT"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, Thermostat::Attributes::MinCoolSetpointLimit::Id); + } + case 22: { + LogStep(22, "Writes a value back that is different but valid for MinCoolSetpointLimit attribute"); + VerifyOrdo(!ShouldSkip("A_MINCOOLSETPOINTLIMIT"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + int16_t value; + value = 2000; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, Thermostat::Attributes::MinCoolSetpointLimit::Id, + value); + } + case 23: { + LogStep(23, "Reads it back again to confirm the successful write of MinCoolSetpointLimit attribute"); + VerifyOrdo(!ShouldSkip("A_MINCOOLSETPOINTLIMIT"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, Thermostat::Attributes::MinCoolSetpointLimit::Id); + } + case 24: { + LogStep(24, "Writes the limit of AbsMinCoolSetpointLimit to MinCoolSetpointLimit attribute"); + VerifyOrdo(!ShouldSkip("A_MINCOOLSETPOINTLIMIT"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + int16_t value; + value = 1600; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, Thermostat::Attributes::MinCoolSetpointLimit::Id, + value); + } + case 25: { + LogStep(25, "Writes the limit of MaxCoolSetpointLimit to MinCoolSetpointLimit attribute"); + VerifyOrdo(!ShouldSkip("A_MINCOOLSETPOINTLIMIT"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + int16_t value; + value = 3200; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, Thermostat::Attributes::MinCoolSetpointLimit::Id, + value); + } + case 26: { + LogStep(26, "Reads MaxCoolSetpointLimit attribute from Server DUT and verifies that the value is within range"); + VerifyOrdo(!ShouldSkip("A_MAXCOOLSETPOINTLIMIT"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, Thermostat::Attributes::MaxCoolSetpointLimit::Id); + } + case 27: { + LogStep(27, "Writes a value back that is different but valid for MaxCoolSetpointLimit attribute"); + VerifyOrdo(!ShouldSkip("A_MAXCOOLSETPOINTLIMIT"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + int16_t value; + value = 2000; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, Thermostat::Attributes::MaxCoolSetpointLimit::Id, + value); + } + case 28: { + LogStep(28, "Reads it back again to confirm the successful write of MaxCoolSetpointLimit attribute"); + VerifyOrdo(!ShouldSkip("A_MAXCOOLSETPOINTLIMIT"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, Thermostat::Attributes::MaxCoolSetpointLimit::Id); + } + case 29: { + LogStep(29, "Writes the limit of AbsMinCoolSetpointLimit to MaxCoolSetpointLimit attribute"); + VerifyOrdo(!ShouldSkip("A_MAXCOOLSETPOINTLIMIT"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + int16_t value; + value = 1600; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, Thermostat::Attributes::MaxCoolSetpointLimit::Id, + value); + } + case 30: { + LogStep(30, "Writes the limit of MaxCoolSetpointLimit to MaxCoolSetpointLimit attribute"); + VerifyOrdo(!ShouldSkip("A_MAXCOOLSETPOINTLIMIT"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + int16_t value; + value = 3200; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, Thermostat::Attributes::MaxCoolSetpointLimit::Id, + value); + } + case 31: { + LogStep(31, "Writes (sets back) the limit of MinHeatSetpointLimit to MinHeatSetpointLimit attribute"); + VerifyOrdo(!ShouldSkip("A_MINHEATSETPOINTLIMIT"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + int16_t value; + value = 700; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, Thermostat::Attributes::MinHeatSetpointLimit::Id, + value); + } + case 32: { + LogStep(32, "Writes (sets back) the limit of MaxHeatSetpointLimit to MinHeatSetpointLimit attribute"); + VerifyOrdo(!ShouldSkip("A_MINHEATSETPOINTLIMIT"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + int16_t value; + value = 3000; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, Thermostat::Attributes::MinHeatSetpointLimit::Id, + value); + } + case 33: { + LogStep(33, "Writes (sets back) the limit of MinHeatSetpointLimit to MaxHeatSetpointLimit attribute"); + VerifyOrdo(!ShouldSkip("A_MINHEATSETPOINTLIMIT"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + int16_t value; + value = 700; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, Thermostat::Attributes::MaxHeatSetpointLimit::Id, + value); + } + case 34: { + LogStep(34, "Writes (sets back) the limit of MaxHeatSetpointLimit to MaxHeatSetpointLimit attribute"); + VerifyOrdo(!ShouldSkip("A_MINHEATSETPOINTLIMIT"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + int16_t value; + value = 3000; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, Thermostat::Attributes::MaxHeatSetpointLimit::Id, + value); + } + case 35: { + LogStep(35, "Writes (sets back) the limit of MinCoolSetpointLimit to MinCoolSetpointLimit attribute"); + VerifyOrdo(!ShouldSkip("A_MINCOOLSETPOINTLIMIT"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + int16_t value; + value = 1600; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, Thermostat::Attributes::MinCoolSetpointLimit::Id, + value); + } + case 36: { + LogStep(36, "Writes (sets back) the limit of MaxCoolSetpointLimit to MinCoolSetpointLimit attribute"); + VerifyOrdo(!ShouldSkip("A_MINCOOLSETPOINTLIMIT"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + int16_t value; + value = 3200; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, Thermostat::Attributes::MinCoolSetpointLimit::Id, + value); + } + case 37: { + LogStep(37, "Writes (sets back) the limit of MinCoolSetpointLimit to MaxCoolSetpointLimit attribute"); + VerifyOrdo(!ShouldSkip("A_MAXCOOLSETPOINTLIMIT"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + int16_t value; + value = 1600; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, Thermostat::Attributes::MaxCoolSetpointLimit::Id, + value); + } + case 38: { + LogStep(38, "Writes (sets back) the limit of MaxCoolSetpointLimit to MaxCoolSetpointLimit attribute"); + VerifyOrdo(!ShouldSkip("A_MAXCOOLSETPOINTLIMIT"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + int16_t value; + value = 3200; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, Thermostat::Attributes::MaxCoolSetpointLimit::Id, + value); + } + case 39: { + LogStep(39, "Reads ControlSequenceOfOperation from Server DUT and verifies that the value is valid"); + VerifyOrdo(!ShouldSkip("A_CONTROLSEQUENCEOFOPERATION"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, + Thermostat::Attributes::ControlSequenceOfOperation::Id); + } + case 40: { + LogStep(40, "Write Attribute command for ControlSequenceOfOperation with a new valid value"); + VerifyOrdo(!ShouldSkip("A_CONTROLSEQUENCEOFOPERATION"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + chip::app::Clusters::Thermostat::ThermostatControlSequence value; + value = static_cast(2); + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, + Thermostat::Attributes::ControlSequenceOfOperation::Id, value); + } + case 41: { + LogStep(41, "Read it back again to confirm the successful write"); + VerifyOrdo(!ShouldSkip("A_CONTROLSEQUENCEOFOPERATION"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, + Thermostat::Attributes::ControlSequenceOfOperation::Id); + } + case 42: { + LogStep(42, "Sets OccupiedHeatingSetpoint to default value"); + VerifyOrdo(!ShouldSkip("A_OCCUPIEDHEATINGSETPOINT"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + int16_t value; + value = 2000; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, + Thermostat::Attributes::OccupiedHeatingSetpoint::Id, value); + } + case 43: { + LogStep(43, "Sets OccupiedHeatingSetpoint to default value"); + VerifyOrdo(!ShouldSkip("A_OCCUPIEDHEATINGSETPOINT"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + int16_t value; + value = 2000; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, + Thermostat::Attributes::OccupiedHeatingSetpoint::Id, value); + } + case 44: { + LogStep(44, "Sets OccupiedCoolingSetpoint to default value"); + VerifyOrdo(!ShouldSkip("A_OCCUPIEDCOOLINGSETPOINT"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + int16_t value; + value = 2600; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, + Thermostat::Attributes::OccupiedCoolingSetpoint::Id, value); + } + case 45: { + LogStep(45, "Sets OccupiedCoolingSetpoint to default value"); + VerifyOrdo(!ShouldSkip("A_OCCUPIEDCOOLINGSETPOINT"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + int16_t value; + value = 2600; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, + Thermostat::Attributes::OccupiedCoolingSetpoint::Id, value); + } + case 46: { + LogStep(46, "Sets OccupiedCoolingSetpoint to default value"); + VerifyOrdo(!ShouldSkip("A_OCCUPIEDCOOLINGSETPOINT"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + int16_t value; + value = 2600; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, + Thermostat::Attributes::OccupiedCoolingSetpoint::Id, value); + } + case 47: { + LogStep(47, "Sets OccupiedHeatingSetpoint to default value"); + VerifyOrdo(!ShouldSkip("A_OCCUPIEDHEATINGSETPOINT"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + int16_t value; + value = 2000; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, + Thermostat::Attributes::OccupiedHeatingSetpoint::Id, value); + } + case 48: { + LogStep(48, "Sets OccupiedCoolingSetpoint to default value"); + VerifyOrdo(!ShouldSkip("A_OCCUPIEDCOOLINGSETPOINT"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + int16_t value; + value = 2600; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, + Thermostat::Attributes::OccupiedCoolingSetpoint::Id, value); + } + case 49: { + LogStep(49, "Sets OccupiedHeatingSetpoint to default value"); + VerifyOrdo(!ShouldSkip("A_OCCUPIEDHEATINGSETPOINT"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + int16_t value; + value = 2000; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, + Thermostat::Attributes::OccupiedHeatingSetpoint::Id, value); + } + } return CHIP_NO_ERROR; } +}; - void OnFailureResponse_9(CHIP_ERROR error) +class Test_TC_TSUIC_1_1Suite : public TestCommand +{ +public: + Test_TC_TSUIC_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_TSUIC_1_1", 5, credsIssuerConfig) { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - void OnSuccessResponse_9() { NextTest(); } + ~Test_TC_TSUIC_1_1Suite() {} - CHIP_ERROR TestReadColorLoopStartEnhancedHueAttributeFromDut_10() + chip::System::Clock::Timeout GetWaitDuration() const override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_10, OnFailureCallback_10, true)); - return CHIP_NO_ERROR; + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } - void OnFailureResponse_10(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; - void OnSuccessResponse_10(uint16_t colorLoopStartEnhancedHue) - { - VerifyOrReturn(CheckValue("colorLoopStartEnhancedHue", colorLoopStartEnhancedHue, 160U)); + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } - NextTest(); - } + // + // Tests methods + // - CHIP_ERROR TestSendsColorLoopSetCommandSetAllAttributes_11() + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type; - - RequestType request; - request.updateFlags = static_cast>(1); - request.action = static_cast(1); - request.direction = static_cast(0); - request.time = 0U; - request.startHue = 0U; - request.optionsMask = 0; - request.optionsOverride = 0; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_11(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_11(error); - }; + bool shouldContinue = false; - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + } + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "list")); + } + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "list")); + } + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "list")); + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } - void OnFailureResponse_11(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } } - void OnSuccessResponse_11() { NextTest(); } - - CHIP_ERROR TestReadColorLoopActiveAttributeFromDut_12() + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_12, OnFailureCallback_12, true)); + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "Read the global attribute constraints: ClusterRevision"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ThermostatUserInterfaceConfiguration::Id, + ThermostatUserInterfaceConfiguration::Attributes::ClusterRevision::Id); + } + case 2: { + LogStep(2, "Read the global attribute: AttributeList"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ThermostatUserInterfaceConfiguration::Id, + ThermostatUserInterfaceConfiguration::Attributes::AttributeList::Id); + } + case 3: { + LogStep(3, "Read the global attribute: AcceptedCommandList"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ThermostatUserInterfaceConfiguration::Id, + ThermostatUserInterfaceConfiguration::Attributes::AcceptedCommandList::Id); + } + case 4: { + LogStep(4, "Read the global attribute: GeneratedCommandList"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ThermostatUserInterfaceConfiguration::Id, + ThermostatUserInterfaceConfiguration::Attributes::GeneratedCommandList::Id); + } + } return CHIP_NO_ERROR; } +}; - void OnFailureResponse_12(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_12(uint8_t colorLoopActive) +class Test_TC_TSUIC_2_1Suite : public TestCommand +{ +public: + Test_TC_TSUIC_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_TSUIC_2_1", 7, credsIssuerConfig) { - VerifyOrReturn(CheckValue("colorLoopActive", colorLoopActive, 1)); - - NextTest(); + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - CHIP_ERROR TestReadEnhancedCurrentHueAttributeFromDut_13() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_13, OnFailureCallback_13, true)); - return CHIP_NO_ERROR; - } + ~Test_TC_TSUIC_2_1Suite() {} - void OnFailureResponse_13(CHIP_ERROR error) + chip::System::Clock::Timeout GetWaitDuration() const override { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } - void OnSuccessResponse_13(uint16_t enhancedCurrentHue) - { - VerifyOrReturn(CheckConstraintType("enhancedCurrentHue", "", "uint16")); - EnhancedCurrentHueValue1 = enhancedCurrentHue; - NextTest(); - } +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; - CHIP_ERROR TestReadColorLoopStoredEnhancedHueAttributeFromDut_14() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_14, OnFailureCallback_14, true)); - return CHIP_NO_ERROR; - } + // + // Tests methods + // - void OnFailureResponse_14(CHIP_ERROR error) + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } + bool shouldContinue = false; - void OnSuccessResponse_14(uint16_t colorLoopStoredEnhancedHue) - { - VerifyOrReturn(CheckValue("colorLoopStoredEnhancedHue", colorLoopStoredEnhancedHue, EnhancedCurrentHueValue1)); + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("temperatureDisplayMode", value, 0)); + } + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 1)); + } + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("keypadLockout", value, 0)); + } + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 5)); + } + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("scheduleProgrammingVisibility", value, 0)); + } + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 1)); + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } - NextTest(); + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } } - CHIP_ERROR TestSendsColorLoopSetCommandSetAllAttributes_15() + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type; - - RequestType request; - request.updateFlags = static_cast>(1); - request.action = static_cast(0); - request.direction = static_cast(0); - request.time = 0U; - request.startHue = 0U; - request.optionsMask = 0; - request.optionsOverride = 0; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_15(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_15(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "read the mandatory attribute: TemperatureDisplayMode"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ThermostatUserInterfaceConfiguration::Id, + ThermostatUserInterfaceConfiguration::Attributes::TemperatureDisplayMode::Id); + } + case 2: { + LogStep(2, "read the mandatory attribute: TemperatureDisplayMode"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ThermostatUserInterfaceConfiguration::Id, + ThermostatUserInterfaceConfiguration::Attributes::TemperatureDisplayMode::Id); + } + case 3: { + LogStep(3, "read the mandatory attribute: KeypadLockout"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ThermostatUserInterfaceConfiguration::Id, + ThermostatUserInterfaceConfiguration::Attributes::KeypadLockout::Id); + } + case 4: { + LogStep(4, "read the mandatory attribute: KeypadLockout"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ThermostatUserInterfaceConfiguration::Id, + ThermostatUserInterfaceConfiguration::Attributes::KeypadLockout::Id); + } + case 5: { + LogStep(5, "read the optional attribute: ScheduleProgrammingVisibility"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ThermostatUserInterfaceConfiguration::Id, + ThermostatUserInterfaceConfiguration::Attributes::ScheduleProgrammingVisibility::Id); + } + case 6: { + LogStep(6, "read the optional attribute: ScheduleProgrammingVisibility"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ThermostatUserInterfaceConfiguration::Id, + ThermostatUserInterfaceConfiguration::Attributes::ScheduleProgrammingVisibility::Id); + } + } return CHIP_NO_ERROR; } +}; - void OnFailureResponse_15(CHIP_ERROR error) +class Test_TC_TSUIC_2_2Suite : public TestCommand +{ +public: + Test_TC_TSUIC_2_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_TSUIC_2_2", 14, credsIssuerConfig) { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - void OnSuccessResponse_15() { NextTest(); } - - CHIP_ERROR TestReadColorLoopActiveAttributeFromDut_16() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_16, OnFailureCallback_16, true)); - return CHIP_NO_ERROR; - } + ~Test_TC_TSUIC_2_2Suite() {} - void OnFailureResponse_16(CHIP_ERROR error) + chip::System::Clock::Timeout GetWaitDuration() const override { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } - void OnSuccessResponse_16(uint8_t colorLoopActive) - { - VerifyOrReturn(CheckValue("colorLoopActive", colorLoopActive, 0)); - - NextTest(); - } +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; - CHIP_ERROR TestReadColorLoopStoredEnhancedHueAttributeFromDut_17() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_17, OnFailureCallback_17, true)); - return CHIP_NO_ERROR; - } + // + // Tests methods + // - void OnFailureResponse_17(CHIP_ERROR error) + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } + bool shouldContinue = false; - void OnSuccessResponse_17(uint16_t colorLoopStoredEnhancedHue) - { - VerifyOrReturn(CheckConstraintType("colorLoopStoredEnhancedHue", "", "uint16")); - ColorLoopStoredEnhancedHueValue1 = colorLoopStoredEnhancedHue; - NextTest(); - } - - CHIP_ERROR TestReadEnhancedCurrentHueAttributeFromDut_18() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_18, OnFailureCallback_18, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_18(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_18(uint16_t enhancedCurrentHue) - { - VerifyOrReturn(CheckValue("enhancedCurrentHue", enhancedCurrentHue, ColorLoopStoredEnhancedHueValue1)); - - NextTest(); - } - - CHIP_ERROR TestSendsColorLoopSetCommandSetAllAttributes_19() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type; - - RequestType request; - request.updateFlags = static_cast>(2); - request.action = static_cast(0); - request.direction = static_cast(1); - request.time = 0U; - request.startHue = 0U; - request.optionsMask = 0; - request.optionsOverride = 0; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_19(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_19(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_19(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_19() { NextTest(); } - - CHIP_ERROR TestReadColorLoopDirectionAttributeFromDut_20() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_20, OnFailureCallback_20, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_20(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_20(uint8_t colorLoopDirection) - { - VerifyOrReturn(CheckValue("colorLoopDirection", colorLoopDirection, 1)); - - NextTest(); - } - - CHIP_ERROR TestSendsColorLoopSetCommandSetAllAttributes_21() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type; - - RequestType request; - request.updateFlags = static_cast>(1); - request.action = static_cast(1); - request.direction = static_cast(0); - request.time = 0U; - request.startHue = 0U; - request.optionsMask = 0; - request.optionsOverride = 0; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_21(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_21(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_21(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_21() { NextTest(); } - - CHIP_ERROR TestReadColorLoopActiveAttributeFromDut_22() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_22, OnFailureCallback_22, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_22(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_22(uint8_t colorLoopActive) - { - VerifyOrReturn(CheckValue("colorLoopActive", colorLoopActive, 1)); - - NextTest(); - } - - CHIP_ERROR TestReadEnhancedCurrentHueAttributeFromDut_23() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_23, OnFailureCallback_23, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_23(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_23(uint16_t enhancedCurrentHue) - { - VerifyOrReturn(CheckConstraintType("enhancedCurrentHue", "", "uint16")); - EnhancedCurrentHueValue2 = enhancedCurrentHue; - NextTest(); - } - - CHIP_ERROR TestReadColorLoopStoredEnhancedHueAttributeFromDut_24() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_24, OnFailureCallback_24, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_24(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_24(uint16_t colorLoopStoredEnhancedHue) - { - VerifyOrReturn(CheckValue("colorLoopStoredEnhancedHue", colorLoopStoredEnhancedHue, EnhancedCurrentHueValue2)); - - NextTest(); - } - - CHIP_ERROR TestSendsColorLoopSetCommandSetAllAttributes_25() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type; - - RequestType request; - request.updateFlags = static_cast>(1); - request.action = static_cast(0); - request.direction = static_cast(0); - request.time = 0U; - request.startHue = 0U; - request.optionsMask = 0; - request.optionsOverride = 0; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_25(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_25(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_25(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_25() { NextTest(); } - - CHIP_ERROR TestReadColorLoopActiveAttributeFromDut_26() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_26, OnFailureCallback_26, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_26(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_26(uint8_t colorLoopActive) - { - VerifyOrReturn(CheckValue("colorLoopActive", colorLoopActive, 0)); - - NextTest(); - } - - CHIP_ERROR TestReadColorLoopStoredEnhancedHueAttributeFromDut_27() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_27, OnFailureCallback_27, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_27(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_27(uint16_t colorLoopStoredEnhancedHue) - { - VerifyOrReturn(CheckConstraintType("colorLoopStoredEnhancedHue", "", "uint16")); - ColorLoopStoredEnhancedHueValue2 = colorLoopStoredEnhancedHue; - NextTest(); - } - - CHIP_ERROR TestReadEnhancedCurrentHueAttributeFromDut_28() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_28, OnFailureCallback_28, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_28(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_28(uint16_t enhancedCurrentHue) - { - VerifyOrReturn(CheckValue("enhancedCurrentHue", enhancedCurrentHue, ColorLoopStoredEnhancedHueValue2)); - - NextTest(); - } - - CHIP_ERROR TestEnhancedMoveToHueCommand_29() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::ColorControl::Commands::EnhancedMoveToHue::Type; - - RequestType request; - request.enhancedHue = 40960U; - request.direction = static_cast(0); - request.transitionTime = 0U; - request.optionsMask = 0; - request.optionsOverride = 0; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_29(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_29(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_29(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_29() { NextTest(); } - - CHIP_ERROR TestWait2000ms_30() - { - SetIdentity(kIdentityAlpha); - return WaitForMs(2000); - } - - CHIP_ERROR TestReadEnhancedCurrentHueAttributeFromDut_31() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_31, OnFailureCallback_31, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_31(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_31(uint16_t enhancedCurrentHue) - { - VerifyOrReturn(CheckValue("enhancedCurrentHue", enhancedCurrentHue, 40960U)); - - NextTest(); - } - - CHIP_ERROR TestSendsColorLoopSetCommandSetAllAttributes_32() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type; - - RequestType request; - request.updateFlags = static_cast>(2); - request.action = static_cast(0); - request.direction = static_cast(0); - request.time = 0U; - request.startHue = 0U; - request.optionsMask = 0; - request.optionsOverride = 0; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_32(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_32(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_32(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_32() { NextTest(); } - - CHIP_ERROR TestReadColorLoopDirectionAttributeFromDut_33() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_33, OnFailureCallback_33, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_33(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_33(uint8_t colorLoopDirection) - { - VerifyOrReturn(CheckValue("colorLoopDirection", colorLoopDirection, 0)); - - NextTest(); - } - - CHIP_ERROR TestSendsColorLoopSetCommandSetAllAttributes_34() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type; - - RequestType request; - request.updateFlags = static_cast>(1); - request.action = static_cast(2); - request.direction = static_cast(0); - request.time = 0U; - request.startHue = 0U; - request.optionsMask = 0; - request.optionsOverride = 0; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_34(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_34(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_34(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_34() { NextTest(); } - - CHIP_ERROR TestReadColorLoopActiveAttributeFromDut_35() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_35, OnFailureCallback_35, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_35(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_35(uint8_t colorLoopActive) - { - VerifyOrReturn(CheckValue("colorLoopActive", colorLoopActive, 1)); - - NextTest(); - } - - CHIP_ERROR TestReadEnhancedCurrentHueAttributeFromDut_36() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_36, OnFailureCallback_36, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_36(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_36(uint16_t enhancedCurrentHue) - { - VerifyOrReturn(CheckConstraintType("enhancedCurrentHue", "", "uint16")); - EnhancedCurrentHueValue3 = enhancedCurrentHue; - NextTest(); - } - - CHIP_ERROR TestReadColorLoopStoredEnhancedHueAttributeFromDut_37() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_37, OnFailureCallback_37, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_37(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_37(uint16_t colorLoopStoredEnhancedHue) - { - VerifyOrReturn(CheckValue("colorLoopStoredEnhancedHue", colorLoopStoredEnhancedHue, EnhancedCurrentHueValue3)); - - NextTest(); - } - - CHIP_ERROR TestSendsColorLoopSetCommandSetAllAttributes_38() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type; - - RequestType request; - request.updateFlags = static_cast>(1); - request.action = static_cast(0); - request.direction = static_cast(0); - request.time = 0U; - request.startHue = 0U; - request.optionsMask = 0; - request.optionsOverride = 0; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_38(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_38(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_38(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_38() { NextTest(); } - - CHIP_ERROR TestReadColorLoopActiveAttributeFromDut_39() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_39, OnFailureCallback_39, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_39(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_39(uint8_t colorLoopActive) - { - VerifyOrReturn(CheckValue("colorLoopActive", colorLoopActive, 0)); - - NextTest(); - } - - CHIP_ERROR TestReadColorLoopStoredEnhancedHueAttributeFromDut_40() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_40, OnFailureCallback_40, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_40(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_40(uint16_t colorLoopStoredEnhancedHue) - { - VerifyOrReturn(CheckConstraintType("colorLoopStoredEnhancedHue", "", "uint16")); - ColorLoopStoredEnhancedHueValue3 = colorLoopStoredEnhancedHue; - NextTest(); - } - - CHIP_ERROR TestReadEnhancedCurrentHueAttributeFromDut_41() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_41, OnFailureCallback_41, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_41(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_41(uint16_t enhancedCurrentHue) - { - VerifyOrReturn(CheckValue("enhancedCurrentHue", enhancedCurrentHue, ColorLoopStoredEnhancedHueValue3)); - - NextTest(); - } - - CHIP_ERROR TestSendsColorLoopSetCommandSetAllAttributes_42() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type; - - RequestType request; - request.updateFlags = static_cast>(2); - request.action = static_cast(0); - request.direction = static_cast(1); - request.time = 0U; - request.startHue = 0U; - request.optionsMask = 0; - request.optionsOverride = 0; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_42(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_42(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_42(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_42() { NextTest(); } - - CHIP_ERROR TestReadColorLoopDirectionAttributeFromDut_43() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_43, OnFailureCallback_43, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_43(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_43(uint8_t colorLoopDirection) - { - VerifyOrReturn(CheckValue("colorLoopDirection", colorLoopDirection, 1)); - - NextTest(); - } - - CHIP_ERROR TestSendsColorLoopSetCommandSetAllAttributes_44() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type; - - RequestType request; - request.updateFlags = static_cast>(1); - request.action = static_cast(2); - request.direction = static_cast(0); - request.time = 0U; - request.startHue = 0U; - request.optionsMask = 0; - request.optionsOverride = 0; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_44(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_44(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_44(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_44() { NextTest(); } - - CHIP_ERROR TestReadColorLoopActiveAttributeFromDut_45() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_45, OnFailureCallback_45, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_45(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_45(uint8_t colorLoopActive) - { - VerifyOrReturn(CheckValue("colorLoopActive", colorLoopActive, 1)); - - NextTest(); - } - - CHIP_ERROR TestReadEnhancedCurrentHueAttributeFromDut_46() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_46, OnFailureCallback_46, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_46(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_46(uint16_t enhancedCurrentHue) - { - VerifyOrReturn(CheckConstraintType("enhancedCurrentHue", "", "uint16")); - EnhancedCurrentHueValue4 = enhancedCurrentHue; - NextTest(); - } - - CHIP_ERROR TestReadColorLoopStoredEnhancedHueAttributeFromDut_47() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_47, OnFailureCallback_47, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_47(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_47(uint16_t colorLoopStoredEnhancedHue) - { - VerifyOrReturn(CheckValue("colorLoopStoredEnhancedHue", colorLoopStoredEnhancedHue, EnhancedCurrentHueValue4)); - - NextTest(); - } - - CHIP_ERROR TestSendsColorLoopSetCommandSetAllAttributes_48() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type; - - RequestType request; - request.updateFlags = static_cast>(1); - request.action = static_cast(0); - request.direction = static_cast(0); - request.time = 0U; - request.startHue = 0U; - request.optionsMask = 0; - request.optionsOverride = 0; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_48(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_48(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_48(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_48() { NextTest(); } - - CHIP_ERROR TestReadColorLoopActiveAttributeFromDut_49() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_49, OnFailureCallback_49, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_49(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_49(uint8_t colorLoopActive) - { - VerifyOrReturn(CheckValue("colorLoopActive", colorLoopActive, 0)); - - NextTest(); - } - - CHIP_ERROR TestReadColorLoopStoredEnhancedHueAttributeFromDut_50() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_50, OnFailureCallback_50, true)); + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 8: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 9: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 10: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); + break; + case 11: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 12: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 13: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } + + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } + } + + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "Writes a value of 0 to TemperatureDisplayMode attribute of DUT"); + VerifyOrdo(!ShouldSkip("A_TEMPERATURE_DISPLAY_MODE"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + uint8_t value; + value = 0; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), ThermostatUserInterfaceConfiguration::Id, + ThermostatUserInterfaceConfiguration::Attributes::TemperatureDisplayMode::Id, value); + } + case 2: { + LogStep(2, "Writes a value of 1 to TemperatureDisplayMode attribute of DUT"); + VerifyOrdo(!ShouldSkip("A_TEMPERATURE_DISPLAY_MODE"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + uint8_t value; + value = 1; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), ThermostatUserInterfaceConfiguration::Id, + ThermostatUserInterfaceConfiguration::Attributes::TemperatureDisplayMode::Id, value); + } + case 3: { + LogStep(3, "Writes a value of greater than 1 to TemperatureDisplayMode attribute of DUT"); + VerifyOrdo(!ShouldSkip("A_TEMPERATURE_DISPLAY_MODE"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + uint8_t value; + value = 2; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), ThermostatUserInterfaceConfiguration::Id, + ThermostatUserInterfaceConfiguration::Attributes::TemperatureDisplayMode::Id, value); + } + case 4: { + LogStep(4, "Writes a value of 0 to KeypadLockout attribute of DUT"); + VerifyOrdo(!ShouldSkip("A_KEYPAD_LOCKOUT"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + uint8_t value; + value = 0; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), ThermostatUserInterfaceConfiguration::Id, + ThermostatUserInterfaceConfiguration::Attributes::KeypadLockout::Id, value); + } + case 5: { + LogStep(5, "Writes a value of 1 to KeypadLockout attribute of DUT"); + VerifyOrdo(!ShouldSkip("A_KEYPAD_LOCKOUT"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + uint8_t value; + value = 1; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), ThermostatUserInterfaceConfiguration::Id, + ThermostatUserInterfaceConfiguration::Attributes::KeypadLockout::Id, value); + } + case 6: { + LogStep(6, "Writes a value of 2 to KeypadLockout attribute of DUT"); + VerifyOrdo(!ShouldSkip("A_KEYPAD_LOCKOUT"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + uint8_t value; + value = 2; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), ThermostatUserInterfaceConfiguration::Id, + ThermostatUserInterfaceConfiguration::Attributes::KeypadLockout::Id, value); + } + case 7: { + LogStep(7, "Writes a value of 3 to KeypadLockout attribute of DUT"); + VerifyOrdo(!ShouldSkip("A_KEYPAD_LOCKOUT"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + uint8_t value; + value = 3; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), ThermostatUserInterfaceConfiguration::Id, + ThermostatUserInterfaceConfiguration::Attributes::KeypadLockout::Id, value); + } + case 8: { + LogStep(8, "Writes a value of 4 to KeypadLockout attribute of DUT"); + VerifyOrdo(!ShouldSkip("A_KEYPAD_LOCKOUT"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + uint8_t value; + value = 4; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), ThermostatUserInterfaceConfiguration::Id, + ThermostatUserInterfaceConfiguration::Attributes::KeypadLockout::Id, value); + } + case 9: { + LogStep(9, "Writes a value of 5 to KeypadLockout attribute of DUT"); + VerifyOrdo(!ShouldSkip("A_KEYPAD_LOCKOUT"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + uint8_t value; + value = 5; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), ThermostatUserInterfaceConfiguration::Id, + ThermostatUserInterfaceConfiguration::Attributes::KeypadLockout::Id, value); + } + case 10: { + LogStep(10, "Writes a value of greater than 5 to KeypadLockout attribute of DUT"); + VerifyOrdo(!ShouldSkip("A_KEYPAD_LOCKOUT"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + uint8_t value; + value = 6; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), ThermostatUserInterfaceConfiguration::Id, + ThermostatUserInterfaceConfiguration::Attributes::KeypadLockout::Id, value); + } + case 11: { + LogStep(11, "Writes a value of 0 to ScheduleProgrammingVisibility attribute of DUT"); + VerifyOrdo(!ShouldSkip("A_SCHEDULE_PROGRAMMING_VISIBILITY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + uint8_t value; + value = 0; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), ThermostatUserInterfaceConfiguration::Id, + ThermostatUserInterfaceConfiguration::Attributes::ScheduleProgrammingVisibility::Id, value); + } + case 12: { + LogStep(12, "Writes a value of 1 to ScheduleProgrammingVisibility attribute of DUT"); + VerifyOrdo(!ShouldSkip("A_SCHEDULE_PROGRAMMING_VISIBILITY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + uint8_t value; + value = 1; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), ThermostatUserInterfaceConfiguration::Id, + ThermostatUserInterfaceConfiguration::Attributes::ScheduleProgrammingVisibility::Id, value); + } + case 13: { + LogStep(13, "Writes a value of greater than 1 to ScheduleProgrammingVisibility attribute of DUT"); + VerifyOrdo(!ShouldSkip("A_SCHEDULE_PROGRAMMING_VISIBILITY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + uint8_t value; + value = 2; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), ThermostatUserInterfaceConfiguration::Id, + ThermostatUserInterfaceConfiguration::Attributes::ScheduleProgrammingVisibility::Id, value); + } + } return CHIP_NO_ERROR; } +}; - void OnFailureResponse_50(CHIP_ERROR error) +class Test_TC_DIAG_TH_NW_1_1Suite : public TestCommand +{ +public: + Test_TC_DIAG_TH_NW_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("Test_TC_DIAG_TH_NW_1_1", 3, credsIssuerConfig) { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - void OnSuccessResponse_50(uint16_t colorLoopStoredEnhancedHue) - { - VerifyOrReturn(CheckConstraintType("colorLoopStoredEnhancedHue", "", "uint16")); - ColorLoopStoredEnhancedHue4 = colorLoopStoredEnhancedHue; - NextTest(); - } + ~Test_TC_DIAG_TH_NW_1_1Suite() {} - CHIP_ERROR TestReadEnhancedCurrentHueAttributeFromDut_51() + chip::System::Clock::Timeout GetWaitDuration() const override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_51, OnFailureCallback_51, true)); - return CHIP_NO_ERROR; + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } - void OnFailureResponse_51(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; - void OnSuccessResponse_51(uint16_t enhancedCurrentHue) - { - VerifyOrReturn(CheckValue("enhancedCurrentHue", enhancedCurrentHue, ColorLoopStoredEnhancedHue4)); + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } - NextTest(); - } + // + // Tests methods + // - CHIP_ERROR TestTurnOffLightForColorControlTests_52() + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::OnOff::Commands::Off::Type; - - RequestType request; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_52(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_52(error); - }; + bool shouldContinue = false; - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint64_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("overrunCount", value, 0ULL)); + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } - void OnFailureResponse_52(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } } - void OnSuccessResponse_52() { NextTest(); } - - CHIP_ERROR TestCheckOnOffAttributeValueIsFalseAfterOffCommand_53() + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::OnOffClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_53, OnFailureCallback_53, true)); + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "Sends ResetCounts command"); + chip::app::Clusters::ThreadNetworkDiagnostics::Commands::ResetCounts::Type value; + return SendCommand(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, + ThreadNetworkDiagnostics::Commands::ResetCounts::Id, value); + } + case 2: { + LogStep(2, "Read the Overruncount attribute"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, + ThreadNetworkDiagnostics::Attributes::OverrunCount::Id); + } + } return CHIP_NO_ERROR; } - - void OnFailureResponse_53(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_53(bool onOff) - { - VerifyOrReturn(CheckValue("onOff", onOff, 0)); - - NextTest(); - } }; -class Test_TC_CC_9_2Suite : public TestCommand +class Test_TC_DIAG_TH_NW_1_2Suite : public TestCommand { public: - Test_TC_CC_9_2Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_CC_9_2", credsIssuerConfig), mTestIndex(0) + Test_TC_DIAG_TH_NW_1_2Suite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("Test_TC_DIAG_TH_NW_1_2", 102, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -18225,1099 +23502,1403 @@ class Test_TC_CC_9_2Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_CC_9_2Suite() {} + ~Test_TC_DIAG_TH_NW_1_2Suite() {} - /////////// TestCommand Interface ///////// - void NextTest() override + chip::System::Clock::Timeout GetWaitDuration() const override { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_CC_9_2\n"); - } + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_CC_9_2\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // - Wait(); + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override + { + bool shouldContinue = false; - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) + switch (mTestIndex - 1) { case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; break; case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Precondition: Turn on light for color control tests\n"); - err = TestPreconditionTurnOnLightForColorControlTests_1(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + } break; case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Precondition: Check on/off attribute value is true after on command\n"); - err = TestPreconditionCheckOnOffAttributeValueIsTrueAfterOnCommand_2(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::CharSpan value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "string")); + VerifyOrReturn(CheckConstraintMaxLength("value", value.size(), 16)); + } break; case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Sends ColorLoopSet Command - Set all Attributes\n"); - if (ShouldSkip("CR_COLORLOOPSET")) + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { - NextTest(); - return; + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); } - err = TestSendsColorLoopSetCommandSetAllAttributes_3(); break; case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Read ColorLoopActive attribute from DUT\n"); - if (ShouldSkip("A_COLORLOOPACTIVE")) + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { - NextTest(); - return; + uint64_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint64")); } - err = TestReadColorLoopActiveAttributeFromDut_4(); break; case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Read ColorLoopDirection attribute from DUT.\n"); - if (ShouldSkip("A_COLORLOOPDIRECTION")) + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { - NextTest(); - return; + uint64_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint64")); } - err = TestReadColorLoopDirectionAttributeFromDut_5(); break; case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : Read ColorLoopTime attribute from DUT.\n"); - if (ShouldSkip("A_COLORLOOPTIME")) + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { - NextTest(); - return; + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("partitionId", value, 0UL)); } - err = TestReadColorLoopTimeAttributeFromDut_6(); break; case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : Read ColorLoopStartEnhancedHue attribute from DUT.\n"); - if (ShouldSkip("A_COLORLOOPSTARTENHANCEDHUE")) + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { - NextTest(); - return; + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint32")); } - err = TestReadColorLoopStartEnhancedHueAttributeFromDut_7(); break; case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : Read EnhancedCurrentHue attribute from DUT.\n"); - if (ShouldSkip("A_ENHANCEDCURRENTHUE")) + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { - NextTest(); - return; + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("weighting", value, 0)); } - err = TestReadEnhancedCurrentHueAttributeFromDut_8(); break; case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : Color Loop Set Command - Set all Attributes\n"); - if (ShouldSkip("CR_COLORLOOPSET")) + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { - NextTest(); - return; + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint8")); } - err = TestColorLoopSetCommandSetAllAttributes_9(); break; case 10: - ChipLogProgress(chipTool, " ***** Test Step 10 : Read ColorLoopActive attribute from DUT.\n"); - if (ShouldSkip("A_COLORLOOPACTIVE")) + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { - NextTest(); - return; + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("dataVersion", value, 0)); } - err = TestReadColorLoopActiveAttributeFromDut_10(); break; case 11: - ChipLogProgress(chipTool, " ***** Test Step 11 : Read ColorLoopStoredEnhancedHue attribute from DUT.\n"); - if (ShouldSkip("A_COLORLOOPSTOREDENHANCEDHUE")) + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { - NextTest(); - return; + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint8")); } - err = TestReadColorLoopStoredEnhancedHueAttributeFromDut_11(); break; case 12: - ChipLogProgress(chipTool, " ***** Test Step 12 : Color Loop Set Command - Start Color Loop\n"); - if (ShouldSkip("CR_COLORLOOPSET")) + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { - NextTest(); - return; + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("stableDataVersion", value, 0)); } - err = TestColorLoopSetCommandStartColorLoop_12(); break; case 13: - ChipLogProgress(chipTool, " ***** Test Step 13 : Read ColorLoopDirection attribute from DUT.\n"); - if (ShouldSkip("A_COLORLOOPDIRECTION")) + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { - NextTest(); - return; + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint8")); } - err = TestReadColorLoopDirectionAttributeFromDut_13(); break; case 14: - ChipLogProgress(chipTool, " ***** Test Step 14 : Color Loop Set Command - Start Color Loop\n"); - if (ShouldSkip("CR_COLORLOOPSET")) + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { - NextTest(); - return; + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("leaderRouterId", value, 0)); } - err = TestColorLoopSetCommandStartColorLoop_14(); break; case 15: - ChipLogProgress(chipTool, " ***** Test Step 15 : Read ColorLoopActive attribute from DUT\n"); - if (ShouldSkip("A_COLORLOOPACTIVE")) + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { - NextTest(); - return; + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint8")); } - err = TestReadColorLoopActiveAttributeFromDut_15(); break; case 16: - ChipLogProgress(chipTool, " ***** Test Step 16 : Read ColorLoopStoredEnhancedHue attribute from DUT.\n"); - if (ShouldSkip("A_COLORLOOPSTOREDENHANCEDHUE")) + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { - NextTest(); - return; + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("detachedRoleCount", value, 0U)); } - err = TestReadColorLoopStoredEnhancedHueAttributeFromDut_16(); break; case 17: - ChipLogProgress(chipTool, " ***** Test Step 17 : Read EnhancedCurrentHue attribute from DUT.\n"); - if (ShouldSkip("A_ENHANCEDCURRENTHUE")) + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { - NextTest(); - return; + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); } - err = TestReadEnhancedCurrentHueAttributeFromDut_17(); break; case 18: - ChipLogProgress(chipTool, " ***** Test Step 18 : Turn off light for color control tests\n"); - err = TestTurnOffLightForColorControlTests_18(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("childRoleCount", value, 0U)); + } break; case 19: - ChipLogProgress(chipTool, " ***** Test Step 19 : Check on/off attribute value is false after off command\n"); - err = TestCheckOnOffAttributeValueIsFalseAfterOffCommand_19(); - break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 20; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - uint16_t EnhancedCurrentHueValue; - uint16_t ColorLoopStoredEnhancedHueValue; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - static void OnFailureCallback_2(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_2(error); - } - - static void OnSuccessCallback_2(void * context, bool onOff) - { - (static_cast(context))->OnSuccessResponse_2(onOff); - } - - static void OnFailureCallback_4(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_4(error); - } - - static void OnSuccessCallback_4(void * context, uint8_t colorLoopActive) - { - (static_cast(context))->OnSuccessResponse_4(colorLoopActive); - } - - static void OnFailureCallback_5(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_5(error); - } - - static void OnSuccessCallback_5(void * context, uint8_t colorLoopDirection) - { - (static_cast(context))->OnSuccessResponse_5(colorLoopDirection); - } - - static void OnFailureCallback_6(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_6(error); - } - - static void OnSuccessCallback_6(void * context, uint16_t colorLoopTime) - { - (static_cast(context))->OnSuccessResponse_6(colorLoopTime); - } - - static void OnFailureCallback_7(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_7(error); - } - - static void OnSuccessCallback_7(void * context, uint16_t colorLoopStartEnhancedHue) - { - (static_cast(context))->OnSuccessResponse_7(colorLoopStartEnhancedHue); - } - - static void OnFailureCallback_8(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_8(error); - } - - static void OnSuccessCallback_8(void * context, uint16_t enhancedCurrentHue) - { - (static_cast(context))->OnSuccessResponse_8(enhancedCurrentHue); - } - - static void OnFailureCallback_10(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_10(error); - } - - static void OnSuccessCallback_10(void * context, uint8_t colorLoopActive) - { - (static_cast(context))->OnSuccessResponse_10(colorLoopActive); - } - - static void OnFailureCallback_11(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_11(error); - } - - static void OnSuccessCallback_11(void * context, uint16_t colorLoopStoredEnhancedHue) - { - (static_cast(context))->OnSuccessResponse_11(colorLoopStoredEnhancedHue); - } - - static void OnFailureCallback_13(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_13(error); - } - - static void OnSuccessCallback_13(void * context, uint8_t colorLoopDirection) - { - (static_cast(context))->OnSuccessResponse_13(colorLoopDirection); - } - - static void OnFailureCallback_15(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_15(error); - } - - static void OnSuccessCallback_15(void * context, uint8_t colorLoopActive) - { - (static_cast(context))->OnSuccessResponse_15(colorLoopActive); - } - - static void OnFailureCallback_16(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_16(error); - } - - static void OnSuccessCallback_16(void * context, uint16_t colorLoopStoredEnhancedHue) - { - (static_cast(context))->OnSuccessResponse_16(colorLoopStoredEnhancedHue); - } - - static void OnFailureCallback_17(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_17(error); - } - - static void OnSuccessCallback_17(void * context, uint16_t enhancedCurrentHue) - { - (static_cast(context))->OnSuccessResponse_17(enhancedCurrentHue); - } - - static void OnFailureCallback_19(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_19(error); - } - - static void OnSuccessCallback_19(void * context, bool onOff) - { - (static_cast(context))->OnSuccessResponse_19(onOff); - } - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestPreconditionTurnOnLightForColorControlTests_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::OnOff::Commands::On::Type; - - RequestType request; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_1(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_1(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_1() { NextTest(); } - - CHIP_ERROR TestPreconditionCheckOnOffAttributeValueIsTrueAfterOnCommand_2() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::OnOffClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_2, OnFailureCallback_2, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_2(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_2(bool onOff) - { - VerifyOrReturn(CheckValue("onOff", onOff, 1)); - - NextTest(); - } - - CHIP_ERROR TestSendsColorLoopSetCommandSetAllAttributes_3() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type; - - RequestType request; - request.updateFlags = static_cast>(15); - request.action = static_cast(0); - request.direction = static_cast(0); - request.time = 30U; - request.startHue = 160U; - request.optionsMask = 0; - request.optionsOverride = 0; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_3(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_3(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_3(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_3() { NextTest(); } - - CHIP_ERROR TestReadColorLoopActiveAttributeFromDut_4() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_4, OnFailureCallback_4, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_4(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_4(uint8_t colorLoopActive) - { - VerifyOrReturn(CheckValue("colorLoopActive", colorLoopActive, 0)); - - NextTest(); - } - - CHIP_ERROR TestReadColorLoopDirectionAttributeFromDut_5() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_5, OnFailureCallback_5, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_5(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_5(uint8_t colorLoopDirection) - { - VerifyOrReturn(CheckValue("colorLoopDirection", colorLoopDirection, 0)); - - NextTest(); - } - - CHIP_ERROR TestReadColorLoopTimeAttributeFromDut_6() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_6, OnFailureCallback_6, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_6(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_6(uint16_t colorLoopTime) - { - VerifyOrReturn(CheckValue("colorLoopTime", colorLoopTime, 30U)); - - NextTest(); - } - - CHIP_ERROR TestReadColorLoopStartEnhancedHueAttributeFromDut_7() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_7, OnFailureCallback_7, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_7(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_7(uint16_t colorLoopStartEnhancedHue) - { - VerifyOrReturn(CheckValue("colorLoopStartEnhancedHue", colorLoopStartEnhancedHue, 160U)); - - NextTest(); - } - - CHIP_ERROR TestReadEnhancedCurrentHueAttributeFromDut_8() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_8, OnFailureCallback_8, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_8(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_8(uint16_t enhancedCurrentHue) - { - VerifyOrReturn(CheckConstraintType("enhancedCurrentHue", "", "uint16")); - EnhancedCurrentHueValue = enhancedCurrentHue; - NextTest(); - } - - CHIP_ERROR TestColorLoopSetCommandSetAllAttributes_9() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type; - - RequestType request; - request.updateFlags = static_cast>(1); - request.action = static_cast(1); - request.direction = static_cast(0); - request.time = 0U; - request.startHue = 0U; - request.optionsMask = 0; - request.optionsOverride = 0; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_9(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_9(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_9(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_9() { NextTest(); } - - CHIP_ERROR TestReadColorLoopActiveAttributeFromDut_10() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_10, OnFailureCallback_10, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_10(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_10(uint8_t colorLoopActive) - { - VerifyOrReturn(CheckValue("colorLoopActive", colorLoopActive, 1)); - - NextTest(); - } - - CHIP_ERROR TestReadColorLoopStoredEnhancedHueAttributeFromDut_11() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_11, OnFailureCallback_11, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_11(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_11(uint16_t colorLoopStoredEnhancedHue) - { - VerifyOrReturn(CheckValue("colorLoopStoredEnhancedHue", colorLoopStoredEnhancedHue, EnhancedCurrentHueValue)); - - NextTest(); - } - - CHIP_ERROR TestColorLoopSetCommandStartColorLoop_12() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type; - - RequestType request; - request.updateFlags = static_cast>(2); - request.action = static_cast(0); - request.direction = static_cast(1); - request.time = 0U; - request.startHue = 0U; - request.optionsMask = 0; - request.optionsOverride = 0; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_12(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_12(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_12(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_12() { NextTest(); } - - CHIP_ERROR TestReadColorLoopDirectionAttributeFromDut_13() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_13, OnFailureCallback_13, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_13(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_13(uint8_t colorLoopDirection) - { - VerifyOrReturn(CheckValue("colorLoopDirection", colorLoopDirection, 1)); - - NextTest(); - } - - CHIP_ERROR TestColorLoopSetCommandStartColorLoop_14() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type; - - RequestType request; - request.updateFlags = static_cast>(1); - request.action = static_cast(0); - request.direction = static_cast(0); - request.time = 0U; - request.startHue = 0U; - request.optionsMask = 0; - request.optionsOverride = 0; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_14(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_14(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_14(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_14() { NextTest(); } - - CHIP_ERROR TestReadColorLoopActiveAttributeFromDut_15() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_15, OnFailureCallback_15, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_15(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_15(uint8_t colorLoopActive) - { - VerifyOrReturn(CheckValue("colorLoopActive", colorLoopActive, 0)); - - NextTest(); - } - - CHIP_ERROR TestReadColorLoopStoredEnhancedHueAttributeFromDut_16() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_16, OnFailureCallback_16, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_16(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_16(uint16_t colorLoopStoredEnhancedHue) - { - VerifyOrReturn(CheckConstraintType("colorLoopStoredEnhancedHue", "", "uint16")); - ColorLoopStoredEnhancedHueValue = colorLoopStoredEnhancedHue; - NextTest(); - } - - CHIP_ERROR TestReadEnhancedCurrentHueAttributeFromDut_17() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_17, OnFailureCallback_17, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_17(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_17(uint16_t enhancedCurrentHue) - { - VerifyOrReturn(CheckValue("enhancedCurrentHue", enhancedCurrentHue, ColorLoopStoredEnhancedHueValue)); - - NextTest(); - } - - CHIP_ERROR TestTurnOffLightForColorControlTests_18() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::OnOff::Commands::Off::Type; - - RequestType request; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_18(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_18(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_18(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_18() { NextTest(); } - - CHIP_ERROR TestCheckOnOffAttributeValueIsFalseAfterOffCommand_19() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::OnOffClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_19, OnFailureCallback_19, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_19(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_19(bool onOff) - { - VerifyOrReturn(CheckValue("onOff", onOff, 0)); - - NextTest(); - } -}; - -class Test_TC_CC_9_3Suite : public TestCommand -{ -public: - Test_TC_CC_9_3Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_CC_9_3", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_CC_9_3Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_CC_9_3\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_CC_9_3\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Precondition: Turn on light for color control tests\n"); - err = TestPreconditionTurnOnLightForColorControlTests_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Precondition: Check on/off attribute value is true after on command\n"); - err = TestPreconditionCheckOnOffAttributeValueIsTrueAfterOnCommand_2(); - break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Sends ColorLoopSet Command - Set all Attributes\n"); - if (ShouldSkip("CR_COLORLOOPSET")) { - NextTest(); - return; + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); } - err = TestSendsColorLoopSetCommandSetAllAttributes_3(); break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Read ColorLoopActive attribute from DUT\n"); - if (ShouldSkip("A_COLORLOOPACTIVE")) + case 20: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { - NextTest(); - return; + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("routerRoleCount", value, 0U)); } - err = TestReadColorLoopActiveAttributeFromDut_4(); break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Read ColorLoopDirection attribute from DUT.\n"); - if (ShouldSkip("A_COLORLOOPDIRECTION")) + case 21: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { - NextTest(); - return; + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); } - err = TestReadColorLoopDirectionAttributeFromDut_5(); break; - case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : Read ColorLoopTime attribute from DUT.\n"); - if (ShouldSkip("A_COLORLOOPTIME")) + case 22: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { - NextTest(); - return; + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("leaderRoleCount", value, 0U)); } - err = TestReadColorLoopTimeAttributeFromDut_6(); break; - case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : Read ColorLoopStartEnhancedHue attribute from DUT.\n"); - if (ShouldSkip("A_COLORLOOPSTARTENHANCEDHUE")) + case 23: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { - NextTest(); - return; + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); } - err = TestReadColorLoopStartEnhancedHueAttributeFromDut_7(); break; - case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : Color Loop Set Command - Set all Attributes\n"); - if (ShouldSkip("CR_COLORLOOPSET")) + case 24: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { - NextTest(); - return; + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("attachAttemptCount", value, 0U)); } - err = TestColorLoopSetCommandSetAllAttributes_8(); break; - case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : Read ColorLoopActive attribute from DUT.\n"); - if (ShouldSkip("A_COLORLOOPACTIVE")) + case 25: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { - NextTest(); - return; + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); } - err = TestReadColorLoopActiveAttributeFromDut_9(); break; - case 10: - ChipLogProgress(chipTool, " ***** Test Step 10 : Read EnhancedCurrentHue attribute from DUT.\n"); - if (ShouldSkip("A_ENHANCEDCURRENTHUE")) + case 26: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { - NextTest(); - return; + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("partitionIdChangeCount", value, 0U)); } - err = TestReadEnhancedCurrentHueAttributeFromDut_10(); break; - case 11: - ChipLogProgress(chipTool, " ***** Test Step 11 : Read ColorLoopStoredEnhancedHue attribute from DUT.\n"); - if (ShouldSkip("A_COLORLOOPSTOREDENHANCEDHUE")) + case 27: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { - NextTest(); - return; + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); } - err = TestReadColorLoopStoredEnhancedHueAttributeFromDut_11(); break; - case 12: - ChipLogProgress(chipTool, " ***** Test Step 12 : Color Loop Set Command - Start Color Loop\n"); - if (ShouldSkip("CR_COLORLOOPSET")) + case 28: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { - NextTest(); - return; + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("betterPartitionAttachAttemptCount", value, 0U)); } - err = TestColorLoopSetCommandStartColorLoop_12(); break; - case 13: - ChipLogProgress(chipTool, " ***** Test Step 13 : Read ColorLoopTime attribute from DUT.\n"); - if (ShouldSkip("A_COLORLOOPTIME")) + case 29: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { - NextTest(); - return; + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); } - err = TestReadColorLoopTimeAttributeFromDut_13(); break; - case 14: - ChipLogProgress(chipTool, " ***** Test Step 14 : Color Loop Set Command - Start Color Loop\n"); - if (ShouldSkip("CR_COLORLOOPSET")) + case 30: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { - NextTest(); - return; + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("parentChangeCount", value, 0U)); } - err = TestColorLoopSetCommandStartColorLoop_14(); break; - case 15: - ChipLogProgress(chipTool, " ***** Test Step 15 : Read ColorLoopActive attribute from DUT\n"); - if (ShouldSkip("A_COLORLOOPACTIVE")) + case 31: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { - NextTest(); - return; + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); } - err = TestReadColorLoopActiveAttributeFromDut_15(); break; - case 16: - ChipLogProgress(chipTool, " ***** Test Step 16 : Read ColorLoopStoredEnhancedHue attribute from DUT.\n"); - if (ShouldSkip("A_COLORLOOPSTOREDENHANCEDHUE")) + case 32: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { - NextTest(); - return; + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("txTotalCount", value, 0UL)); } - err = TestReadColorLoopStoredEnhancedHueAttributeFromDut_16(); break; - case 17: - ChipLogProgress(chipTool, " ***** Test Step 17 : Read EnhancedCurrentHue attribute from DUT.\n"); - if (ShouldSkip("A_ENHANCEDCURRENTHUE")) + case 33: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { - NextTest(); - return; + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint32")); } - err = TestReadEnhancedCurrentHueAttributeFromDut_17(); break; - case 18: - ChipLogProgress(chipTool, " ***** Test Step 18 : Turn off light for color control tests\n"); - err = TestTurnOffLightForColorControlTests_18(); + case 34: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("txUnicastCount", value, 0UL)); + } break; - case 19: - ChipLogProgress(chipTool, " ***** Test Step 19 : Check on/off attribute value is false after off command\n"); - err = TestCheckOnOffAttributeValueIsFalseAfterOffCommand_19(); + case 35: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint32")); + } + break; + case 36: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("txBroadcastCount", value, 0UL)); + } + break; + case 37: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint32")); + } + break; + case 38: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("txNoAckRequestedCount", value, 0UL)); + } + break; + case 39: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint32")); + } + break; + case 40: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("txDataCount", value, 0UL)); + } + break; + case 41: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint32")); + } + break; + case 42: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("txDataPollCount", value, 0UL)); + } + break; + case 43: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint32")); + } + break; + case 44: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("txBeaconCount", value, 0UL)); + } + break; + case 45: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint32")); + } + break; + case 46: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("txBeaconRequestCount", value, 0UL)); + } + break; + case 47: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint32")); + } + break; + case 48: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("txOtherCount", value, 0UL)); + } + break; + case 49: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint32")); + } + break; + case 50: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("txRetryCount", value, 0UL)); + } + break; + case 51: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint32")); + } + break; + case 52: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("txDirectMaxRetryExpiryCount", value, 0UL)); + } + break; + case 53: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint32")); + } + break; + case 54: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("txIndirectMaxRetryExpiryCount", value, 0UL)); + } + break; + case 55: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint32")); + } + break; + case 56: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("txErrCcaCount", value, 0UL)); + } + break; + case 57: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint32")); + } + break; + case 58: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("txErrAbortCount", value, 0UL)); + } + break; + case 59: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint32")); + } + break; + case 60: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("txErrBusyChannelCount", value, 0UL)); + } + break; + case 61: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint32")); + } + break; + case 62: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("rxTotalCount", value, 0UL)); + } + break; + case 63: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint32")); + } + break; + case 64: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("rxUnicastCount", value, 0UL)); + } + break; + case 65: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint32")); + } + break; + case 66: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("rxBroadcastCount", value, 0UL)); + } + break; + case 67: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint32")); + } + break; + case 68: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("rxDataCount", value, 0UL)); + } + break; + case 69: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint32")); + } + break; + case 70: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("rxDataPollCount", value, 0UL)); + } + break; + case 71: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint32")); + } + break; + case 72: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("rxBeaconCount", value, 0UL)); + } + break; + case 73: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint32")); + } + break; + case 74: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("rxBeaconRequestCount", value, 0UL)); + } + break; + case 75: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint32")); + } + break; + case 76: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("rxOtherCount", value, 0UL)); + } + break; + case 77: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint32")); + } + break; + case 78: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("rxAddressFilteredCount", value, 0UL)); + } + break; + case 79: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint32")); + } + break; + case 80: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("rxDestAddrFilteredCount", value, 0UL)); + } + break; + case 81: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint32")); + } + break; + case 82: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("rxDuplicatedCount", value, 0UL)); + } + break; + case 83: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint32")); + } + break; + case 84: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("rxErrNoFrameCount", value, 0UL)); + } + break; + case 85: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint32")); + } + break; + case 86: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("rxErrUnknownNeighborCount", value, 0UL)); + } + break; + case 87: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint32")); + } + break; + case 88: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("rxErrInvalidSrcAddrCount", value, 0UL)); + } + break; + case 89: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint32")); + } + break; + case 90: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("rxErrSecCount", value, 0UL)); + } + break; + case 91: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint32")); + } + break; + case 92: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("rxErrFcsCount", value, 0UL)); + } + break; + case 93: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint32")); + } + break; + case 94: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("rxErrOtherCount", value, 0UL)); + } + break; + case 95: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint32")); + } + break; + case 96: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint64_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("activeTimestamp", value, 0ULL)); + } + break; + case 97: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint64_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint64")); + } + break; + case 98: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint64_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("pendingTimestamp", value, 0ULL)); + } + break; + case 99: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint64_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint64")); + } + break; + case 100: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("delay", value, 0UL)); + } + break; + case 101: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint32")); + } break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } + + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); } + } - if (CHIP_NO_ERROR != err) + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "Validate constraints of attribute: Channel"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, + ThreadNetworkDiagnostics::Attributes::Channel::Id); + } + case 2: { + LogStep(2, "Validate constraints of attribute: NetworkName"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, + ThreadNetworkDiagnostics::Attributes::NetworkName::Id); + } + case 3: { + LogStep(3, "Validate constraints of attribute: PanId"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, + ThreadNetworkDiagnostics::Attributes::PanId::Id); + } + case 4: { + LogStep(4, "Validate constraints of attribute: ExtendedPanId"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, + ThreadNetworkDiagnostics::Attributes::ExtendedPanId::Id); + } + case 5: { + LogStep(5, "Validate constraints of attribute: OverrunCount"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, + ThreadNetworkDiagnostics::Attributes::OverrunCount::Id); + } + case 6: { + LogStep(6, "read PartitionId attribute value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, + ThreadNetworkDiagnostics::Attributes::PartitionId::Id); + } + case 7: { + LogStep(7, "Validate constraints of attribute: PartitionId"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, + ThreadNetworkDiagnostics::Attributes::PartitionId::Id); + } + case 8: { + LogStep(8, "read Weighting attribute value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, + ThreadNetworkDiagnostics::Attributes::Weighting::Id); + } + case 9: { + LogStep(9, "Validate constraints of attribute: weighting"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, + ThreadNetworkDiagnostics::Attributes::Weighting::Id); + } + case 10: { + LogStep(10, "read DataVersion attribute value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, + ThreadNetworkDiagnostics::Attributes::DataVersion::Id); + } + case 11: { + LogStep(11, "Validate constraints of attribute: DataVersion"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, + ThreadNetworkDiagnostics::Attributes::DataVersion::Id); + } + case 12: { + LogStep(12, "read StableDataVersion attribute value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, + ThreadNetworkDiagnostics::Attributes::StableDataVersion::Id); + } + case 13: { + LogStep(13, "Validate constraints of attribute: StableDataVersion"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, + ThreadNetworkDiagnostics::Attributes::StableDataVersion::Id); + } + case 14: { + LogStep(14, "read LeaderRouterId attribute value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, + ThreadNetworkDiagnostics::Attributes::LeaderRouterId::Id); + } + case 15: { + LogStep(15, "Validate constraints of attribute: LeaderRouterId"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, + ThreadNetworkDiagnostics::Attributes::LeaderRouterId::Id); + } + case 16: { + LogStep(16, "read DetachedRoleCount attribute value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, + ThreadNetworkDiagnostics::Attributes::DetachedRoleCount::Id); } + case 17: { + LogStep(17, "Validate constraints of attribute: DetachedRoleCount"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, + ThreadNetworkDiagnostics::Attributes::DetachedRoleCount::Id); + } + case 18: { + LogStep(18, "read ChildRoleCount attribute value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, + ThreadNetworkDiagnostics::Attributes::ChildRoleCount::Id); + } + case 19: { + LogStep(19, "Validate constraints of attribute: ChildRoleCount"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, + ThreadNetworkDiagnostics::Attributes::ChildRoleCount::Id); + } + case 20: { + LogStep(20, "read RouterRoleCount attribute value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, + ThreadNetworkDiagnostics::Attributes::RouterRoleCount::Id); + } + case 21: { + LogStep(21, "Validate constraints of attribute: RouterRoleCount"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, + ThreadNetworkDiagnostics::Attributes::RouterRoleCount::Id); + } + case 22: { + LogStep(22, "read LeaderRoleCount attribute value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, + ThreadNetworkDiagnostics::Attributes::LeaderRoleCount::Id); + } + case 23: { + LogStep(23, "Validate constraints of attribute: LeaderRoleCount"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, + ThreadNetworkDiagnostics::Attributes::LeaderRoleCount::Id); + } + case 24: { + LogStep(24, "read AttachAttemptCount attribute value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, + ThreadNetworkDiagnostics::Attributes::AttachAttemptCount::Id); + } + case 25: { + LogStep(25, "Validate constraints of attribute: AttachAttemptCount"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, + ThreadNetworkDiagnostics::Attributes::AttachAttemptCount::Id); + } + case 26: { + LogStep(26, "read PartitionIdChangeCount attribute value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, + ThreadNetworkDiagnostics::Attributes::PartitionIdChangeCount::Id); + } + case 27: { + LogStep(27, "Validate constraints of attribute: PartitionIdChangeCount"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, + ThreadNetworkDiagnostics::Attributes::PartitionIdChangeCount::Id); + } + case 28: { + LogStep(28, "read BetterPartitionAttachAttemptCount attribute value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, + ThreadNetworkDiagnostics::Attributes::BetterPartitionAttachAttemptCount::Id); + } + case 29: { + LogStep(29, "Validate constraints of attribute: BetterPartitionAttachAttemptCount"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, + ThreadNetworkDiagnostics::Attributes::BetterPartitionAttachAttemptCount::Id); + } + case 30: { + LogStep(30, "read ParentChangeCount attribute value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, + ThreadNetworkDiagnostics::Attributes::ParentChangeCount::Id); + } + case 31: { + LogStep(31, "Validate constraints of attribute: ParentChangeCount"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, + ThreadNetworkDiagnostics::Attributes::ParentChangeCount::Id); + } + case 32: { + LogStep(32, "read TxTotalCount attribute value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, + ThreadNetworkDiagnostics::Attributes::TxTotalCount::Id); + } + case 33: { + LogStep(33, "Validate constraints of attribute: TxTotalCount"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, + ThreadNetworkDiagnostics::Attributes::TxTotalCount::Id); + } + case 34: { + LogStep(34, "read TxUnicastCount attribute value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, + ThreadNetworkDiagnostics::Attributes::TxUnicastCount::Id); + } + case 35: { + LogStep(35, "Validate constraints of attribute: TxUnicastCount"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, + ThreadNetworkDiagnostics::Attributes::TxUnicastCount::Id); + } + case 36: { + LogStep(36, "read TxBroadcastCount attribute value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, + ThreadNetworkDiagnostics::Attributes::TxBroadcastCount::Id); + } + case 37: { + LogStep(37, "Validate constraints of attribute: TxBroadcastCount"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, + ThreadNetworkDiagnostics::Attributes::TxBroadcastCount::Id); + } + case 38: { + LogStep(38, "read TxNoAckRequestedCount attribute value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, + ThreadNetworkDiagnostics::Attributes::TxNoAckRequestedCount::Id); + } + case 39: { + LogStep(39, "Validate constraints of attribute: TxNoAckRequestedCount"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, + ThreadNetworkDiagnostics::Attributes::TxNoAckRequestedCount::Id); + } + case 40: { + LogStep(40, "read TxDataCount attribute value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, + ThreadNetworkDiagnostics::Attributes::TxDataCount::Id); + } + case 41: { + LogStep(41, "Validate constraints of attribute: TxDataCount"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, + ThreadNetworkDiagnostics::Attributes::TxDataCount::Id); + } + case 42: { + LogStep(42, "read TxDataPollCount attribute value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, + ThreadNetworkDiagnostics::Attributes::TxDataPollCount::Id); + } + case 43: { + LogStep(43, "Validate constraints of attribute: TxDataPollCount"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, + ThreadNetworkDiagnostics::Attributes::TxDataPollCount::Id); + } + case 44: { + LogStep(44, "read TxBeaconCount attribute value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, + ThreadNetworkDiagnostics::Attributes::TxBeaconCount::Id); + } + case 45: { + LogStep(45, "Validate constraints of attribute: TxBeaconCount"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, + ThreadNetworkDiagnostics::Attributes::TxBeaconCount::Id); + } + case 46: { + LogStep(46, "read TxBeaconRequestCount attribute value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, + ThreadNetworkDiagnostics::Attributes::TxBeaconRequestCount::Id); + } + case 47: { + LogStep(47, "Validate constraints of attribute: TxBeaconRequestCount"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, + ThreadNetworkDiagnostics::Attributes::TxBeaconRequestCount::Id); + } + case 48: { + LogStep(48, "read TxOtherCount attribute value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, + ThreadNetworkDiagnostics::Attributes::TxOtherCount::Id); + } + case 49: { + LogStep(49, "Validate constraints of attribute: TxOtherCount"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, + ThreadNetworkDiagnostics::Attributes::TxOtherCount::Id); + } + case 50: { + LogStep(50, "read TxRetryCount attribute value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, + ThreadNetworkDiagnostics::Attributes::TxRetryCount::Id); + } + case 51: { + LogStep(51, "Validate constraints of attribute: TxRetryCount"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, + ThreadNetworkDiagnostics::Attributes::TxRetryCount::Id); + } + case 52: { + LogStep(52, "read TxDirectMaxRetryExpiryCount attribute value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, + ThreadNetworkDiagnostics::Attributes::TxDirectMaxRetryExpiryCount::Id); + } + case 53: { + LogStep(53, "Validate constraints of attribute: TxDirectMaxRetryExpiryCount"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, + ThreadNetworkDiagnostics::Attributes::TxDirectMaxRetryExpiryCount::Id); + } + case 54: { + LogStep(54, "read TxIndirectMaxRetryExpiryCount attribute value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, + ThreadNetworkDiagnostics::Attributes::TxIndirectMaxRetryExpiryCount::Id); + } + case 55: { + LogStep(55, "Validate constraints of attribute: TxIndirectMaxRetryExpiryCount"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, + ThreadNetworkDiagnostics::Attributes::TxIndirectMaxRetryExpiryCount::Id); + } + case 56: { + LogStep(56, "read TxErrCcaCount attribute value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, + ThreadNetworkDiagnostics::Attributes::TxErrCcaCount::Id); + } + case 57: { + LogStep(57, "Validate constraints of attribute: TxErrCcaCount"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, + ThreadNetworkDiagnostics::Attributes::TxErrCcaCount::Id); + } + case 58: { + LogStep(58, "read TxErrAbortCount attribute value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, + ThreadNetworkDiagnostics::Attributes::TxErrAbortCount::Id); + } + case 59: { + LogStep(59, "Validate constraints of attribute: TxErrAbortCount"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, + ThreadNetworkDiagnostics::Attributes::TxErrAbortCount::Id); + } + case 60: { + LogStep(60, "read TxErrBusyChannelCount attribute value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, + ThreadNetworkDiagnostics::Attributes::TxErrBusyChannelCount::Id); + } + case 61: { + LogStep(61, "Validate constraints of attribute: TxErrBusyChannelCount"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, + ThreadNetworkDiagnostics::Attributes::TxErrBusyChannelCount::Id); + } + case 62: { + LogStep(62, "read RxTotalCount attribute value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, + ThreadNetworkDiagnostics::Attributes::RxTotalCount::Id); + } + case 63: { + LogStep(63, "Validate constraints of attribute: RxTotalCount"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, + ThreadNetworkDiagnostics::Attributes::RxTotalCount::Id); + } + case 64: { + LogStep(64, "read RxUnicastCount attribute value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, + ThreadNetworkDiagnostics::Attributes::RxUnicastCount::Id); + } + case 65: { + LogStep(65, "Validate constraints of attribute: RxUnicastCount"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, + ThreadNetworkDiagnostics::Attributes::RxUnicastCount::Id); + } + case 66: { + LogStep(66, "read RxBroadcastCount attribute value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, + ThreadNetworkDiagnostics::Attributes::RxBroadcastCount::Id); + } + case 67: { + LogStep(67, "Validate constraints of attribute: RxBroadcastCount"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, + ThreadNetworkDiagnostics::Attributes::RxBroadcastCount::Id); + } + case 68: { + LogStep(68, "read RxDataCount attribute value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, + ThreadNetworkDiagnostics::Attributes::RxDataCount::Id); + } + case 69: { + LogStep(69, "Validate constraints of attribute: RxDataCount"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, + ThreadNetworkDiagnostics::Attributes::RxDataCount::Id); + } + case 70: { + LogStep(70, "read RxDataPollCount attribute value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, + ThreadNetworkDiagnostics::Attributes::RxDataPollCount::Id); + } + case 71: { + LogStep(71, "Validate constraints of attribute: RxDataPollCount"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, + ThreadNetworkDiagnostics::Attributes::RxDataPollCount::Id); + } + case 72: { + LogStep(72, "read RxBeaconCount attribute value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, + ThreadNetworkDiagnostics::Attributes::RxBeaconCount::Id); + } + case 73: { + LogStep(73, "Validate constraints of attribute: RxBeaconCount"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, + ThreadNetworkDiagnostics::Attributes::RxBeaconCount::Id); + } + case 74: { + LogStep(74, "read RxBeaconRequestCount attribute value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, + ThreadNetworkDiagnostics::Attributes::RxBeaconRequestCount::Id); + } + case 75: { + LogStep(75, "Validate constraints of attribute: RxBeaconRequestCount"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, + ThreadNetworkDiagnostics::Attributes::RxBeaconRequestCount::Id); + } + case 76: { + LogStep(76, "read RxOtherCount attribute value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, + ThreadNetworkDiagnostics::Attributes::RxOtherCount::Id); + } + case 77: { + LogStep(77, "Validate constraints of attribute: RxOtherCount"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, + ThreadNetworkDiagnostics::Attributes::RxOtherCount::Id); + } + case 78: { + LogStep(78, "read RxAddressFilteredCount attribute value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, + ThreadNetworkDiagnostics::Attributes::RxAddressFilteredCount::Id); + } + case 79: { + LogStep(79, "Validate constraints of attribute: RxAddressFilteredCount"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, + ThreadNetworkDiagnostics::Attributes::RxAddressFilteredCount::Id); + } + case 80: { + LogStep(80, "read RxDestAddrFilteredCount attribute value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, + ThreadNetworkDiagnostics::Attributes::RxDestAddrFilteredCount::Id); + } + case 81: { + LogStep(81, "Validate constraints of attribute: RxDestAddrFilteredCount"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, + ThreadNetworkDiagnostics::Attributes::RxDestAddrFilteredCount::Id); + } + case 82: { + LogStep(82, "read RxDuplicatedCount attribute value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, + ThreadNetworkDiagnostics::Attributes::RxDuplicatedCount::Id); + } + case 83: { + LogStep(83, "Validate constraints of attribute: RxDuplicatedCount"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, + ThreadNetworkDiagnostics::Attributes::RxDuplicatedCount::Id); + } + case 84: { + LogStep(84, "read RxErrNoFrameCount attribute value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, + ThreadNetworkDiagnostics::Attributes::RxErrNoFrameCount::Id); + } + case 85: { + LogStep(85, "Validate constraints of attribute: RxErrNoFrameCount"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, + ThreadNetworkDiagnostics::Attributes::RxErrNoFrameCount::Id); + } + case 86: { + LogStep(86, "read RxErrUnknownNeighborCount attribute value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, + ThreadNetworkDiagnostics::Attributes::RxErrUnknownNeighborCount::Id); + } + case 87: { + LogStep(87, "Validate constraints of attribute: RxErrUnknownNeighborCount"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, + ThreadNetworkDiagnostics::Attributes::RxErrUnknownNeighborCount::Id); + } + case 88: { + LogStep(88, "read RxErrInvalidScrAddrCount attribute value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, + ThreadNetworkDiagnostics::Attributes::RxErrInvalidSrcAddrCount::Id); + } + case 89: { + LogStep(89, "Validate constraints of attribute: RxErrInvalidSrcAddrCount"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, + ThreadNetworkDiagnostics::Attributes::RxErrInvalidSrcAddrCount::Id); + } + case 90: { + LogStep(90, "read RxErrSecCount attribute value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, + ThreadNetworkDiagnostics::Attributes::RxErrSecCount::Id); + } + case 91: { + LogStep(91, "Validate constraints of attribute: RxErrInvalidSrcAddrCount"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, + ThreadNetworkDiagnostics::Attributes::RxErrSecCount::Id); + } + case 92: { + LogStep(92, "read RxErrFcsCount attribute value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, + ThreadNetworkDiagnostics::Attributes::RxErrFcsCount::Id); + } + case 93: { + LogStep(93, "Validate constraints of attribute: RxErrFcsCount"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, + ThreadNetworkDiagnostics::Attributes::RxErrFcsCount::Id); + } + case 94: { + LogStep(94, "read RxErrOtherCount attribute value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, + ThreadNetworkDiagnostics::Attributes::RxErrOtherCount::Id); + } + case 95: { + LogStep(95, "Validate constraints of attribute: RxErrOtherCount"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, + ThreadNetworkDiagnostics::Attributes::RxErrOtherCount::Id); + } + case 96: { + LogStep(96, "read ActiveTimestamp attribute value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, + ThreadNetworkDiagnostics::Attributes::ActiveTimestamp::Id); + } + case 97: { + LogStep(97, "Validate constraints of attribute: ActiveTimestamp"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, + ThreadNetworkDiagnostics::Attributes::ActiveTimestamp::Id); + } + case 98: { + LogStep(98, "read PendingTimestamp attribute value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, + ThreadNetworkDiagnostics::Attributes::PendingTimestamp::Id); + } + case 99: { + LogStep(99, "Validate constraints of attribute: PendingTimestamp"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, + ThreadNetworkDiagnostics::Attributes::PendingTimestamp::Id); + } + case 100: { + LogStep(100, "read Delay attribute value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, + ThreadNetworkDiagnostics::Attributes::Delay::Id); + } + case 101: { + LogStep(101, "Validate constraints of attribute: delay"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, + ThreadNetworkDiagnostics::Attributes::Delay::Id); + } + } + return CHIP_NO_ERROR; + } +}; + +class Test_TC_LC_1_2Suite : public TestCommand +{ +public: + Test_TC_LC_1_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_LC_1_2", 2, credsIssuerConfig) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } + ~Test_TC_LC_1_2Suite() {} + chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 20; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; - uint16_t EnhancedCurrentHueValue; - uint16_t ColorLoopStoredEnhancedHueValue; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { @@ -19329,6 +24910,13 @@ class Test_TC_CC_9_3Suite : public TestCommand VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); shouldContinue = true; break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + } + break; default: LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); } @@ -19339,657 +24927,398 @@ class Test_TC_CC_9_3Suite : public TestCommand } } - static void OnFailureCallback_2(void * context, CHIP_ERROR error) + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - (static_cast(context))->OnFailureResponse_2(error); + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "TH1 reads LabelList attribute from the DUT"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UserLabel::Id, UserLabel::Attributes::LabelList::Id); + } + } + return CHIP_NO_ERROR; } +}; - static void OnSuccessCallback_2(void * context, bool onOff) +class Test_TC_WIFIDIAG_1_1Suite : public TestCommand +{ +public: + Test_TC_WIFIDIAG_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("Test_TC_WIFIDIAG_1_1", 7, credsIssuerConfig) { - (static_cast(context))->OnSuccessResponse_2(onOff); + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - static void OnFailureCallback_4(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_4(error); - } + ~Test_TC_WIFIDIAG_1_1Suite() {} - static void OnSuccessCallback_4(void * context, uint8_t colorLoopActive) + chip::System::Clock::Timeout GetWaitDuration() const override { - (static_cast(context))->OnSuccessResponse_4(colorLoopActive); + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } - static void OnFailureCallback_5(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_5(error); - } +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; - static void OnSuccessCallback_5(void * context, uint8_t colorLoopDirection) - { - (static_cast(context))->OnSuccessResponse_5(colorLoopDirection); - } + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } - static void OnFailureCallback_6(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_6(error); - } + // + // Tests methods + // - static void OnSuccessCallback_6(void * context, uint16_t colorLoopTime) + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { - (static_cast(context))->OnSuccessResponse_6(colorLoopTime); - } - - static void OnFailureCallback_7(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_7(error); - } - - static void OnSuccessCallback_7(void * context, uint16_t colorLoopStartEnhancedHue) - { - (static_cast(context))->OnSuccessResponse_7(colorLoopStartEnhancedHue); - } - - static void OnFailureCallback_9(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_9(error); - } - - static void OnSuccessCallback_9(void * context, uint8_t colorLoopActive) - { - (static_cast(context))->OnSuccessResponse_9(colorLoopActive); - } - - static void OnFailureCallback_10(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_10(error); - } - - static void OnSuccessCallback_10(void * context, uint16_t enhancedCurrentHue) - { - (static_cast(context))->OnSuccessResponse_10(enhancedCurrentHue); - } - - static void OnFailureCallback_11(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_11(error); - } - - static void OnSuccessCallback_11(void * context, uint16_t colorLoopStoredEnhancedHue) - { - (static_cast(context))->OnSuccessResponse_11(colorLoopStoredEnhancedHue); - } - - static void OnFailureCallback_13(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_13(error); - } - - static void OnSuccessCallback_13(void * context, uint16_t colorLoopTime) - { - (static_cast(context))->OnSuccessResponse_13(colorLoopTime); - } + bool shouldContinue = false; - static void OnFailureCallback_15(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_15(error); - } + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList< + chip::app::Clusters::GeneralDiagnostics::Structs::NetworkInterfaceType::DecodableType> + value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "list")); + } + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNull("securityType", value)); + } + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "enum")); + } + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "enum")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 5)); + } + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + } + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "int8")); + VerifyOrReturn(CheckConstraintMinValue("value", value, -120)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 0)); + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } - static void OnSuccessCallback_15(void * context, uint8_t colorLoopActive) - { - (static_cast(context))->OnSuccessResponse_15(colorLoopActive); + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } } - static void OnFailureCallback_16(void * context, CHIP_ERROR error) + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - (static_cast(context))->OnFailureResponse_16(error); + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "Reads NetworkInterface structure attribute from DUT"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), GeneralDiagnostics::Id, + GeneralDiagnostics::Attributes::NetworkInterfaces::Id); + } + case 2: { + LogStep(2, "Reads SecurityType attribute from DUT"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), WiFiNetworkDiagnostics::Id, + WiFiNetworkDiagnostics::Attributes::SecurityType::Id); + } + case 3: { + LogStep(3, "Reads SecurityType attribute constraints"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), WiFiNetworkDiagnostics::Id, + WiFiNetworkDiagnostics::Attributes::SecurityType::Id); + } + case 4: { + LogStep(4, "Reads WiFiVersion attribute constraints"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), WiFiNetworkDiagnostics::Id, + WiFiNetworkDiagnostics::Attributes::WiFiVersion::Id); + } + case 5: { + LogStep(5, "Reads ChannelNumber attribute constraints"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), WiFiNetworkDiagnostics::Id, + WiFiNetworkDiagnostics::Attributes::ChannelNumber::Id); + } + case 6: { + LogStep(6, "Reads RSSI attribute constraints"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), WiFiNetworkDiagnostics::Id, + WiFiNetworkDiagnostics::Attributes::Rssi::Id); + } + } + return CHIP_NO_ERROR; } +}; - static void OnSuccessCallback_16(void * context, uint16_t colorLoopStoredEnhancedHue) +class Test_TC_WIFIDIAG_3_1Suite : public TestCommand +{ +public: + Test_TC_WIFIDIAG_3_1Suite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("Test_TC_WIFIDIAG_3_1", 1, credsIssuerConfig) { - (static_cast(context))->OnSuccessResponse_16(colorLoopStoredEnhancedHue); + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - static void OnFailureCallback_17(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_17(error); - } + ~Test_TC_WIFIDIAG_3_1Suite() {} - static void OnSuccessCallback_17(void * context, uint16_t enhancedCurrentHue) + chip::System::Clock::Timeout GetWaitDuration() const override { - (static_cast(context))->OnSuccessResponse_17(enhancedCurrentHue); + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } - static void OnFailureCallback_19(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_19(error); - } +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; - static void OnSuccessCallback_19(void * context, bool onOff) - { - (static_cast(context))->OnSuccessResponse_19(onOff); - } + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } // // Tests methods // - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestPreconditionTurnOnLightForColorControlTests_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::OnOff::Commands::On::Type; - - RequestType request; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_1(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_1(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_1() { NextTest(); } - - CHIP_ERROR TestPreconditionCheckOnOffAttributeValueIsTrueAfterOnCommand_2() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::OnOffClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_2, OnFailureCallback_2, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_2(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_2(bool onOff) - { - VerifyOrReturn(CheckValue("onOff", onOff, 1)); - - NextTest(); - } - - CHIP_ERROR TestSendsColorLoopSetCommandSetAllAttributes_3() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type; - - RequestType request; - request.updateFlags = static_cast>(15); - request.action = static_cast(0); - request.direction = static_cast(0); - request.time = 30U; - request.startHue = 160U; - request.optionsMask = 0; - request.optionsOverride = 0; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_3(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_3(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_3(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_3() { NextTest(); } - - CHIP_ERROR TestReadColorLoopActiveAttributeFromDut_4() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_4, OnFailureCallback_4, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_4(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_4(uint8_t colorLoopActive) - { - VerifyOrReturn(CheckValue("colorLoopActive", colorLoopActive, 0)); - - NextTest(); - } - - CHIP_ERROR TestReadColorLoopDirectionAttributeFromDut_5() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_5, OnFailureCallback_5, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_5(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_5(uint8_t colorLoopDirection) - { - VerifyOrReturn(CheckValue("colorLoopDirection", colorLoopDirection, 0)); - - NextTest(); - } - - CHIP_ERROR TestReadColorLoopTimeAttributeFromDut_6() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_6, OnFailureCallback_6, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_6(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_6(uint16_t colorLoopTime) - { - VerifyOrReturn(CheckValue("colorLoopTime", colorLoopTime, 30U)); - - NextTest(); - } - - CHIP_ERROR TestReadColorLoopStartEnhancedHueAttributeFromDut_7() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_7, OnFailureCallback_7, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_7(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_7(uint16_t colorLoopStartEnhancedHue) - { - VerifyOrReturn(CheckValue("colorLoopStartEnhancedHue", colorLoopStartEnhancedHue, 160U)); - - NextTest(); - } - - CHIP_ERROR TestColorLoopSetCommandSetAllAttributes_8() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type; - - RequestType request; - request.updateFlags = static_cast>(1); - request.action = static_cast(1); - request.direction = static_cast(0); - request.time = 0U; - request.startHue = 0U; - request.optionsMask = 0; - request.optionsOverride = 0; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_8(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_8(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_8(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_8() { NextTest(); } - - CHIP_ERROR TestReadColorLoopActiveAttributeFromDut_9() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_9, OnFailureCallback_9, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_9(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_9(uint8_t colorLoopActive) - { - VerifyOrReturn(CheckValue("colorLoopActive", colorLoopActive, 1)); - - NextTest(); - } - - CHIP_ERROR TestReadEnhancedCurrentHueAttributeFromDut_10() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_10, OnFailureCallback_10, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_10(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_10(uint16_t enhancedCurrentHue) - { - VerifyOrReturn(CheckConstraintType("enhancedCurrentHue", "", "uint16")); - EnhancedCurrentHueValue = enhancedCurrentHue; - NextTest(); - } - - CHIP_ERROR TestReadColorLoopStoredEnhancedHueAttributeFromDut_11() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_11, OnFailureCallback_11, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_11(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_11(uint16_t colorLoopStoredEnhancedHue) - { - VerifyOrReturn(CheckValue("colorLoopStoredEnhancedHue", colorLoopStoredEnhancedHue, EnhancedCurrentHueValue)); - - NextTest(); - } - - CHIP_ERROR TestColorLoopSetCommandStartColorLoop_12() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type; - - RequestType request; - request.updateFlags = static_cast>(4); - request.action = static_cast(0); - request.direction = static_cast(0); - request.time = 60U; - request.startHue = 0U; - request.optionsMask = 0; - request.optionsOverride = 0; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_12(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_12(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_12(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_12() { NextTest(); } - - CHIP_ERROR TestReadColorLoopTimeAttributeFromDut_13() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_13, OnFailureCallback_13, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_13(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_13(uint16_t colorLoopTime) - { - VerifyOrReturn(CheckValue("colorLoopTime", colorLoopTime, 60U)); - - NextTest(); - } - - CHIP_ERROR TestColorLoopSetCommandStartColorLoop_14() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type; - - RequestType request; - request.updateFlags = static_cast>(1); - request.action = static_cast(0); - request.direction = static_cast(0); - request.time = 0U; - request.startHue = 0U; - request.optionsMask = 0; - request.optionsOverride = 0; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_14(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_14(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_14(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_14() { NextTest(); } - - CHIP_ERROR TestReadColorLoopActiveAttributeFromDut_15() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_15, OnFailureCallback_15, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_15(CHIP_ERROR error) + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } + bool shouldContinue = false; - void OnSuccessResponse_15(uint8_t colorLoopActive) - { - VerifyOrReturn(CheckValue("colorLoopActive", colorLoopActive, 0)); + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } - NextTest(); + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } } - CHIP_ERROR TestReadColorLoopStoredEnhancedHueAttributeFromDut_16() + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_16, OnFailureCallback_16, true)); + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + } return CHIP_NO_ERROR; } +}; - void OnFailureResponse_16(CHIP_ERROR error) +class Test_TC_WNCV_1_1Suite : public TestCommand +{ +public: + Test_TC_WNCV_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_WNCV_1_1", 8, credsIssuerConfig) { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - void OnSuccessResponse_16(uint16_t colorLoopStoredEnhancedHue) - { - VerifyOrReturn(CheckConstraintType("colorLoopStoredEnhancedHue", "", "uint16")); - ColorLoopStoredEnhancedHueValue = colorLoopStoredEnhancedHue; - NextTest(); - } + ~Test_TC_WNCV_1_1Suite() {} - CHIP_ERROR TestReadEnhancedCurrentHueAttributeFromDut_17() + chip::System::Clock::Timeout GetWaitDuration() const override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_17, OnFailureCallback_17, true)); - return CHIP_NO_ERROR; + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } - void OnFailureResponse_17(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; - void OnSuccessResponse_17(uint16_t enhancedCurrentHue) - { - VerifyOrReturn(CheckValue("enhancedCurrentHue", enhancedCurrentHue, ColorLoopStoredEnhancedHueValue)); + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } - NextTest(); - } + // + // Tests methods + // - CHIP_ERROR TestTurnOffLightForColorControlTests_18() + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::OnOff::Commands::Off::Type; - - RequestType request; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_18(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_18(error); - }; + bool shouldContinue = false; - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 5U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 200U)); + } + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + VerifyOrReturn(CheckConstraintNotValue("value", value, 201U)); + } + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "list")); + } + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint32")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0UL)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 32768UL)); + } + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); + break; + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint32")); + VerifyOrReturn(CheckConstraintNotValue("value", value, 32769UL)); + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } - void OnFailureResponse_18(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } } - void OnSuccessResponse_18() { NextTest(); } - - CHIP_ERROR TestCheckOnOffAttributeValueIsFalseAfterOffCommand_19() + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::OnOffClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_19, OnFailureCallback_19, true)); + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "2: read the global attribute: ClusterRevision"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, + WindowCovering::Attributes::ClusterRevision::Id); + } + case 2: { + LogStep(2, "3a: write a value into the RO mandatory global attribute: ClusterRevision"); + uint16_t value; + value = 201U; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, + WindowCovering::Attributes::ClusterRevision::Id, value); + } + case 3: { + LogStep(3, "3b: reads back global attribute: ClusterRevision"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, + WindowCovering::Attributes::ClusterRevision::Id); + } + case 4: { + LogStep(4, "Read the global attribute: AttributeList"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, WindowCovering::Attributes::AttributeList::Id); + } + case 5: { + LogStep(5, "2: read the global attribute: FeatureMap"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, WindowCovering::Attributes::FeatureMap::Id); + } + case 6: { + LogStep(6, "3a: write the default value to optional global attribute: FeatureMap"); + uint32_t value; + value = 32769UL; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, WindowCovering::Attributes::FeatureMap::Id, + value); + } + case 7: { + LogStep(7, "3b: reads back global attribute: FeatureMap"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, WindowCovering::Attributes::FeatureMap::Id); + } + } return CHIP_NO_ERROR; } - - void OnFailureResponse_19(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_19(bool onOff) - { - VerifyOrReturn(CheckValue("onOff", onOff, 0)); - - NextTest(); - } }; -class Test_TC_DM_1_1Suite : public TestCommand +class Test_TC_WNCV_2_1Suite : public TestCommand { public: - Test_TC_DM_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_DM_1_1", credsIssuerConfig), mTestIndex(0) + Test_TC_WNCV_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_WNCV_2_1", 55, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -19997,155 +25326,435 @@ class Test_TC_DM_1_1Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_DM_1_1Suite() {} + ~Test_TC_WNCV_2_1Suite() {} - /////////// TestCommand Interface ///////// - void NextTest() override + chip::System::Clock::Timeout GetWaitDuration() const override { - CHIP_ERROR err = CHIP_NO_ERROR; + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_DM_1_1\n"); - } +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_DM_1_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } - Wait(); + // + // Tests methods + // + + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override + { + bool shouldContinue = false; - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) + switch (mTestIndex - 1) { case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; break; case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Query Data Model Revision\n"); - err = TestQueryDataModelRevision_1(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::WindowCovering::Type value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 9)); + } break; case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Query Vendor Name\n"); - err = TestQueryVendorName_2(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); break; case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Query VendorID\n"); - err = TestQueryVendorID_3(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::WindowCovering::Type value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "enum8")); + VerifyOrReturn(CheckConstraintNotValue("value", value, 250)); + } break; case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Query Product Name\n"); - err = TestQueryProductName_4(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::BitFlags value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "map8")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 63)); + } break; case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Query ProductID\n"); - err = TestQueryProductID_5(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); break; case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : Query Node Label\n"); - err = TestQueryNodeLabel_6(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::BitFlags value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "map8")); + VerifyOrReturn(CheckConstraintNotValue("value", value, 128)); + } break; case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : Query User Location\n"); - err = TestQueryUserLocation_7(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "map8")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 63)); + } break; case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : Query HardwareVersion\n"); - err = TestQueryHardwareVersion_8(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); break; case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : Query HardwareVersionString\n"); - err = TestQueryHardwareVersionString_9(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "map8")); + VerifyOrReturn(CheckConstraintNotValue("value", value, 128)); + } break; case 10: - ChipLogProgress(chipTool, " ***** Test Step 10 : Query SoftwareVersion\n"); - err = TestQuerySoftwareVersion_10(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::WindowCovering::EndProductType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 23)); + } break; case 11: - ChipLogProgress(chipTool, " ***** Test Step 11 : Query SoftwareVersionString\n"); - err = TestQuerySoftwareVersionString_11(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); break; case 12: - ChipLogProgress(chipTool, " ***** Test Step 12 : Query ManufacturingDate\n"); - if (ShouldSkip("MANF_DATE")) + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { - NextTest(); - return; + chip::app::Clusters::WindowCovering::EndProductType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "enum8")); + VerifyOrReturn(CheckConstraintNotValue("value", value, 250)); } - err = TestQueryManufacturingDate_12(); break; case 13: - ChipLogProgress(chipTool, " ***** Test Step 13 : Query PartNumber\n"); - if (ShouldSkip("PART_NUM")) + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { - NextTest(); - return; + chip::BitFlags value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "map8")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 15)); } - err = TestQueryPartNumber_13(); break; case 14: - ChipLogProgress(chipTool, " ***** Test Step 14 : Query ProductURL\n"); - err = TestQueryProductURL_14(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; case 15: - ChipLogProgress(chipTool, " ***** Test Step 15 : Query ProductLabel\n"); - err = TestQueryProductLabel_15(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::BitFlags value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("mode", value, 8)); + } break; case 16: - ChipLogProgress(chipTool, " ***** Test Step 16 : Query SerialNumber\n"); - err = TestQuerySerialNumber_16(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "Percent100ths")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 10000U)); + } break; case 17: - ChipLogProgress(chipTool, " ***** Test Step 17 : Query LocalConfigDisabled\n"); - err = TestQueryLocalConfigDisabled_17(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); break; case 18: - ChipLogProgress(chipTool, " ***** Test Step 18 : Query Reachable\n"); - err = TestQueryReachable_18(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "Percent100ths")); + VerifyOrReturn(CheckConstraintNotValue("value", value, 20000U)); + } break; case 19: - ChipLogProgress(chipTool, " ***** Test Step 19 : Query UniqueID\n"); - err = TestQueryUniqueID_19(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "Percent100ths")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 10000U)); + } break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 20; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: + case 20: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); + break; + case 21: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "Percent100ths")); + VerifyOrReturn(CheckConstraintNotValue("value", value, 20000U)); + } + break; + case 22: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "Percent100ths")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 10000U)); + } + break; + case 23: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); + break; + case 24: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "Percent100ths")); + VerifyOrReturn(CheckConstraintNotValue("value", value, 20000U)); + } + break; + case 25: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "Percent100ths")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 10000U)); + } + break; + case 26: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); + break; + case 27: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "Percent100ths")); + VerifyOrReturn(CheckConstraintNotValue("value", value, 20000U)); + } + break; + case 28: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 65535U)); + } + break; + case 29: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); + break; + case 30: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 65535U)); + } + break; + case 31: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 65535U)); + } + break; + case 32: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); + break; + case 33: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 65535U)); + } + break; + case 34: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 65535U)); + } + break; + case 35: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); + break; + case 36: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 65535U)); + } + break; + case 37: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 65535U)); + } + break; + case 38: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); + break; + case 39: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 65535U)); + } + break; + case 40: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "map16")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 2047U)); + } + break; + case 41: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); + break; + case 42: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "map16")); + VerifyOrReturn(CheckConstraintNotValue("value", value, 4096U)); + } + break; + case 43: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 65535U)); + } + break; + case 44: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); + break; + case 45: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 65535U)); + } + break; + case 46: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 65535U)); + } + break; + case 47: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); + break; + case 48: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 65535U)); + } + break; + case 49: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "Percent")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 100)); + } + break; + case 50: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); + break; + case 51: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "Percent")); + VerifyOrReturn(CheckConstraintNotValue("value", value, 200)); + } + break; + case 52: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "Percent")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 100)); + } + break; + case 53: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); + break; + case 54: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "Percent")); + VerifyOrReturn(CheckConstraintNotValue("value", value, 200)); + } break; default: LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); @@ -20157,676 +25766,864 @@ class Test_TC_DM_1_1Suite : public TestCommand } } - static void OnFailureCallback_1(void * context, CHIP_ERROR error) + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - (static_cast(context))->OnFailureResponse_1(error); - } - - static void OnSuccessCallback_1(void * context, uint16_t dataModelRevision) - { - (static_cast(context))->OnSuccessResponse_1(dataModelRevision); + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "2: read the RO mandatory attribute default: Type"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, WindowCovering::Attributes::Type::Id); + } + case 2: { + LogStep(2, "3a: write a value into the RO mandatory attribute: Type"); + chip::app::Clusters::WindowCovering::Type value; + value = static_cast(250); + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, WindowCovering::Attributes::Type::Id, value); + } + case 3: { + LogStep(3, "3b: reads back the RO mandatory attribute: Type"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, WindowCovering::Attributes::Type::Id); + } + case 4: { + LogStep(4, "2: read the RO mandatory attribute default: ConfigStatus"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, WindowCovering::Attributes::ConfigStatus::Id); + } + case 5: { + LogStep(5, "3a: write a value into the RO mandatory attribute: ConfigStatus"); + chip::BitFlags value; + value = static_cast>(128); + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, WindowCovering::Attributes::ConfigStatus::Id, + value); + } + case 6: { + LogStep(6, "3b: reads back the RO mandatory attribute: ConfigStatus"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, WindowCovering::Attributes::ConfigStatus::Id); + } + case 7: { + LogStep(7, "2: read the RO mandatory attribute default: OperationalStatus"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, + WindowCovering::Attributes::OperationalStatus::Id); + } + case 8: { + LogStep(8, "3a: write a value into the RO mandatory attribute: OperationalStatus"); + uint8_t value; + value = 128; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, + WindowCovering::Attributes::OperationalStatus::Id, value); + } + case 9: { + LogStep(9, "3b: reads back the RO mandatory attribute: OperationalStatus"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, + WindowCovering::Attributes::OperationalStatus::Id); + } + case 10: { + LogStep(10, "2: read the RO mandatory attribute default: EndProductType"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, + WindowCovering::Attributes::EndProductType::Id); + } + case 11: { + LogStep(11, "3a: write a value into the RO mandatory attribute: EndProductType"); + chip::app::Clusters::WindowCovering::EndProductType value; + value = static_cast(250); + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, + WindowCovering::Attributes::EndProductType::Id, value); + } + case 12: { + LogStep(12, "3b: reads back the RO mandatory attribute: EndProductType"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, + WindowCovering::Attributes::EndProductType::Id); + } + case 13: { + LogStep(13, "2: read the RW mandatory attribute default: Mode"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, WindowCovering::Attributes::Mode::Id); + } + case 14: { + LogStep(14, "3a: write a value into the RW mandatory attribute:: Mode"); + chip::BitFlags value; + value = static_cast>(8); + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, WindowCovering::Attributes::Mode::Id, value); + } + case 15: { + LogStep(15, "3b: reads back the RW mandatory attribute: Mode"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, WindowCovering::Attributes::Mode::Id); + } + case 16: { + LogStep(16, "2: read the RO optional attribute default: TargetPositionLiftPercent100ths"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, + WindowCovering::Attributes::TargetPositionLiftPercent100ths::Id); + } + case 17: { + LogStep(17, "3a: write a value into the RO optional attribute: TargetPositionLiftPercent100ths"); + chip::app::DataModel::Nullable value; + value.SetNonNull(); + value.Value() = 20000U; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, + WindowCovering::Attributes::TargetPositionLiftPercent100ths::Id, value); + } + case 18: { + LogStep(18, "3b: reads back the RO optional attribute: TargetPositionLiftPercent100ths"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, + WindowCovering::Attributes::TargetPositionLiftPercent100ths::Id); + } + case 19: { + LogStep(19, "2: read the RO optional attribute default: TargetPositionTiltPercent100ths"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, + WindowCovering::Attributes::TargetPositionTiltPercent100ths::Id); + } + case 20: { + LogStep(20, "3a: write a value into the RO optional attribute: TargetPositionTiltPercent100ths"); + chip::app::DataModel::Nullable value; + value.SetNonNull(); + value.Value() = 20000U; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, + WindowCovering::Attributes::TargetPositionTiltPercent100ths::Id, value); + } + case 21: { + LogStep(21, "3b: reads back the RO optional attribute: TargetPositionTiltPercent100ths"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, + WindowCovering::Attributes::TargetPositionTiltPercent100ths::Id); + } + case 22: { + LogStep(22, "2: read the RO optional attribute default: CurrentPositionLiftPercent100ths"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, + WindowCovering::Attributes::CurrentPositionLiftPercent100ths::Id); + } + case 23: { + LogStep(23, "3a: write a value into the RO optional attribute: CurrentPositionLiftPercent100ths"); + chip::app::DataModel::Nullable value; + value.SetNonNull(); + value.Value() = 20000U; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, + WindowCovering::Attributes::CurrentPositionLiftPercent100ths::Id, value); + } + case 24: { + LogStep(24, "3b: reads back the RO optional attribute: CurrentPositionLiftPercent100ths"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, + WindowCovering::Attributes::CurrentPositionLiftPercent100ths::Id); + } + case 25: { + LogStep(25, "2: read the RO optional attribute default: CurrentPositionTiltPercent100ths"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, + WindowCovering::Attributes::CurrentPositionTiltPercent100ths::Id); + } + case 26: { + LogStep(26, "3a: write a value into the RO optional attribute: CurrentPositionTiltPercent100ths"); + chip::app::DataModel::Nullable value; + value.SetNonNull(); + value.Value() = 20000U; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, + WindowCovering::Attributes::CurrentPositionTiltPercent100ths::Id, value); + } + case 27: { + LogStep(27, "3b: reads back the RO optional attribute: CurrentPositionTiltPercent100ths"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, + WindowCovering::Attributes::CurrentPositionTiltPercent100ths::Id); + } + case 28: { + LogStep(28, "2: read the RO optional attribute default: InstalledOpenLimitLift"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, + WindowCovering::Attributes::InstalledOpenLimitLift::Id); + } + case 29: { + LogStep(29, "3a: write a value into the RO optional attribute: InstalledOpenLimitLift"); + uint16_t value; + value = 255U; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, + WindowCovering::Attributes::InstalledOpenLimitLift::Id, value); + } + case 30: { + LogStep(30, "3b: reads back the RO optional attribute: InstalledOpenLimitLift"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, + WindowCovering::Attributes::InstalledOpenLimitLift::Id); + } + case 31: { + LogStep(31, "2: read the RO optional attribute default: InstalledClosedLimitLift"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, + WindowCovering::Attributes::InstalledClosedLimitLift::Id); + } + case 32: { + LogStep(32, "3a: write a value into the RO optional attribute: InstalledClosedLimitLift"); + uint16_t value; + value = 255U; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, + WindowCovering::Attributes::InstalledClosedLimitLift::Id, value); + } + case 33: { + LogStep(33, "3b: reads back the RO optional attribute: InstalledClosedLimitLift"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, + WindowCovering::Attributes::InstalledClosedLimitLift::Id); + } + case 34: { + LogStep(34, "2: read the RO optional attribute default: InstalledOpenLimitTilt"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, + WindowCovering::Attributes::InstalledOpenLimitTilt::Id); + } + case 35: { + LogStep(35, "3a: write a value into the RO optional attribute: InstalledOpenLimitTilt"); + uint16_t value; + value = 255U; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, + WindowCovering::Attributes::InstalledOpenLimitTilt::Id, value); + } + case 36: { + LogStep(36, "3b: reads back the RO optional attribute: InstalledOpenLimitTilt"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, + WindowCovering::Attributes::InstalledOpenLimitTilt::Id); + } + case 37: { + LogStep(37, "2: read the RO optional attribute default: InstalledClosedLimitTilt"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, + WindowCovering::Attributes::InstalledClosedLimitTilt::Id); + } + case 38: { + LogStep(38, "3a: write a value into the RO optional attribute: InstalledClosedLimitTilt"); + uint16_t value; + value = 255U; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, + WindowCovering::Attributes::InstalledClosedLimitTilt::Id, value); + } + case 39: { + LogStep(39, "3b: reads back the RO optional attribute: InstalledClosedLimitTilt"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, + WindowCovering::Attributes::InstalledClosedLimitTilt::Id); + } + case 40: { + LogStep(40, "4: read the RO mandatory attribute default: SafetyStatus"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, WindowCovering::Attributes::SafetyStatus::Id); + } + case 41: { + LogStep(41, "5a: write a value into the RO mandatory attribute: SafetyStatus"); + uint16_t value; + value = 4096U; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, WindowCovering::Attributes::SafetyStatus::Id, + value); + } + case 42: { + LogStep(42, "5b: reads back the RO mandatory attribute: SafetyStatus"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, WindowCovering::Attributes::SafetyStatus::Id); + } + case 43: { + LogStep(43, "4: read the RO optional attribute default: CurrentPositionLift"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, + WindowCovering::Attributes::CurrentPositionLift::Id); + } + case 44: { + LogStep(44, "5a: write a value into the RO optional attribute: CurrentPositionLift"); + chip::app::DataModel::Nullable value; + value.SetNonNull(); + value.Value() = 255U; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, + WindowCovering::Attributes::CurrentPositionLift::Id, value); + } + case 45: { + LogStep(45, "5b: reads back the RO optional attribute: CurrentPositionLift"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, + WindowCovering::Attributes::CurrentPositionLift::Id); + } + case 46: { + LogStep(46, "4: read the RO optional attribute default: CurrentPositionTilt"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, + WindowCovering::Attributes::CurrentPositionTilt::Id); + } + case 47: { + LogStep(47, "5a: write a value into the RO optional attribute: CurrentPositionTilt"); + chip::app::DataModel::Nullable value; + value.SetNonNull(); + value.Value() = 255U; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, + WindowCovering::Attributes::CurrentPositionTilt::Id, value); + } + case 48: { + LogStep(48, "5b: reads back the RO optional attribute: CurrentPositionTilt"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, + WindowCovering::Attributes::CurrentPositionTilt::Id); + } + case 49: { + LogStep(49, "4: read the RO optional attribute default: CurrentPositionLiftPercentage"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, + WindowCovering::Attributes::CurrentPositionLiftPercentage::Id); + } + case 50: { + LogStep(50, "5a: write a value into the RO optional attribute: CurrentPositionLiftPercentage"); + chip::app::DataModel::Nullable value; + value.SetNonNull(); + value.Value() = 200; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, + WindowCovering::Attributes::CurrentPositionLiftPercentage::Id, value); + } + case 51: { + LogStep(51, "5b: reads back the RO optional attribute: CurrentPositionLiftPercentage"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, + WindowCovering::Attributes::CurrentPositionLiftPercentage::Id); + } + case 52: { + LogStep(52, "4: read the RO optional attribute default: CurrentPositionTiltPercentage"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, + WindowCovering::Attributes::CurrentPositionTiltPercentage::Id); + } + case 53: { + LogStep(53, "5a: write a value into the RO optional attribute: CurrentPositionTiltPercentage"); + chip::app::DataModel::Nullable value; + value.SetNonNull(); + value.Value() = 200; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, + WindowCovering::Attributes::CurrentPositionTiltPercentage::Id, value); + } + case 54: { + LogStep(54, "5b: reads back the RO optional attribute: CurrentPositionTiltPercentage"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, + WindowCovering::Attributes::CurrentPositionTiltPercentage::Id); + } + } + return CHIP_NO_ERROR; } +}; - static void OnFailureCallback_2(void * context, CHIP_ERROR error) +class Test_TC_WNCV_2_2Suite : public TestCommand +{ +public: + Test_TC_WNCV_2_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_WNCV_2_2", 1, credsIssuerConfig) { - (static_cast(context))->OnFailureResponse_2(error); + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - static void OnSuccessCallback_2(void * context, chip::CharSpan vendorName) - { - (static_cast(context))->OnSuccessResponse_2(vendorName); - } + ~Test_TC_WNCV_2_2Suite() {} - static void OnFailureCallback_3(void * context, CHIP_ERROR error) + chip::System::Clock::Timeout GetWaitDuration() const override { - (static_cast(context))->OnFailureResponse_3(error); + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } - static void OnSuccessCallback_3(void * context, chip::VendorId vendorID) - { - (static_cast(context))->OnSuccessResponse_3(vendorID); - } +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; - static void OnFailureCallback_4(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_4(error); - } + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } - static void OnSuccessCallback_4(void * context, chip::CharSpan productName) - { - (static_cast(context))->OnSuccessResponse_4(productName); - } + // + // Tests methods + // - static void OnFailureCallback_5(void * context, CHIP_ERROR error) + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { - (static_cast(context))->OnFailureResponse_5(error); - } + bool shouldContinue = false; - static void OnSuccessCallback_5(void * context, uint16_t productID) - { - (static_cast(context))->OnSuccessResponse_5(productID); - } + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } - static void OnFailureCallback_6(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_6(error); + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } } - static void OnSuccessCallback_6(void * context, chip::CharSpan nodeLabel) + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - (static_cast(context))->OnSuccessResponse_6(nodeLabel); + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + } + return CHIP_NO_ERROR; } +}; - static void OnFailureCallback_7(void * context, CHIP_ERROR error) +class Test_TC_WNCV_2_3Suite : public TestCommand +{ +public: + Test_TC_WNCV_2_3Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_WNCV_2_3", 19, credsIssuerConfig) { - (static_cast(context))->OnFailureResponse_7(error); + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - static void OnSuccessCallback_7(void * context, chip::CharSpan location) - { - (static_cast(context))->OnSuccessResponse_7(location); - } + ~Test_TC_WNCV_2_3Suite() {} - static void OnFailureCallback_8(void * context, CHIP_ERROR error) + chip::System::Clock::Timeout GetWaitDuration() const override { - (static_cast(context))->OnFailureResponse_8(error); + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } - static void OnSuccessCallback_8(void * context, uint16_t hardwareVersion) - { - (static_cast(context))->OnSuccessResponse_8(hardwareVersion); - } +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; - static void OnFailureCallback_9(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_9(error); - } + chip::BitFlags configStatusValA; + chip::BitFlags configStatusValB; - static void OnSuccessCallback_9(void * context, chip::CharSpan hardwareVersionString) - { - (static_cast(context))->OnSuccessResponse_9(hardwareVersionString); - } + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } - static void OnFailureCallback_10(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_10(error); - } + // + // Tests methods + // - static void OnSuccessCallback_10(void * context, uint32_t softwareVersion) + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { - (static_cast(context))->OnSuccessResponse_10(softwareVersion); - } + bool shouldContinue = false; - static void OnFailureCallback_11(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_11(error); - } + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::BitFlags value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintMinValue("value", value, 4)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 127)); + } + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::BitFlags value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 127)); + } + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::BitFlags value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 127)); + configStatusValA = value; + } + break; + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); + break; + case 8: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 9: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::BitFlags value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintMinValue("value", value, 1)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 127)); + } + break; + case 10: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::BitFlags value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 127)); + } + break; + case 11: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 12: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 13: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::BitFlags value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 127)); + configStatusValB = value; + } + break; + case 14: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_BUSY)); + break; + case 15: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 16: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::BitFlags value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintMinValue("value", value, 1)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 127)); + } + break; + case 17: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::BitFlags value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 127)); + } + break; + case 18: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } - static void OnSuccessCallback_11(void * context, chip::CharSpan softwareVersionString) - { - (static_cast(context))->OnSuccessResponse_11(softwareVersionString); + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } } - static void OnFailureCallback_12(void * context, CHIP_ERROR error) + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - (static_cast(context))->OnFailureResponse_12(error); + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "1a: TH set the Mode Attribute bit0 of the DUT"); + VerifyOrdo(!ShouldSkip("WNCV_REVERSAL"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + chip::BitFlags value; + value = static_cast>(1); + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, WindowCovering::Attributes::Mode::Id, value); + } + case 2: { + LogStep(2, "1b: TH reads ConfigStatus attribute from DUT"); + VerifyOrdo(!ShouldSkip("WNCV_REVERSAL"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, WindowCovering::Attributes::ConfigStatus::Id); + } + case 3: { + LogStep(3, "1c: TH clear the Mode Attribute bit0 of the DUT"); + VerifyOrdo(!ShouldSkip("WNCV_REVERSAL"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + chip::BitFlags value; + value = static_cast>(0); + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, WindowCovering::Attributes::Mode::Id, value); + } + case 4: { + LogStep(4, "1d: TH reads ConfigStatus attribute from DUT"); + VerifyOrdo(!ShouldSkip("WNCV_REVERSAL"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, WindowCovering::Attributes::ConfigStatus::Id); + } + case 5: { + LogStep(5, "2a: TH set the Mode Attribute bit1 of the DUT"); + VerifyOrdo(!ShouldSkip("WNCV_CALIBRATION"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + chip::BitFlags value; + value = static_cast>(2); + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, WindowCovering::Attributes::Mode::Id, value); + } + case 6: { + LogStep(6, "2b: TH reads ConfigStatus attribute from DUT"); + VerifyOrdo(!ShouldSkip("WNCV_CALIBRATION"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, WindowCovering::Attributes::ConfigStatus::Id); + } + case 7: { + LogStep(7, "2c: If (ConfigStatus bit0 == 0) TH send DownOrClose command to the DUT"); + VerifyOrdo(!ShouldSkip("WNCV_CALIBRATION"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + chip::app::Clusters::WindowCovering::Commands::DownOrClose::Type value; + return SendCommand(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, WindowCovering::Commands::DownOrClose::Id, + value); + } + case 8: { + LogStep(8, "2d: TH clear the Mode Attribute bit1 of the DUT"); + VerifyOrdo(!ShouldSkip("WNCV_CALIBRATION"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + chip::BitFlags value; + value = static_cast>(0); + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, WindowCovering::Attributes::Mode::Id, value); + } + case 9: { + LogStep(9, "2e: TH reads ConfigStatus attribute from DUT"); + VerifyOrdo(!ShouldSkip("WNCV_CALIBRATION"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, WindowCovering::Attributes::ConfigStatus::Id); + } + case 10: { + LogStep(10, "2f: TH reads the Mode Attribute from the DUT"); + VerifyOrdo(!ShouldSkip("WNCV_CALIBRATION"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, WindowCovering::Attributes::Mode::Id); + } + case 11: { + LogStep(11, "2g: TH send DownOrClose command to the DUT"); + VerifyOrdo(!ShouldSkip("WNCV_CALIBRATION"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + chip::app::Clusters::WindowCovering::Commands::DownOrClose::Type value; + return SendCommand(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, WindowCovering::Commands::DownOrClose::Id, + value); + } + case 12: { + LogStep(12, "3a: TH set the Mode Attribute bit2 of the DUT"); + VerifyOrdo(!ShouldSkip("WNCV_MAINTENANCE"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + chip::BitFlags value; + value = static_cast>(4); + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, WindowCovering::Attributes::Mode::Id, value); + } + case 13: { + LogStep(13, "3c: TH reads ConfigStatus attribute from DUT"); + VerifyOrdo(!ShouldSkip("WNCV_MAINTENANCE"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, WindowCovering::Attributes::ConfigStatus::Id); + } + case 14: { + LogStep(14, "3c: TH send DownOrClose command to the DUT"); + VerifyOrdo(!ShouldSkip("WNCV_MAINTENANCE"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + chip::app::Clusters::WindowCovering::Commands::DownOrClose::Type value; + return SendCommand(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, WindowCovering::Commands::DownOrClose::Id, + value); + } + case 15: { + LogStep(15, "3d: TH clear the Mode Attribute bit2 of the DUT"); + VerifyOrdo(!ShouldSkip("WNCV_MAINTENANCE"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + chip::BitFlags value; + value = static_cast>(0); + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, WindowCovering::Attributes::Mode::Id, value); + } + case 16: { + LogStep(16, "3e: TH reads ConfigStatus attribute from DUT"); + VerifyOrdo(!ShouldSkip("WNCV_MAINTENANCE"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, WindowCovering::Attributes::ConfigStatus::Id); + } + case 17: { + LogStep(17, "3f: TH reads the Mode Attribute from the DUT"); + VerifyOrdo(!ShouldSkip("WNCV_MAINTENANCE"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, WindowCovering::Attributes::Mode::Id); + } + case 18: { + LogStep(18, "3g: TH send DownOrClose command to the DUT"); + VerifyOrdo(!ShouldSkip("WNCV_MAINTENANCE"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + chip::app::Clusters::WindowCovering::Commands::DownOrClose::Type value; + return SendCommand(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, WindowCovering::Commands::DownOrClose::Id, + value); + } + } + return CHIP_NO_ERROR; } +}; - static void OnSuccessCallback_12(void * context, chip::CharSpan manufacturingDate) +class Test_TC_WNCV_2_4Suite : public TestCommand +{ +public: + Test_TC_WNCV_2_4Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_WNCV_2_4", 3, credsIssuerConfig) { - (static_cast(context))->OnSuccessResponse_12(manufacturingDate); + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - static void OnFailureCallback_13(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_13(error); - } + ~Test_TC_WNCV_2_4Suite() {} - static void OnSuccessCallback_13(void * context, chip::CharSpan partNumber) + chip::System::Clock::Timeout GetWaitDuration() const override { - (static_cast(context))->OnSuccessResponse_13(partNumber); + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } - static void OnFailureCallback_14(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_14(error); - } +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; - static void OnSuccessCallback_14(void * context, chip::CharSpan productURL) - { - (static_cast(context))->OnSuccessResponse_14(productURL); - } + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } - static void OnFailureCallback_15(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_15(error); - } + // + // Tests methods + // - static void OnSuccessCallback_15(void * context, chip::CharSpan productLabel) + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { - (static_cast(context))->OnSuccessResponse_15(productLabel); - } + bool shouldContinue = false; - static void OnFailureCallback_16(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_16(error); - } + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::WindowCovering::Type value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("type", value, 0)); + } + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::WindowCovering::Type value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 9)); + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } - static void OnSuccessCallback_16(void * context, chip::CharSpan serialNumber) - { - (static_cast(context))->OnSuccessResponse_16(serialNumber); + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } } - static void OnFailureCallback_17(void * context, CHIP_ERROR error) + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - (static_cast(context))->OnFailureResponse_17(error); + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "Reads Type attribute from DUT"); + VerifyOrdo(!ShouldSkip("A_TYPE"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, WindowCovering::Attributes::Type::Id); + } + case 2: { + LogStep(2, "Reads Type attribute constraints"); + VerifyOrdo(!ShouldSkip("A_TYPE"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, WindowCovering::Attributes::Type::Id); + } + } + return CHIP_NO_ERROR; } +}; - static void OnSuccessCallback_17(void * context, bool localConfigDisabled) +class Test_TC_WNCV_2_5Suite : public TestCommand +{ +public: + Test_TC_WNCV_2_5Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_WNCV_2_5", 3, credsIssuerConfig) { - (static_cast(context))->OnSuccessResponse_17(localConfigDisabled); + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - static void OnFailureCallback_18(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_18(error); - } + ~Test_TC_WNCV_2_5Suite() {} - static void OnSuccessCallback_18(void * context, bool reachable) + chip::System::Clock::Timeout GetWaitDuration() const override { - (static_cast(context))->OnSuccessResponse_18(reachable); + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } - static void OnFailureCallback_19(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_19(error); - } +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; - static void OnSuccessCallback_19(void * context, chip::CharSpan uniqueID) - { - (static_cast(context))->OnSuccessResponse_19(uniqueID); - } + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } // // Tests methods // - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } + bool shouldContinue = false; - CHIP_ERROR TestQueryDataModelRevision_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::BasicClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::WindowCovering::EndProductType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("endProductType", value, 0)); + } + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::WindowCovering::EndProductType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 23)); + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_1, OnFailureCallback_1, true)); - return CHIP_NO_ERROR; + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } } - void OnFailureResponse_1(CHIP_ERROR error) + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_1(uint16_t dataModelRevision) - { - VerifyOrReturn(CheckConstraintType("dataModelRevision", "", "uint16")); - NextTest(); - } - - CHIP_ERROR TestQueryVendorName_2() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::BasicClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_2, OnFailureCallback_2, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_2(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_2(chip::CharSpan vendorName) - { - VerifyOrReturn(CheckConstraintType("vendorName", "", "string")); - VerifyOrReturn(CheckConstraintMaxLength("vendorName", vendorName.size(), 32)); - NextTest(); - } - - CHIP_ERROR TestQueryVendorID_3() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::BasicClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_3, OnFailureCallback_3, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_3(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_3(chip::VendorId vendorID) - { - VerifyOrReturn(CheckConstraintType("vendorID", "", "uint16")); - NextTest(); - } - - CHIP_ERROR TestQueryProductName_4() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::BasicClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_4, OnFailureCallback_4, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_4(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_4(chip::CharSpan productName) - { - VerifyOrReturn(CheckConstraintType("productName", "", "string")); - VerifyOrReturn(CheckConstraintMaxLength("productName", productName.size(), 32)); - NextTest(); - } - - CHIP_ERROR TestQueryProductID_5() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::BasicClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_5, OnFailureCallback_5, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_5(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_5(uint16_t productID) - { - VerifyOrReturn(CheckConstraintType("productID", "", "uint16")); - NextTest(); - } - - CHIP_ERROR TestQueryNodeLabel_6() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::BasicClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_6, OnFailureCallback_6, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_6(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_6(chip::CharSpan nodeLabel) - { - VerifyOrReturn(CheckConstraintType("nodeLabel", "", "string")); - VerifyOrReturn(CheckConstraintMaxLength("nodeLabel", nodeLabel.size(), 32)); - NextTest(); - } - - CHIP_ERROR TestQueryUserLocation_7() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::BasicClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_7, OnFailureCallback_7, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_7(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_7(chip::CharSpan location) - { - VerifyOrReturn(CheckConstraintType("location", "", "string")); - VerifyOrReturn(CheckConstraintFormat("location", "", "ISO 3166-1 alpha-2")); - VerifyOrReturn(CheckConstraintMaxLength("location", location.size(), 2)); - NextTest(); - } - - CHIP_ERROR TestQueryHardwareVersion_8() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::BasicClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_8, OnFailureCallback_8, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_8(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_8(uint16_t hardwareVersion) - { - VerifyOrReturn(CheckConstraintType("hardwareVersion", "", "uint16")); - NextTest(); - } - - CHIP_ERROR TestQueryHardwareVersionString_9() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::BasicClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_9, OnFailureCallback_9, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_9(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_9(chip::CharSpan hardwareVersionString) - { - VerifyOrReturn(CheckConstraintType("hardwareVersionString", "", "string")); - VerifyOrReturn(CheckConstraintMinLength("hardwareVersionString", hardwareVersionString.size(), 1)); - VerifyOrReturn(CheckConstraintMaxLength("hardwareVersionString", hardwareVersionString.size(), 64)); - NextTest(); - } - - CHIP_ERROR TestQuerySoftwareVersion_10() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::BasicClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_10, OnFailureCallback_10, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_10(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_10(uint32_t softwareVersion) - { - VerifyOrReturn(CheckConstraintType("softwareVersion", "", "uint32")); - NextTest(); - } - - CHIP_ERROR TestQuerySoftwareVersionString_11() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::BasicClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_11, OnFailureCallback_11, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_11(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_11(chip::CharSpan softwareVersionString) - { - VerifyOrReturn(CheckConstraintType("softwareVersionString", "", "string")); - VerifyOrReturn(CheckConstraintFormat("softwareVersionString", "", "ASCII")); - VerifyOrReturn(CheckConstraintMinLength("softwareVersionString", softwareVersionString.size(), 1)); - VerifyOrReturn(CheckConstraintMaxLength("softwareVersionString", softwareVersionString.size(), 64)); - NextTest(); - } - - CHIP_ERROR TestQueryManufacturingDate_12() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::BasicClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_12, OnFailureCallback_12, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_12(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() - : ThrowFailureResponse(error); - } - - void OnSuccessResponse_12(chip::CharSpan manufacturingDate) - { - VerifyOrReturn(CheckConstraintType("manufacturingDate", "", "string")); - VerifyOrReturn(CheckConstraintFormat("manufacturingDate", "", "ISO 8601")); - VerifyOrReturn(CheckConstraintMinLength("manufacturingDate", manufacturingDate.size(), 8)); - VerifyOrReturn(CheckConstraintMaxLength("manufacturingDate", manufacturingDate.size(), 16)); - NextTest(); - } - - CHIP_ERROR TestQueryPartNumber_13() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::BasicClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_13, OnFailureCallback_13, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_13(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() - : ThrowFailureResponse(error); - } - - void OnSuccessResponse_13(chip::CharSpan partNumber) - { - VerifyOrReturn(CheckConstraintType("partNumber", "", "string")); - VerifyOrReturn(CheckConstraintMaxLength("partNumber", partNumber.size(), 32)); - NextTest(); - } - - CHIP_ERROR TestQueryProductURL_14() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::BasicClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_14, OnFailureCallback_14, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_14(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() - : ThrowFailureResponse(error); - } - - void OnSuccessResponse_14(chip::CharSpan productURL) - { - VerifyOrReturn(CheckConstraintType("productURL", "", "string")); - VerifyOrReturn(CheckConstraintFormat("productURL", "", "RFC3986")); - VerifyOrReturn(CheckConstraintMaxLength("productURL", productURL.size(), 256)); - NextTest(); - } - - CHIP_ERROR TestQueryProductLabel_15() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::BasicClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_15, OnFailureCallback_15, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_15(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() - : ThrowFailureResponse(error); - } - - void OnSuccessResponse_15(chip::CharSpan productLabel) - { - VerifyOrReturn(CheckConstraintType("productLabel", "", "string")); - VerifyOrReturn(CheckConstraintMaxLength("productLabel", productLabel.size(), 64)); - NextTest(); - } - - CHIP_ERROR TestQuerySerialNumber_16() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::BasicClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_16, OnFailureCallback_16, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_16(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() - : ThrowFailureResponse(error); - } - - void OnSuccessResponse_16(chip::CharSpan serialNumber) - { - VerifyOrReturn(CheckConstraintType("serialNumber", "", "string")); - VerifyOrReturn(CheckConstraintMaxLength("serialNumber", serialNumber.size(), 32)); - NextTest(); - } - - CHIP_ERROR TestQueryLocalConfigDisabled_17() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::BasicClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_17, OnFailureCallback_17, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_17(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() - : ThrowFailureResponse(error); - } - - void OnSuccessResponse_17(bool localConfigDisabled) - { - VerifyOrReturn(CheckConstraintType("localConfigDisabled", "", "boolean")); - NextTest(); - } - - CHIP_ERROR TestQueryReachable_18() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::BasicClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_18, OnFailureCallback_18, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_18(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() - : ThrowFailureResponse(error); - } - - void OnSuccessResponse_18(bool reachable) - { - VerifyOrReturn(CheckConstraintType("reachable", "", "boolean")); - NextTest(); - } - - CHIP_ERROR TestQueryUniqueID_19() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::BasicClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_19, OnFailureCallback_19, true)); + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "Reads EndProductType attribute from DUT"); + VerifyOrdo(!ShouldSkip("A_ENDPRODUCTTYPE"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, + WindowCovering::Attributes::EndProductType::Id); + } + case 2: { + LogStep(2, "Reads EndProductType attribute constraints from DUT"); + VerifyOrdo(!ShouldSkip("A_ENDPRODUCTTYPE"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, + WindowCovering::Attributes::EndProductType::Id); + } + } return CHIP_NO_ERROR; } - - void OnFailureResponse_19(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() - : ThrowFailureResponse(error); - } - - void OnSuccessResponse_19(chip::CharSpan uniqueID) - { - VerifyOrReturn(CheckConstraintType("uniqueID", "", "string")); - VerifyOrReturn(CheckConstraintMaxLength("uniqueID", uniqueID.size(), 32)); - NextTest(); - } }; -class Test_TC_DM_3_1Suite : public TestCommand +class Test_TC_WNCV_3_1Suite : public TestCommand { public: - Test_TC_DM_3_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_DM_3_1", credsIssuerConfig), mTestIndex(0) + Test_TC_WNCV_3_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_WNCV_3_1", 24, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -20834,53 +26631,7 @@ class Test_TC_DM_3_1Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_DM_3_1Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_DM_3_1\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_DM_3_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Query MaxNetworks\n"); - err = TestQueryMaxNetworks_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Query Networks\n"); - err = TestQueryNetworks_2(); - break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } + ~Test_TC_WNCV_3_1Suite() {} chip::System::Clock::Timeout GetWaitDuration() const override { @@ -20888,14 +26639,17 @@ class Test_TC_DM_3_1Suite : public TestCommand } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 3; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -20906,6 +26660,175 @@ class Test_TC_DM_3_1Suite : public TestCommand VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); shouldContinue = true; break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 1U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 10000U)); + } + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint8")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 1)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 100)); + } + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 1U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 10000U)); + } + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint8")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 1)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 100)); + } + break; + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "map8")); + } + break; + case 8: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 9: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 10: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNonNull("targetPositionLiftPercent100ths", value)); + VerifyOrReturn(CheckValue("targetPositionLiftPercent100ths.Value()", value.Value(), 0U)); + } + break; + case 11: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 12: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "map8")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 5)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 21)); + } + shouldContinue = true; + break; + case 13: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 14: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 9999U)); + } + break; + case 15: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint8")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 99)); + } + break; + case 16: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 9999U)); + } + break; + case 17: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint8")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 99)); + } + break; + case 18: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 19: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 20: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("operationalStatus", value, 0)); + } + break; + case 21: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 22: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 9999U)); + } + break; + case 23: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 9999U)); + } + break; default: LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); } @@ -20916,95 +26839,155 @@ class Test_TC_DM_3_1Suite : public TestCommand } } - static void OnFailureCallback_1(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_1(error); - } - - static void OnSuccessCallback_1(void * context, uint8_t maxNetworks) - { - (static_cast(context))->OnSuccessResponse_1(maxNetworks); - } - - static void OnFailureCallback_2(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_2(error); - } - - static void OnSuccessCallback_2( - void * context, - const chip::app::DataModel::DecodableList & - networks) - { - (static_cast(context))->OnSuccessResponse_2(networks); - } - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestQueryMaxNetworks_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::NetworkCommissioningClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_1, OnFailureCallback_1, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() - : ThrowFailureResponse(error); - } - - void OnSuccessResponse_1(uint8_t maxNetworks) + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - VerifyOrReturn(CheckConstraintType("maxNetworks", "", "uint8")); - NextTest(); - } - - CHIP_ERROR TestQueryNetworks_2() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::NetworkCommissioningClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_2, OnFailureCallback_2, true)); + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "0: Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "1a: TH sends DownOrClose command to preposition the DUT in the opposite direction"); + chip::app::Clusters::WindowCovering::Commands::DownOrClose::Type value; + return SendCommand(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, WindowCovering::Commands::DownOrClose::Id, + value); + } + case 2: { + LogStep(2, "1b: TH Waits for 10 seconds movement(s) on the device"); + SetIdentity(kIdentityAlpha); + return WaitForMs(10000); + } + case 3: { + LogStep(3, "1c: If (PA & LF) TH reads CurrentPositionLiftPercent100ths attribute from DUT"); + VerifyOrdo(!ShouldSkip("WNCV_LF && WNCV_PA_LF"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, + WindowCovering::Attributes::CurrentPositionLiftPercent100ths::Id); + } + case 4: { + LogStep(4, "1d: If (PA & LF) TH reads CurrentPositionLiftPercentage optional attribute from DUT"); + VerifyOrdo(!ShouldSkip("WNCV_LF && WNCV_PA_LF && A_CURRENTPOSITIONLIFTPERCENTAGE"), + return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, + WindowCovering::Attributes::CurrentPositionLiftPercentage::Id); + } + case 5: { + LogStep(5, "1e: If (PA & TL) TH reads CurrentPositionTiltPercent100ths attribute from DUT"); + VerifyOrdo(!ShouldSkip("WNCV_TL && WNCV_PA_TL"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, + WindowCovering::Attributes::CurrentPositionTiltPercent100ths::Id); + } + case 6: { + LogStep(6, "1f: If (PA & TL) TH reads CurrentPositionTiltPercentage optional attribute from DUT"); + VerifyOrdo(!ShouldSkip("WNCV_TL && WNCV_PA_TL && A_CURRENTPOSITIONTILTPERCENTAGE"), + return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, + WindowCovering::Attributes::CurrentPositionTiltPercentage::Id); + } + case 7: { + LogStep(7, "2: Subscribe to DUT reports on OperationalStatus attribute"); + return SubscribeAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, + WindowCovering::Attributes::OperationalStatus::Id, 4, 5); + } + case 8: { + LogStep(8, "2a: TH sends UpOrOpen command to DUT"); + chip::app::Clusters::WindowCovering::Commands::UpOrOpen::Type value; + return SendCommand(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, WindowCovering::Commands::UpOrOpen::Id, value); + } + case 9: { + LogStep(9, "2b: DUT updates its attributes"); + SetIdentity(kIdentityAlpha); + return WaitForMs(100); + } + case 10: { + LogStep(10, "2c: If (PA & LF) TH reads TargetPositionLiftPercent100ths attribute from DUT"); + VerifyOrdo(!ShouldSkip("WNCV_LF && WNCV_PA_LF"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, + WindowCovering::Attributes::TargetPositionLiftPercent100ths::Id); + } + case 11: { + LogStep(11, "2e: TH leave the device moving for 2 seconds"); + SetIdentity(kIdentityAlpha); + return WaitForMs(2000); + } + case 12: { + LogStep(12, "3a1: Verify DUT reports OperationalStatus attribute to TH after a UpOrOpen"); + return WaitForReport(); + } + case 13: { + LogStep(13, "3a2: DUT updates its attributes"); + SetIdentity(kIdentityAlpha); + return WaitForMs(2000); + } + case 14: { + LogStep(14, "3b: If (PA & LF) TH reads CurrentPositionLiftPercent100ths attribute from DUT"); + VerifyOrdo(!ShouldSkip("WNCV_LF && WNCV_PA_LF"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, + WindowCovering::Attributes::CurrentPositionLiftPercent100ths::Id); + } + case 15: { + LogStep(15, "3c: If (PA & LF) TH reads CurrentPositionLiftPercentage optional attribute from DUT"); + VerifyOrdo(!ShouldSkip("WNCV_LF && WNCV_PA_LF && A_CURRENTPOSITIONLIFTPERCENTAGE"), + return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, + WindowCovering::Attributes::CurrentPositionLiftPercentage::Id); + } + case 16: { + LogStep(16, "3d: If (PA & TL) TH reads CurrentPositionTiltPercent100ths attribute from DUT"); + VerifyOrdo(!ShouldSkip("WNCV_TL && WNCV_PA_TL"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, + WindowCovering::Attributes::CurrentPositionTiltPercent100ths::Id); + } + case 17: { + LogStep(17, "3e: If (PA & LF) TH reads CurrentPositionTiltPercentage optional attribute from DUT"); + VerifyOrdo(!ShouldSkip("WNCV_TL && WNCV_PA_TL && A_CURRENTPOSITIONTILTPERCENTAGE"), + return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, + WindowCovering::Attributes::CurrentPositionTiltPercentage::Id); + } + case 18: { + LogStep(18, "4a: TH sends a StopMotion command to DUT"); + chip::app::Clusters::WindowCovering::Commands::StopMotion::Type value; + return SendCommand(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, WindowCovering::Commands::StopMotion::Id, value); + } + case 19: { + LogStep(19, "4b: TH waits for 3 seconds the end of inertial movement(s) on the device"); + SetIdentity(kIdentityAlpha); + return WaitForMs(3000); + } + case 20: { + LogStep(20, "4c: Verify DUT update OperationalStatus attribute to TH after a StopMotion"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, + WindowCovering::Attributes::OperationalStatus::Id); + } + case 21: { + LogStep(21, "5a: TH waits for x seconds attributes update on the device"); + SetIdentity(kIdentityAlpha); + return WaitForMs(1000); + } + case 22: { + LogStep(22, "5b: If (PA & LF) TH reads TargetPositionLiftPercent100ths attribute from DUT"); + VerifyOrdo(!ShouldSkip("WNCV_LF && WNCV_PA_LF"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, + WindowCovering::Attributes::TargetPositionLiftPercent100ths::Id); + } + case 23: { + LogStep(23, "5c: If (PA & TL) TH reads TargetPositionTiltPercent100ths attribute from DUT"); + VerifyOrdo(!ShouldSkip("WNCV_TL && WNCV_PA_TL"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, + WindowCovering::Attributes::TargetPositionTiltPercent100ths::Id); + } + } return CHIP_NO_ERROR; } - - void OnFailureResponse_2(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() - : ThrowFailureResponse(error); - } - - void OnSuccessResponse_2( - const chip::app::DataModel::DecodableList & - networks) - { - VerifyOrReturn(CheckConstraintType("networks", "", "list")); - NextTest(); - } }; -class Test_TC_DM_2_2Suite : public TestCommand +class Test_TC_WNCV_3_2Suite : public TestCommand { public: - Test_TC_DM_2_2Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_DM_2_2", credsIssuerConfig), mTestIndex(0) + Test_TC_WNCV_3_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_WNCV_3_2", 24, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -21012,61 +26995,7 @@ class Test_TC_DM_2_2Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_DM_2_2Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_DM_2_2\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_DM_2_2\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Query fabrics list\n"); - err = TestQueryFabricsList_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Query Supported Fabrics\n"); - err = TestQuerySupportedFabrics_2(); - break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Query Commissioned Fabrics\n"); - err = TestQueryCommissionedFabrics_3(); - break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Query User Trusted Root Certificates\n"); - err = TestQueryUserTrustedRootCertificates_4(); - break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } + ~Test_TC_WNCV_3_2Suite() {} chip::System::Clock::Timeout GetWaitDuration() const override { @@ -21074,14 +27003,17 @@ class Test_TC_DM_2_2Suite : public TestCommand } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 5; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -21092,180 +27024,334 @@ class Test_TC_DM_2_2Suite : public TestCommand VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); shouldContinue = true; break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - static void OnFailureCallback_1(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_1(error); - } - - static void - OnSuccessCallback_1(void * context, - const chip::app::DataModel::DecodableList< - chip::app::Clusters::OperationalCredentials::Structs::FabricDescriptor::DecodableType> & fabrics) - { - (static_cast(context))->OnSuccessResponse_1(fabrics); - } - - static void OnFailureCallback_2(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_2(error); - } - - static void OnSuccessCallback_2(void * context, uint8_t supportedFabrics) - { - (static_cast(context))->OnSuccessResponse_2(supportedFabrics); - } - - static void OnFailureCallback_3(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_3(error); - } - - static void OnSuccessCallback_3(void * context, uint8_t commissionedFabrics) - { - (static_cast(context))->OnSuccessResponse_3(commissionedFabrics); - } - - static void OnFailureCallback_4(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_4(error); - } - - static void OnSuccessCallback_4(void * context, - const chip::app::DataModel::DecodableList & trustedRootCertificates) - { - (static_cast(context))->OnSuccessResponse_4(trustedRootCertificates); - } - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestQueryFabricsList_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::OperationalCredentialsClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_1, OnFailureCallback_1, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_1(const chip::app::DataModel::DecodableList< - chip::app::Clusters::OperationalCredentials::Structs::FabricDescriptor::DecodableType> & fabrics) - { - { - auto iter_0 = fabrics.begin(); - VerifyOrReturn(CheckNextListItemDecodes("fabrics", iter_0, 0)); - VerifyOrReturn(CheckValueAsString("fabrics[0].label", iter_0.GetValue().label, chip::CharSpan("", 0))); - VerifyOrReturn(CheckNoMoreListItems("fabrics", iter_0, 1)); - } - VerifyOrReturn(CheckConstraintType("fabrics", "", "list")); - NextTest(); - } - - CHIP_ERROR TestQuerySupportedFabrics_2() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::OperationalCredentialsClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_2, OnFailureCallback_2, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_2(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_2(uint8_t supportedFabrics) - { - VerifyOrReturn(CheckValue("supportedFabrics", supportedFabrics, 16)); - VerifyOrReturn(CheckConstraintType("supportedFabrics", "", "uint8")); - NextTest(); - } - - CHIP_ERROR TestQueryCommissionedFabrics_3() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::OperationalCredentialsClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_3, OnFailureCallback_3, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_3(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 9999U)); + } + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint8")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 99)); + } + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 9999U)); + } + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint8")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 99)); + } + break; + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "map8")); + } + break; + case 8: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 9: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 10: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNonNull("targetPositionLiftPercent100ths", value)); + VerifyOrReturn(CheckValue("targetPositionLiftPercent100ths.Value()", value.Value(), 10000U)); + } + break; + case 11: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 12: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "map8")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 10)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 42)); + } + shouldContinue = true; + break; + case 13: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 14: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 1U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 10000U)); + } + break; + case 15: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint8")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 1)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 100)); + } + break; + case 16: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 1U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 10000U)); + } + break; + case 17: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint8")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 1)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 100)); + } + break; + case 18: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 19: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 20: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("operationalStatus", value, 0)); + } + break; + case 21: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 22: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 1U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 10000U)); + } + break; + case 23: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint16")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 1U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 10000U)); + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } - void OnSuccessResponse_3(uint8_t commissionedFabrics) - { - VerifyOrReturn(CheckValue("commissionedFabrics", commissionedFabrics, 1)); - VerifyOrReturn(CheckConstraintType("commissionedFabrics", "", "uint8")); - NextTest(); + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } } - CHIP_ERROR TestQueryUserTrustedRootCertificates_4() + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::OperationalCredentialsClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_4, OnFailureCallback_4, true)); + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "0: Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "1a: TH sends UpOrOpen command to preposition the DUT in the opposite direction"); + chip::app::Clusters::WindowCovering::Commands::UpOrOpen::Type value; + return SendCommand(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, WindowCovering::Commands::UpOrOpen::Id, value); + } + case 2: { + LogStep(2, "1b: TH Waits for 10 seconds movement(s) on the device"); + SetIdentity(kIdentityAlpha); + return WaitForMs(10000); + } + case 3: { + LogStep(3, "1c: If (PA & LF) TH reads CurrentPositionLiftPercent100ths attribute from DUT"); + VerifyOrdo(!ShouldSkip("WNCV_LF && WNCV_PA_LF"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, + WindowCovering::Attributes::CurrentPositionLiftPercent100ths::Id); + } + case 4: { + LogStep(4, "1d: If (PA & LF) TH reads CurrentPositionLiftPercentage optional attribute from DUT"); + VerifyOrdo(!ShouldSkip("WNCV_LF && WNCV_PA_LF && A_CURRENTPOSITIONLIFTPERCENTAGE"), + return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, + WindowCovering::Attributes::CurrentPositionLiftPercentage::Id); + } + case 5: { + LogStep(5, "1e: If (PA & TL) TH reads CurrentPositionTiltPercent100ths attribute from DUT"); + VerifyOrdo(!ShouldSkip("WNCV_TL && WNCV_PA_TL"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, + WindowCovering::Attributes::CurrentPositionTiltPercent100ths::Id); + } + case 6: { + LogStep(6, "1f: If (PA & TL) TH reads CurrentPositionTiltPercentage optional attribute from DUT"); + VerifyOrdo(!ShouldSkip("WNCV_TL && WNCV_PA_TL && A_CURRENTPOSITIONTILTPERCENTAGE"), + return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, + WindowCovering::Attributes::CurrentPositionTiltPercentage::Id); + } + case 7: { + LogStep(7, "2: Subscribe to DUT reports on OperationalStatus attribute"); + return SubscribeAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, + WindowCovering::Attributes::OperationalStatus::Id, 4, 5); + } + case 8: { + LogStep(8, "2a: TH sends DownOrClose command to DUT"); + chip::app::Clusters::WindowCovering::Commands::DownOrClose::Type value; + return SendCommand(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, WindowCovering::Commands::DownOrClose::Id, + value); + } + case 9: { + LogStep(9, "2b: DUT updates its attributes"); + SetIdentity(kIdentityAlpha); + return WaitForMs(100); + } + case 10: { + LogStep(10, "2c: If (PA & LF) TH reads TargetPositionLiftPercent100ths attribute from DUT"); + VerifyOrdo(!ShouldSkip("WNCV_LF && WNCV_PA_LF"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, + WindowCovering::Attributes::TargetPositionLiftPercent100ths::Id); + } + case 11: { + LogStep(11, "2e: TH leave the device moving for 2 seconds"); + SetIdentity(kIdentityAlpha); + return WaitForMs(2000); + } + case 12: { + LogStep(12, "3a: Verify DUT reports OperationalStatus attribute to TH after a DownOrClose"); + return WaitForReport(); + } + case 13: { + LogStep(13, "3a2: DUT updates its attributes"); + SetIdentity(kIdentityAlpha); + return WaitForMs(2000); + } + case 14: { + LogStep(14, "3b: If (PA & LF) TH reads CurrentPositionLiftPercent100ths attribute from DUT"); + VerifyOrdo(!ShouldSkip("WNCV_LF && WNCV_PA_LF"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, + WindowCovering::Attributes::CurrentPositionLiftPercent100ths::Id); + } + case 15: { + LogStep(15, "3c: If (PA & LF) TH reads CurrentPositionLiftPercentage optional attribute from DUT"); + VerifyOrdo(!ShouldSkip("WNCV_LF && WNCV_PA_LF && A_CURRENTPOSITIONLIFTPERCENTAGE"), + return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, + WindowCovering::Attributes::CurrentPositionLiftPercentage::Id); + } + case 16: { + LogStep(16, "3d: If (PA & TL) TH reads CurrentPositionTiltPercent100ths attribute from DUT"); + VerifyOrdo(!ShouldSkip("WNCV_TL && WNCV_PA_TL"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, + WindowCovering::Attributes::CurrentPositionTiltPercent100ths::Id); + } + case 17: { + LogStep(17, "3e: If (PA & LF) TH reads CurrentPositionTiltPercentage optional attribute from DUT"); + VerifyOrdo(!ShouldSkip("WNCV_TL && WNCV_PA_TL && A_CURRENTPOSITIONTILTPERCENTAGE"), + return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, + WindowCovering::Attributes::CurrentPositionTiltPercentage::Id); + } + case 18: { + LogStep(18, "4a: TH sends a StopMotion command to DUT"); + chip::app::Clusters::WindowCovering::Commands::StopMotion::Type value; + return SendCommand(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, WindowCovering::Commands::StopMotion::Id, value); + } + case 19: { + LogStep(19, "4b: TH waits for 3 seconds the end of inertial movement(s) on the device"); + SetIdentity(kIdentityAlpha); + return WaitForMs(3000); + } + case 20: { + LogStep(20, "4c: Verify DUT update OperationalStatus attribute to TH after a StopMotion"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, + WindowCovering::Attributes::OperationalStatus::Id); + } + case 21: { + LogStep(21, "5a: TH waits for x seconds attributes update on the device"); + SetIdentity(kIdentityAlpha); + return WaitForMs(1000); + } + case 22: { + LogStep(22, "5b: If (PA & LF) TH reads TargetPositionLiftPercent100ths attribute from DUT"); + VerifyOrdo(!ShouldSkip("WNCV_LF && WNCV_PA_LF"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, + WindowCovering::Attributes::TargetPositionLiftPercent100ths::Id); + } + case 23: { + LogStep(23, "5c: If (PA & TL) TH reads TargetPositionTiltPercent100ths attribute from DUT"); + VerifyOrdo(!ShouldSkip("WNCV_TL && WNCV_PA_TL"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, + WindowCovering::Attributes::TargetPositionTiltPercent100ths::Id); + } + } return CHIP_NO_ERROR; } - - void OnFailureResponse_4(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_4(const chip::app::DataModel::DecodableList & trustedRootCertificates) - { - VerifyOrReturn(CheckConstraintType("trustedRootCertificates", "", "list")); - NextTest(); - } }; -class Test_TC_EMR_1_1Suite : public TestCommand +class Test_TC_WNCV_3_3Suite : public TestCommand { public: - Test_TC_EMR_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_EMR_1_1", credsIssuerConfig), mTestIndex(0) + Test_TC_WNCV_3_3Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_WNCV_3_3", 15, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -21273,66 +27359,7 @@ class Test_TC_EMR_1_1Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_EMR_1_1Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_EMR_1_1\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_EMR_1_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : read the global attribute: ClusterRevision\n"); - err = TestReadTheGlobalAttributeClusterRevision_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Read the global attribute constraints: ClusterRevision\n"); - err = TestReadTheGlobalAttributeConstraintsClusterRevision_2(); - break; - case 3: - ChipLogProgress(chipTool, - " ***** Test Step 3 : write the default values to mandatory global attribute: ClusterRevision\n"); - err = TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_3(); - break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : reads back global attribute: ClusterRevision\n"); - err = TestReadsBackGlobalAttributeClusterRevision_4(); - break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Read the global attribute: AttributeList\n"); - err = TestReadTheGlobalAttributeAttributeList_5(); - break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } + ~Test_TC_WNCV_3_3Suite() {} chip::System::Clock::Timeout GetWaitDuration() const override { @@ -21340,14 +27367,20 @@ class Test_TC_EMR_1_1Suite : public TestCommand } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 6; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::app::DataModel::Nullable attrCurrentPositionLift; + chip::app::DataModel::Nullable attrCurrentPositionTilt; + + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -21358,6 +27391,110 @@ class Test_TC_EMR_1_1Suite : public TestCommand VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); shouldContinue = true; break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "map8")); + } + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 8: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("operationalStatus", value, 0)); + } + shouldContinue = true; + break; + case 9: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 10: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("operationalStatus", value, 0)); + } + break; + case 11: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 10000U)); + attrCurrentPositionLift = value; + } + break; + case 12: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + if (attrCurrentPositionLift.IsNull()) + { + VerifyOrReturn(CheckValueNull("targetPositionLiftPercent100ths", value)); + } + else + { + VerifyOrReturn(CheckValueNonNull("targetPositionLiftPercent100ths", value)); + VerifyOrReturn( + CheckValue("targetPositionLiftPercent100ths.Value()", value.Value(), attrCurrentPositionLift.Value())); + } + } + break; + case 13: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 10000U)); + attrCurrentPositionTilt = value; + } + break; + case 14: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + if (attrCurrentPositionTilt.IsNull()) + { + VerifyOrReturn(CheckValueNull("targetPositionTiltPercent100ths", value)); + } + else + { + VerifyOrReturn(CheckValueNonNull("targetPositionTiltPercent100ths", value)); + VerifyOrReturn( + CheckValue("targetPositionTiltPercent100ths.Value()", value.Value(), attrCurrentPositionTilt.Value())); + } + } + break; default: LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); } @@ -21368,287 +27505,299 @@ class Test_TC_EMR_1_1Suite : public TestCommand } } - static void OnFailureCallback_1(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_1(error); - } - - static void OnSuccessCallback_1(void * context, uint16_t clusterRevision) - { - (static_cast(context))->OnSuccessResponse_1(clusterRevision); - } - - static void OnFailureCallback_2(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_2(error); - } - - static void OnSuccessCallback_2(void * context, uint16_t clusterRevision) - { - (static_cast(context))->OnSuccessResponse_2(clusterRevision); - } - - static void OnFailureCallback_3(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_3(error); - } - - static void OnSuccessCallback_3(void * context) { (static_cast(context))->OnSuccessResponse_3(); } - - static void OnFailureCallback_4(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_4(error); - } - - static void OnSuccessCallback_4(void * context, uint16_t clusterRevision) - { - (static_cast(context))->OnSuccessResponse_4(clusterRevision); - } - - static void OnFailureCallback_5(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_5(error); - } - - static void OnSuccessCallback_5(void * context, const chip::app::DataModel::DecodableList & attributeList) - { - (static_cast(context))->OnSuccessResponse_5(attributeList); - } - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestReadTheGlobalAttributeClusterRevision_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ElectricalMeasurementClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_1, OnFailureCallback_1, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_1(uint16_t clusterRevision) - { - VerifyOrReturn(CheckValue("clusterRevision", clusterRevision, 3U)); - - NextTest(); - } - - CHIP_ERROR TestReadTheGlobalAttributeConstraintsClusterRevision_2() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ElectricalMeasurementClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_2, OnFailureCallback_2, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_2(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_2(uint16_t clusterRevision) - { - VerifyOrReturn(CheckConstraintType("clusterRevision", "", "uint16")); - NextTest(); - } - - CHIP_ERROR TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_3() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ElectricalMeasurementClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - uint16_t clusterRevisionArgument; - clusterRevisionArgument = 1U; - - ReturnErrorOnFailure( - cluster.WriteAttribute( - clusterRevisionArgument, this, OnSuccessCallback_3, OnFailureCallback_3)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_3(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - NextTest(); - } - - void OnSuccessResponse_3() { ThrowSuccessResponse(); } - - CHIP_ERROR TestReadsBackGlobalAttributeClusterRevision_4() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ElectricalMeasurementClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_4, OnFailureCallback_4, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_4(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_4(uint16_t clusterRevision) - { - VerifyOrReturn(CheckValue("clusterRevision", clusterRevision, 3U)); - - NextTest(); - } - - CHIP_ERROR TestReadTheGlobalAttributeAttributeList_5() + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ElectricalMeasurementClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_5, OnFailureCallback_5, true)); + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "0: Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "1a: TH sends DownOrClose command to preposition the DUT in the opposite direction"); + chip::app::Clusters::WindowCovering::Commands::DownOrClose::Type value; + return SendCommand(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, WindowCovering::Commands::DownOrClose::Id, + value); + } + case 2: { + LogStep(2, "1b: TH Waits for 6-8 seconds movement(s) on the device"); + SetIdentity(kIdentityAlpha); + return WaitForMs(6000); + } + case 3: { + LogStep(3, "1c: TH sends UpOrOpen command to preposition the DUT in the opposite direction"); + chip::app::Clusters::WindowCovering::Commands::UpOrOpen::Type value; + return SendCommand(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, WindowCovering::Commands::UpOrOpen::Id, value); + } + case 4: { + LogStep(4, "1d: TH Waits for 2 seconds movement(s) on the device"); + SetIdentity(kIdentityAlpha); + return WaitForMs(2000); + } + case 5: { + LogStep(5, "2: Subscribe to DUT reports on OperationalStatus attribute"); + return SubscribeAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, + WindowCovering::Attributes::OperationalStatus::Id, 4, 5); + } + case 6: { + LogStep(6, "2a: TH sends a StopMotion command to DUT"); + chip::app::Clusters::WindowCovering::Commands::StopMotion::Type value; + return SendCommand(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, WindowCovering::Commands::StopMotion::Id, value); + } + case 7: { + LogStep(7, "2b: TH waits for 3 seconds the end of inertial movement(s) on the device"); + SetIdentity(kIdentityAlpha); + return WaitForMs(3000); + } + case 8: { + LogStep(8, "2c: Verify DUT reports OperationalStatus attribute to TH after a StopMotion"); + return WaitForReport(); + } + case 9: { + LogStep(9, "2d: TH waits for 100ms - 3s attributes update on the device"); + SetIdentity(kIdentityAlpha); + return WaitForMs(2000); + } + case 10: { + LogStep(10, "2e: TH reads OperationalStatus attribute from DUT"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, + WindowCovering::Attributes::OperationalStatus::Id); + } + case 11: { + LogStep(11, "3a: If (PA & LF) TH reads CurrentPositionLiftPercent100ths attribute from DUT"); + VerifyOrdo(!ShouldSkip("WNCV_LF && WNCV_PA_LF"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, + WindowCovering::Attributes::CurrentPositionLiftPercent100ths::Id); + } + case 12: { + LogStep(12, + "3b: If (PA & LF) TH reads TargetPositionLiftPercent100ths attribute 3c: it Must be equal with " + "CurrentPositionLiftPercent100ths from DUT"); + VerifyOrdo(!ShouldSkip("WNCV_LF && WNCV_PA_LF"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, + WindowCovering::Attributes::TargetPositionLiftPercent100ths::Id); + } + case 13: { + LogStep(13, "4a: If (PA & TL) TH reads CurrentPositionTiltPercent100ths attribute from DUT"); + VerifyOrdo(!ShouldSkip("WNCV_TL && WNCV_PA_TL"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, + WindowCovering::Attributes::CurrentPositionTiltPercent100ths::Id); + } + case 14: { + LogStep(14, + "4b: If (PA & TL) TH reads TargetPositionTiltPercent100ths attribute 4c: it Must be equal with " + "CurrentPositionTiltPercent100ths from DUT"); + VerifyOrdo(!ShouldSkip("WNCV_TL && WNCV_PA_TL"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, + WindowCovering::Attributes::TargetPositionTiltPercent100ths::Id); + } + } return CHIP_NO_ERROR; } - - void OnFailureResponse_5(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_5(const chip::app::DataModel::DecodableList & attributeList) - { - VerifyOrReturn(CheckConstraintType("attributeList", "", "list")); - NextTest(); - } }; -class Test_TC_ETHDIAG_1_1Suite : public TestCommand +class Test_TC_WNCV_3_4Suite : public TestCommand { public: - Test_TC_ETHDIAG_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_ETHDIAG_1_1", credsIssuerConfig), mTestIndex(0) + Test_TC_WNCV_3_4Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_WNCV_3_4", 9, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("fastMotionDuration", 0, UINT16_MAX, &mFastMotionDuration); + AddArgument("fullMotionDuration", 0, UINT16_MAX, &mFullMotionDuration); AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_ETHDIAG_1_1Suite() {} + ~Test_TC_WNCV_3_4Suite() {} - /////////// TestCommand Interface ///////// - void NextTest() override + chip::System::Clock::Timeout GetWaitDuration() const override { - CHIP_ERROR err = CHIP_NO_ERROR; + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_ETHDIAG_1_1\n"); - } +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mFastMotionDuration; + chip::Optional mFullMotionDuration; + chip::Optional mTimeout; - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_ETHDIAG_1_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // - Wait(); + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override + { + bool shouldContinue = false; - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) + switch (mTestIndex - 1) { case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; break; case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Read PHYRate attribute constraints\n"); - err = TestReadPHYRateAttributeConstraints_1(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Read FullDuplex attribute constraints\n"); - err = TestReadFullDuplexAttributeConstraints_2(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; break; case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Read PacketRxCount attribute constraints\n"); - err = TestReadPacketRxCountAttributeConstraints_3(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Read PacketTxCount attribute constraints\n"); - err = TestReadPacketTxCountAttributeConstraints_4(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; break; case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Read TxErrCount attribute constraints\n"); - err = TestReadTxErrCountAttributeConstraints_5(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNonNull("currentPositionLiftPercent100ths", value)); + VerifyOrReturn(CheckValue("currentPositionLiftPercent100ths.Value()", value.Value(), 0U)); + } break; case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : Read CollisionCount attribute constraints\n"); - err = TestReadCollisionCountAttributeConstraints_6(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNonNull("currentPositionLiftPercentage", value)); + VerifyOrReturn(CheckValue("currentPositionLiftPercentage.Value()", value.Value(), 0)); + } break; case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : Read OverrunCount attribute constraints\n"); - err = TestReadOverrunCountAttributeConstraints_7(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNonNull("currentPositionTiltPercent100ths", value)); + VerifyOrReturn(CheckValue("currentPositionTiltPercent100ths.Value()", value.Value(), 0U)); + } break; case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : Read CarrierDetect attribute constraints\n"); - err = TestReadCarrierDetectAttributeConstraints_8(); - break; - case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : Read TimeSinceReset attribute constraints\n"); - err = TestReadTimeSinceResetAttributeConstraints_9(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNonNull("currentPositionTiltPercentage", value)); + VerifyOrReturn(CheckValue("currentPositionTiltPercentage.Value()", value.Value(), 0)); + } break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } + + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); } + } - if (CHIP_NO_ERROR != err) + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); + case 0: { + LogStep(0, "0: Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "1a: TH sends DownOrClose command to preposition the DUT in the opposite direction"); + chip::app::Clusters::WindowCovering::Commands::DownOrClose::Type value; + return SendCommand(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, WindowCovering::Commands::DownOrClose::Id, + value); + } + case 2: { + LogStep(2, "1b: TH Waits for fastMotionDuration seconds movement(s) on the device"); + SetIdentity(kIdentityAlpha); + return WaitForMs(mFastMotionDuration.HasValue() ? mFastMotionDuration.Value() : 3000U); + } + case 3: { + LogStep(3, "2a: TH sends UpOrOpen command to DUT"); + chip::app::Clusters::WindowCovering::Commands::UpOrOpen::Type value; + return SendCommand(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, WindowCovering::Commands::UpOrOpen::Id, value); + } + case 4: { + LogStep(4, "2b: TH Waits for fullMotionDuration seconds movement(s) on the device"); + SetIdentity(kIdentityAlpha); + return WaitForMs(mFullMotionDuration.HasValue() ? mFullMotionDuration.Value() : 6000U); + } + case 5: { + LogStep(5, "3a: If (PA & LF) TH reads CurrentPositionLiftPercent100ths attribute from DUT"); + VerifyOrdo(!ShouldSkip("WNCV_LF && WNCV_PA_LF"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, + WindowCovering::Attributes::CurrentPositionLiftPercent100ths::Id); + } + case 6: { + LogStep(6, "3b: If (PA & LF) TH reads CurrentPositionLiftPercentage optional attribute from DUT"); + VerifyOrdo(!ShouldSkip("WNCV_LF && WNCV_PA_LF && A_CURRENTPOSITIONLIFTPERCENTAGE"), + return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, + WindowCovering::Attributes::CurrentPositionLiftPercentage::Id); + } + case 7: { + LogStep(7, "3c: If (PA & TL) TH reads CurrentPositionTiltPercent100ths attribute from DUT"); + VerifyOrdo(!ShouldSkip("WNCV_TL && WNCV_PA_TL"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, + WindowCovering::Attributes::CurrentPositionTiltPercent100ths::Id); + } + case 8: { + LogStep(8, "3d: If (PA & TL) TH reads CurrentPositionTiltPercentage optional attribute from DUT"); + VerifyOrdo(!ShouldSkip("WNCV_TL && WNCV_PA_TL && A_CURRENTPOSITIONLIFTPERCENTAGE"), + return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, + WindowCovering::Attributes::CurrentPositionTiltPercentage::Id); } + } + return CHIP_NO_ERROR; + } +}; + +class Test_TC_WNCV_3_5Suite : public TestCommand +{ +public: + Test_TC_WNCV_3_5Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_WNCV_3_5", 9, credsIssuerConfig) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("fastMotionDuration", 0, UINT16_MAX, &mFastMotionDuration); + AddArgument("fullMotionDuration", 0, UINT16_MAX, &mFullMotionDuration); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } + ~Test_TC_WNCV_3_5Suite() {} + chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 10; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; + chip::Optional mFastMotionDuration; + chip::Optional mFullMotionDuration; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -21659,6 +27808,56 @@ class Test_TC_ETHDIAG_1_1Suite : public TestCommand VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); shouldContinue = true; break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNonNull("currentPositionLiftPercent100ths", value)); + VerifyOrReturn(CheckValue("currentPositionLiftPercent100ths.Value()", value.Value(), 10000U)); + } + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNonNull("currentPositionLiftPercentage", value)); + VerifyOrReturn(CheckValue("currentPositionLiftPercentage.Value()", value.Value(), 100)); + } + break; + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNonNull("currentPositionTiltPercent100ths", value)); + VerifyOrReturn(CheckValue("currentPositionTiltPercent100ths.Value()", value.Value(), 10000U)); + } + break; + case 8: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNonNull("currentPositionTiltPercentage", value)); + VerifyOrReturn(CheckValue("currentPositionTiltPercentage.Value()", value.Value(), 100)); + } + break; default: LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); } @@ -21669,378 +27868,81 @@ class Test_TC_ETHDIAG_1_1Suite : public TestCommand } } - static void OnFailureCallback_1(void * context, CHIP_ERROR error) + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - (static_cast(context))->OnFailureResponse_1(error); - } - - static void OnSuccessCallback_1( - void * context, - const chip::app::DataModel::Nullable & PHYRate) - { - (static_cast(context))->OnSuccessResponse_1(PHYRate); - } - - static void OnFailureCallback_2(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_2(error); - } - - static void OnSuccessCallback_2(void * context, const chip::app::DataModel::Nullable & fullDuplex) - { - (static_cast(context))->OnSuccessResponse_2(fullDuplex); - } - - static void OnFailureCallback_3(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_3(error); - } - - static void OnSuccessCallback_3(void * context, uint64_t packetRxCount) - { - (static_cast(context))->OnSuccessResponse_3(packetRxCount); - } - - static void OnFailureCallback_4(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_4(error); - } - - static void OnSuccessCallback_4(void * context, uint64_t packetTxCount) - { - (static_cast(context))->OnSuccessResponse_4(packetTxCount); - } - - static void OnFailureCallback_5(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_5(error); - } - - static void OnSuccessCallback_5(void * context, uint64_t txErrCount) - { - (static_cast(context))->OnSuccessResponse_5(txErrCount); - } - - static void OnFailureCallback_6(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_6(error); - } - - static void OnSuccessCallback_6(void * context, uint64_t collisionCount) - { - (static_cast(context))->OnSuccessResponse_6(collisionCount); - } - - static void OnFailureCallback_7(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_7(error); - } - - static void OnSuccessCallback_7(void * context, uint64_t overrunCount) - { - (static_cast(context))->OnSuccessResponse_7(overrunCount); - } - - static void OnFailureCallback_8(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_8(error); - } - - static void OnSuccessCallback_8(void * context, const chip::app::DataModel::Nullable & carrierDetect) - { - (static_cast(context))->OnSuccessResponse_8(carrierDetect); - } - - static void OnFailureCallback_9(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_9(error); - } - - static void OnSuccessCallback_9(void * context, uint64_t timeSinceReset) - { - (static_cast(context))->OnSuccessResponse_9(timeSinceReset); - } - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestReadPHYRateAttributeConstraints_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::EthernetNetworkDiagnosticsClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_1, OnFailureCallback_1, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_1( - const chip::app::DataModel::Nullable & PHYRate) - { - VerifyOrReturn(CheckConstraintType("PHYRate", "", "enum8")); - VerifyOrReturn(CheckConstraintMinValue("PHYRate", PHYRate, 0)); - VerifyOrReturn(CheckConstraintMaxValue("PHYRate", PHYRate, 9)); - NextTest(); - } - - CHIP_ERROR TestReadFullDuplexAttributeConstraints_2() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::EthernetNetworkDiagnosticsClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_2, OnFailureCallback_2, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_2(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_2(const chip::app::DataModel::Nullable & fullDuplex) - { - VerifyOrReturn(CheckConstraintType("fullDuplex", "", "bool")); - NextTest(); - } - - CHIP_ERROR TestReadPacketRxCountAttributeConstraints_3() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::EthernetNetworkDiagnosticsClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_3, OnFailureCallback_3, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_3(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_3(uint64_t packetRxCount) - { - VerifyOrReturn(CheckConstraintType("packetRxCount", "", "uint64")); - NextTest(); - } - - CHIP_ERROR TestReadPacketTxCountAttributeConstraints_4() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::EthernetNetworkDiagnosticsClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_4, OnFailureCallback_4, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_4(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_4(uint64_t packetTxCount) - { - VerifyOrReturn(CheckConstraintType("packetTxCount", "", "uint64")); - NextTest(); - } - - CHIP_ERROR TestReadTxErrCountAttributeConstraints_5() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::EthernetNetworkDiagnosticsClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_5, OnFailureCallback_5, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_5(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_5(uint64_t txErrCount) - { - VerifyOrReturn(CheckConstraintType("txErrCount", "", "uint64")); - NextTest(); - } - - CHIP_ERROR TestReadCollisionCountAttributeConstraints_6() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::EthernetNetworkDiagnosticsClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_6, OnFailureCallback_6, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_6(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_6(uint64_t collisionCount) - { - VerifyOrReturn(CheckConstraintType("collisionCount", "", "uint64")); - NextTest(); - } - - CHIP_ERROR TestReadOverrunCountAttributeConstraints_7() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::EthernetNetworkDiagnosticsClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_7, OnFailureCallback_7, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_7(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_7(uint64_t overrunCount) - { - VerifyOrReturn(CheckConstraintType("overrunCount", "", "uint64")); - NextTest(); - } - - CHIP_ERROR TestReadCarrierDetectAttributeConstraints_8() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::EthernetNetworkDiagnosticsClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_8, OnFailureCallback_8, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_8(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_8(const chip::app::DataModel::Nullable & carrierDetect) - { - VerifyOrReturn(CheckConstraintType("carrierDetect", "", "bool")); - NextTest(); - } - - CHIP_ERROR TestReadTimeSinceResetAttributeConstraints_9() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::EthernetNetworkDiagnosticsClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_9, OnFailureCallback_9, true)); + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "0: Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "1a: TH sends UpOrOpen command to preposition the DUT in the opposite direction"); + chip::app::Clusters::WindowCovering::Commands::UpOrOpen::Type value; + return SendCommand(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, WindowCovering::Commands::UpOrOpen::Id, value); + } + case 2: { + LogStep(2, "1b: TH Waits for fastMotionDuration seconds movement(s) on the device"); + SetIdentity(kIdentityAlpha); + return WaitForMs(mFastMotionDuration.HasValue() ? mFastMotionDuration.Value() : 3000U); + } + case 3: { + LogStep(3, "2a: TH sends DownOrClose command to DUT"); + chip::app::Clusters::WindowCovering::Commands::DownOrClose::Type value; + return SendCommand(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, WindowCovering::Commands::DownOrClose::Id, + value); + } + case 4: { + LogStep(4, "2b: TH Waits for fullMotionDuration seconds movement(s) on the device"); + SetIdentity(kIdentityAlpha); + return WaitForMs(mFullMotionDuration.HasValue() ? mFullMotionDuration.Value() : 6000U); + } + case 5: { + LogStep(5, "3a: If (PA & LF) TH reads CurrentPositionLiftPercent100ths attribute from DUT"); + VerifyOrdo(!ShouldSkip("WNCV_LF && WNCV_PA_LF"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, + WindowCovering::Attributes::CurrentPositionLiftPercent100ths::Id); + } + case 6: { + LogStep(6, "3b: If (PA & LF) TH reads CurrentPositionLiftPercentage optional attribute from DUT"); + VerifyOrdo(!ShouldSkip("WNCV_LF && WNCV_PA_LF && A_CURRENTPOSITIONLIFTPERCENTAGE"), + return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, + WindowCovering::Attributes::CurrentPositionLiftPercentage::Id); + } + case 7: { + LogStep(7, "3c: If (PA & TL) TH reads CurrentPositionTiltPercent100ths attribute from DUT"); + VerifyOrdo(!ShouldSkip("WNCV_TL && WNCV_PA_TL"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, + WindowCovering::Attributes::CurrentPositionTiltPercent100ths::Id); + } + case 8: { + LogStep(8, "3d: If (PA & TL) TH reads CurrentPositionTiltPercentage optional attribute from DUT"); + VerifyOrdo(!ShouldSkip("WNCV_TL && WNCV_PA_TL && A_CURRENTPOSITIONLIFTPERCENTAGE"), + return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, + WindowCovering::Attributes::CurrentPositionTiltPercentage::Id); + } + } return CHIP_NO_ERROR; } - - void OnFailureResponse_9(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_9(uint64_t timeSinceReset) - { - VerifyOrReturn(CheckConstraintType("timeSinceReset", "", "uint64")); - NextTest(); - } }; -class Test_TC_ETHDIAG_2_1Suite : public TestCommand +class Test_TC_WNCV_4_1Suite : public TestCommand { public: - Test_TC_ETHDIAG_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_ETHDIAG_2_1", credsIssuerConfig), mTestIndex(0) + Test_TC_WNCV_4_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_WNCV_4_1", 13, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("fullMotionDuration", 0, UINT16_MAX, &mFullMotionDuration); AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_ETHDIAG_2_1Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_ETHDIAG_2_1\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_ETHDIAG_2_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } + ~Test_TC_WNCV_4_1Suite() {} chip::System::Clock::Timeout GetWaitDuration() const override { @@ -22048,14 +27950,18 @@ class Test_TC_ETHDIAG_2_1Suite : public TestCommand } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 1; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; + chip::Optional mFullMotionDuration; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -22066,6 +27972,68 @@ class Test_TC_ETHDIAG_2_1Suite : public TestCommand VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); shouldContinue = true; break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintNotValue("value", value, 0U)); + } + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNonNull("targetPositionLiftPercent100ths", value)); + VerifyOrReturn(CheckValue("targetPositionLiftPercent100ths.Value()", value.Value(), 2500U)); + } + break; + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 8: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("operationalStatus", value, 0)); + } + break; + case 9: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 10: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 11: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 12: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("operationalStatus", value, 0)); + } + break; default: LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); } @@ -22076,81 +28044,107 @@ class Test_TC_ETHDIAG_2_1Suite : public TestCommand } } - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "0: Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "1a: TH sends DownOrClose command to preposition the DUT in the opposite direction"); + chip::app::Clusters::WindowCovering::Commands::DownOrClose::Type value; + return SendCommand(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, WindowCovering::Commands::DownOrClose::Id, + value); + } + case 2: { + LogStep(2, "1b: TH waits for x seconds movement(s) on the DUT"); + SetIdentity(kIdentityAlpha); + return WaitForMs(mFullMotionDuration.HasValue() ? mFullMotionDuration.Value() : 6000U); + } + case 3: { + LogStep(3, "1c: If (PA & LF) TH reads CurrentPositionLiftPercent100ths attribute from DUT"); + VerifyOrdo(!ShouldSkip("WNCV_PA_LF && WNCV_LF"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, + WindowCovering::Attributes::CurrentPositionLiftPercent100ths::Id); + } + case 4: { + LogStep(4, "2a: TH sends GoToLiftPercentage command with 25 percent to DUT"); + VerifyOrdo(!ShouldSkip("WNCV_LF && CR_GOTOLIFTPERCENTAGE"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + chip::app::Clusters::WindowCovering::Commands::GoToLiftPercentage::Type value; + value.liftPercentageValue = 25; + value.liftPercent100thsValue.Emplace(); + value.liftPercent100thsValue.Value() = 2500U; + return SendCommand(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, WindowCovering::Commands::GoToLiftPercentage::Id, + value); + } + case 5: { + LogStep(5, "2b: DUT updates its attributes"); + SetIdentity(kIdentityAlpha); + return WaitForMs(100); + } + case 6: { + LogStep(6, "2c: If (PA & LF) TH reads TargetPositionLiftPercent100ths attribute from DUT"); + VerifyOrdo(!ShouldSkip("WNCV_PA_LF && WNCV_LF"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, + WindowCovering::Attributes::TargetPositionLiftPercent100ths::Id); + } + case 7: { + LogStep(7, "3a: TH set a timeout of X minutes for failure"); + SetIdentity(kIdentityAlpha); + return WaitForMs(mFullMotionDuration.HasValue() ? mFullMotionDuration.Value() : 6000U); + } + case 8: { + LogStep(8, "3b: TH reads OperationalStatus attribute from DUT"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, + WindowCovering::Attributes::OperationalStatus::Id); + } + case 9: { + LogStep(9, "4a: TH sends GoToLiftPercentage command with 75.20 percent to DUT"); + VerifyOrdo(!ShouldSkip("WNCV_LF && CR_GOTOLIFTPERCENTAGE"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + chip::app::Clusters::WindowCovering::Commands::GoToLiftPercentage::Type value; + value.liftPercentageValue = 75; + value.liftPercent100thsValue.Emplace(); + value.liftPercent100thsValue.Value() = 7520U; + return SendCommand(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, WindowCovering::Commands::GoToLiftPercentage::Id, + value); + } + case 10: { + LogStep(10, "4b: DUT updates its attributes"); + SetIdentity(kIdentityAlpha); + return WaitForMs(100); + } + case 11: { + LogStep(11, "5a: TH waits for x seconds movement(s) on the DUT"); + SetIdentity(kIdentityAlpha); + return WaitForMs(mFullMotionDuration.HasValue() ? mFullMotionDuration.Value() : 6000U); + } + case 12: { + LogStep(12, "5b: TH reads OperationalStatus attribute from DUT"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, + WindowCovering::Attributes::OperationalStatus::Id); + } + } + return CHIP_NO_ERROR; } }; -class Test_TC_FLW_1_1Suite : public TestCommand +class Test_TC_WNCV_4_2Suite : public TestCommand { public: - Test_TC_FLW_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_FLW_1_1", credsIssuerConfig), mTestIndex(0) + Test_TC_WNCV_4_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_WNCV_4_2", 13, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("fullMotionDuration", 0, UINT16_MAX, &mFullMotionDuration); AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_FLW_1_1Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_FLW_1_1\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_FLW_1_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Read the global attribute constraints: ClusterRevision\n"); - err = TestReadTheGlobalAttributeConstraintsClusterRevision_1(); - break; - case 2: - ChipLogProgress(chipTool, - " ***** Test Step 2 : write the default values to mandatory global attribute: ClusterRevision\n"); - err = TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_2(); - break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Read the global attribute: AttributeList\n"); - err = TestReadTheGlobalAttributeAttributeList_3(); - break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } + ~Test_TC_WNCV_4_2Suite() {} chip::System::Clock::Timeout GetWaitDuration() const override { @@ -22158,259 +28152,221 @@ class Test_TC_FLW_1_1Suite : public TestCommand } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 4; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; + chip::Optional mFullMotionDuration; chip::Optional mTimeout; - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - static void OnFailureCallback_1(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_1(error); - } - - static void OnSuccessCallback_1(void * context, uint16_t clusterRevision) - { - (static_cast(context))->OnSuccessResponse_1(clusterRevision); - } - - static void OnFailureCallback_2(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_2(error); - } - - static void OnSuccessCallback_2(void * context) { (static_cast(context))->OnSuccessResponse_2(); } - - static void OnFailureCallback_3(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_3(error); - } - - static void OnSuccessCallback_3(void * context, const chip::app::DataModel::DecodableList & attributeList) - { - (static_cast(context))->OnSuccessResponse_3(attributeList); - } + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } // // Tests methods // - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestReadTheGlobalAttributeConstraintsClusterRevision_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::FlowMeasurementClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_1, OnFailureCallback_1, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_1(uint16_t clusterRevision) - { - VerifyOrReturn(CheckConstraintType("clusterRevision", "", "uint16")); - NextTest(); - } - - CHIP_ERROR TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_2() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::FlowMeasurementClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - uint16_t clusterRevisionArgument; - clusterRevisionArgument = 2U; - - ReturnErrorOnFailure(cluster.WriteAttribute( - clusterRevisionArgument, this, OnSuccessCallback_2, OnFailureCallback_2)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_2(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - NextTest(); - } - - void OnSuccessResponse_2() { ThrowSuccessResponse(); } - - CHIP_ERROR TestReadTheGlobalAttributeAttributeList_3() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::FlowMeasurementClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_3, OnFailureCallback_3, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_3(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_3(const chip::app::DataModel::DecodableList & attributeList) - { - VerifyOrReturn(CheckConstraintType("attributeList", "", "list")); - NextTest(); - } -}; - -class Test_TC_FLW_2_1Suite : public TestCommand -{ -public: - Test_TC_FLW_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_FLW_2_1", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_FLW_2_1Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_FLW_2_1\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_FLW_2_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); + bool shouldContinue = false; - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) + switch (mTestIndex - 1) { case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; break; case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : read the mandatory attribute: MeasuredValue\n"); - err = TestReadTheMandatoryAttributeMeasuredValue_1(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : read the mandatory attribute: MinMeasuredValue\n"); - err = TestReadTheMandatoryAttributeMinMeasuredValue_2(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; break; case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : read the mandatory attribute: MaxMeasuredValue\n"); - err = TestReadTheMandatoryAttributeMaxMeasuredValue_3(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintNotValue("value", value, 0U)); + } break; case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : write the default value to optional attribute: MeasuredValue\n"); - err = TestWriteTheDefaultValueToOptionalAttributeMeasuredValue_4(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : write the default value to optional attribute: MinMeasuredValue\n"); - err = TestWriteTheDefaultValueToOptionalAttributeMinMeasuredValue_5(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; break; case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : write the default value to optional attribute: MaxMeasuredValue\n"); - err = TestWriteTheDefaultValueToOptionalAttributeMaxMeasuredValue_6(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNonNull("targetPositionTiltPercent100ths", value)); + VerifyOrReturn(CheckValue("targetPositionTiltPercent100ths.Value()", value.Value(), 3000U)); + } break; case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : read the mandatory attribute: MeasuredValue\n"); - err = TestReadTheMandatoryAttributeMeasuredValue_7(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; break; case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : read the mandatory attribute: MinMeasuredValue\n"); - err = TestReadTheMandatoryAttributeMinMeasuredValue_8(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("operationalStatus", value, 0)); + } break; case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : read the mandatory attribute: MaxMeasuredValue\n"); - err = TestReadTheMandatoryAttributeMaxMeasuredValue_9(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; case 10: - ChipLogProgress(chipTool, " ***** Test Step 10 : read the optional attribute: Tolerance\n"); - err = TestReadTheOptionalAttributeTolerance_10(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; break; case 11: - ChipLogProgress(chipTool, " ***** Test Step 11 : read the optional attribute: Tolerance\n"); - err = TestReadTheOptionalAttributeTolerance_11(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; break; case 12: - ChipLogProgress(chipTool, " ***** Test Step 12 : write the default value to optional attribute: Tolerance\n"); - err = TestWriteTheDefaultValueToOptionalAttributeTolerance_12(); - break; - case 13: - ChipLogProgress(chipTool, " ***** Test Step 13 : read the optional attribute: Tolerance\n"); - err = TestReadTheOptionalAttributeTolerance_13(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("operationalStatus", value, 0)); + } break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } + + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); } + } - if (CHIP_NO_ERROR != err) + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); + case 0: { + LogStep(0, "0: Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "1a: TH sends DownOrClose command to preposition the DUT in the opposite direction"); + chip::app::Clusters::WindowCovering::Commands::DownOrClose::Type value; + return SendCommand(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, WindowCovering::Commands::DownOrClose::Id, + value); + } + case 2: { + LogStep(2, "1b: TH waits for x seconds movement(s) on the DUT"); + SetIdentity(kIdentityAlpha); + return WaitForMs(mFullMotionDuration.HasValue() ? mFullMotionDuration.Value() : 6000U); + } + case 3: { + LogStep(3, "1c: If (PA & TL) TH reads CurrentPositionTiltPercent100ths attribute from DUT"); + VerifyOrdo(!ShouldSkip("WNCV_PA_TL && WNCV_TL"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, + WindowCovering::Attributes::CurrentPositionTiltPercent100ths::Id); + } + case 4: { + LogStep(4, "2a: TH sends GoToTiltPercentage command with 30 percent to DUT"); + VerifyOrdo(!ShouldSkip("WNCV_TL && CR_GOTOTILTPERCENTAGE"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + chip::app::Clusters::WindowCovering::Commands::GoToTiltPercentage::Type value; + value.tiltPercentageValue = 30; + value.tiltPercent100thsValue.Emplace(); + value.tiltPercent100thsValue.Value() = 3000U; + return SendCommand(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, WindowCovering::Commands::GoToTiltPercentage::Id, + value); + } + case 5: { + LogStep(5, "2b: DUT updates its attributes"); + SetIdentity(kIdentityAlpha); + return WaitForMs(100); + } + case 6: { + LogStep(6, "2c: If (PA & TL) TH reads TargetPositionTiltPercent100ths attribute from DUT"); + VerifyOrdo(!ShouldSkip("WNCV_PA_TL && WNCV_TL"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, + WindowCovering::Attributes::TargetPositionTiltPercent100ths::Id); + } + case 7: { + LogStep(7, "3a: TH set a timeout of X minutes for failure"); + SetIdentity(kIdentityAlpha); + return WaitForMs(mFullMotionDuration.HasValue() ? mFullMotionDuration.Value() : 6000U); + } + case 8: { + LogStep(8, "3b: TH reads OperationalStatus attribute from DUT"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, + WindowCovering::Attributes::OperationalStatus::Id); + } + case 9: { + LogStep(9, "4a: TH sends GoToTiltPercentage command with 60.20 percent to DUT"); + VerifyOrdo(!ShouldSkip("WNCV_TL && CR_GOTOTILTPERCENTAGE"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + chip::app::Clusters::WindowCovering::Commands::GoToTiltPercentage::Type value; + value.tiltPercentageValue = 60; + value.tiltPercent100thsValue.Emplace(); + value.tiltPercent100thsValue.Value() = 6005U; + return SendCommand(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, WindowCovering::Commands::GoToTiltPercentage::Id, + value); + } + case 10: { + LogStep(10, "4b: DUT updates its attributes"); + SetIdentity(kIdentityAlpha); + return WaitForMs(100); + } + case 11: { + LogStep(11, "5a: TH waits for x seconds movement(s) on the DUT"); + SetIdentity(kIdentityAlpha); + return WaitForMs(mFullMotionDuration.HasValue() ? mFullMotionDuration.Value() : 6000U); + } + case 12: { + LogStep(12, "5b: TH reads OperationalStatus attribute from DUT"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, + WindowCovering::Attributes::OperationalStatus::Id); } + } + return CHIP_NO_ERROR; + } +}; + +class Test_TC_WNCV_4_3Suite : public TestCommand +{ +public: + Test_TC_WNCV_4_3Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_WNCV_4_3", 6, credsIssuerConfig) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } + ~Test_TC_WNCV_4_3Suite() {} + chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 14; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::app::DataModel::Nullable attrCurrentPositionLiftPercent100ths; + chip::app::DataModel::Nullable attrCurrentPositionLiftPercentage; + + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -22421,6 +28377,35 @@ class Test_TC_FLW_2_1Suite : public TestCommand VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); shouldContinue = true; break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 10000U)); + attrCurrentPositionLiftPercent100ths = value; + } + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 100)); + attrCurrentPositionLiftPercentage = value; + } + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); + break; default: LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); } @@ -22431,456 +28416,467 @@ class Test_TC_FLW_2_1Suite : public TestCommand } } - static void OnFailureCallback_1(void * context, CHIP_ERROR error) + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - (static_cast(context))->OnFailureResponse_1(error); + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "0: Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "1a: If (PA_LF & LF) TH reads CurrentPositionLiftPercent100ths from DUT"); + VerifyOrdo(!ShouldSkip("WNCV_LF && WNCV_PA_LF"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, + WindowCovering::Attributes::CurrentPositionLiftPercent100ths::Id); + } + case 2: { + LogStep(2, "1b: If (PA_LF & LF) TH reads CurrentPositionLiftPercentage from DUT"); + VerifyOrdo(!ShouldSkip("WNCV_LF && WNCV_PA_LF && A_CURRENTPOSITIONLIFTPERCENTAGE"), + return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, + WindowCovering::Attributes::CurrentPositionLiftPercentage::Id); + } + case 3: { + LogStep(3, "2b: TH sends GoToLiftPercentage command with BadParam to DUT"); + VerifyOrdo(!ShouldSkip("WNCV_LF && WNCV_PA_LF || WNCV_LF && CR_GOTOLIFTPERCENTAGE"), + return ContinueOnChipMainThread(CHIP_NO_ERROR)); + chip::app::Clusters::WindowCovering::Commands::GoToLiftPercentage::Type value; + value.liftPercentageValue = 63; + value.liftPercent100thsValue.Emplace(); + value.liftPercent100thsValue.Value() = 12288U; + return SendCommand(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, WindowCovering::Commands::GoToLiftPercentage::Id, + value); + } + case 4: { + LogStep(4, "3a: TH sends GoToLiftPercentage command with 10001 to DUT"); + VerifyOrdo(!ShouldSkip("WNCV_LF && WNCV_PA_LF || WNCV_LF && CR_GOTOLIFTPERCENTAGE"), + return ContinueOnChipMainThread(CHIP_NO_ERROR)); + chip::app::Clusters::WindowCovering::Commands::GoToLiftPercentage::Type value; + value.liftPercentageValue = 100; + value.liftPercent100thsValue.Emplace(); + value.liftPercent100thsValue.Value() = 10001U; + return SendCommand(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, WindowCovering::Commands::GoToLiftPercentage::Id, + value); + } + case 5: { + LogStep(5, "4a: TH sends GoToLiftPercentage command with 0xFFFF to DUT"); + VerifyOrdo(!ShouldSkip("WNCV_LF && WNCV_PA_LF || WNCV_LF && CR_GOTOLIFTPERCENTAGE"), + return ContinueOnChipMainThread(CHIP_NO_ERROR)); + chip::app::Clusters::WindowCovering::Commands::GoToLiftPercentage::Type value; + value.liftPercentageValue = 255; + value.liftPercent100thsValue.Emplace(); + value.liftPercent100thsValue.Value() = 65535U; + return SendCommand(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, WindowCovering::Commands::GoToLiftPercentage::Id, + value); + } + } + return CHIP_NO_ERROR; } +}; - static void OnSuccessCallback_1(void * context, const chip::app::DataModel::Nullable & measuredValue) +class Test_TC_WNCV_4_4Suite : public TestCommand +{ +public: + Test_TC_WNCV_4_4Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_WNCV_4_4", 6, credsIssuerConfig) { - (static_cast(context))->OnSuccessResponse_1(measuredValue); + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - static void OnFailureCallback_2(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_2(error); - } + ~Test_TC_WNCV_4_4Suite() {} - static void OnSuccessCallback_2(void * context, const chip::app::DataModel::Nullable & minMeasuredValue) + chip::System::Clock::Timeout GetWaitDuration() const override { - (static_cast(context))->OnSuccessResponse_2(minMeasuredValue); + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } - static void OnFailureCallback_3(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_3(error); - } - - static void OnSuccessCallback_3(void * context, const chip::app::DataModel::Nullable & maxMeasuredValue) - { - (static_cast(context))->OnSuccessResponse_3(maxMeasuredValue); - } - - static void OnFailureCallback_4(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_4(error); - } - - static void OnSuccessCallback_4(void * context) { (static_cast(context))->OnSuccessResponse_4(); } - - static void OnFailureCallback_5(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_5(error); - } - - static void OnSuccessCallback_5(void * context) { (static_cast(context))->OnSuccessResponse_5(); } - - static void OnFailureCallback_6(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_6(error); - } - - static void OnSuccessCallback_6(void * context) { (static_cast(context))->OnSuccessResponse_6(); } - - static void OnFailureCallback_7(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_7(error); - } - - static void OnSuccessCallback_7(void * context, const chip::app::DataModel::Nullable & measuredValue) - { - (static_cast(context))->OnSuccessResponse_7(measuredValue); - } - - static void OnFailureCallback_8(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_8(error); - } - - static void OnSuccessCallback_8(void * context, const chip::app::DataModel::Nullable & minMeasuredValue) - { - (static_cast(context))->OnSuccessResponse_8(minMeasuredValue); - } - - static void OnFailureCallback_9(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_9(error); - } - - static void OnSuccessCallback_9(void * context, const chip::app::DataModel::Nullable & maxMeasuredValue) - { - (static_cast(context))->OnSuccessResponse_9(maxMeasuredValue); - } - - static void OnFailureCallback_10(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_10(error); - } - - static void OnSuccessCallback_10(void * context, uint16_t tolerance) - { - (static_cast(context))->OnSuccessResponse_10(tolerance); - } - - static void OnFailureCallback_11(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_11(error); - } - - static void OnSuccessCallback_11(void * context, uint16_t tolerance) - { - (static_cast(context))->OnSuccessResponse_11(tolerance); - } - - static void OnFailureCallback_12(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_12(error); - } - - static void OnSuccessCallback_12(void * context) { (static_cast(context))->OnSuccessResponse_12(); } +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; - static void OnFailureCallback_13(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_13(error); - } + chip::app::DataModel::Nullable attrCurrentPositionTiltPercent100ths; + chip::app::DataModel::Nullable attrCurrentPositionTiltPercentage; - static void OnSuccessCallback_13(void * context, uint16_t tolerance) - { - (static_cast(context))->OnSuccessResponse_13(tolerance); - } + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } // // Tests methods // - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestReadTheMandatoryAttributeMeasuredValue_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::FlowMeasurementClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_1, OnFailureCallback_1, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_1(const chip::app::DataModel::Nullable & measuredValue) - { - VerifyOrReturn(CheckConstraintType("measuredValue", "", "uint16")); - NextTest(); - } - - CHIP_ERROR TestReadTheMandatoryAttributeMinMeasuredValue_2() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::FlowMeasurementClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_2, OnFailureCallback_2, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_2(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_2(const chip::app::DataModel::Nullable & minMeasuredValue) - { - VerifyOrReturn(CheckConstraintType("minMeasuredValue", "", "uint16")); - NextTest(); - } - - CHIP_ERROR TestReadTheMandatoryAttributeMaxMeasuredValue_3() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::FlowMeasurementClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_3, OnFailureCallback_3, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_3(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_3(const chip::app::DataModel::Nullable & maxMeasuredValue) - { - VerifyOrReturn(CheckConstraintType("maxMeasuredValue", "", "uint16")); - NextTest(); - } - - CHIP_ERROR TestWriteTheDefaultValueToOptionalAttributeMeasuredValue_4() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::FlowMeasurementClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::DataModel::Nullable measuredValueArgument; - measuredValueArgument.SetNonNull(); - measuredValueArgument.Value() = 0U; - - ReturnErrorOnFailure(cluster.WriteAttribute( - measuredValueArgument, this, OnSuccessCallback_4, OnFailureCallback_4)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_4(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - NextTest(); - } - - void OnSuccessResponse_4() { ThrowSuccessResponse(); } - - CHIP_ERROR TestWriteTheDefaultValueToOptionalAttributeMinMeasuredValue_5() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::FlowMeasurementClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::DataModel::Nullable minMeasuredValueArgument; - minMeasuredValueArgument.SetNonNull(); - minMeasuredValueArgument.Value() = 0U; - - ReturnErrorOnFailure(cluster.WriteAttribute( - minMeasuredValueArgument, this, OnSuccessCallback_5, OnFailureCallback_5)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_5(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - NextTest(); - } - - void OnSuccessResponse_5() { ThrowSuccessResponse(); } - - CHIP_ERROR TestWriteTheDefaultValueToOptionalAttributeMaxMeasuredValue_6() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::FlowMeasurementClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::DataModel::Nullable maxMeasuredValueArgument; - maxMeasuredValueArgument.SetNonNull(); - maxMeasuredValueArgument.Value() = 0U; - - ReturnErrorOnFailure(cluster.WriteAttribute( - maxMeasuredValueArgument, this, OnSuccessCallback_6, OnFailureCallback_6)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_6(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - NextTest(); - } - - void OnSuccessResponse_6() { ThrowSuccessResponse(); } - - CHIP_ERROR TestReadTheMandatoryAttributeMeasuredValue_7() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::FlowMeasurementClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_7, OnFailureCallback_7, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_7(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_7(const chip::app::DataModel::Nullable & measuredValue) - { - VerifyOrReturn(CheckConstraintType("measuredValue", "", "uint16")); - NextTest(); - } - - CHIP_ERROR TestReadTheMandatoryAttributeMinMeasuredValue_8() + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::FlowMeasurementClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_8, OnFailureCallback_8, true)); - return CHIP_NO_ERROR; - } + bool shouldContinue = false; - void OnFailureResponse_8(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 10000U)); + attrCurrentPositionTiltPercent100ths = value; + } + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 100)); + attrCurrentPositionTiltPercentage = value; + } + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } - void OnSuccessResponse_8(const chip::app::DataModel::Nullable & minMeasuredValue) - { - VerifyOrReturn(CheckConstraintType("minMeasuredValue", "", "uint16")); - NextTest(); + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } } - CHIP_ERROR TestReadTheMandatoryAttributeMaxMeasuredValue_9() + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::FlowMeasurementClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_9, OnFailureCallback_9, true)); + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "0: Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "1a: If (PA_TL & TL) TH reads CurrentPositionTiltPercent100ths from DUT"); + VerifyOrdo(!ShouldSkip("WNCV_TL && WNCV_PA_TL"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, + WindowCovering::Attributes::CurrentPositionTiltPercent100ths::Id); + } + case 2: { + LogStep(2, "1b: If (PA_TL & TL) TH reads CurrentPositionTiltPercentage from DUT"); + VerifyOrdo(!ShouldSkip("WNCV_TL && WNCV_PA_TL && A_CURRENTPOSITIONTILTPERCENTAGE"), + return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, + WindowCovering::Attributes::CurrentPositionTiltPercentage::Id); + } + case 3: { + LogStep(3, "2b: TH sends GoToTiltPercentage command with BadParam to DUT"); + VerifyOrdo(!ShouldSkip("WNCV_TL && WNCV_PA_TL || WNCV_TL && CR_GOTOTILTPERCENTAGE"), + return ContinueOnChipMainThread(CHIP_NO_ERROR)); + chip::app::Clusters::WindowCovering::Commands::GoToTiltPercentage::Type value; + value.tiltPercentageValue = 63; + value.tiltPercent100thsValue.Emplace(); + value.tiltPercent100thsValue.Value() = 12288U; + return SendCommand(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, WindowCovering::Commands::GoToTiltPercentage::Id, + value); + } + case 4: { + LogStep(4, "3a: TH sends GoToTiltPercentage command with 10001 to DUT"); + VerifyOrdo(!ShouldSkip("WNCV_TL && WNCV_PA_TL || WNCV_TL && CR_GOTOTILTPERCENTAGE"), + return ContinueOnChipMainThread(CHIP_NO_ERROR)); + chip::app::Clusters::WindowCovering::Commands::GoToTiltPercentage::Type value; + value.tiltPercentageValue = 100; + value.tiltPercent100thsValue.Emplace(); + value.tiltPercent100thsValue.Value() = 10001U; + return SendCommand(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, WindowCovering::Commands::GoToTiltPercentage::Id, + value); + } + case 5: { + LogStep(5, "4a: TH sends GoToTiltPercentage command with 0xFFFF to DUT"); + VerifyOrdo(!ShouldSkip("WNCV_TL && WNCV_PA_TL || WNCV_TL && CR_GOTOTILTPERCENTAGE"), + return ContinueOnChipMainThread(CHIP_NO_ERROR)); + chip::app::Clusters::WindowCovering::Commands::GoToTiltPercentage::Type value; + value.tiltPercentageValue = 255; + value.tiltPercent100thsValue.Emplace(); + value.tiltPercent100thsValue.Value() = 65535U; + return SendCommand(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, WindowCovering::Commands::GoToTiltPercentage::Id, + value); + } + } return CHIP_NO_ERROR; } +}; - void OnFailureResponse_9(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_9(const chip::app::DataModel::Nullable & maxMeasuredValue) +class Test_TC_WNCV_4_5Suite : public TestCommand +{ +public: + Test_TC_WNCV_4_5Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_WNCV_4_5", 16, credsIssuerConfig) { - VerifyOrReturn(CheckConstraintType("maxMeasuredValue", "", "uint16")); - NextTest(); + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("discriminator", 0, UINT16_MAX, &mDiscriminator); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - CHIP_ERROR TestReadTheOptionalAttributeTolerance_10() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::FlowMeasurementClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_10, OnFailureCallback_10, true)); - return CHIP_NO_ERROR; - } + ~Test_TC_WNCV_4_5Suite() {} - void OnFailureResponse_10(CHIP_ERROR error) + chip::System::Clock::Timeout GetWaitDuration() const override { - chip::app::StatusIB status(error); - (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() - : ThrowFailureResponse(error); + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } - void OnSuccessResponse_10(uint16_t tolerance) - { - VerifyOrReturn(CheckValue("tolerance", tolerance, 0U)); +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mDiscriminator; + chip::Optional mTimeout; - NextTest(); - } + chip::app::DataModel::Nullable attrCurrentPositionLiftPercent100ths; + chip::app::DataModel::Nullable attrCurrentPositionTiltPercent100ths; - CHIP_ERROR TestReadTheOptionalAttributeTolerance_11() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::FlowMeasurementClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_11, OnFailureCallback_11, true)); - return CHIP_NO_ERROR; - } + // + // Tests methods + // - void OnFailureResponse_11(CHIP_ERROR error) + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { - chip::app::StatusIB status(error); - (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() - : ThrowFailureResponse(error); - } + bool shouldContinue = false; - void OnSuccessResponse_11(uint16_t tolerance) - { - VerifyOrReturn(CheckConstraintType("tolerance", "", "uint16")); - VerifyOrReturn(CheckConstraintMinValue("tolerance", tolerance, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("tolerance", tolerance, 2048U)); - NextTest(); - } + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 8: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 9: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 10: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintNotValue("value", value, 0U)); - CHIP_ERROR TestWriteTheDefaultValueToOptionalAttributeTolerance_12() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::FlowMeasurementClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); + attrCurrentPositionLiftPercent100ths = value; + } + break; + case 11: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintNotValue("value", value, 0U)); - uint16_t toleranceArgument; - toleranceArgument = 0U; + attrCurrentPositionTiltPercent100ths = value; + } + break; + case 12: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 13: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 14: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + if (attrCurrentPositionLiftPercent100ths.IsNull()) + { + VerifyOrReturn(CheckValueNull("currentPositionLiftPercent100ths", value)); + } + else + { + VerifyOrReturn(CheckValueNonNull("currentPositionLiftPercent100ths", value)); + VerifyOrReturn(CheckValue("currentPositionLiftPercent100ths.Value()", value.Value(), + attrCurrentPositionLiftPercent100ths.Value())); + } + } + break; + case 15: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + if (attrCurrentPositionTiltPercent100ths.IsNull()) + { + VerifyOrReturn(CheckValueNull("currentPositionTiltPercent100ths", value)); + } + else + { + VerifyOrReturn(CheckValueNonNull("currentPositionTiltPercent100ths", value)); + VerifyOrReturn(CheckValue("currentPositionTiltPercent100ths.Value()", value.Value(), + attrCurrentPositionTiltPercent100ths.Value())); + } + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } - ReturnErrorOnFailure(cluster.WriteAttribute( - toleranceArgument, this, OnSuccessCallback_12, OnFailureCallback_12)); - return CHIP_NO_ERROR; + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } } - void OnFailureResponse_12(CHIP_ERROR error) + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - chip::app::StatusIB status(error); - if (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) + using namespace chip::app::Clusters; + switch (testIndex) { - NextTest(); + case 0: { + LogStep(0, "0a: Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "0b: TH sends UpOrOpen command to preposition the DUT"); + chip::app::Clusters::WindowCovering::Commands::UpOrOpen::Type value; + return SendCommand(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, WindowCovering::Commands::UpOrOpen::Id, value); + } + case 2: { + LogStep(2, "1a: If (PA_LF & LF) TH sends GoToLiftPercentage command with 90%% to DUT"); + VerifyOrdo(!ShouldSkip("WNCV_LF && WNCV_PA_LF"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + chip::app::Clusters::WindowCovering::Commands::GoToLiftPercentage::Type value; + value.liftPercentageValue = 90; + value.liftPercent100thsValue.Emplace(); + value.liftPercent100thsValue.Value() = 9000U; + return SendCommand(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, WindowCovering::Commands::GoToLiftPercentage::Id, + value); + } + case 3: { + LogStep(3, "1b: TH Waits for 100ms-1s"); + SetIdentity(kIdentityAlpha); + return WaitForMs(500); + } + case 4: { + LogStep(4, "1c: TH sends StopMotion command to DUT"); + chip::app::Clusters::WindowCovering::Commands::StopMotion::Type value; + return SendCommand(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, WindowCovering::Commands::StopMotion::Id, value); + } + case 5: { + LogStep(5, "1d: TH Waits for 100ms-1s"); + SetIdentity(kIdentityAlpha); + return WaitForMs(500); + } + case 6: { + LogStep(6, "2a: If (PA_TL & TL) TH sends GoToTiltPercentage command with 90%% to DUT"); + VerifyOrdo(!ShouldSkip("WNCV_TL && WNCV_PA_TL"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + chip::app::Clusters::WindowCovering::Commands::GoToTiltPercentage::Type value; + value.tiltPercentageValue = 90; + value.tiltPercent100thsValue.Emplace(); + value.tiltPercent100thsValue.Value() = 9000U; + return SendCommand(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, WindowCovering::Commands::GoToTiltPercentage::Id, + value); + } + case 7: { + LogStep(7, "2b: TH Waits for 100ms-1s"); + SetIdentity(kIdentityAlpha); + return WaitForMs(500); + } + case 8: { + LogStep(8, "2c: TH sends StopMotion command to DUT"); + chip::app::Clusters::WindowCovering::Commands::StopMotion::Type value; + return SendCommand(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, WindowCovering::Commands::StopMotion::Id, value); + } + case 9: { + LogStep(9, "2d: TH Waits for 100ms-1s"); + SetIdentity(kIdentityAlpha); + return WaitForMs(500); + } + case 10: { + LogStep(10, "3a: TH reads CurrentPositionLiftPercent100ths from DUT"); + VerifyOrdo(!ShouldSkip("WNCV_LF && WNCV_PA_LF"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, + WindowCovering::Attributes::CurrentPositionLiftPercent100ths::Id); + } + case 11: { + LogStep(11, "3b: TH reads CurrentPositionTiltPercent100ths from DUT"); + VerifyOrdo(!ShouldSkip("WNCV_TL && WNCV_PA_TL"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, + WindowCovering::Attributes::CurrentPositionTiltPercent100ths::Id); + } + case 12: { + LogStep(12, "3c: reboot/restart the DUT"); + SetIdentity(kIdentityAlpha); + return Reboot(mDiscriminator.HasValue() ? mDiscriminator.Value() : 3840U); + } + case 13: { + LogStep(13, "3d: Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 14: { + LogStep(14, "3e: TH reads CurrentPositionLiftPercent100ths from DUT"); + VerifyOrdo(!ShouldSkip("WNCV_LF && WNCV_PA_LF"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, + WindowCovering::Attributes::CurrentPositionLiftPercent100ths::Id); + } + case 15: { + LogStep(15, "3f: TH reads CurrentPositionTiltPercent100ths from DUT"); + VerifyOrdo(!ShouldSkip("WNCV_TL && WNCV_PA_TL"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, + WindowCovering::Attributes::CurrentPositionTiltPercent100ths::Id); } - else - { - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - NextTest(); } - } - - void OnSuccessResponse_12() { ThrowSuccessResponse(); } - - CHIP_ERROR TestReadTheOptionalAttributeTolerance_13() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::FlowMeasurementClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_13, OnFailureCallback_13, true)); return CHIP_NO_ERROR; } - - void OnFailureResponse_13(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() - : ThrowFailureResponse(error); - } - - void OnSuccessResponse_13(uint16_t tolerance) - { - VerifyOrReturn(CheckValue("tolerance", tolerance, 0U)); - - NextTest(); - } }; -class Test_TC_FLW_2_2Suite : public TestCommand +class TV_TargetNavigatorClusterSuite : public TestCommand { public: - Test_TC_FLW_2_2Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_FLW_2_2", credsIssuerConfig), mTestIndex(0) + TV_TargetNavigatorClusterSuite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("TV_TargetNavigatorCluster", 4, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -22888,53 +28884,7 @@ class Test_TC_FLW_2_2Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_FLW_2_2Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_FLW_2_2\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_FLW_2_2\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : read the mandatory attribute: MeasuredValue\n"); - err = TestReadTheMandatoryAttributeMeasuredValue_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : read the mandatory attribute: MeasuredValue\n"); - err = TestReadTheMandatoryAttributeMeasuredValue_2(); - break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } + ~TV_TargetNavigatorClusterSuite() {} chip::System::Clock::Timeout GetWaitDuration() const override { @@ -22942,14 +28892,17 @@ class Test_TC_FLW_2_2Suite : public TestCommand } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 3; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -22960,6 +28913,44 @@ class Test_TC_FLW_2_2Suite : public TestCommand VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); shouldContinue = true; break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + { + auto iter_0 = value.begin(); + VerifyOrReturn(CheckNextListItemDecodes("targetList", iter_0, 0)); + VerifyOrReturn(CheckValue("targetList[0].identifier", iter_0.GetValue().identifier, 1)); + VerifyOrReturn( + CheckValueAsString("targetList[0].name", iter_0.GetValue().name, chip::CharSpan("exampleName", 11))); + VerifyOrReturn(CheckNextListItemDecodes("targetList", iter_0, 1)); + VerifyOrReturn(CheckValue("targetList[1].identifier", iter_0.GetValue().identifier, 2)); + VerifyOrReturn( + CheckValueAsString("targetList[1].name", iter_0.GetValue().name, chip::CharSpan("exampleName", 11))); + VerifyOrReturn(CheckNoMoreListItems("targetList", iter_0, 2)); + } + } + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("currentTarget", value, 0)); + } + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::TargetNavigator::Commands::NavigateTargetResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("status", value.status, 0)); + + VerifyOrReturn(CheckValuePresent("data", value.data)); + VerifyOrReturn(CheckValueAsString("data.Value()", value.data.Value(), chip::CharSpan("data response", 13))); + } + break; default: LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); } @@ -22970,88 +28961,44 @@ class Test_TC_FLW_2_2Suite : public TestCommand } } - static void OnFailureCallback_1(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_1(error); - } - - static void OnSuccessCallback_1(void * context, const chip::app::DataModel::Nullable & measuredValue) - { - (static_cast(context))->OnSuccessResponse_1(measuredValue); - } - - static void OnFailureCallback_2(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_2(error); - } - - static void OnSuccessCallback_2(void * context, const chip::app::DataModel::Nullable & measuredValue) - { - (static_cast(context))->OnSuccessResponse_2(measuredValue); - } - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestReadTheMandatoryAttributeMeasuredValue_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::FlowMeasurementClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_1, OnFailureCallback_1, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_1(const chip::app::DataModel::Nullable & measuredValue) - { - VerifyOrReturn(CheckConstraintType("measuredValue", "", "uint16")); - NextTest(); - } - - CHIP_ERROR TestReadTheMandatoryAttributeMeasuredValue_2() + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::FlowMeasurementClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_2, OnFailureCallback_2, true)); + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "Read attribute Target Navigator list"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TargetNavigator::Id, TargetNavigator::Attributes::TargetList::Id); + } + case 2: { + LogStep(2, "Read attribute current navigator target"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TargetNavigator::Id, + TargetNavigator::Attributes::CurrentTarget::Id); + } + case 3: { + LogStep(3, "Navigate Target Request Command"); + chip::app::Clusters::TargetNavigator::Commands::NavigateTarget::Type value; + value.target = 1; + value.data.Emplace(); + value.data.Value() = chip::Span("1garbage: not in length on purpose", 1); + return SendCommand(kIdentityAlpha, GetEndpoint(1), TargetNavigator::Id, TargetNavigator::Commands::NavigateTarget::Id, + value); + } + } return CHIP_NO_ERROR; } - - void OnFailureResponse_2(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_2(const chip::app::DataModel::Nullable & measuredValue) - { - VerifyOrReturn(CheckConstraintType("measuredValue", "", "uint16")); - NextTest(); - } }; -class Test_TC_GC_1_1Suite : public TestCommand +class TV_AudioOutputClusterSuite : public TestCommand { public: - Test_TC_GC_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_GC_1_1", credsIssuerConfig), mTestIndex(0) + TV_AudioOutputClusterSuite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("TV_AudioOutputCluster", 6, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -23059,65 +29006,7 @@ class Test_TC_GC_1_1Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_GC_1_1Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_GC_1_1\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_GC_1_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : TH1 reads the BreadCrumb Attribute from the DUT\n"); - err = TestTh1ReadsTheBreadCrumbAttributeFromTheDut_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : TH1 writes the BreadCrumb attribute as 1 to the DUT\n"); - err = TestTh1WritesTheBreadCrumbAttributeAs1ToTheDut_2(); - break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : TH1 reads the BreadCrumb attribute from the DUT\n"); - err = TestTh1ReadsTheBreadCrumbAttributeFromTheDut_3(); - break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : TH1 reads the RegulatoryConfig attribute from the DUT\n"); - err = TestTh1ReadsTheRegulatoryConfigAttributeFromTheDut_4(); - break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : TH1 reads the LocationCapability attribute from the DUT\n"); - err = TestTh1ReadsTheLocationCapabilityAttributeFromTheDut_5(); - break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } + ~TV_AudioOutputClusterSuite() {} chip::System::Clock::Timeout GetWaitDuration() const override { @@ -23125,14 +29014,17 @@ class Test_TC_GC_1_1Suite : public TestCommand } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 6; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -23143,6 +29035,67 @@ class Test_TC_GC_1_1Suite : public TestCommand VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); shouldContinue = true; break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + { + auto iter_0 = value.begin(); + VerifyOrReturn(CheckNextListItemDecodes("outputList", iter_0, 0)); + VerifyOrReturn(CheckValue("outputList[0].index", iter_0.GetValue().index, 1)); + VerifyOrReturn(CheckValue("outputList[0].outputType", iter_0.GetValue().outputType, 0)); + VerifyOrReturn(CheckValueAsString("outputList[0].name", iter_0.GetValue().name, chip::CharSpan("HDMI", 4))); + VerifyOrReturn(CheckNextListItemDecodes("outputList", iter_0, 1)); + VerifyOrReturn(CheckValue("outputList[1].index", iter_0.GetValue().index, 2)); + VerifyOrReturn(CheckValue("outputList[1].outputType", iter_0.GetValue().outputType, 0)); + VerifyOrReturn(CheckValueAsString("outputList[1].name", iter_0.GetValue().name, chip::CharSpan("HDMI", 4))); + VerifyOrReturn(CheckNextListItemDecodes("outputList", iter_0, 2)); + VerifyOrReturn(CheckValue("outputList[2].index", iter_0.GetValue().index, 3)); + VerifyOrReturn(CheckValue("outputList[2].outputType", iter_0.GetValue().outputType, 0)); + VerifyOrReturn(CheckValueAsString("outputList[2].name", iter_0.GetValue().name, chip::CharSpan("HDMI", 4))); + VerifyOrReturn(CheckNoMoreListItems("outputList", iter_0, 3)); + } + } + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("currentOutput", value, 1)); + } + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + { + auto iter_0 = value.begin(); + VerifyOrReturn(CheckNextListItemDecodes("outputList", iter_0, 0)); + VerifyOrReturn(CheckValue("outputList[0].index", iter_0.GetValue().index, 1)); + VerifyOrReturn(CheckValue("outputList[0].outputType", iter_0.GetValue().outputType, 0)); + VerifyOrReturn( + CheckValueAsString("outputList[0].name", iter_0.GetValue().name, chip::CharSpan("HDMI Test", 9))); + VerifyOrReturn(CheckNextListItemDecodes("outputList", iter_0, 1)); + VerifyOrReturn(CheckValue("outputList[1].index", iter_0.GetValue().index, 2)); + VerifyOrReturn(CheckValue("outputList[1].outputType", iter_0.GetValue().outputType, 0)); + VerifyOrReturn(CheckValueAsString("outputList[1].name", iter_0.GetValue().name, chip::CharSpan("HDMI", 4))); + VerifyOrReturn(CheckNextListItemDecodes("outputList", iter_0, 2)); + VerifyOrReturn(CheckValue("outputList[2].index", iter_0.GetValue().index, 3)); + VerifyOrReturn(CheckValue("outputList[2].outputType", iter_0.GetValue().outputType, 0)); + VerifyOrReturn(CheckValueAsString("outputList[2].name", iter_0.GetValue().name, chip::CharSpan("HDMI", 4))); + VerifyOrReturn(CheckNoMoreListItems("outputList", iter_0, 3)); + } + } + break; default: LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); } @@ -23153,191 +29106,213 @@ class Test_TC_GC_1_1Suite : public TestCommand } } - static void OnFailureCallback_1(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_1(error); - } - - static void OnSuccessCallback_1(void * context, uint64_t breadcrumb) - { - (static_cast(context))->OnSuccessResponse_1(breadcrumb); - } - - static void OnFailureCallback_2(void * context, CHIP_ERROR error) + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - (static_cast(context))->OnFailureResponse_2(error); - } - - static void OnSuccessCallback_2(void * context) { (static_cast(context))->OnSuccessResponse_2(); } - - static void OnFailureCallback_3(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_3(error); + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "Read attribute Audio Output list"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(2), AudioOutput::Id, AudioOutput::Attributes::OutputList::Id); + } + case 2: { + LogStep(2, "Read attribute current audio output"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(2), AudioOutput::Id, AudioOutput::Attributes::CurrentOutput::Id); + } + case 3: { + LogStep(3, "Select Output Command"); + chip::app::Clusters::AudioOutput::Commands::SelectOutput::Type value; + value.index = 1; + return SendCommand(kIdentityAlpha, GetEndpoint(2), AudioOutput::Id, AudioOutput::Commands::SelectOutput::Id, value); + } + case 4: { + LogStep(4, "Rename Output Command"); + chip::app::Clusters::AudioOutput::Commands::RenameOutput::Type value; + value.index = 1; + value.name = chip::Span("HDMI Testgarbage: not in length on purpose", 9); + return SendCommand(kIdentityAlpha, GetEndpoint(2), AudioOutput::Id, AudioOutput::Commands::RenameOutput::Id, value); + } + case 5: { + LogStep(5, "Read attribute Audio Output list"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(2), AudioOutput::Id, AudioOutput::Attributes::OutputList::Id); + } + } + return CHIP_NO_ERROR; } +}; - static void OnSuccessCallback_3(void * context, uint64_t breadcrumb) +class TV_ApplicationLauncherClusterSuite : public TestCommand +{ +public: + TV_ApplicationLauncherClusterSuite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("TV_ApplicationLauncherCluster", 6, credsIssuerConfig) { - (static_cast(context))->OnSuccessResponse_3(breadcrumb); + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - static void OnFailureCallback_4(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_4(error); - } + ~TV_ApplicationLauncherClusterSuite() {} - static void OnSuccessCallback_4(void * context, - chip::app::Clusters::GeneralCommissioning::RegulatoryLocationType regulatoryConfig) + chip::System::Clock::Timeout GetWaitDuration() const override { - (static_cast(context))->OnSuccessResponse_4(regulatoryConfig); + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } - static void OnFailureCallback_5(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_5(error); - } +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; - static void OnSuccessCallback_5(void * context, - chip::app::Clusters::GeneralCommissioning::RegulatoryLocationType locationCapability) - { - (static_cast(context))->OnSuccessResponse_5(locationCapability); - } + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } // // Tests methods // - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestTh1ReadsTheBreadCrumbAttributeFromTheDut_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::GeneralCommissioningClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_1, OnFailureCallback_1, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_1(uint64_t breadcrumb) - { - VerifyOrReturn(CheckValue("breadcrumb", breadcrumb, 0ULL)); - - NextTest(); - } - - CHIP_ERROR TestTh1WritesTheBreadCrumbAttributeAs1ToTheDut_2() + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::GeneralCommissioningClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - uint64_t breadcrumbArgument; - breadcrumbArgument = 1ULL; - - ReturnErrorOnFailure(cluster.WriteAttribute( - breadcrumbArgument, this, OnSuccessCallback_2, OnFailureCallback_2)); - return CHIP_NO_ERROR; - } + bool shouldContinue = false; - void OnFailureResponse_2(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + { + auto iter_0 = value.begin(); + VerifyOrReturn(CheckNextListItemDecodes("catalogList", iter_0, 0)); + VerifyOrReturn(CheckValue("catalogList[0]", iter_0.GetValue(), 123U)); + VerifyOrReturn(CheckNextListItemDecodes("catalogList", iter_0, 1)); + VerifyOrReturn(CheckValue("catalogList[1]", iter_0.GetValue(), 456U)); + VerifyOrReturn(CheckNoMoreListItems("catalogList", iter_0, 2)); + } + } + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable + value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNull("currentApp", value)); + } + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::ApplicationLauncher::Commands::LauncherResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("status", value.status, 0)); - void OnSuccessResponse_2() { NextTest(); } + VerifyOrReturn(CheckValueAsString("data", value.data, chip::ByteSpan(chip::Uint8::from_const_char("data"), 4))); + } + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::ApplicationLauncher::Commands::LauncherResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("status", value.status, 0)); - CHIP_ERROR TestTh1ReadsTheBreadCrumbAttributeFromTheDut_3() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::GeneralCommissioningClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); + VerifyOrReturn(CheckValueAsString("data", value.data, chip::ByteSpan(chip::Uint8::from_const_char("data"), 4))); + } + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::ApplicationLauncher::Commands::LauncherResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("status", value.status, 0)); - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_3, OnFailureCallback_3, true)); - return CHIP_NO_ERROR; - } + VerifyOrReturn(CheckValueAsString("data", value.data, chip::ByteSpan(chip::Uint8::from_const_char("data"), 4))); + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } - void OnFailureResponse_3(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } } - void OnSuccessResponse_3(uint64_t breadcrumb) + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - VerifyOrReturn(CheckValue("breadcrumb", breadcrumb, 1ULL)); - - NextTest(); - } + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "Read attribute Application Launcher list"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ApplicationLauncher::Id, + ApplicationLauncher::Attributes::CatalogList::Id); + } + case 2: { + LogStep(2, "Read attribute application launcher app"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ApplicationLauncher::Id, + ApplicationLauncher::Attributes::CurrentApp::Id); + } + case 3: { + LogStep(3, "Launch App Command"); + chip::app::Clusters::ApplicationLauncher::Commands::LaunchApp::Type value; - CHIP_ERROR TestTh1ReadsTheRegulatoryConfigAttributeFromTheDut_4() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::GeneralCommissioningClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); + value.application.catalogVendorId = 123U; + value.application.applicationId = chip::Span("applicationIdgarbage: not in length on purpose", 13); - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_4, OnFailureCallback_4, true)); - return CHIP_NO_ERROR; - } + value.data.Emplace(); + value.data.Value() = chip::ByteSpan(chip::Uint8::from_const_char("datagarbage: not in length on purpose"), 4); + return SendCommand(kIdentityAlpha, GetEndpoint(1), ApplicationLauncher::Id, + ApplicationLauncher::Commands::LaunchApp::Id, value); + } + case 4: { + LogStep(4, "Stop App Command"); + chip::app::Clusters::ApplicationLauncher::Commands::StopApp::Type value; - void OnFailureResponse_4(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } + value.application.catalogVendorId = 123U; + value.application.applicationId = chip::Span("applicationIdgarbage: not in length on purpose", 13); - void OnSuccessResponse_4(chip::app::Clusters::GeneralCommissioning::RegulatoryLocationType regulatoryConfig) - { - VerifyOrReturn(CheckConstraintMinValue("regulatoryConfig", regulatoryConfig, 0)); - VerifyOrReturn(CheckConstraintMaxValue("regulatoryConfig", regulatoryConfig, 2)); - NextTest(); - } + return SendCommand(kIdentityAlpha, GetEndpoint(1), ApplicationLauncher::Id, ApplicationLauncher::Commands::StopApp::Id, + value); + } + case 5: { + LogStep(5, "Hide App Command"); + chip::app::Clusters::ApplicationLauncher::Commands::HideApp::Type value; - CHIP_ERROR TestTh1ReadsTheLocationCapabilityAttributeFromTheDut_5() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::GeneralCommissioningClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); + value.application.catalogVendorId = 123U; + value.application.applicationId = chip::Span("applicationIdgarbage: not in length on purpose", 13); - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_5, OnFailureCallback_5, true)); + return SendCommand(kIdentityAlpha, GetEndpoint(1), ApplicationLauncher::Id, ApplicationLauncher::Commands::HideApp::Id, + value); + } + } return CHIP_NO_ERROR; } - - void OnFailureResponse_5(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_5(chip::app::Clusters::GeneralCommissioning::RegulatoryLocationType locationCapability) - { - VerifyOrReturn(CheckConstraintMinValue("locationCapability", locationCapability, 0)); - VerifyOrReturn(CheckConstraintMaxValue("locationCapability", locationCapability, 2)); - NextTest(); - } }; -class Test_TC_I_1_1Suite : public TestCommand +class TV_KeypadInputClusterSuite : public TestCommand { public: - Test_TC_I_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_I_1_1", credsIssuerConfig), mTestIndex(0) + TV_KeypadInputClusterSuite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("TV_KeypadInputCluster", 2, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -23345,61 +29320,7 @@ class Test_TC_I_1_1Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_I_1_1Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_I_1_1\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_I_1_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Reads constraints of ClusterRevision attribute\n"); - err = TestReadsConstraintsOfClusterRevisionAttribute_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Read the global attribute: AttributeList\n"); - err = TestReadTheGlobalAttributeAttributeList_2(); - break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Read the global attribute: AcceptedCommandList\n"); - err = TestReadTheGlobalAttributeAcceptedCommandList_3(); - break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Read the global attribute: GeneratedCommandList\n"); - err = TestReadTheGlobalAttributeGeneratedCommandList_4(); - break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } + ~TV_KeypadInputClusterSuite() {} chip::System::Clock::Timeout GetWaitDuration() const override { @@ -23407,14 +29328,17 @@ class Test_TC_I_1_1Suite : public TestCommand } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 5; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -23425,6 +29349,14 @@ class Test_TC_I_1_1Suite : public TestCommand VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); shouldContinue = true; break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::KeypadInput::Commands::SendKeyResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("status", value.status, 0)); + } + break; default: LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); } @@ -23435,156 +29367,133 @@ class Test_TC_I_1_1Suite : public TestCommand } } - static void OnFailureCallback_1(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_1(error); - } - - static void OnSuccessCallback_1(void * context, uint16_t clusterRevision) - { - (static_cast(context))->OnSuccessResponse_1(clusterRevision); - } - - static void OnFailureCallback_2(void * context, CHIP_ERROR error) + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - (static_cast(context))->OnFailureResponse_2(error); + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "Send Key Command"); + chip::app::Clusters::KeypadInput::Commands::SendKey::Type value; + value.keyCode = static_cast(3); + return SendCommand(kIdentityAlpha, GetEndpoint(1), KeypadInput::Id, KeypadInput::Commands::SendKey::Id, value); + } + } + return CHIP_NO_ERROR; } +}; - static void OnSuccessCallback_2(void * context, const chip::app::DataModel::DecodableList & attributeList) +class TV_AccountLoginClusterSuite : public TestCommand +{ +public: + TV_AccountLoginClusterSuite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("TV_AccountLoginCluster", 4, credsIssuerConfig) { - (static_cast(context))->OnSuccessResponse_2(attributeList); + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - static void OnFailureCallback_3(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_3(error); - } + ~TV_AccountLoginClusterSuite() {} - static void OnSuccessCallback_3(void * context, - const chip::app::DataModel::DecodableList & acceptedCommandList) + chip::System::Clock::Timeout GetWaitDuration() const override { - (static_cast(context))->OnSuccessResponse_3(acceptedCommandList); + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } - static void OnFailureCallback_4(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_4(error); - } +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; - static void OnSuccessCallback_4(void * context, - const chip::app::DataModel::DecodableList & generatedCommandList) - { - (static_cast(context))->OnSuccessResponse_4(generatedCommandList); - } + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } // // Tests methods // - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestReadsConstraintsOfClusterRevisionAttribute_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::IdentifyClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_1, OnFailureCallback_1, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_1(uint16_t clusterRevision) - { - VerifyOrReturn(CheckConstraintType("clusterRevision", "", "uint16")); - NextTest(); - } - - CHIP_ERROR TestReadTheGlobalAttributeAttributeList_2() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::IdentifyClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_2, OnFailureCallback_2, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_2(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_2(const chip::app::DataModel::DecodableList & attributeList) - { - VerifyOrReturn(CheckConstraintType("attributeList", "", "list")); - NextTest(); - } - - CHIP_ERROR TestReadTheGlobalAttributeAcceptedCommandList_3() + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::IdentifyClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_3, OnFailureCallback_3, true)); - return CHIP_NO_ERROR; - } + bool shouldContinue = false; - void OnFailureResponse_3(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::AccountLogin::Commands::GetSetupPINResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueAsString("setupPIN", value.setupPIN, chip::CharSpan("tempPin123", 10))); + } + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } - void OnSuccessResponse_3(const chip::app::DataModel::DecodableList & acceptedCommandList) - { - VerifyOrReturn(CheckConstraintType("acceptedCommandList", "", "list")); - NextTest(); + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } } - CHIP_ERROR TestReadTheGlobalAttributeGeneratedCommandList_4() + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::IdentifyClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_4, OnFailureCallback_4, true)); + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "Get Setup PIN Command"); + chip::app::Clusters::AccountLogin::Commands::GetSetupPIN::Type value; + value.tempAccountIdentifier = chip::Span("asdfgarbage: not in length on purpose", 4); + return SendCommand(kIdentityAlpha, GetEndpoint(3), AccountLogin::Id, AccountLogin::Commands::GetSetupPIN::Id, value, + chip::Optional(10000)); + } + case 2: { + LogStep(2, "Login Command"); + chip::app::Clusters::AccountLogin::Commands::Login::Type value; + value.tempAccountIdentifier = chip::Span("asdfgarbage: not in length on purpose", 4); + value.setupPIN = chip::Span("tempPin123garbage: not in length on purpose", 10); + return SendCommand(kIdentityAlpha, GetEndpoint(3), AccountLogin::Id, AccountLogin::Commands::Login::Id, value, + chip::Optional(10000)); + } + case 3: { + LogStep(3, "Logout Command"); + chip::app::Clusters::AccountLogin::Commands::Logout::Type value; + return SendCommand(kIdentityAlpha, GetEndpoint(3), AccountLogin::Id, AccountLogin::Commands::Logout::Id, value, + chip::Optional(10000)); + } + } return CHIP_NO_ERROR; } - - void OnFailureResponse_4(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_4(const chip::app::DataModel::DecodableList & generatedCommandList) - { - VerifyOrReturn(CheckConstraintType("generatedCommandList", "", "list")); - NextTest(); - } }; -class Test_TC_I_2_1Suite : public TestCommand +class TV_WakeOnLanClusterSuite : public TestCommand { public: - Test_TC_I_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_I_2_1", credsIssuerConfig), mTestIndex(0) + TV_WakeOnLanClusterSuite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("TV_WakeOnLanCluster", 2, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -23592,53 +29501,7 @@ class Test_TC_I_2_1Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_I_2_1Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_I_2_1\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_I_2_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : TH reads the IdentifyTime attribute from the DUT\n"); - err = TestThReadsTheIdentifyTimeAttributeFromTheDut_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : TH reads the IdentifyType attribute from the DUT\n"); - err = TestThReadsTheIdentifyTypeAttributeFromTheDut_2(); - break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } + ~TV_WakeOnLanClusterSuite() {} chip::System::Clock::Timeout GetWaitDuration() const override { @@ -23646,14 +29509,17 @@ class Test_TC_I_2_1Suite : public TestCommand } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 3; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -23664,6 +29530,14 @@ class Test_TC_I_2_1Suite : public TestCommand VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); shouldContinue = true; break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::CharSpan value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueAsString("MACAddress", value, chip::CharSpan("00:00:00:00:00", 14))); + } + break; default: LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); } @@ -23674,90 +29548,30 @@ class Test_TC_I_2_1Suite : public TestCommand } } - static void OnFailureCallback_1(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_1(error); - } - - static void OnSuccessCallback_1(void * context, uint16_t identifyTime) - { - (static_cast(context))->OnSuccessResponse_1(identifyTime); - } - - static void OnFailureCallback_2(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_2(error); - } - - static void OnSuccessCallback_2(void * context, uint8_t identifyType) - { - (static_cast(context))->OnSuccessResponse_2(identifyType); - } - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestThReadsTheIdentifyTimeAttributeFromTheDut_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::IdentifyClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_1, OnFailureCallback_1, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_1(uint16_t identifyTime) - { - VerifyOrReturn(CheckConstraintType("identifyTime", "", "uint16")); - NextTest(); - } - - CHIP_ERROR TestThReadsTheIdentifyTypeAttributeFromTheDut_2() + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::IdentifyClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_2, OnFailureCallback_2, true)); + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "Read mac address"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WakeOnLan::Id, WakeOnLan::Attributes::MACAddress::Id); + } + } return CHIP_NO_ERROR; } - - void OnFailureResponse_2(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_2(uint8_t identifyType) - { - VerifyOrReturn(CheckConstraintType("identifyType", "", "enum8")); - VerifyOrReturn(CheckConstraintMinValue("identifyType", identifyType, 0)); - VerifyOrReturn(CheckConstraintMaxValue("identifyType", identifyType, 5)); - NextTest(); - } }; -class Test_TC_I_2_3Suite : public TestCommand +class TV_ApplicationBasicClusterSuite : public TestCommand { public: - Test_TC_I_2_3Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_I_2_3", credsIssuerConfig), mTestIndex(0) + TV_ApplicationBasicClusterSuite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("TV_ApplicationBasicCluster", 9, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -23765,172 +29579,201 @@ class Test_TC_I_2_3Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_I_2_3Suite() {} + ~TV_ApplicationBasicClusterSuite() {} - /////////// TestCommand Interface ///////// - void NextTest() override + chip::System::Clock::Timeout GetWaitDuration() const override { - CHIP_ERROR err = CHIP_NO_ERROR; + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_I_2_3\n"); - } +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_I_2_3\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // - Wait(); + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override + { + bool shouldContinue = false; - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) + switch (mTestIndex - 1) { case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : 1.Wait for the commissioned device to be retrieved\n"); - err = Test1WaitForTheCommissionedDeviceToBeRetrieved_0(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; break; case 1: - ChipLogProgress(chipTool, - " ***** Test Step 1 : TH sends TriggerEffect command to DUT with the effect identifier field set to " - "0x00 blink and the effect variant field set to 0x00 default\n"); - err = - TestThSendsTriggerEffectCommandToDutWithTheEffectIdentifierFieldSetTo0x00BlinkAndTheEffectVariantFieldSetTo0x00Default_1(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::CharSpan value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueAsString("vendorName", value, chip::CharSpan("exampleVendorName1", 18))); + } break; case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Manually check DUT executes a blink effect\n"); - err = TestManuallyCheckDutExecutesABlinkEffect_2(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("vendorID", value, 1U)); + } break; case 3: - ChipLogProgress(chipTool, - " ***** Test Step 3 : TH sends TriggerEffect command to DUT with the effect identifier field set to " - "0x01 breathe and the effect variant field set to 0x00 default\n"); - err = - TestThSendsTriggerEffectCommandToDutWithTheEffectIdentifierFieldSetTo0x01BreatheAndTheEffectVariantFieldSetTo0x00Default_3(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::CharSpan value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueAsString("applicationName", value, chip::CharSpan("exampleName1", 12))); + } break; case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : check DUT executes a breathe effect\n"); - err = TestCheckDutExecutesABreatheEffect_4(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("productID", value, 1U)); + } break; case 5: - ChipLogProgress(chipTool, - " ***** Test Step 5 : TH sends TriggerEffect command to DUT with the effect identifier field set to " - "0x02 okay and the effect variant field set to 0x00 default\n"); - err = - TestThSendsTriggerEffectCommandToDutWithTheEffectIdentifierFieldSetTo0x02OkayAndTheEffectVariantFieldSetTo0x00Default_5(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::ApplicationBasic::ApplicationStatusEnum value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("status", value, 0)); + } break; case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : check DUT executes an okay effect\n"); - err = TestCheckDutExecutesAnOkayEffect_6(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::ApplicationBasic::Structs::ApplicationBasicApplication::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("application.catalogVendorId", value.catalogVendorId, 123U)); + VerifyOrReturn( + CheckValueAsString("application.applicationId", value.applicationId, chip::CharSpan("applicationId", 13))); + } break; case 7: - ChipLogProgress(chipTool, - " ***** Test Step 7 : TH sends TriggerEffect command to DUT with the effect identifier field set to " - "0x0b channel change and the effect variant field set to 0x00 default\n"); - err = - TestThSendsTriggerEffectCommandToDutWithTheEffectIdentifierFieldSetTo0x0bChannelChangeAndTheEffectVariantFieldSetTo0x00Default_7(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::CharSpan value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueAsString("applicationVersion", value, chip::CharSpan("exampleVersion", 14))); + } break; case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : check DUT executes a channel change effect\n"); - err = TestCheckDutExecutesAChannelChangeEffect_8(); - break; - case 9: - ChipLogProgress(chipTool, - " ***** Test Step 9 : TH sends TriggerEffect command to DUT with the effect identifier field set to " - "0x01 breathe and the effect variant field set to 0x00 default\n"); - err = - TestThSendsTriggerEffectCommandToDutWithTheEffectIdentifierFieldSetTo0x01BreatheAndTheEffectVariantFieldSetTo0x00Default_9(); - break; - case 10: - ChipLogProgress(chipTool, " ***** Test Step 10 : check DUT executes a breathe effect\n"); - err = TestCheckDutExecutesABreatheEffect_10(); - break; - case 11: - ChipLogProgress(chipTool, - " ***** Test Step 11 : TH sends TriggerEffect command to DUT with the effect identifier field set to " - "0xfe finish effect and the effect variant field set to 0x00 default\n"); - err = - TestThSendsTriggerEffectCommandToDutWithTheEffectIdentifierFieldSetTo0xfeFinishEffectAndTheEffectVariantFieldSetTo0x00Default_11(); - break; - case 12: - ChipLogProgress( - chipTool, " ***** Test Step 12 : Manually check DUT stops the breathe effect after the current effect sequence\n"); - err = TestManuallyCheckDutStopsTheBreatheEffectAfterTheCurrentEffectSequence_12(); - break; - case 13: - ChipLogProgress(chipTool, - " ***** Test Step 13 : TH sends TriggerEffect command to DUT with the effect identifier field set to " - "0x01 breathe and the effect variant field set to 0x00 default\n"); - err = - TestThSendsTriggerEffectCommandToDutWithTheEffectIdentifierFieldSetTo0x01BreatheAndTheEffectVariantFieldSetTo0x00Default_13(); - break; - case 14: - ChipLogProgress(chipTool, " ***** Test Step 14 : Manually check DUT executes a breathe effect\n"); - err = TestManuallyCheckDutExecutesABreatheEffect_14(); - break; - case 15: - ChipLogProgress(chipTool, - " ***** Test Step 15 : TH sends TriggerEffect command to DUT with the effect identifier field set to " - "0xff stop effect and the effect variant field set to 0x00 default\n"); - err = - TestThSendsTriggerEffectCommandToDutWithTheEffectIdentifierFieldSetTo0xffStopEffectAndTheEffectVariantFieldSetTo0x00Default_15(); - break; - case 16: - ChipLogProgress(chipTool, " ***** Test Step 16 : Check DUT stops the breathe effect as soon as possible.\n"); - err = TestCheckDutStopsTheBreatheEffectAsSoonAsPossible_16(); - break; - case 17: - ChipLogProgress(chipTool, - " ***** Test Step 17 : TH sends TriggerEffect command to DUT with the effect identifier field set to " - "0x00 blink and the effect variant field set to 0x42 unknown\n"); - err = - TestThSendsTriggerEffectCommandToDutWithTheEffectIdentifierFieldSetTo0x00BlinkAndTheEffectVariantFieldSetTo0x42Unknown_17(); - break; - case 18: - ChipLogProgress(chipTool, " ***** Test Step 18 : Check DUT executes a blink effect.\n"); - err = TestCheckDutExecutesABlinkEffect_18(); - break; - case 19: - ChipLogProgress(chipTool, - " ***** Test Step 19 : TH sends TriggerEffect command to DUT with the effect identifier field set to " - "0xff stop effect and the effect variant field set to 0x00 default\n"); - err = - TestThSendsTriggerEffectCommandToDutWithTheEffectIdentifierFieldSetTo0xffStopEffectAndTheEffectVariantFieldSetTo0x00Default_19(); - break; - case 20: - ChipLogProgress(chipTool, - " ***** Test Step 20 : Check DUT stops any effect that may be still running as soon as possible\n"); - err = TestCheckDutStopsAnyEffectThatMayBeStillRunningAsSoonAsPossible_20(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + { + auto iter_0 = value.begin(); + VerifyOrReturn(CheckNextListItemDecodes("allowedVendorList", iter_0, 0)); + VerifyOrReturn(CheckValue("allowedVendorList[0]", iter_0.GetValue(), 1U)); + VerifyOrReturn(CheckNextListItemDecodes("allowedVendorList", iter_0, 1)); + VerifyOrReturn(CheckValue("allowedVendorList[1]", iter_0.GetValue(), 456U)); + VerifyOrReturn(CheckNoMoreListItems("allowedVendorList", iter_0, 2)); + } + } break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); } - if (CHIP_NO_ERROR != err) + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } + } + + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "Read attribute vendor name"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(3), ApplicationBasic::Id, + ApplicationBasic::Attributes::VendorName::Id); + } + case 2: { + LogStep(2, "Read attribute vendor id"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(3), ApplicationBasic::Id, ApplicationBasic::Attributes::VendorID::Id); + } + case 3: { + LogStep(3, "Read attribute application name"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(3), ApplicationBasic::Id, + ApplicationBasic::Attributes::ApplicationName::Id); + } + case 4: { + LogStep(4, "Read attribute product id"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(3), ApplicationBasic::Id, ApplicationBasic::Attributes::ProductID::Id); + } + case 5: { + LogStep(5, "Read attribute application status"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(3), ApplicationBasic::Id, ApplicationBasic::Attributes::Status::Id); + } + case 6: { + LogStep(6, "Read attribute application status"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(3), ApplicationBasic::Id, + ApplicationBasic::Attributes::Application::Id); + } + case 7: { + LogStep(7, "Read attribute application version"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(3), ApplicationBasic::Id, + ApplicationBasic::Attributes::ApplicationVersion::Id); + } + case 8: { + LogStep(8, "Read attribute application allowed vendor list"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(3), ApplicationBasic::Id, + ApplicationBasic::Attributes::AllowedVendorList::Id); + } } + return CHIP_NO_ERROR; + } +}; + +class TV_MediaPlaybackClusterSuite : public TestCommand +{ +public: + TV_MediaPlaybackClusterSuite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("TV_MediaPlaybackCluster", 22, credsIssuerConfig) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } + ~TV_MediaPlaybackClusterSuite() {} + chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 21; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -23941,45 +29784,222 @@ class Test_TC_I_2_3Suite : public TestCommand VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); shouldContinue = true; break; - case 2: + case 1: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; + { + chip::app::Clusters::MediaPlayback::PlaybackStateEnum value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("currentState", value, 0)); + } break; - case 4: + case 2: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNonNull("startTime", value)); + VerifyOrReturn(CheckValue("startTime.Value()", value.Value(), 0ULL)); + } break; - case 6: + case 3: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNonNull("duration", value)); + VerifyOrReturn(CheckValue("duration.Value()", value.Value(), 80000ULL)); + } break; - case 8: + case 4: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNonNull("sampledPosition", value)); + VerifyOrReturn(CheckValue("sampledPosition.Value().updatedAt", value.Value().updatedAt, 0ULL)); + VerifyOrReturn(CheckValueNonNull("sampledPosition.Value().position", value.Value().position)); + VerifyOrReturn(CheckValue("sampledPosition.Value().position.Value()", value.Value().position.Value(), 0ULL)); + } break; - case 10: + case 5: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; + { + float value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("playbackSpeed", value, 0.0f)); + } + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNonNull("seekRangeEnd", value)); + VerifyOrReturn(CheckValue("seekRangeEnd.Value()", value.Value(), 80000ULL)); + } + break; + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNonNull("seekRangeStart", value)); + VerifyOrReturn(CheckValue("seekRangeStart.Value()", value.Value(), 0ULL)); + } + break; + case 8: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::MediaPlayback::Commands::PlaybackResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("status", value.status, 0)); + + VerifyOrReturn(CheckValuePresent("data", value.data)); + VerifyOrReturn(CheckValueAsString("data.Value()", value.data.Value(), chip::CharSpan("data response", 13))); + } + break; + case 9: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::MediaPlayback::Commands::PlaybackResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("status", value.status, 0)); + + VerifyOrReturn(CheckValuePresent("data", value.data)); + VerifyOrReturn(CheckValueAsString("data.Value()", value.data.Value(), chip::CharSpan("data response", 13))); + } + break; + case 10: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::MediaPlayback::Commands::PlaybackResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("status", value.status, 0)); + + VerifyOrReturn(CheckValuePresent("data", value.data)); + VerifyOrReturn(CheckValueAsString("data.Value()", value.data.Value(), chip::CharSpan("data response", 13))); + } + break; + case 11: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::MediaPlayback::Commands::PlaybackResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("status", value.status, 0)); + + VerifyOrReturn(CheckValuePresent("data", value.data)); + VerifyOrReturn(CheckValueAsString("data.Value()", value.data.Value(), chip::CharSpan("data response", 13))); + } break; case 12: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; + { + chip::app::Clusters::MediaPlayback::Commands::PlaybackResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("status", value.status, 0)); + + VerifyOrReturn(CheckValuePresent("data", value.data)); + VerifyOrReturn(CheckValueAsString("data.Value()", value.data.Value(), chip::CharSpan("data response", 13))); + } + break; + case 13: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::MediaPlayback::Commands::PlaybackResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("status", value.status, 0)); + + VerifyOrReturn(CheckValuePresent("data", value.data)); + VerifyOrReturn(CheckValueAsString("data.Value()", value.data.Value(), chip::CharSpan("data response", 13))); + } break; case 14: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; + { + chip::app::Clusters::MediaPlayback::Commands::PlaybackResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("status", value.status, 0)); + + VerifyOrReturn(CheckValuePresent("data", value.data)); + VerifyOrReturn(CheckValueAsString("data.Value()", value.data.Value(), chip::CharSpan("data response", 13))); + } + break; + case 15: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::MediaPlayback::Commands::PlaybackResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("status", value.status, 0)); + + VerifyOrReturn(CheckValuePresent("data", value.data)); + VerifyOrReturn(CheckValueAsString("data.Value()", value.data.Value(), chip::CharSpan("data response", 13))); + } break; case 16: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; + { + chip::app::Clusters::MediaPlayback::Commands::PlaybackResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("status", value.status, 0)); + + VerifyOrReturn(CheckValuePresent("data", value.data)); + VerifyOrReturn(CheckValueAsString("data.Value()", value.data.Value(), chip::CharSpan("data response", 13))); + } + break; + case 17: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNonNull("sampledPosition", value)); + VerifyOrReturn(CheckValue("sampledPosition.Value().updatedAt", value.Value().updatedAt, 0ULL)); + VerifyOrReturn(CheckValueNonNull("sampledPosition.Value().position", value.Value().position)); + VerifyOrReturn(CheckValue("sampledPosition.Value().position.Value()", value.Value().position.Value(), 500ULL)); + } break; case 18: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; + { + chip::app::Clusters::MediaPlayback::Commands::PlaybackResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("status", value.status, 0)); + + VerifyOrReturn(CheckValuePresent("data", value.data)); + VerifyOrReturn(CheckValueAsString("data.Value()", value.data.Value(), chip::CharSpan("data response", 13))); + } + break; + case 19: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNonNull("sampledPosition", value)); + VerifyOrReturn(CheckValue("sampledPosition.Value().updatedAt", value.Value().updatedAt, 0ULL)); + VerifyOrReturn(CheckValueNonNull("sampledPosition.Value().position", value.Value().position)); + VerifyOrReturn(CheckValue("sampledPosition.Value().position.Value()", value.Value().position.Value(), 400ULL)); + } break; case 20: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; + { + chip::app::Clusters::MediaPlayback::Commands::PlaybackResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("status", value.status, 0)); + + VerifyOrReturn(CheckValuePresent("data", value.data)); + VerifyOrReturn(CheckValueAsString("data.Value()", value.data.Value(), chip::CharSpan("data response", 13))); + } + break; + case 21: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNonNull("sampledPosition", value)); + VerifyOrReturn(CheckValue("sampledPosition.Value().updatedAt", value.Value().updatedAt, 0ULL)); + VerifyOrReturn(CheckValueNonNull("sampledPosition.Value().position", value.Value().position)); + VerifyOrReturn(CheckValue("sampledPosition.Value().position.Value()", value.Value().position.Value(), 1000ULL)); + } break; default: LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); @@ -23991,382 +30011,650 @@ class Test_TC_I_2_3Suite : public TestCommand } } - // - // Tests methods - // - - CHIP_ERROR Test1WaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR - TestThSendsTriggerEffectCommandToDutWithTheEffectIdentifierFieldSetTo0x00BlinkAndTheEffectVariantFieldSetTo0x00Default_1() + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::Identify::Commands::TriggerEffect::Type; - - RequestType request; - request.effectIdentifier = static_cast(0); - request.effectVariant = static_cast(0); - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_1(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_1(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "Read attribute playback state"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(3), MediaPlayback::Id, MediaPlayback::Attributes::CurrentState::Id); + } + case 2: { + LogStep(2, "Read attribute start time"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(3), MediaPlayback::Id, MediaPlayback::Attributes::StartTime::Id); + } + case 3: { + LogStep(3, "Read attribute duration"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(3), MediaPlayback::Id, MediaPlayback::Attributes::Duration::Id); + } + case 4: { + LogStep(4, "Read attribute position"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(3), MediaPlayback::Id, MediaPlayback::Attributes::SampledPosition::Id); + } + case 5: { + LogStep(5, "Read attribute playback speed"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(3), MediaPlayback::Id, MediaPlayback::Attributes::PlaybackSpeed::Id); + } + case 6: { + LogStep(6, "Read attribute seek range end"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(3), MediaPlayback::Id, MediaPlayback::Attributes::SeekRangeEnd::Id); + } + case 7: { + LogStep(7, "Read attribute seek range start"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(3), MediaPlayback::Id, MediaPlayback::Attributes::SeekRangeStart::Id); + } + case 8: { + LogStep(8, "Media Playback Play Command"); + chip::app::Clusters::MediaPlayback::Commands::Play::Type value; + return SendCommand(kIdentityAlpha, GetEndpoint(3), MediaPlayback::Id, MediaPlayback::Commands::Play::Id, value); + } + case 9: { + LogStep(9, "Media Playback Pause Command"); + chip::app::Clusters::MediaPlayback::Commands::Pause::Type value; + return SendCommand(kIdentityAlpha, GetEndpoint(3), MediaPlayback::Id, MediaPlayback::Commands::Pause::Id, value); + } + case 10: { + LogStep(10, "Media Playback Stop Command"); + chip::app::Clusters::MediaPlayback::Commands::StopPlayback::Type value; + return SendCommand(kIdentityAlpha, GetEndpoint(3), MediaPlayback::Id, MediaPlayback::Commands::StopPlayback::Id, value); + } + case 11: { + LogStep(11, "Media Playback Start Over Command"); + chip::app::Clusters::MediaPlayback::Commands::StartOver::Type value; + return SendCommand(kIdentityAlpha, GetEndpoint(3), MediaPlayback::Id, MediaPlayback::Commands::StartOver::Id, value); + } + case 12: { + LogStep(12, "Media Playback Previous Command"); + chip::app::Clusters::MediaPlayback::Commands::Previous::Type value; + return SendCommand(kIdentityAlpha, GetEndpoint(3), MediaPlayback::Id, MediaPlayback::Commands::Previous::Id, value); + } + case 13: { + LogStep(13, "Media Playback Next Command"); + chip::app::Clusters::MediaPlayback::Commands::Next::Type value; + return SendCommand(kIdentityAlpha, GetEndpoint(3), MediaPlayback::Id, MediaPlayback::Commands::Next::Id, value); + } + case 14: { + LogStep(14, "Media Playback Rewind Command"); + chip::app::Clusters::MediaPlayback::Commands::Rewind::Type value; + return SendCommand(kIdentityAlpha, GetEndpoint(3), MediaPlayback::Id, MediaPlayback::Commands::Rewind::Id, value); + } + case 15: { + LogStep(15, "Media Playback Fast Forward Command"); + chip::app::Clusters::MediaPlayback::Commands::FastForward::Type value; + return SendCommand(kIdentityAlpha, GetEndpoint(3), MediaPlayback::Id, MediaPlayback::Commands::FastForward::Id, value); + } + case 16: { + LogStep(16, "Media Playback Skip Forward Command"); + chip::app::Clusters::MediaPlayback::Commands::SkipForward::Type value; + value.deltaPositionMilliseconds = 500ULL; + return SendCommand(kIdentityAlpha, GetEndpoint(3), MediaPlayback::Id, MediaPlayback::Commands::SkipForward::Id, value); + } + case 17: { + LogStep(17, "Read attribute position after skip forward"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(3), MediaPlayback::Id, MediaPlayback::Attributes::SampledPosition::Id); + } + case 18: { + LogStep(18, "Media Playback Skip Backward Command"); + chip::app::Clusters::MediaPlayback::Commands::SkipBackward::Type value; + value.deltaPositionMilliseconds = 100ULL; + return SendCommand(kIdentityAlpha, GetEndpoint(3), MediaPlayback::Id, MediaPlayback::Commands::SkipBackward::Id, value); + } + case 19: { + LogStep(19, "Read attribute position after skip backward"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(3), MediaPlayback::Id, MediaPlayback::Attributes::SampledPosition::Id); + } + case 20: { + LogStep(20, "Media Playback Seek Command"); + chip::app::Clusters::MediaPlayback::Commands::Seek::Type value; + value.position = 1000ULL; + return SendCommand(kIdentityAlpha, GetEndpoint(3), MediaPlayback::Id, MediaPlayback::Commands::Seek::Id, value); + } + case 21: { + LogStep(21, "Read attribute position after seek"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(3), MediaPlayback::Id, MediaPlayback::Attributes::SampledPosition::Id); + } + } return CHIP_NO_ERROR; } +}; - void OnFailureResponse_1(CHIP_ERROR error) +class TV_ChannelClusterSuite : public TestCommand +{ +public: + TV_ChannelClusterSuite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("TV_ChannelCluster", 7, credsIssuerConfig) { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - void OnSuccessResponse_1() { NextTest(); } + ~TV_ChannelClusterSuite() {} - CHIP_ERROR TestManuallyCheckDutExecutesABlinkEffect_2() + chip::System::Clock::Timeout GetWaitDuration() const override { - SetIdentity(kIdentityAlpha); - return UserPrompt("DUT executes a blink effect"); + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } - CHIP_ERROR - TestThSendsTriggerEffectCommandToDutWithTheEffectIdentifierFieldSetTo0x01BreatheAndTheEffectVariantFieldSetTo0x00Default_3() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::Identify::Commands::TriggerEffect::Type; - - RequestType request; - request.effectIdentifier = static_cast(1); - request.effectVariant = static_cast(0); - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_3(); - }; +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_3(error); - }; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } + // + // Tests methods + // - void OnFailureResponse_3(CHIP_ERROR error) + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } + bool shouldContinue = false; + + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + { + auto iter_0 = value.begin(); + VerifyOrReturn(CheckNextListItemDecodes("channelList", iter_0, 0)); + VerifyOrReturn(CheckValue("channelList[0].majorNumber", iter_0.GetValue().majorNumber, 6U)); + VerifyOrReturn(CheckValue("channelList[0].minorNumber", iter_0.GetValue().minorNumber, 0U)); + VerifyOrReturn(CheckValuePresent("channelList[0].name", iter_0.GetValue().name)); + VerifyOrReturn(CheckValueAsString("channelList[0].name.Value()", iter_0.GetValue().name.Value(), + chip::CharSpan("ABC", 3))); + VerifyOrReturn(CheckValuePresent("channelList[0].callSign", iter_0.GetValue().callSign)); + VerifyOrReturn(CheckValueAsString("channelList[0].callSign.Value()", iter_0.GetValue().callSign.Value(), + chip::CharSpan("KAAL-TV", 7))); + VerifyOrReturn(CheckValuePresent("channelList[0].affiliateCallSign", iter_0.GetValue().affiliateCallSign)); + VerifyOrReturn(CheckValueAsString("channelList[0].affiliateCallSign.Value()", + iter_0.GetValue().affiliateCallSign.Value(), chip::CharSpan("KAAL", 4))); + VerifyOrReturn(CheckNextListItemDecodes("channelList", iter_0, 1)); + VerifyOrReturn(CheckValue("channelList[1].majorNumber", iter_0.GetValue().majorNumber, 9U)); + VerifyOrReturn(CheckValue("channelList[1].minorNumber", iter_0.GetValue().minorNumber, 1U)); + VerifyOrReturn(CheckValuePresent("channelList[1].name", iter_0.GetValue().name)); + VerifyOrReturn(CheckValueAsString("channelList[1].name.Value()", iter_0.GetValue().name.Value(), + chip::CharSpan("PBS", 3))); + VerifyOrReturn(CheckValuePresent("channelList[1].callSign", iter_0.GetValue().callSign)); + VerifyOrReturn(CheckValueAsString("channelList[1].callSign.Value()", iter_0.GetValue().callSign.Value(), + chip::CharSpan("KCTS-TV", 7))); + VerifyOrReturn(CheckValuePresent("channelList[1].affiliateCallSign", iter_0.GetValue().affiliateCallSign)); + VerifyOrReturn(CheckValueAsString("channelList[1].affiliateCallSign.Value()", + iter_0.GetValue().affiliateCallSign.Value(), chip::CharSpan("KCTS", 4))); + VerifyOrReturn(CheckNextListItemDecodes("channelList", iter_0, 2)); + VerifyOrReturn(CheckValue("channelList[2].majorNumber", iter_0.GetValue().majorNumber, 9U)); + VerifyOrReturn(CheckValue("channelList[2].minorNumber", iter_0.GetValue().minorNumber, 2U)); + VerifyOrReturn(CheckValuePresent("channelList[2].name", iter_0.GetValue().name)); + VerifyOrReturn(CheckValueAsString("channelList[2].name.Value()", iter_0.GetValue().name.Value(), + chip::CharSpan("PBS Kids", 8))); + VerifyOrReturn(CheckValuePresent("channelList[2].callSign", iter_0.GetValue().callSign)); + VerifyOrReturn(CheckValueAsString("channelList[2].callSign.Value()", iter_0.GetValue().callSign.Value(), + chip::CharSpan("KCTS-TV", 7))); + VerifyOrReturn(CheckValuePresent("channelList[2].affiliateCallSign", iter_0.GetValue().affiliateCallSign)); + VerifyOrReturn(CheckValueAsString("channelList[2].affiliateCallSign.Value()", + iter_0.GetValue().affiliateCallSign.Value(), chip::CharSpan("KCTS", 4))); + VerifyOrReturn(CheckNextListItemDecodes("channelList", iter_0, 3)); + VerifyOrReturn(CheckValue("channelList[3].majorNumber", iter_0.GetValue().majorNumber, 9U)); + VerifyOrReturn(CheckValue("channelList[3].minorNumber", iter_0.GetValue().minorNumber, 3U)); + VerifyOrReturn(CheckValuePresent("channelList[3].name", iter_0.GetValue().name)); + VerifyOrReturn(CheckValueAsString("channelList[3].name.Value()", iter_0.GetValue().name.Value(), + chip::CharSpan("World Channel", 13))); + VerifyOrReturn(CheckValuePresent("channelList[3].callSign", iter_0.GetValue().callSign)); + VerifyOrReturn(CheckValueAsString("channelList[3].callSign.Value()", iter_0.GetValue().callSign.Value(), + chip::CharSpan("KCTS-TV", 7))); + VerifyOrReturn(CheckValuePresent("channelList[3].affiliateCallSign", iter_0.GetValue().affiliateCallSign)); + VerifyOrReturn(CheckValueAsString("channelList[3].affiliateCallSign.Value()", + iter_0.GetValue().affiliateCallSign.Value(), chip::CharSpan("KCTS", 4))); + VerifyOrReturn(CheckNoMoreListItems("channelList", iter_0, 4)); + } + } + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNonNull("lineup", value)); + VerifyOrReturn( + CheckValueAsString("lineup.Value().operatorName", value.Value().operatorName, chip::CharSpan("Comcast", 7))); + VerifyOrReturn(CheckValuePresent("lineup.Value().lineupName", value.Value().lineupName)); + VerifyOrReturn(CheckValueAsString("lineup.Value().lineupName.Value()", value.Value().lineupName.Value(), + chip::CharSpan("Comcast King County", 19))); + VerifyOrReturn(CheckValuePresent("lineup.Value().postalCode", value.Value().postalCode)); + VerifyOrReturn(CheckValueAsString("lineup.Value().postalCode.Value()", value.Value().postalCode.Value(), + chip::CharSpan("98052", 5))); + VerifyOrReturn(CheckValue("lineup.Value().lineupInfoType", value.Value().lineupInfoType, 0)); + } + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNonNull("currentChannel", value)); + VerifyOrReturn(CheckValue("currentChannel.Value().majorNumber", value.Value().majorNumber, 6U)); + VerifyOrReturn(CheckValue("currentChannel.Value().minorNumber", value.Value().minorNumber, 0U)); + VerifyOrReturn(CheckValuePresent("currentChannel.Value().name", value.Value().name)); + VerifyOrReturn(CheckValueAsString("currentChannel.Value().name.Value()", value.Value().name.Value(), + chip::CharSpan("ABC", 3))); + VerifyOrReturn(CheckValuePresent("currentChannel.Value().callSign", value.Value().callSign)); + VerifyOrReturn(CheckValueAsString("currentChannel.Value().callSign.Value()", value.Value().callSign.Value(), + chip::CharSpan("KAAL-TV", 7))); + VerifyOrReturn(CheckValuePresent("currentChannel.Value().affiliateCallSign", value.Value().affiliateCallSign)); + VerifyOrReturn(CheckValueAsString("currentChannel.Value().affiliateCallSign.Value()", + value.Value().affiliateCallSign.Value(), chip::CharSpan("KAAL", 4))); + } + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::Channel::Commands::ChangeChannelResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("status", value.status, 0)); - void OnSuccessResponse_3() { NextTest(); } + VerifyOrReturn(CheckValuePresent("data", value.data)); + VerifyOrReturn(CheckValueAsString("data.Value()", value.data.Value(), chip::CharSpan("data response", 13))); + } + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } - CHIP_ERROR TestCheckDutExecutesABreatheEffect_4() - { - SetIdentity(kIdentityAlpha); - return UserPrompt("DUT executes a breathe effect"); + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } } - CHIP_ERROR - TestThSendsTriggerEffectCommandToDutWithTheEffectIdentifierFieldSetTo0x02OkayAndTheEffectVariantFieldSetTo0x00Default_5() + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::Identify::Commands::TriggerEffect::Type; - - RequestType request; - request.effectIdentifier = static_cast(2); - request.effectVariant = static_cast(0); - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_5(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_5(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "Read attribute Channel list"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Channel::Id, Channel::Attributes::ChannelList::Id); + } + case 2: { + LogStep(2, "Read attribute channel lineup"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Channel::Id, Channel::Attributes::Lineup::Id); + } + case 3: { + LogStep(3, "Read attribute current channel"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Channel::Id, Channel::Attributes::CurrentChannel::Id); + } + case 4: { + LogStep(4, "Change Channel Command"); + chip::app::Clusters::Channel::Commands::ChangeChannel::Type value; + value.match = chip::Span("PBSgarbage: not in length on purpose", 3); + return SendCommand(kIdentityAlpha, GetEndpoint(1), Channel::Id, Channel::Commands::ChangeChannel::Id, value); + } + case 5: { + LogStep(5, "Change Channel By Number Command"); + chip::app::Clusters::Channel::Commands::ChangeChannelByNumber::Type value; + value.majorNumber = 6U; + value.minorNumber = 0U; + return SendCommand(kIdentityAlpha, GetEndpoint(1), Channel::Id, Channel::Commands::ChangeChannelByNumber::Id, value); + } + case 6: { + LogStep(6, "Skip Channel Command"); + chip::app::Clusters::Channel::Commands::SkipChannel::Type value; + value.count = 1U; + return SendCommand(kIdentityAlpha, GetEndpoint(1), Channel::Id, Channel::Commands::SkipChannel::Id, value); + } + } return CHIP_NO_ERROR; } +}; - void OnFailureResponse_5(CHIP_ERROR error) +class TV_LowPowerClusterSuite : public TestCommand +{ +public: + TV_LowPowerClusterSuite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("TV_LowPowerCluster", 2, credsIssuerConfig) { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - void OnSuccessResponse_5() { NextTest(); } + ~TV_LowPowerClusterSuite() {} - CHIP_ERROR TestCheckDutExecutesAnOkayEffect_6() + chip::System::Clock::Timeout GetWaitDuration() const override { - SetIdentity(kIdentityAlpha); - return UserPrompt("DUT executes an okay effect"); + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } - CHIP_ERROR - TestThSendsTriggerEffectCommandToDutWithTheEffectIdentifierFieldSetTo0x0bChannelChangeAndTheEffectVariantFieldSetTo0x00Default_7() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::Identify::Commands::TriggerEffect::Type; - - RequestType request; - request.effectIdentifier = static_cast(11); - request.effectVariant = static_cast(0); - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_7(); - }; +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_7(error); - }; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } + // + // Tests methods + // - void OnFailureResponse_7(CHIP_ERROR error) + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } + bool shouldContinue = false; - void OnSuccessResponse_7() { NextTest(); } + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } - CHIP_ERROR TestCheckDutExecutesAChannelChangeEffect_8() - { - SetIdentity(kIdentityAlpha); - return UserPrompt("DUT executes a channel change effect"); + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } } - CHIP_ERROR - TestThSendsTriggerEffectCommandToDutWithTheEffectIdentifierFieldSetTo0x01BreatheAndTheEffectVariantFieldSetTo0x00Default_9() + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::Identify::Commands::TriggerEffect::Type; - - RequestType request; - request.effectIdentifier = static_cast(1); - request.effectVariant = static_cast(0); - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_9(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_9(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "Sleep Input Status Command"); + chip::app::Clusters::LowPower::Commands::Sleep::Type value; + return SendCommand(kIdentityAlpha, GetEndpoint(1), LowPower::Id, LowPower::Commands::Sleep::Id, value); + } + } return CHIP_NO_ERROR; } +}; - void OnFailureResponse_9(CHIP_ERROR error) +class TV_ContentLauncherClusterSuite : public TestCommand +{ +public: + TV_ContentLauncherClusterSuite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("TV_ContentLauncherCluster", 5, credsIssuerConfig) { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - void OnSuccessResponse_9() { NextTest(); } - - CHIP_ERROR TestCheckDutExecutesABreatheEffect_10() - { - SetIdentity(kIdentityAlpha); - return UserPrompt("DUT executes a breathe effect"); - } + ~TV_ContentLauncherClusterSuite() {} - CHIP_ERROR - TestThSendsTriggerEffectCommandToDutWithTheEffectIdentifierFieldSetTo0xfeFinishEffectAndTheEffectVariantFieldSetTo0x00Default_11() + chip::System::Clock::Timeout GetWaitDuration() const override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::Identify::Commands::TriggerEffect::Type; - - RequestType request; - request.effectIdentifier = static_cast(254); - request.effectVariant = static_cast(0); - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_11(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_11(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } - void OnFailureResponse_11(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; - void OnSuccessResponse_11() { NextTest(); } + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } - CHIP_ERROR TestManuallyCheckDutStopsTheBreatheEffectAfterTheCurrentEffectSequence_12() - { - SetIdentity(kIdentityAlpha); - return UserPrompt("DUT stops the breathe effect after the current effect sequence"); - } + // + // Tests methods + // - CHIP_ERROR - TestThSendsTriggerEffectCommandToDutWithTheEffectIdentifierFieldSetTo0x01BreatheAndTheEffectVariantFieldSetTo0x00Default_13() + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::Identify::Commands::TriggerEffect::Type; + bool shouldContinue = false; - RequestType request; - request.effectIdentifier = static_cast(1); - request.effectVariant = static_cast(0); + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + { + auto iter_0 = value.begin(); + VerifyOrReturn(CheckNextListItemDecodes("acceptHeader", iter_0, 0)); + VerifyOrReturn(CheckValueAsString("acceptHeader[0]", iter_0.GetValue(), chip::CharSpan("example", 7))); + VerifyOrReturn(CheckNextListItemDecodes("acceptHeader", iter_0, 1)); + VerifyOrReturn(CheckValueAsString("acceptHeader[1]", iter_0.GetValue(), chip::CharSpan("example", 7))); + VerifyOrReturn(CheckNoMoreListItems("acceptHeader", iter_0, 2)); + } + } + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("supportedStreamingProtocols", value, 0UL)); + } + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::ContentLauncher::Commands::LaunchResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("status", value.status, 0)); - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_13(); - }; + VerifyOrReturn(CheckValuePresent("data", value.data)); + VerifyOrReturn(CheckValueAsString("data.Value()", value.data.Value(), chip::CharSpan("exampleData", 11))); + } + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::ContentLauncher::Commands::LaunchResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("status", value.status, 0)); - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_13(error); - }; + VerifyOrReturn(CheckValuePresent("data", value.data)); + VerifyOrReturn(CheckValueAsString("data.Value()", value.data.Value(), chip::CharSpan("exampleData", 11))); + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } } - void OnFailureResponse_13(CHIP_ERROR error) + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "Read attribute accept header list"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ContentLauncher::Id, + ContentLauncher::Attributes::AcceptHeader::Id); + } + case 2: { + LogStep(2, "Read attribute supported streaming protocols"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ContentLauncher::Id, + ContentLauncher::Attributes::SupportedStreamingProtocols::Id); + } + case 3: { + LogStep(3, "Launch Content Command"); + ListFreer listFreer; + chip::app::Clusters::ContentLauncher::Commands::LaunchContent::Type value; - void OnSuccessResponse_13() { NextTest(); } + { + auto * listHolder_1 = new ListHolder(1); + listFreer.add(listHolder_1); - CHIP_ERROR TestManuallyCheckDutExecutesABreatheEffect_14() - { - SetIdentity(kIdentityAlpha); - return UserPrompt("DUT executes a breathe effect"); - } + listHolder_1->mList[0].type = static_cast(1); + listHolder_1->mList[0].value = chip::Span("exampleValuegarbage: not in length on purpose", 12); + listHolder_1->mList[0].externalIDList.Emplace(); - CHIP_ERROR - TestThSendsTriggerEffectCommandToDutWithTheEffectIdentifierFieldSetTo0xffStopEffectAndTheEffectVariantFieldSetTo0x00Default_15() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::Identify::Commands::TriggerEffect::Type; + { + auto * listHolder_4 = new ListHolder(1); + listFreer.add(listHolder_4); - RequestType request; - request.effectIdentifier = static_cast(255); - request.effectVariant = static_cast(0); + listHolder_4->mList[0].name = chip::Span("namegarbage: not in length on purpose", 4); + listHolder_4->mList[0].value = chip::Span("valuegarbage: not in length on purpose", 5); - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_15(); - }; + listHolder_1->mList[0].externalIDList.Value() = + chip::app::DataModel::List( + listHolder_4->mList, 1); + } - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_15(error); - }; + value.search.parameterList = + chip::app::DataModel::List(listHolder_1->mList, + 1); + } - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } + value.autoPlay = true; + value.data.Emplace(); + value.data.Value() = chip::Span("exampleDatagarbage: not in length on purpose", 11); + return SendCommand(kIdentityAlpha, GetEndpoint(1), ContentLauncher::Id, ContentLauncher::Commands::LaunchContent::Id, + value); + } + case 4: { + LogStep(4, "Launch URL Command"); + chip::app::Clusters::ContentLauncher::Commands::LaunchURL::Type value; + value.contentURL = chip::Span("exampleUrlgarbage: not in length on purpose", 10); + value.displayString.Emplace(); + value.displayString.Value() = chip::Span("exampleDisplayStringgarbage: not in length on purpose", 20); + value.brandingInformation.Emplace(); - void OnFailureResponse_15(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } + value.brandingInformation.Value().providerName = + chip::Span("exampleNamegarbage: not in length on purpose", 11); + value.brandingInformation.Value().background.Emplace(); - void OnSuccessResponse_15() { NextTest(); } + value.brandingInformation.Value().background.Value().imageUrl.Emplace(); + value.brandingInformation.Value().background.Value().imageUrl.Value() = + chip::Span("exampleUrlgarbage: not in length on purpose", 10); + value.brandingInformation.Value().background.Value().color.Emplace(); + value.brandingInformation.Value().background.Value().color.Value() = + chip::Span("exampleColorgarbage: not in length on purpose", 12); + value.brandingInformation.Value().background.Value().size.Emplace(); - CHIP_ERROR TestCheckDutStopsTheBreatheEffectAsSoonAsPossible_16() - { - SetIdentity(kIdentityAlpha); - return UserPrompt("DUT stops the breathe effect as soon as possible"); - } + value.brandingInformation.Value().background.Value().size.Value().width = 0; + value.brandingInformation.Value().background.Value().size.Value().height = 0; + value.brandingInformation.Value().background.Value().size.Value().metric = + static_cast(0); - CHIP_ERROR - TestThSendsTriggerEffectCommandToDutWithTheEffectIdentifierFieldSetTo0x00BlinkAndTheEffectVariantFieldSetTo0x42Unknown_17() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::Identify::Commands::TriggerEffect::Type; + value.brandingInformation.Value().logo.Emplace(); - RequestType request; - request.effectIdentifier = static_cast(0); - request.effectVariant = static_cast(66); + value.brandingInformation.Value().logo.Value().imageUrl.Emplace(); + value.brandingInformation.Value().logo.Value().imageUrl.Value() = + chip::Span("exampleUrlgarbage: not in length on purpose", 10); + value.brandingInformation.Value().logo.Value().color.Emplace(); + value.brandingInformation.Value().logo.Value().color.Value() = + chip::Span("exampleColorgarbage: not in length on purpose", 12); + value.brandingInformation.Value().logo.Value().size.Emplace(); - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_17(); - }; + value.brandingInformation.Value().logo.Value().size.Value().width = 0; + value.brandingInformation.Value().logo.Value().size.Value().height = 0; + value.brandingInformation.Value().logo.Value().size.Value().metric = + static_cast(0); - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_17(error); - }; + value.brandingInformation.Value().progressBar.Emplace(); - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } + value.brandingInformation.Value().progressBar.Value().imageUrl.Emplace(); + value.brandingInformation.Value().progressBar.Value().imageUrl.Value() = + chip::Span("exampleUrlgarbage: not in length on purpose", 10); + value.brandingInformation.Value().progressBar.Value().color.Emplace(); + value.brandingInformation.Value().progressBar.Value().color.Value() = + chip::Span("exampleColorgarbage: not in length on purpose", 12); + value.brandingInformation.Value().progressBar.Value().size.Emplace(); - void OnFailureResponse_17(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } + value.brandingInformation.Value().progressBar.Value().size.Value().width = 0; + value.brandingInformation.Value().progressBar.Value().size.Value().height = 0; + value.brandingInformation.Value().progressBar.Value().size.Value().metric = + static_cast(0); - void OnSuccessResponse_17() { NextTest(); } + value.brandingInformation.Value().splash.Emplace(); - CHIP_ERROR TestCheckDutExecutesABlinkEffect_18() - { - SetIdentity(kIdentityAlpha); - return UserPrompt("DUT executes a blink effect"); - } + value.brandingInformation.Value().splash.Value().imageUrl.Emplace(); + value.brandingInformation.Value().splash.Value().imageUrl.Value() = + chip::Span("exampleUrlgarbage: not in length on purpose", 10); + value.brandingInformation.Value().splash.Value().color.Emplace(); + value.brandingInformation.Value().splash.Value().color.Value() = + chip::Span("exampleColorgarbage: not in length on purpose", 12); + value.brandingInformation.Value().splash.Value().size.Emplace(); - CHIP_ERROR - TestThSendsTriggerEffectCommandToDutWithTheEffectIdentifierFieldSetTo0xffStopEffectAndTheEffectVariantFieldSetTo0x00Default_19() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::Identify::Commands::TriggerEffect::Type; + value.brandingInformation.Value().splash.Value().size.Value().width = 0; + value.brandingInformation.Value().splash.Value().size.Value().height = 0; + value.brandingInformation.Value().splash.Value().size.Value().metric = + static_cast(0); - RequestType request; - request.effectIdentifier = static_cast(255); - request.effectVariant = static_cast(0); + value.brandingInformation.Value().waterMark.Emplace(); - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_19(); - }; + value.brandingInformation.Value().waterMark.Value().imageUrl.Emplace(); + value.brandingInformation.Value().waterMark.Value().imageUrl.Value() = + chip::Span("exampleUrlgarbage: not in length on purpose", 10); + value.brandingInformation.Value().waterMark.Value().color.Emplace(); + value.brandingInformation.Value().waterMark.Value().color.Value() = + chip::Span("exampleColorgarbage: not in length on purpose", 12); + value.brandingInformation.Value().waterMark.Value().size.Emplace(); - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_19(error); - }; + value.brandingInformation.Value().waterMark.Value().size.Value().width = 0; + value.brandingInformation.Value().waterMark.Value().size.Value().height = 0; + value.brandingInformation.Value().waterMark.Value().size.Value().metric = + static_cast(0); - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + return SendCommand(kIdentityAlpha, GetEndpoint(1), ContentLauncher::Id, ContentLauncher::Commands::LaunchURL::Id, + value); + } + } return CHIP_NO_ERROR; } - - void OnFailureResponse_19(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_19() { NextTest(); } - - CHIP_ERROR TestCheckDutStopsAnyEffectThatMayBeStillRunningAsSoonAsPossible_20() - { - SetIdentity(kIdentityAlpha); - return UserPrompt("DUT stops any effect that may be still running as soon as possible"); - } }; -class Test_TC_ILL_1_1Suite : public TestCommand +class TV_MediaInputClusterSuite : public TestCommand { public: - Test_TC_ILL_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_ILL_1_1", credsIssuerConfig), mTestIndex(0) + TV_MediaInputClusterSuite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("TV_MediaInputCluster", 8, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -24374,61 +30662,7 @@ class Test_TC_ILL_1_1Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_ILL_1_1Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_ILL_1_1\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_ILL_1_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Read the global attribute constraints: ClusterRevision\n"); - err = TestReadTheGlobalAttributeConstraintsClusterRevision_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Read the global attribute: AttributeList\n"); - err = TestReadTheGlobalAttributeAttributeList_2(); - break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Read the global attribute: AcceptedCommandList\n"); - err = TestReadTheGlobalAttributeAcceptedCommandList_3(); - break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Read the global attribute: GeneratedCommandList\n"); - err = TestReadTheGlobalAttributeGeneratedCommandList_4(); - break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } + ~TV_MediaInputClusterSuite() {} chip::System::Clock::Timeout GetWaitDuration() const override { @@ -24436,14 +30670,17 @@ class Test_TC_ILL_1_1Suite : public TestCommand } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 5; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -24454,6 +30691,72 @@ class Test_TC_ILL_1_1Suite : public TestCommand VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); shouldContinue = true; break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + { + auto iter_0 = value.begin(); + VerifyOrReturn(CheckNextListItemDecodes("inputList", iter_0, 0)); + VerifyOrReturn(CheckValue("inputList[0].index", iter_0.GetValue().index, 1)); + VerifyOrReturn(CheckValue("inputList[0].inputType", iter_0.GetValue().inputType, 4)); + VerifyOrReturn(CheckValueAsString("inputList[0].name", iter_0.GetValue().name, chip::CharSpan("HDMI", 4))); + VerifyOrReturn(CheckValueAsString("inputList[0].description", iter_0.GetValue().description, + chip::CharSpan("High-Definition Multimedia Interface", 36))); + VerifyOrReturn(CheckNextListItemDecodes("inputList", iter_0, 1)); + VerifyOrReturn(CheckValue("inputList[1].index", iter_0.GetValue().index, 2)); + VerifyOrReturn(CheckValue("inputList[1].inputType", iter_0.GetValue().inputType, 4)); + VerifyOrReturn(CheckValueAsString("inputList[1].name", iter_0.GetValue().name, chip::CharSpan("HDMI", 4))); + VerifyOrReturn(CheckValueAsString("inputList[1].description", iter_0.GetValue().description, + chip::CharSpan("High-Definition Multimedia Interface", 36))); + VerifyOrReturn(CheckNoMoreListItems("inputList", iter_0, 2)); + } + } + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("currentInput", value, 1)); + } + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + { + auto iter_0 = value.begin(); + VerifyOrReturn(CheckNextListItemDecodes("inputList", iter_0, 0)); + VerifyOrReturn(CheckValue("inputList[0].index", iter_0.GetValue().index, 1)); + VerifyOrReturn(CheckValue("inputList[0].inputType", iter_0.GetValue().inputType, 4)); + VerifyOrReturn(CheckValueAsString("inputList[0].name", iter_0.GetValue().name, chip::CharSpan("HDMI Test", 9))); + VerifyOrReturn(CheckValueAsString("inputList[0].description", iter_0.GetValue().description, + chip::CharSpan("High-Definition Multimedia Interface", 36))); + VerifyOrReturn(CheckNextListItemDecodes("inputList", iter_0, 1)); + VerifyOrReturn(CheckValue("inputList[1].index", iter_0.GetValue().index, 2)); + VerifyOrReturn(CheckValue("inputList[1].inputType", iter_0.GetValue().inputType, 4)); + VerifyOrReturn(CheckValueAsString("inputList[1].name", iter_0.GetValue().name, chip::CharSpan("HDMI", 4))); + VerifyOrReturn(CheckValueAsString("inputList[1].description", iter_0.GetValue().description, + chip::CharSpan("High-Definition Multimedia Interface", 36))); + VerifyOrReturn(CheckNoMoreListItems("inputList", iter_0, 2)); + } + } + break; default: LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); } @@ -24464,240 +30767,89 @@ class Test_TC_ILL_1_1Suite : public TestCommand } } - static void OnFailureCallback_1(void * context, CHIP_ERROR error) + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - (static_cast(context))->OnFailureResponse_1(error); - } - - static void OnSuccessCallback_1(void * context, uint16_t clusterRevision) - { - (static_cast(context))->OnSuccessResponse_1(clusterRevision); - } - - static void OnFailureCallback_2(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_2(error); + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "Read attribute media input list"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), MediaInput::Id, MediaInput::Attributes::InputList::Id); + } + case 2: { + LogStep(2, "Read current media input"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), MediaInput::Id, MediaInput::Attributes::CurrentInput::Id); + } + case 3: { + LogStep(3, "Select Input Command"); + chip::app::Clusters::MediaInput::Commands::SelectInput::Type value; + value.index = 1; + return SendCommand(kIdentityAlpha, GetEndpoint(1), MediaInput::Id, MediaInput::Commands::SelectInput::Id, value); + } + case 4: { + LogStep(4, "Hide Input Status Command"); + chip::app::Clusters::MediaInput::Commands::HideInputStatus::Type value; + return SendCommand(kIdentityAlpha, GetEndpoint(1), MediaInput::Id, MediaInput::Commands::HideInputStatus::Id, value); + } + case 5: { + LogStep(5, "Show Input Status Command"); + chip::app::Clusters::MediaInput::Commands::ShowInputStatus::Type value; + return SendCommand(kIdentityAlpha, GetEndpoint(1), MediaInput::Id, MediaInput::Commands::ShowInputStatus::Id, value); + } + case 6: { + LogStep(6, "Rename Input Command"); + chip::app::Clusters::MediaInput::Commands::RenameInput::Type value; + value.index = 1; + value.name = chip::Span("HDMI Testgarbage: not in length on purpose", 9); + return SendCommand(kIdentityAlpha, GetEndpoint(1), MediaInput::Id, MediaInput::Commands::RenameInput::Id, value); + } + case 7: { + LogStep(7, "Read attribute media input list"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), MediaInput::Id, MediaInput::Attributes::InputList::Id); + } + } + return CHIP_NO_ERROR; } +}; - static void OnSuccessCallback_2(void * context, const chip::app::DataModel::DecodableList & attributeList) +class TestClusterSuite : public TestCommand +{ +public: + TestClusterSuite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("TestCluster", 481, credsIssuerConfig) { - (static_cast(context))->OnSuccessResponse_2(attributeList); + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - static void OnFailureCallback_3(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_3(error); - } + ~TestClusterSuite() {} - static void OnSuccessCallback_3(void * context, - const chip::app::DataModel::DecodableList & acceptedCommandList) + chip::System::Clock::Timeout GetWaitDuration() const override { - (static_cast(context))->OnSuccessResponse_3(acceptedCommandList); + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } - static void OnFailureCallback_4(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_4(error); - } +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; - static void OnSuccessCallback_4(void * context, - const chip::app::DataModel::DecodableList & generatedCommandList) - { - (static_cast(context))->OnSuccessResponse_4(generatedCommandList); - } + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } // // Tests methods // - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestReadTheGlobalAttributeConstraintsClusterRevision_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::IlluminanceMeasurementClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_1, OnFailureCallback_1, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_1(uint16_t clusterRevision) - { - VerifyOrReturn(CheckConstraintType("clusterRevision", "", "uint16")); - NextTest(); - } - - CHIP_ERROR TestReadTheGlobalAttributeAttributeList_2() + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::IlluminanceMeasurementClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_2, OnFailureCallback_2, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_2(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_2(const chip::app::DataModel::DecodableList & attributeList) - { - VerifyOrReturn(CheckConstraintType("attributeList", "", "list")); - NextTest(); - } - - CHIP_ERROR TestReadTheGlobalAttributeAcceptedCommandList_3() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::IlluminanceMeasurementClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_3, OnFailureCallback_3, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_3(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_3(const chip::app::DataModel::DecodableList & acceptedCommandList) - { - VerifyOrReturn(CheckConstraintType("acceptedCommandList", "", "list")); - NextTest(); - } - - CHIP_ERROR TestReadTheGlobalAttributeGeneratedCommandList_4() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::IlluminanceMeasurementClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_4, OnFailureCallback_4, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_4(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_4(const chip::app::DataModel::DecodableList & generatedCommandList) - { - VerifyOrReturn(CheckConstraintType("generatedCommandList", "", "list")); - NextTest(); - } -}; - -class Test_TC_ILL_2_1Suite : public TestCommand -{ -public: - Test_TC_ILL_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_ILL_2_1", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_ILL_2_1Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_ILL_2_1\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_ILL_2_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : TH reads MinMeasuredValue attribute from DUT\n"); - err = TestThReadsMinMeasuredValueAttributeFromDut_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : TH reads MaxMeasuredValue attribute from DUT\n"); - err = TestThReadsMaxMeasuredValueAttributeFromDut_2(); - break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : TH reads Tolerance attribute from DUT\n"); - err = TestThReadsToleranceAttributeFromDut_3(); - break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : TH reads LightSensorType attribute from DUT\n"); - err = TestThReadsLightSensorTypeAttributeFromDut_4(); - break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 5; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; + bool shouldContinue = false; switch (mTestIndex - 1) { @@ -24705,87194 +30857,10340 @@ class Test_TC_ILL_2_1Suite : public TestCommand VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); shouldContinue = true; break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - static void OnFailureCallback_1(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_1(error); - } - - static void OnSuccessCallback_1(void * context, const chip::app::DataModel::Nullable & minMeasuredValue) - { - (static_cast(context))->OnSuccessResponse_1(minMeasuredValue); - } - - static void OnFailureCallback_2(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_2(error); - } - - static void OnSuccessCallback_2(void * context, const chip::app::DataModel::Nullable & maxMeasuredValue) - { - (static_cast(context))->OnSuccessResponse_2(maxMeasuredValue); - } - - static void OnFailureCallback_3(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_3(error); - } - - static void OnSuccessCallback_3(void * context, uint16_t tolerance) - { - (static_cast(context))->OnSuccessResponse_3(tolerance); - } - - static void OnFailureCallback_4(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_4(error); - } - - static void OnSuccessCallback_4(void * context, const chip::app::DataModel::Nullable & lightSensorType) - { - (static_cast(context))->OnSuccessResponse_4(lightSensorType); - } - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestThReadsMinMeasuredValueAttributeFromDut_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::IlluminanceMeasurementClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_1, OnFailureCallback_1, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_1(const chip::app::DataModel::Nullable & minMeasuredValue) - { - VerifyOrReturn(CheckConstraintType("minMeasuredValue", "", "uint16")); - VerifyOrReturn(CheckConstraintMinValue("minMeasuredValue", minMeasuredValue, 1U)); - VerifyOrReturn(CheckConstraintMaxValue("minMeasuredValue", minMeasuredValue, 65533U)); - NextTest(); - } - - CHIP_ERROR TestThReadsMaxMeasuredValueAttributeFromDut_2() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::IlluminanceMeasurementClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_2, OnFailureCallback_2, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_2(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_2(const chip::app::DataModel::Nullable & maxMeasuredValue) - { - VerifyOrReturn(CheckConstraintType("maxMeasuredValue", "", "uint16")); - VerifyOrReturn(CheckConstraintMinValue("maxMeasuredValue", maxMeasuredValue, 2U)); - VerifyOrReturn(CheckConstraintMaxValue("maxMeasuredValue", maxMeasuredValue, 65534U)); - NextTest(); - } - - CHIP_ERROR TestThReadsToleranceAttributeFromDut_3() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::IlluminanceMeasurementClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_3, OnFailureCallback_3, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_3(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_3(uint16_t tolerance) - { - VerifyOrReturn(CheckConstraintType("tolerance", "", "uint16")); - VerifyOrReturn(CheckConstraintMinValue("tolerance", tolerance, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("tolerance", tolerance, 2048U)); - NextTest(); - } - - CHIP_ERROR TestThReadsLightSensorTypeAttributeFromDut_4() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::IlluminanceMeasurementClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_4, OnFailureCallback_4, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_4(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_4(const chip::app::DataModel::Nullable & lightSensorType) - { - VerifyOrReturn(CheckConstraintType("lightSensorType", "", "enum8")); - NextTest(); - } -}; - -class Test_TC_LVL_1_1Suite : public TestCommand -{ -public: - Test_TC_LVL_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_LVL_1_1", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_LVL_1_1Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_LVL_1_1\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_LVL_1_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); - break; case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : read the global attribute: ClusterRevision\n"); - err = TestReadTheGlobalAttributeClusterRevision_1(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Read the global attribute constraints: ClusterRevision\n"); - err = TestReadTheGlobalAttributeConstraintsClusterRevision_2(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_COMMAND)); break; case 3: - ChipLogProgress(chipTool, - " ***** Test Step 3 : write the default values to mandatory global attribute: ClusterRevision\n"); - err = TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_3(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::TestCluster::Commands::TestSpecificResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("returnValue", value.returnValue, 7)); + } break; case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : reads back global attribute: ClusterRevision\n"); - err = TestReadsBackGlobalAttributeClusterRevision_4(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::TestCluster::Commands::TestAddArgumentsResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("returnValue", value.returnValue, 20)); + } break; case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Read the global attribute: AttributeList\n"); - err = TestReadTheGlobalAttributeAttributeList_5(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_COMMAND)); break; case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : Read the global attribute: AcceptedCommandList\n"); - err = TestReadTheGlobalAttributeAcceptedCommandList_6(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + bool value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("boolean", value, 0)); + } break; case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : Read the global attribute: GeneratedCommandList\n"); - err = TestReadTheGlobalAttributeGeneratedCommandList_7(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : read the optional global attribute: FeatureMap\n"); - err = TestReadTheOptionalGlobalAttributeFeatureMap_8(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + bool value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("boolean", value, 1)); + } break; case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : Read the optional global attribute : FeatureMap\n"); - err = TestReadTheOptionalGlobalAttributeFeatureMap_9(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; case 10: - ChipLogProgress(chipTool, " ***** Test Step 10 : write the default values to optional global attribute: FeatureMap\n"); - err = TestWriteTheDefaultValuesToOptionalGlobalAttributeFeatureMap_10(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + bool value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("boolean", value, 0)); + } break; case 11: - ChipLogProgress(chipTool, " ***** Test Step 11 : reads back optional global attribute: FeatureMap\n"); - err = TestReadsBackOptionalGlobalAttributeFeatureMap_11(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::BitFlags value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("bitmap8", value, 0)); + } break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 12; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: + case 12: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - static void OnFailureCallback_1(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_1(error); - } - - static void OnSuccessCallback_1(void * context, uint16_t clusterRevision) - { - (static_cast(context))->OnSuccessResponse_1(clusterRevision); - } - - static void OnFailureCallback_2(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_2(error); - } - - static void OnSuccessCallback_2(void * context, uint16_t clusterRevision) - { - (static_cast(context))->OnSuccessResponse_2(clusterRevision); - } - - static void OnFailureCallback_3(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_3(error); - } - - static void OnSuccessCallback_3(void * context) { (static_cast(context))->OnSuccessResponse_3(); } - - static void OnFailureCallback_4(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_4(error); - } - - static void OnSuccessCallback_4(void * context, uint16_t clusterRevision) - { - (static_cast(context))->OnSuccessResponse_4(clusterRevision); - } - - static void OnFailureCallback_5(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_5(error); - } - - static void OnSuccessCallback_5(void * context, const chip::app::DataModel::DecodableList & attributeList) - { - (static_cast(context))->OnSuccessResponse_5(attributeList); - } - - static void OnFailureCallback_6(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_6(error); - } - - static void OnSuccessCallback_6(void * context, - const chip::app::DataModel::DecodableList & acceptedCommandList) - { - (static_cast(context))->OnSuccessResponse_6(acceptedCommandList); - } - - static void OnFailureCallback_7(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_7(error); - } - - static void OnSuccessCallback_7(void * context, - const chip::app::DataModel::DecodableList & generatedCommandList) - { - (static_cast(context))->OnSuccessResponse_7(generatedCommandList); - } - - static void OnFailureCallback_8(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_8(error); - } - - static void OnSuccessCallback_8(void * context, uint32_t featureMap) - { - (static_cast(context))->OnSuccessResponse_8(featureMap); - } - - static void OnFailureCallback_9(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_9(error); - } - - static void OnSuccessCallback_9(void * context, uint32_t featureMap) - { - (static_cast(context))->OnSuccessResponse_9(featureMap); - } - - static void OnFailureCallback_10(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_10(error); - } - - static void OnSuccessCallback_10(void * context) { (static_cast(context))->OnSuccessResponse_10(); } - - static void OnFailureCallback_11(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_11(error); - } - - static void OnSuccessCallback_11(void * context, uint32_t featureMap) - { - (static_cast(context))->OnSuccessResponse_11(featureMap); - } - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestReadTheGlobalAttributeClusterRevision_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::LevelControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_1, OnFailureCallback_1, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_1(uint16_t clusterRevision) - { - VerifyOrReturn(CheckValue("clusterRevision", clusterRevision, 5U)); - - NextTest(); - } - - CHIP_ERROR TestReadTheGlobalAttributeConstraintsClusterRevision_2() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::LevelControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_2, OnFailureCallback_2, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_2(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_2(uint16_t clusterRevision) - { - VerifyOrReturn(CheckConstraintType("clusterRevision", "", "uint16")); - NextTest(); - } - - CHIP_ERROR TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_3() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::LevelControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - uint16_t clusterRevisionArgument; - clusterRevisionArgument = 4U; - - ReturnErrorOnFailure(cluster.WriteAttribute( - clusterRevisionArgument, this, OnSuccessCallback_3, OnFailureCallback_3)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_3(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - NextTest(); - } - - void OnSuccessResponse_3() { ThrowSuccessResponse(); } - - CHIP_ERROR TestReadsBackGlobalAttributeClusterRevision_4() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::LevelControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_4, OnFailureCallback_4, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_4(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_4(uint16_t clusterRevision) - { - VerifyOrReturn(CheckValue("clusterRevision", clusterRevision, 5U)); - - NextTest(); - } - - CHIP_ERROR TestReadTheGlobalAttributeAttributeList_5() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::LevelControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_5, OnFailureCallback_5, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_5(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_5(const chip::app::DataModel::DecodableList & attributeList) - { - VerifyOrReturn(CheckConstraintType("attributeList", "", "list")); - NextTest(); - } - - CHIP_ERROR TestReadTheGlobalAttributeAcceptedCommandList_6() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::LevelControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_6, OnFailureCallback_6, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_6(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_6(const chip::app::DataModel::DecodableList & acceptedCommandList) - { - VerifyOrReturn(CheckConstraintType("acceptedCommandList", "", "list")); - NextTest(); - } - - CHIP_ERROR TestReadTheGlobalAttributeGeneratedCommandList_7() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::LevelControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_7, OnFailureCallback_7, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_7(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_7(const chip::app::DataModel::DecodableList & generatedCommandList) - { - VerifyOrReturn(CheckConstraintType("generatedCommandList", "", "list")); - NextTest(); - } - - CHIP_ERROR TestReadTheOptionalGlobalAttributeFeatureMap_8() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::LevelControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_8, OnFailureCallback_8, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_8(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_8(uint32_t featureMap) - { - VerifyOrReturn(CheckValue("featureMap", featureMap, 3UL)); - - NextTest(); - } - - CHIP_ERROR TestReadTheOptionalGlobalAttributeFeatureMap_9() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::LevelControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_9, OnFailureCallback_9, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_9(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_9(uint32_t featureMap) - { - VerifyOrReturn(CheckConstraintType("featureMap", "", "map32")); - NextTest(); - } - - CHIP_ERROR TestWriteTheDefaultValuesToOptionalGlobalAttributeFeatureMap_10() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::LevelControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - uint32_t featureMapArgument; - featureMapArgument = 0UL; - - ReturnErrorOnFailure(cluster.WriteAttribute( - featureMapArgument, this, OnSuccessCallback_10, OnFailureCallback_10)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_10(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - NextTest(); - } - - void OnSuccessResponse_10() { ThrowSuccessResponse(); } - - CHIP_ERROR TestReadsBackOptionalGlobalAttributeFeatureMap_11() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::LevelControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_11, OnFailureCallback_11, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_11(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_11(uint32_t featureMap) - { - VerifyOrReturn(CheckConstraintType("featureMap", "", "map32")); - NextTest(); - } -}; - -class Test_TC_LVL_2_1Suite : public TestCommand -{ -public: - Test_TC_LVL_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_LVL_2_1", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_LVL_2_1Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_LVL_2_1\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_LVL_2_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + case 13: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::BitFlags value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("bitmap8", value, 255)); + } break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Reset level to 254\n"); - err = TestResetLevelTo254_1(); + case 14: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Wait 100ms\n"); - err = TestWait100ms_2(); + case 15: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::BitFlags value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("bitmap8", value, 0)); + } break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Reads the CurrentLevel attribute\n"); - err = TestReadsTheCurrentLevelAttribute_3(); + case 16: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::BitFlags value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("bitmap16", value, 0U)); + } break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Reads the RemainingTime attribute\n"); - err = TestReadsTheRemainingTimeAttribute_4(); + case 17: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Reads the MinLevel attribute\n"); - err = TestReadsTheMinLevelAttribute_5(); + case 18: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::BitFlags value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("bitmap16", value, 65535U)); + } break; - case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : Reads the MaxLevel attribute\n"); - err = TestReadsTheMaxLevelAttribute_6(); + case 19: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : Reads the CurrentFrequency attribute\n"); - err = TestReadsTheCurrentFrequencyAttribute_7(); + case 20: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::BitFlags value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("bitmap16", value, 0U)); + } break; - case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : Reads the MinFrequency attribute\n"); - err = TestReadsTheMinFrequencyAttribute_8(); + case 21: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::BitFlags value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("bitmap32", value, 0UL)); + } break; - case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : Reads the MaxFrequency attribute\n"); - err = TestReadsTheMaxFrequencyAttribute_9(); + case 22: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - case 10: - ChipLogProgress(chipTool, " ***** Test Step 10 : Reads the OnOffTransitionTime attribute\n"); - err = TestReadsTheOnOffTransitionTimeAttribute_10(); + case 23: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::BitFlags value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("bitmap32", value, 4294967295UL)); + } break; - case 11: - ChipLogProgress(chipTool, " ***** Test Step 11 : Reads the OnLevel attribute \n"); - err = TestReadsTheOnLevelAttribute_11(); + case 24: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - case 12: - ChipLogProgress(chipTool, " ***** Test Step 12 : Reads the OnTransitionTime attribute \n"); - err = TestReadsTheOnTransitionTimeAttribute_12(); + case 25: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::BitFlags value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("bitmap32", value, 0UL)); + } break; - case 13: - ChipLogProgress(chipTool, " ***** Test Step 13 : Reads the OffTransitionTime attribute \n"); - err = TestReadsTheOffTransitionTimeAttribute_13(); + case 26: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::BitFlags value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("bitmap64", value, 0ULL)); + } break; - case 14: - ChipLogProgress(chipTool, " ***** Test Step 14 : Reads the DefaultMoveRate attribute \n"); - err = TestReadsTheDefaultMoveRateAttribute_14(); + case 27: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - case 15: - ChipLogProgress(chipTool, " ***** Test Step 15 : Reads the Options attribute \n"); - err = TestReadsTheOptionsAttribute_15(); + case 28: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::BitFlags value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("bitmap64", value, 18446744073709551615ULL)); + } break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 16; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: + case 29: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; break; - case 2: + case 30: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; + { + chip::BitFlags value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("bitmap64", value, 0ULL)); + } break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - static void OnFailureCallback_3(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_3(error); - } - - static void OnSuccessCallback_3(void * context, uint8_t currentLevel) - { - (static_cast(context))->OnSuccessResponse_3(currentLevel); - } - - static void OnFailureCallback_4(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_4(error); - } - - static void OnSuccessCallback_4(void * context, uint16_t remainingTime) - { - (static_cast(context))->OnSuccessResponse_4(remainingTime); - } - - static void OnFailureCallback_5(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_5(error); - } - - static void OnSuccessCallback_5(void * context, uint8_t minLevel) - { - (static_cast(context))->OnSuccessResponse_5(minLevel); - } - - static void OnFailureCallback_6(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_6(error); - } - - static void OnSuccessCallback_6(void * context, uint8_t maxLevel) - { - (static_cast(context))->OnSuccessResponse_6(maxLevel); - } - - static void OnFailureCallback_7(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_7(error); - } - - static void OnSuccessCallback_7(void * context, uint16_t currentFrequency) - { - (static_cast(context))->OnSuccessResponse_7(currentFrequency); - } - - static void OnFailureCallback_8(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_8(error); - } - - static void OnSuccessCallback_8(void * context, uint16_t minFrequency) - { - (static_cast(context))->OnSuccessResponse_8(minFrequency); - } - - static void OnFailureCallback_9(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_9(error); - } - - static void OnSuccessCallback_9(void * context, uint16_t maxFrequency) - { - (static_cast(context))->OnSuccessResponse_9(maxFrequency); - } - - static void OnFailureCallback_10(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_10(error); - } - - static void OnSuccessCallback_10(void * context, uint16_t onOffTransitionTime) - { - (static_cast(context))->OnSuccessResponse_10(onOffTransitionTime); - } - - static void OnFailureCallback_11(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_11(error); - } - - static void OnSuccessCallback_11(void * context, const chip::app::DataModel::Nullable & onLevel) - { - (static_cast(context))->OnSuccessResponse_11(onLevel); - } - - static void OnFailureCallback_12(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_12(error); - } - - static void OnSuccessCallback_12(void * context, const chip::app::DataModel::Nullable & onTransitionTime) - { - (static_cast(context))->OnSuccessResponse_12(onTransitionTime); - } - - static void OnFailureCallback_13(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_13(error); - } - - static void OnSuccessCallback_13(void * context, const chip::app::DataModel::Nullable & offTransitionTime) - { - (static_cast(context))->OnSuccessResponse_13(offTransitionTime); - } - - static void OnFailureCallback_14(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_14(error); - } - - static void OnSuccessCallback_14(void * context, const chip::app::DataModel::Nullable & defaultMoveRate) - { - (static_cast(context))->OnSuccessResponse_14(defaultMoveRate); - } - - static void OnFailureCallback_15(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_15(error); - } - - static void OnSuccessCallback_15(void * context, uint8_t options) - { - (static_cast(context))->OnSuccessResponse_15(options); - } - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestResetLevelTo254_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::LevelControl::Commands::MoveToLevel::Type; - - RequestType request; - request.level = 254; - request.transitionTime = 0U; - request.optionMask = 1; - request.optionOverride = 1; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_1(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_1(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_1() { NextTest(); } - - CHIP_ERROR TestWait100ms_2() - { - SetIdentity(kIdentityAlpha); - return WaitForMs(100); - } - - CHIP_ERROR TestReadsTheCurrentLevelAttribute_3() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::LevelControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_3, OnFailureCallback_3, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_3(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_3(uint8_t currentLevel) - { - VerifyOrReturn(CheckValue("currentLevel", currentLevel, 254)); - VerifyOrReturn(CheckConstraintType("currentLevel", "", "uint8")); - NextTest(); - } - - CHIP_ERROR TestReadsTheRemainingTimeAttribute_4() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::LevelControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_4, OnFailureCallback_4, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_4(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_4(uint16_t remainingTime) - { - VerifyOrReturn(CheckValue("remainingTime", remainingTime, 0U)); - VerifyOrReturn(CheckConstraintType("remainingTime", "", "uint16")); - NextTest(); - } - - CHIP_ERROR TestReadsTheMinLevelAttribute_5() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::LevelControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_5, OnFailureCallback_5, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_5(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_5(uint8_t minLevel) - { - VerifyOrReturn(CheckValue("minLevel", minLevel, 0)); - VerifyOrReturn(CheckConstraintType("minLevel", "", "uint8")); - NextTest(); - } - - CHIP_ERROR TestReadsTheMaxLevelAttribute_6() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::LevelControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_6, OnFailureCallback_6, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_6(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_6(uint8_t maxLevel) - { - VerifyOrReturn(CheckConstraintType("maxLevel", "", "uint8")); - NextTest(); - } - - CHIP_ERROR TestReadsTheCurrentFrequencyAttribute_7() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::LevelControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_7, OnFailureCallback_7, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_7(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_7(uint16_t currentFrequency) - { - VerifyOrReturn(CheckValue("currentFrequency", currentFrequency, 0U)); - VerifyOrReturn(CheckConstraintType("currentFrequency", "", "uint16")); - NextTest(); - } - - CHIP_ERROR TestReadsTheMinFrequencyAttribute_8() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::LevelControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_8, OnFailureCallback_8, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_8(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_8(uint16_t minFrequency) - { - VerifyOrReturn(CheckValue("minFrequency", minFrequency, 0U)); - VerifyOrReturn(CheckConstraintType("minFrequency", "", "uint16")); - NextTest(); - } - - CHIP_ERROR TestReadsTheMaxFrequencyAttribute_9() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::LevelControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_9, OnFailureCallback_9, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_9(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_9(uint16_t maxFrequency) - { - VerifyOrReturn(CheckValue("maxFrequency", maxFrequency, 0U)); - VerifyOrReturn(CheckConstraintType("maxFrequency", "", "uint16")); - NextTest(); - } - - CHIP_ERROR TestReadsTheOnOffTransitionTimeAttribute_10() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::LevelControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_10, OnFailureCallback_10, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_10(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_10(uint16_t onOffTransitionTime) - { - VerifyOrReturn(CheckValue("onOffTransitionTime", onOffTransitionTime, 0U)); - VerifyOrReturn(CheckConstraintType("onOffTransitionTime", "", "uint16")); - NextTest(); - } - - CHIP_ERROR TestReadsTheOnLevelAttribute_11() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::LevelControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_11, OnFailureCallback_11, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_11(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_11(const chip::app::DataModel::Nullable & onLevel) - { - VerifyOrReturn(CheckConstraintType("onLevel", "", "uint8")); - NextTest(); - } - - CHIP_ERROR TestReadsTheOnTransitionTimeAttribute_12() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::LevelControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_12, OnFailureCallback_12, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_12(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_12(const chip::app::DataModel::Nullable & onTransitionTime) - { - VerifyOrReturn(CheckConstraintType("onTransitionTime", "", "uint16")); - NextTest(); - } - - CHIP_ERROR TestReadsTheOffTransitionTimeAttribute_13() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::LevelControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_13, OnFailureCallback_13, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_13(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_13(const chip::app::DataModel::Nullable & offTransitionTime) - { - VerifyOrReturn(CheckConstraintType("offTransitionTime", "", "uint16")); - NextTest(); - } - - CHIP_ERROR TestReadsTheDefaultMoveRateAttribute_14() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::LevelControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_14, OnFailureCallback_14, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_14(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_14(const chip::app::DataModel::Nullable & defaultMoveRate) - { - VerifyOrReturn(CheckConstraintType("defaultMoveRate", "", "uint8")); - NextTest(); - } - - CHIP_ERROR TestReadsTheOptionsAttribute_15() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::LevelControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_15, OnFailureCallback_15, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_15(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_15(uint8_t options) - { - VerifyOrReturn(CheckValue("options", options, 0)); - VerifyOrReturn(CheckConstraintType("options", "", "map8")); - NextTest(); - } -}; - -class Test_TC_LVL_2_2Suite : public TestCommand -{ -public: - Test_TC_LVL_2_2Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_LVL_2_2", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_LVL_2_2Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_LVL_2_2\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_LVL_2_2\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + case 31: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("int8u", value, 0)); + } break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Reads the OnOffTransitionTime attribute from the DUT\n"); - err = TestReadsTheOnOffTransitionTimeAttributeFromTheDut_1(); + case 32: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : writes the OnOffTransitionTime attribute on the DUT\n"); - err = TestWritesTheOnOffTransitionTimeAttributeOnTheDut_2(); + case 33: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("int8u", value, 255)); + } break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Reads the OnOffTransitionTime attribute from the DUT\n"); - err = TestReadsTheOnOffTransitionTimeAttributeFromTheDut_3(); + case 34: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : writes default value of OnOffTransitionTime attribute\n"); - err = TestWritesDefaultValueOfOnOffTransitionTimeAttribute_4(); + case 35: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("int8u", value, 0)); + } break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : writes the OnLevel attribute on the DUT\n"); - err = TestWritesTheOnLevelAttributeOnTheDut_5(); + case 36: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("int16u", value, 0U)); + } break; - case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : Reads the OnLevel attribute from the DUT\n"); - err = TestReadsTheOnLevelAttributeFromTheDut_6(); + case 37: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : Writes the OnTransitionTime attribute on the DUT\n"); - err = TestWritesTheOnTransitionTimeAttributeOnTheDut_7(); + case 38: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("int16u", value, 65535U)); + } break; - case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : Reads the OnTransitionTime attribute from the DUT\n"); - err = TestReadsTheOnTransitionTimeAttributeFromTheDut_8(); + case 39: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : Writes the OffTransitionTime attribute on the DUT\n"); - err = TestWritesTheOffTransitionTimeAttributeOnTheDut_9(); + case 40: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("int16u", value, 0U)); + } break; - case 10: - ChipLogProgress(chipTool, " ***** Test Step 10 : Reads the OffTransitionTime attribute from the DUT\n"); - err = TestReadsTheOffTransitionTimeAttributeFromTheDut_10(); + case 41: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("int32u", value, 0UL)); + } break; - case 11: - ChipLogProgress(chipTool, " ***** Test Step 11 : Reads the DefaultMoveRate attribute from the DUT\n"); - err = TestReadsTheDefaultMoveRateAttributeFromTheDut_11(); + case 42: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - case 12: - ChipLogProgress(chipTool, " ***** Test Step 12 : Writes the DefaultMoveRate attribute on the DUT\n"); - err = TestWritesTheDefaultMoveRateAttributeOnTheDut_12(); + case 43: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("int32u", value, 4294967295UL)); + } break; - case 13: - ChipLogProgress(chipTool, " ***** Test Step 13 : Reads the DefaultMoveRate attribute from the DUT\n"); - err = TestReadsTheDefaultMoveRateAttributeFromTheDut_13(); + case 44: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - case 14: - ChipLogProgress(chipTool, " ***** Test Step 14 : writes the StartUpCurrentLevel attribute on the DUT\n"); - err = TestWritesTheStartUpCurrentLevelAttributeOnTheDut_14(); + case 45: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("int32u", value, 0UL)); + } break; - case 15: - ChipLogProgress(chipTool, " ***** Test Step 15 : reads the StartUpCurrentLevel attribute from the DUT\n"); - err = TestReadsTheStartUpCurrentLevelAttributeFromTheDut_15(); + case 46: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint64_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("int64u", value, 0ULL)); + } break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 16; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: + case 47: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - static void OnFailureCallback_1(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_1(error); - } - - static void OnSuccessCallback_1(void * context, uint16_t onOffTransitionTime) - { - (static_cast(context))->OnSuccessResponse_1(onOffTransitionTime); - } - - static void OnFailureCallback_2(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_2(error); - } - - static void OnSuccessCallback_2(void * context) { (static_cast(context))->OnSuccessResponse_2(); } - - static void OnFailureCallback_3(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_3(error); - } - - static void OnSuccessCallback_3(void * context, uint16_t onOffTransitionTime) - { - (static_cast(context))->OnSuccessResponse_3(onOffTransitionTime); - } - - static void OnFailureCallback_4(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_4(error); - } - - static void OnSuccessCallback_4(void * context) { (static_cast(context))->OnSuccessResponse_4(); } - - static void OnFailureCallback_5(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_5(error); - } - - static void OnSuccessCallback_5(void * context) { (static_cast(context))->OnSuccessResponse_5(); } - - static void OnFailureCallback_6(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_6(error); - } - - static void OnSuccessCallback_6(void * context, const chip::app::DataModel::Nullable & onLevel) - { - (static_cast(context))->OnSuccessResponse_6(onLevel); - } - - static void OnFailureCallback_7(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_7(error); - } - - static void OnSuccessCallback_7(void * context) { (static_cast(context))->OnSuccessResponse_7(); } - - static void OnFailureCallback_8(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_8(error); - } - - static void OnSuccessCallback_8(void * context, const chip::app::DataModel::Nullable & onTransitionTime) - { - (static_cast(context))->OnSuccessResponse_8(onTransitionTime); - } - - static void OnFailureCallback_9(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_9(error); - } - - static void OnSuccessCallback_9(void * context) { (static_cast(context))->OnSuccessResponse_9(); } - - static void OnFailureCallback_10(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_10(error); - } - - static void OnSuccessCallback_10(void * context, const chip::app::DataModel::Nullable & offTransitionTime) - { - (static_cast(context))->OnSuccessResponse_10(offTransitionTime); - } - - static void OnFailureCallback_11(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_11(error); - } - - static void OnSuccessCallback_11(void * context, const chip::app::DataModel::Nullable & defaultMoveRate) - { - (static_cast(context))->OnSuccessResponse_11(defaultMoveRate); - } - - static void OnFailureCallback_12(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_12(error); - } - - static void OnSuccessCallback_12(void * context) { (static_cast(context))->OnSuccessResponse_12(); } - - static void OnFailureCallback_13(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_13(error); - } - - static void OnSuccessCallback_13(void * context, const chip::app::DataModel::Nullable & defaultMoveRate) - { - (static_cast(context))->OnSuccessResponse_13(defaultMoveRate); - } - - static void OnFailureCallback_14(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_14(error); - } - - static void OnSuccessCallback_14(void * context) { (static_cast(context))->OnSuccessResponse_14(); } - - static void OnFailureCallback_15(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_15(error); - } - - static void OnSuccessCallback_15(void * context, const chip::app::DataModel::Nullable & startUpCurrentLevel) - { - (static_cast(context))->OnSuccessResponse_15(startUpCurrentLevel); - } - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestReadsTheOnOffTransitionTimeAttributeFromTheDut_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::LevelControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_1, OnFailureCallback_1, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_1(uint16_t onOffTransitionTime) - { - VerifyOrReturn(CheckValue("onOffTransitionTime", onOffTransitionTime, 0U)); - VerifyOrReturn(CheckConstraintType("onOffTransitionTime", "", "uint16")); - NextTest(); - } - - CHIP_ERROR TestWritesTheOnOffTransitionTimeAttributeOnTheDut_2() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::LevelControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - uint16_t onOffTransitionTimeArgument; - onOffTransitionTimeArgument = 10U; - - ReturnErrorOnFailure(cluster.WriteAttribute( - onOffTransitionTimeArgument, this, OnSuccessCallback_2, OnFailureCallback_2)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_2(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_2() { NextTest(); } - - CHIP_ERROR TestReadsTheOnOffTransitionTimeAttributeFromTheDut_3() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::LevelControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_3, OnFailureCallback_3, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_3(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_3(uint16_t onOffTransitionTime) - { - VerifyOrReturn(CheckValue("onOffTransitionTime", onOffTransitionTime, 10U)); - VerifyOrReturn(CheckConstraintType("onOffTransitionTime", "", "uint16")); - NextTest(); - } - - CHIP_ERROR TestWritesDefaultValueOfOnOffTransitionTimeAttribute_4() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::LevelControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - uint16_t onOffTransitionTimeArgument; - onOffTransitionTimeArgument = 0U; - - ReturnErrorOnFailure(cluster.WriteAttribute( - onOffTransitionTimeArgument, this, OnSuccessCallback_4, OnFailureCallback_4)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_4(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_4() { NextTest(); } - - CHIP_ERROR TestWritesTheOnLevelAttributeOnTheDut_5() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::LevelControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::DataModel::Nullable onLevelArgument; - onLevelArgument.SetNonNull(); - onLevelArgument.Value() = 254; - - ReturnErrorOnFailure(cluster.WriteAttribute( - onLevelArgument, this, OnSuccessCallback_5, OnFailureCallback_5)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_5(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_5() { NextTest(); } - - CHIP_ERROR TestReadsTheOnLevelAttributeFromTheDut_6() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::LevelControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_6, OnFailureCallback_6, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_6(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_6(const chip::app::DataModel::Nullable & onLevel) - { - VerifyOrReturn(CheckValueNonNull("onLevel", onLevel)); - VerifyOrReturn(CheckValue("onLevel.Value()", onLevel.Value(), 254)); - VerifyOrReturn(CheckConstraintType("onLevel", "", "uint8")); - NextTest(); - } - - CHIP_ERROR TestWritesTheOnTransitionTimeAttributeOnTheDut_7() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::LevelControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::DataModel::Nullable onTransitionTimeArgument; - onTransitionTimeArgument.SetNonNull(); - onTransitionTimeArgument.Value() = 100U; - - ReturnErrorOnFailure(cluster.WriteAttribute( - onTransitionTimeArgument, this, OnSuccessCallback_7, OnFailureCallback_7)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_7(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_7() { NextTest(); } - - CHIP_ERROR TestReadsTheOnTransitionTimeAttributeFromTheDut_8() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::LevelControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_8, OnFailureCallback_8, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_8(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_8(const chip::app::DataModel::Nullable & onTransitionTime) - { - VerifyOrReturn(CheckValueNonNull("onTransitionTime", onTransitionTime)); - VerifyOrReturn(CheckValue("onTransitionTime.Value()", onTransitionTime.Value(), 100U)); - VerifyOrReturn(CheckConstraintType("onTransitionTime", "", "uint16")); - NextTest(); - } - - CHIP_ERROR TestWritesTheOffTransitionTimeAttributeOnTheDut_9() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::LevelControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::DataModel::Nullable offTransitionTimeArgument; - offTransitionTimeArgument.SetNonNull(); - offTransitionTimeArgument.Value() = 100U; - - ReturnErrorOnFailure(cluster.WriteAttribute( - offTransitionTimeArgument, this, OnSuccessCallback_9, OnFailureCallback_9)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_9(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_9() { NextTest(); } - - CHIP_ERROR TestReadsTheOffTransitionTimeAttributeFromTheDut_10() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::LevelControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_10, OnFailureCallback_10, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_10(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_10(const chip::app::DataModel::Nullable & offTransitionTime) - { - VerifyOrReturn(CheckValueNonNull("offTransitionTime", offTransitionTime)); - VerifyOrReturn(CheckValue("offTransitionTime.Value()", offTransitionTime.Value(), 100U)); - VerifyOrReturn(CheckConstraintType("offTransitionTime", "", "uint16")); - NextTest(); - } - - CHIP_ERROR TestReadsTheDefaultMoveRateAttributeFromTheDut_11() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::LevelControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_11, OnFailureCallback_11, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_11(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_11(const chip::app::DataModel::Nullable & defaultMoveRate) - { - VerifyOrReturn(CheckValueNonNull("defaultMoveRate", defaultMoveRate)); - VerifyOrReturn(CheckValue("defaultMoveRate.Value()", defaultMoveRate.Value(), 50)); - VerifyOrReturn(CheckConstraintType("defaultMoveRate", "", "uint8")); - NextTest(); - } - - CHIP_ERROR TestWritesTheDefaultMoveRateAttributeOnTheDut_12() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::LevelControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::DataModel::Nullable defaultMoveRateArgument; - defaultMoveRateArgument.SetNonNull(); - defaultMoveRateArgument.Value() = 100; - - ReturnErrorOnFailure(cluster.WriteAttribute( - defaultMoveRateArgument, this, OnSuccessCallback_12, OnFailureCallback_12)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_12(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_12() { NextTest(); } - - CHIP_ERROR TestReadsTheDefaultMoveRateAttributeFromTheDut_13() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::LevelControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_13, OnFailureCallback_13, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_13(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_13(const chip::app::DataModel::Nullable & defaultMoveRate) - { - VerifyOrReturn(CheckValueNonNull("defaultMoveRate", defaultMoveRate)); - VerifyOrReturn(CheckValue("defaultMoveRate.Value()", defaultMoveRate.Value(), 100)); - VerifyOrReturn(CheckConstraintType("defaultMoveRate", "", "uint8")); - NextTest(); - } - - CHIP_ERROR TestWritesTheStartUpCurrentLevelAttributeOnTheDut_14() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::LevelControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::DataModel::Nullable startUpCurrentLevelArgument; - startUpCurrentLevelArgument.SetNonNull(); - startUpCurrentLevelArgument.Value() = 254; - - ReturnErrorOnFailure(cluster.WriteAttribute( - startUpCurrentLevelArgument, this, OnSuccessCallback_14, OnFailureCallback_14)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_14(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_14() { NextTest(); } - - CHIP_ERROR TestReadsTheStartUpCurrentLevelAttributeFromTheDut_15() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::LevelControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_15, OnFailureCallback_15, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_15(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_15(const chip::app::DataModel::Nullable & startUpCurrentLevel) - { - VerifyOrReturn(CheckValueNonNull("startUpCurrentLevel", startUpCurrentLevel)); - VerifyOrReturn(CheckValue("startUpCurrentLevel.Value()", startUpCurrentLevel.Value(), 254)); - VerifyOrReturn(CheckConstraintType("startUpCurrentLevel", "", "uint8")); - NextTest(); - } -}; - -class Test_TC_LVL_3_1Suite : public TestCommand -{ -public: - Test_TC_LVL_3_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_LVL_3_1", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_LVL_3_1Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_LVL_3_1\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_LVL_3_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + case 48: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint64_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("int64u", value, 18446744073709551615ULL)); + } break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : reads CurrentLevel attribute from DUT\n"); - err = TestReadsCurrentLevelAttributeFromDut_1(); + case 49: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Reads the MinLevel attribute\n"); - err = TestReadsTheMinLevelAttribute_2(); + case 50: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint64_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("int64u", value, 0ULL)); + } break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Reads the MaxLevel attribute\n"); - err = TestReadsTheMaxLevelAttribute_3(); + case 51: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + int8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("int8s", value, 0)); + } break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : sends a Move to level command\n"); - err = TestSendsAMoveToLevelCommand_4(); + case 52: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Wait 100ms\n"); - err = TestWait100ms_5(); + case 53: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + int8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("int8s", value, 127)); + } break; - case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : reads CurrentLevel attribute from DUT\n"); - err = TestReadsCurrentLevelAttributeFromDut_6(); + case 54: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : sends a Move to level command\n"); - err = TestSendsAMoveToLevelCommand_7(); + case 55: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + int8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("int8s", value, -128)); + } break; - case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : Wait 11000 second\n"); - err = TestWait11000Second_8(); + case 56: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : reads CurrentLevel attribute from DUT\n"); - err = TestReadsCurrentLevelAttributeFromDut_9(); + case 57: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + int8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("int8s", value, 0)); + } break; - case 10: - ChipLogProgress(chipTool, " ***** Test Step 10 : reads On Off Transition Time attribute from DUT\n"); - err = TestReadsOnOffTransitionTimeAttributeFromDut_10(); + case 58: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + int16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("int16s", value, 0)); + } break; - case 11: - ChipLogProgress(chipTool, " ***** Test Step 11 : sends a Move to level command\n"); - err = TestSendsAMoveToLevelCommand_11(); + case 59: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - case 12: - ChipLogProgress(chipTool, " ***** Test Step 12 : Wait 1000ms\n"); - err = TestWait1000ms_12(); + case 60: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + int16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("int16s", value, 32767)); + } break; - case 13: - ChipLogProgress(chipTool, " ***** Test Step 13 : reads CurrentLevel attribute from DUT\n"); - err = TestReadsCurrentLevelAttributeFromDut_13(); + case 61: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - case 14: - ChipLogProgress(chipTool, " ***** Test Step 14 : Reset level to 254\n"); - err = TestResetLevelTo254_14(); + case 62: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + int16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("int16s", value, -32768)); + } break; - case 15: - ChipLogProgress(chipTool, " ***** Test Step 15 : Wait 100ms\n"); - err = TestWait100ms_15(); + case 63: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 16; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: + case 64: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; + { + int16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("int16s", value, 0)); + } break; - case 5: + case 65: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; + { + int32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("int32s", value, 0L)); + } break; - case 8: + case 66: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; break; - case 12: + case 67: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; + { + int32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("int32s", value, 2147483647L)); + } break; - case 15: + case 68: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - static void OnFailureCallback_1(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_1(error); - } - - static void OnSuccessCallback_1(void * context, uint8_t currentLevel) - { - (static_cast(context))->OnSuccessResponse_1(currentLevel); - } - - static void OnFailureCallback_2(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_2(error); - } - - static void OnSuccessCallback_2(void * context, uint8_t minLevel) - { - (static_cast(context))->OnSuccessResponse_2(minLevel); - } - - static void OnFailureCallback_3(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_3(error); - } - - static void OnSuccessCallback_3(void * context, uint8_t maxLevel) - { - (static_cast(context))->OnSuccessResponse_3(maxLevel); - } - - static void OnFailureCallback_6(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_6(error); - } - - static void OnSuccessCallback_6(void * context, uint8_t currentLevel) - { - (static_cast(context))->OnSuccessResponse_6(currentLevel); - } - - static void OnFailureCallback_9(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_9(error); - } - - static void OnSuccessCallback_9(void * context, uint8_t currentLevel) - { - (static_cast(context))->OnSuccessResponse_9(currentLevel); - } - - static void OnFailureCallback_10(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_10(error); - } - - static void OnSuccessCallback_10(void * context, uint16_t onOffTransitionTime) - { - (static_cast(context))->OnSuccessResponse_10(onOffTransitionTime); - } - - static void OnFailureCallback_13(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_13(error); - } - - static void OnSuccessCallback_13(void * context, uint8_t currentLevel) - { - (static_cast(context))->OnSuccessResponse_13(currentLevel); - } - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestReadsCurrentLevelAttributeFromDut_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::LevelControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_1, OnFailureCallback_1, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_1(uint8_t currentLevel) - { - VerifyOrReturn(CheckConstraintType("currentLevel", "", "uint8")); - NextTest(); - } - - CHIP_ERROR TestReadsTheMinLevelAttribute_2() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::LevelControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_2, OnFailureCallback_2, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_2(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_2(uint8_t minLevel) - { - VerifyOrReturn(CheckConstraintType("minLevel", "", "uint8")); - NextTest(); - } - - CHIP_ERROR TestReadsTheMaxLevelAttribute_3() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::LevelControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_3, OnFailureCallback_3, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_3(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_3(uint8_t maxLevel) - { - VerifyOrReturn(CheckConstraintType("maxLevel", "", "uint8")); - NextTest(); - } - - CHIP_ERROR TestSendsAMoveToLevelCommand_4() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::LevelControl::Commands::MoveToLevel::Type; - - RequestType request; - request.level = 64; - request.transitionTime = 65535U; - request.optionMask = 1; - request.optionOverride = 1; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_4(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_4(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_4(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_4() { NextTest(); } - - CHIP_ERROR TestWait100ms_5() - { - SetIdentity(kIdentityAlpha); - return WaitForMs(100); - } - - CHIP_ERROR TestReadsCurrentLevelAttributeFromDut_6() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::LevelControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_6, OnFailureCallback_6, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_6(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_6(uint8_t currentLevel) - { - VerifyOrReturn(CheckValue("currentLevel", currentLevel, 64)); - - NextTest(); - } - - CHIP_ERROR TestSendsAMoveToLevelCommand_7() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::LevelControl::Commands::MoveToLevel::Type; - - RequestType request; - request.level = 100; - request.transitionTime = 100U; - request.optionMask = 1; - request.optionOverride = 1; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_7(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_7(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_7(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_7() { NextTest(); } - - CHIP_ERROR TestWait11000Second_8() - { - SetIdentity(kIdentityAlpha); - return WaitForMs(11000); - } - - CHIP_ERROR TestReadsCurrentLevelAttributeFromDut_9() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::LevelControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_9, OnFailureCallback_9, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_9(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_9(uint8_t currentLevel) - { - VerifyOrReturn(CheckValue("currentLevel", currentLevel, 100)); - - NextTest(); - } - - CHIP_ERROR TestReadsOnOffTransitionTimeAttributeFromDut_10() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::LevelControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_10, OnFailureCallback_10, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_10(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_10(uint16_t onOffTransitionTime) - { - VerifyOrReturn(CheckConstraintType("onOffTransitionTime", "", "uint16")); - NextTest(); - } - - CHIP_ERROR TestSendsAMoveToLevelCommand_11() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::LevelControl::Commands::MoveToLevel::Type; - - RequestType request; - request.level = 128; - request.transitionTime = 65535U; - request.optionMask = 1; - request.optionOverride = 1; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_11(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_11(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_11(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_11() { NextTest(); } - - CHIP_ERROR TestWait1000ms_12() - { - SetIdentity(kIdentityAlpha); - return WaitForMs(1000); - } - - CHIP_ERROR TestReadsCurrentLevelAttributeFromDut_13() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::LevelControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_13, OnFailureCallback_13, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_13(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_13(uint8_t currentLevel) - { - VerifyOrReturn(CheckValue("currentLevel", currentLevel, 128)); - - NextTest(); - } - - CHIP_ERROR TestResetLevelTo254_14() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::LevelControl::Commands::MoveToLevel::Type; - - RequestType request; - request.level = 254; - request.transitionTime = 0U; - request.optionMask = 1; - request.optionOverride = 1; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_14(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_14(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_14(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_14() { NextTest(); } - - CHIP_ERROR TestWait100ms_15() - { - SetIdentity(kIdentityAlpha); - return WaitForMs(100); - } -}; - -class Test_TC_LVL_4_1Suite : public TestCommand -{ -public: - Test_TC_LVL_4_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_LVL_4_1", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_LVL_4_1Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_LVL_4_1\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_LVL_4_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : reads max level attribute from DUT\n"); - err = TestReadsMaxLevelAttributeFromDut_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : sends a Move up command\n"); - err = TestSendsAMoveUpCommand_2(); - break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : user prompt message\n"); - err = TestUserPromptMessage_3(); - break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Wait 3000ms\n"); - err = TestWait3000ms_4(); + case 69: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + int32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("int32s", value, -2147483648L)); + } break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : reads CurrentLevel attribute from DUT\n"); - err = TestReadsCurrentLevelAttributeFromDut_5(); + case 70: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : reads min level attribute from DUT\n"); - err = TestReadsMinLevelAttributeFromDut_6(); + case 71: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + int32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("int32s", value, 0L)); + } break; - case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : sends a Move down command\n"); - err = TestSendsAMoveDownCommand_7(); + case 72: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + int64_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("int64s", value, 0LL)); + } break; - case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : user prompt message\n"); - err = TestUserPromptMessage_8(); + case 73: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : Wait 5000ms\n"); - err = TestWait5000ms_9(); + case 74: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + int64_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("int64s", value, 9223372036854775807LL)); + } break; - case 10: - ChipLogProgress(chipTool, " ***** Test Step 10 : reads CurrentLevel attribute from DUT\n"); - err = TestReadsCurrentLevelAttributeFromDut_10(); + case 75: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - case 11: - ChipLogProgress(chipTool, " ***** Test Step 11 : reads default move rate attribute from DUT\n"); - err = TestReadsDefaultMoveRateAttributeFromDut_11(); + case 76: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + int64_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("int64s", value, -9223372036854775807LL)); + } break; - case 12: - ChipLogProgress(chipTool, " ***** Test Step 12 : sends a Move up command at default move rate\n"); - err = TestSendsAMoveUpCommandAtDefaultMoveRate_12(); + case 77: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - case 13: - ChipLogProgress(chipTool, " ***** Test Step 13 : Wait 100ms\n"); - err = TestWait100ms_13(); + case 78: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + int64_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("int64s", value, 0LL)); + } break; - case 14: - ChipLogProgress(chipTool, " ***** Test Step 14 : reads CurrentLevel attribute from DUT\n"); - err = TestReadsCurrentLevelAttributeFromDut_14(); + case 79: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + float value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("floatSingle", value, 0.0f)); + } break; - case 15: - ChipLogProgress(chipTool, " ***** Test Step 15 : user prompt message\n"); - err = TestUserPromptMessage_15(); + case 80: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - case 16: - ChipLogProgress(chipTool, " ***** Test Step 16 : Reset level to 254\n"); - err = TestResetLevelTo254_16(); + case 81: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + float value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("floatSingle", value, 0.1f)); + } break; - case 17: - ChipLogProgress(chipTool, " ***** Test Step 17 : Wait 100ms\n"); - err = TestWait100ms_17(); + case 82: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 18; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - uint8_t MaxlevelValue; - uint8_t MinlevelValue; - chip::app::DataModel::Nullable DefaultMoveRateValue; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: + case 83: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; + { + float value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("floatSingle", value, 17000000000.0f)); + } break; - case 3: + case 84: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; break; - case 4: + case 85: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; + { + float value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("floatSingle", value, 1.7e-10f)); + } break; - case 8: + case 86: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; break; - case 9: + case 87: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; + { + float value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("floatSingle", value, 0.0f)); + } break; - case 13: + case 88: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; + { + double value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("floatDouble", value, 0)); + } break; - case 15: + case 89: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; break; - case 17: + case 90: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; + { + double value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("floatDouble", value, 0.1234567890123)); + } break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - static void OnFailureCallback_1(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_1(error); - } - - static void OnSuccessCallback_1(void * context, uint8_t maxLevel) - { - (static_cast(context))->OnSuccessResponse_1(maxLevel); - } - - static void OnFailureCallback_5(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_5(error); - } - - static void OnSuccessCallback_5(void * context, uint8_t currentLevel) - { - (static_cast(context))->OnSuccessResponse_5(currentLevel); - } - - static void OnFailureCallback_6(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_6(error); - } - - static void OnSuccessCallback_6(void * context, uint8_t minLevel) - { - (static_cast(context))->OnSuccessResponse_6(minLevel); - } - - static void OnFailureCallback_10(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_10(error); - } - - static void OnSuccessCallback_10(void * context, uint8_t currentLevel) - { - (static_cast(context))->OnSuccessResponse_10(currentLevel); - } - - static void OnFailureCallback_11(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_11(error); - } - - static void OnSuccessCallback_11(void * context, const chip::app::DataModel::Nullable & defaultMoveRate) - { - (static_cast(context))->OnSuccessResponse_11(defaultMoveRate); - } - - static void OnFailureCallback_14(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_14(error); - } - - static void OnSuccessCallback_14(void * context, uint8_t currentLevel) - { - (static_cast(context))->OnSuccessResponse_14(currentLevel); - } - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestReadsMaxLevelAttributeFromDut_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::LevelControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_1, OnFailureCallback_1, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_1(uint8_t maxLevel) - { - VerifyOrReturn(CheckConstraintType("maxLevel", "", "uint8")); - MaxlevelValue = maxLevel; - NextTest(); - } - - CHIP_ERROR TestSendsAMoveUpCommand_2() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::LevelControl::Commands::Move::Type; - - RequestType request; - request.moveMode = static_cast(0); - request.rate = 32; - request.optionMask = 1; - request.optionOverride = 1; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_2(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_2(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_2(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_2() { NextTest(); } - - CHIP_ERROR TestUserPromptMessage_3() - { - SetIdentity(kIdentityAlpha); - return UserPrompt("Physically verify that the DUT moves at a rate of 32 units per second or as close as possible to this " - "rate and completes moving to its maximum level"); - } - - CHIP_ERROR TestWait3000ms_4() - { - SetIdentity(kIdentityAlpha); - return WaitForMs(3000); - } - - CHIP_ERROR TestReadsCurrentLevelAttributeFromDut_5() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::LevelControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_5, OnFailureCallback_5, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_5(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_5(uint8_t currentLevel) - { - VerifyOrReturn(CheckValue("currentLevel", currentLevel, MaxlevelValue)); - - NextTest(); - } - - CHIP_ERROR TestReadsMinLevelAttributeFromDut_6() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::LevelControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_6, OnFailureCallback_6, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_6(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_6(uint8_t minLevel) - { - VerifyOrReturn(CheckConstraintType("minLevel", "", "uint8")); - MinlevelValue = minLevel; - NextTest(); - } - - CHIP_ERROR TestSendsAMoveDownCommand_7() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::LevelControl::Commands::Move::Type; - - RequestType request; - request.moveMode = static_cast(1); - request.rate = 64; - request.optionMask = 1; - request.optionOverride = 1; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_7(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_7(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_7(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_7() { NextTest(); } - - CHIP_ERROR TestUserPromptMessage_8() - { - SetIdentity(kIdentityAlpha); - return UserPrompt("Physically verify that the DUT moves at a rate of 64 units per second or as close as possible to this " - "rate and complete moving to its minimum level"); - } - - CHIP_ERROR TestWait5000ms_9() - { - SetIdentity(kIdentityAlpha); - return WaitForMs(5000); - } - - CHIP_ERROR TestReadsCurrentLevelAttributeFromDut_10() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::LevelControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_10, OnFailureCallback_10, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_10(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_10(uint8_t currentLevel) - { - VerifyOrReturn(CheckValue("currentLevel", currentLevel, 1)); - VerifyOrReturn(CheckConstraintMinValue("currentLevel", currentLevel, 0)); - VerifyOrReturn(CheckConstraintMaxValue("currentLevel", currentLevel, 1)); - NextTest(); - } - - CHIP_ERROR TestReadsDefaultMoveRateAttributeFromDut_11() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::LevelControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_11, OnFailureCallback_11, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_11(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_11(const chip::app::DataModel::Nullable & defaultMoveRate) - { - VerifyOrReturn(CheckConstraintType("defaultMoveRate", "", "uint8")); - DefaultMoveRateValue = defaultMoveRate; - NextTest(); - } - - CHIP_ERROR TestSendsAMoveUpCommandAtDefaultMoveRate_12() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::LevelControl::Commands::Move::Type; - - RequestType request; - request.moveMode = static_cast(0); - request.rate = 255; - request.optionMask = 1; - request.optionOverride = 1; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_12(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_12(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_12(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_12() { NextTest(); } - - CHIP_ERROR TestWait100ms_13() - { - SetIdentity(kIdentityAlpha); - return WaitForMs(100); - } - - CHIP_ERROR TestReadsCurrentLevelAttributeFromDut_14() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::LevelControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_14, OnFailureCallback_14, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_14(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_14(uint8_t currentLevel) - { - VerifyOrReturn(CheckConstraintNotValue("currentLevel", currentLevel, 255)); - - NextTest(); - } - - CHIP_ERROR TestUserPromptMessage_15() - { - SetIdentity(kIdentityAlpha); - return UserPrompt( - "Physically verify that the device moves at the rate recorded in step 3a and completes moving to its maximum level."); - } - - CHIP_ERROR TestResetLevelTo254_16() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::LevelControl::Commands::MoveToLevel::Type; - - RequestType request; - request.level = 254; - request.transitionTime = 0U; - request.optionMask = 1; - request.optionOverride = 1; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_16(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_16(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_16(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_16() { NextTest(); } - - CHIP_ERROR TestWait100ms_17() - { - SetIdentity(kIdentityAlpha); - return WaitForMs(100); - } -}; - -class Test_TC_LVL_5_1Suite : public TestCommand -{ -public: - Test_TC_LVL_5_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_LVL_5_1", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_LVL_5_1Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_LVL_5_1\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_LVL_5_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + case 91: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Sending on command\n"); - err = TestSendingOnCommand_1(); + case 92: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + double value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("floatDouble", value, 1.7e+200)); + } break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Precondition: DUT level is set to its lowest point\n"); - err = TestPreconditionDutLevelIsSetToItsLowestPoint_2(); + case 93: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Wait 3000ms\n"); - err = TestWait3000ms_3(); + case 94: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + double value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("floatDouble", value, 1.7e-200)); + } break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Reads current level attribute from DUT\n"); - err = TestReadsCurrentLevelAttributeFromDut_4(); + case 95: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Sends step up command to DUT\n"); - err = TestSendsStepUpCommandToDut_5(); + case 96: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + double value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("floatDouble", value, 0)); + } break; - case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : Wait 5000ms\n"); - err = TestWait5000ms_6(); + case 97: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("enum8", value, 0)); + } break; - case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : Reads current level attribute from DUT\n"); - err = TestReadsCurrentLevelAttributeFromDut_7(); + case 98: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : Sends a Step down command\n"); - err = TestSendsAStepDownCommand_8(); + case 99: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("enum8", value, 255)); + } break; - case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : Wait 4000ms\n"); - err = TestWait4000ms_9(); + case 100: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - case 10: - ChipLogProgress(chipTool, " ***** Test Step 10 : Reads current level attribute from DUT\n"); - err = TestReadsCurrentLevelAttributeFromDut_10(); + case 101: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("enum8", value, 0)); + } break; - case 11: - ChipLogProgress(chipTool, " ***** Test Step 11 : Reset level to 254\n"); - err = TestResetLevelTo254_11(); + case 102: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("enum16", value, 0U)); + } break; - case 12: - ChipLogProgress(chipTool, " ***** Test Step 12 : Wait 100ms\n"); - err = TestWait100ms_12(); + case 103: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - case 13: - ChipLogProgress(chipTool, " ***** Test Step 13 : Sending off command\n"); - err = TestSendingOffCommand_13(); + case 104: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("enum16", value, 65535U)); + } break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 14; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - uint8_t CurrentlevelValue; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: + case 105: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; break; - case 3: + case 106: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("enum16", value, 0U)); + } break; - case 6: + case 107: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; + { + chip::ByteSpan value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueAsString("octetString", value, chip::ByteSpan(chip::Uint8::from_const_char(""), 0))); + } break; - case 9: + case 108: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; break; - case 12: + case 109: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; + { + chip::ByteSpan value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn( + CheckValueAsString("octetString", value, chip::ByteSpan(chip::Uint8::from_const_char("Tes\000ti\000ng"), 9))); + } break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - static void OnFailureCallback_4(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_4(error); - } - - static void OnSuccessCallback_4(void * context, uint8_t currentLevel) - { - (static_cast(context))->OnSuccessResponse_4(currentLevel); - } - - static void OnFailureCallback_7(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_7(error); - } - - static void OnSuccessCallback_7(void * context, uint8_t currentLevel) - { - (static_cast(context))->OnSuccessResponse_7(currentLevel); - } - - static void OnFailureCallback_10(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_10(error); - } - - static void OnSuccessCallback_10(void * context, uint8_t currentLevel) - { - (static_cast(context))->OnSuccessResponse_10(currentLevel); - } - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestSendingOnCommand_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::OnOff::Commands::On::Type; - - RequestType request; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_1(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_1(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_1() { NextTest(); } - - CHIP_ERROR TestPreconditionDutLevelIsSetToItsLowestPoint_2() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::LevelControl::Commands::Step::Type; - - RequestType request; - request.stepMode = static_cast(1); - request.stepSize = 100; - request.transitionTime = 20U; - request.optionMask = 0; - request.optionOverride = 0; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_2(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_2(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_2(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_2() { NextTest(); } - - CHIP_ERROR TestWait3000ms_3() - { - SetIdentity(kIdentityAlpha); - return WaitForMs(3000); - } - - CHIP_ERROR TestReadsCurrentLevelAttributeFromDut_4() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::LevelControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_4, OnFailureCallback_4, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_4(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_4(uint8_t currentLevel) - { - VerifyOrReturn(CheckConstraintType("currentLevel", "", "uint8")); - CurrentlevelValue = currentLevel; - NextTest(); - } - - CHIP_ERROR TestSendsStepUpCommandToDut_5() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::LevelControl::Commands::Step::Type; - - RequestType request; - request.stepMode = static_cast(0); - request.stepSize = 64; - request.transitionTime = 2U; - request.optionMask = 0; - request.optionOverride = 0; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_5(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_5(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_5(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_5() { NextTest(); } - - CHIP_ERROR TestWait5000ms_6() - { - SetIdentity(kIdentityAlpha); - return WaitForMs(5000); - } - - CHIP_ERROR TestReadsCurrentLevelAttributeFromDut_7() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::LevelControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_7, OnFailureCallback_7, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_7(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_7(uint8_t currentLevel) - { - VerifyOrReturn(CheckConstraintNotValue("currentLevel", currentLevel, CurrentlevelValue)); - - NextTest(); - } - - CHIP_ERROR TestSendsAStepDownCommand_8() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::LevelControl::Commands::Step::Type; - - RequestType request; - request.stepMode = static_cast(1); - request.stepSize = 64; - request.transitionTime = 2U; - request.optionMask = 0; - request.optionOverride = 0; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_8(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_8(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_8(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_8() { NextTest(); } - - CHIP_ERROR TestWait4000ms_9() - { - SetIdentity(kIdentityAlpha); - return WaitForMs(4000); - } - - CHIP_ERROR TestReadsCurrentLevelAttributeFromDut_10() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::LevelControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_10, OnFailureCallback_10, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_10(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_10(uint8_t currentLevel) - { - VerifyOrReturn(CheckValue("currentLevel", currentLevel, CurrentlevelValue)); - - NextTest(); - } - - CHIP_ERROR TestResetLevelTo254_11() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::LevelControl::Commands::MoveToLevel::Type; - - RequestType request; - request.level = 254; - request.transitionTime = 0U; - request.optionMask = 1; - request.optionOverride = 1; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_11(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_11(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_11(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_11() { NextTest(); } - - CHIP_ERROR TestWait100ms_12() - { - SetIdentity(kIdentityAlpha); - return WaitForMs(100); - } - - CHIP_ERROR TestSendingOffCommand_13() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::OnOff::Commands::Off::Type; - - RequestType request; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_13(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_13(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_13(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_13() { NextTest(); } -}; - -class Test_TC_LVL_6_1Suite : public TestCommand -{ -public: - Test_TC_LVL_6_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_LVL_6_1", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_LVL_6_1Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_LVL_6_1\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_LVL_6_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + case 110: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Sending on command\n"); - err = TestSendingOnCommand_1(); + case 111: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::ByteSpan value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueAsString("octetString", value, + chip::ByteSpan(chip::Uint8::from_const_char("\015\012\377\042\240"), 5))); + } break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Precondition: set DUT to lowest point\n"); - err = TestPreconditionSetDutToLowestPoint_2(); + case 112: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Wait 100ms\n"); - err = TestWait100ms_3(); + case 113: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::ByteSpan value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn( + CheckValueAsString("octetString", value, chip::ByteSpan(chip::Uint8::from_const_char("TestValue"), 9))); + } break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Reads CurrentLevel attribute from DUT\n"); - err = TestReadsCurrentLevelAttributeFromDut_4(); + case 114: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Sends a move up command to DUT\n"); - err = TestSendsAMoveUpCommandToDut_5(); + case 115: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::ByteSpan value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn( + CheckValueAsString("octetString", value, chip::ByteSpan(chip::Uint8::from_const_char("TestValue"), 9))); + } break; - case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : Wait 2000ms\n"); - err = TestWait2000ms_6(); + case 116: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : Sends stop command to DUT\n"); - err = TestSendsStopCommandToDut_7(); + case 117: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::ByteSpan value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueAsString("longOctetString", value, chip::ByteSpan(chip::Uint8::from_const_char(""), 0))); + } break; - case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : Reads CurrentLevel attribute from DUT\n"); - err = TestReadsCurrentLevelAttributeFromDut_8(); + case 118: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : Reset level to 254\n"); - err = TestResetLevelTo254_9(); + case 119: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::ByteSpan value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueAsString( + "longOctetString", value, + chip::ByteSpan( + chip::Uint8::from_const_char( + "111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111" + "111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111" + "111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111"), + 300))); + } break; - case 10: - ChipLogProgress(chipTool, " ***** Test Step 10 : Wait 100ms\n"); - err = TestWait100ms_10(); + case 120: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - case 11: - ChipLogProgress(chipTool, " ***** Test Step 11 : Sending off command\n"); - err = TestSendingOffCommand_11(); + case 121: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::CharSpan value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueAsString("charString", value, chip::CharSpan("", 0))); + } break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 12; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - uint8_t CurrentLevelValue; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: + case 122: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; break; - case 3: + case 123: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; + { + chip::CharSpan value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueAsString("charString", value, chip::CharSpan("☉T☉", 7))); + } break; - case 6: + case 124: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); + break; + case 125: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; + { + chip::CharSpan value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueAsString("charString", value, chip::CharSpan("☉T☉", 7))); + } break; - case 10: + case 126: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - static void OnFailureCallback_4(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_4(error); - } - - static void OnSuccessCallback_4(void * context, uint8_t currentLevel) - { - (static_cast(context))->OnSuccessResponse_4(currentLevel); - } - - static void OnFailureCallback_8(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_8(error); - } - - static void OnSuccessCallback_8(void * context, uint8_t currentLevel) - { - (static_cast(context))->OnSuccessResponse_8(currentLevel); - } - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestSendingOnCommand_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::OnOff::Commands::On::Type; - - RequestType request; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_1(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_1(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_1() { NextTest(); } - - CHIP_ERROR TestPreconditionSetDutToLowestPoint_2() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::LevelControl::Commands::MoveToLevel::Type; - - RequestType request; - request.level = 0; - request.transitionTime = 0U; - request.optionMask = 1; - request.optionOverride = 1; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_2(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_2(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_2(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_2() { NextTest(); } - - CHIP_ERROR TestWait100ms_3() - { - SetIdentity(kIdentityAlpha); - return WaitForMs(100); - } - - CHIP_ERROR TestReadsCurrentLevelAttributeFromDut_4() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::LevelControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_4, OnFailureCallback_4, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_4(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_4(uint8_t currentLevel) - { - VerifyOrReturn(CheckConstraintMinValue("currentLevel", currentLevel, 0)); - VerifyOrReturn(CheckConstraintMaxValue("currentLevel", currentLevel, 1)); - CurrentLevelValue = currentLevel; - NextTest(); - } - - CHIP_ERROR TestSendsAMoveUpCommandToDut_5() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::LevelControl::Commands::Move::Type; - - RequestType request; - request.moveMode = static_cast(0); - request.rate = 1; - request.optionMask = 1; - request.optionOverride = 1; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_5(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_5(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_5(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_5() { NextTest(); } - - CHIP_ERROR TestWait2000ms_6() - { - SetIdentity(kIdentityAlpha); - return WaitForMs(2000); - } - - CHIP_ERROR TestSendsStopCommandToDut_7() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::LevelControl::Commands::Stop::Type; - - RequestType request; - request.optionMask = 0; - request.optionOverride = 0; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_7(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_7(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_7(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_7() { NextTest(); } - - CHIP_ERROR TestReadsCurrentLevelAttributeFromDut_8() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::LevelControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_8, OnFailureCallback_8, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_8(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_8(uint8_t currentLevel) - { - VerifyOrReturn(CheckConstraintNotValue("currentLevel", currentLevel, CurrentLevelValue)); - - NextTest(); - } - - CHIP_ERROR TestResetLevelTo254_9() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::LevelControl::Commands::MoveToLevel::Type; - - RequestType request; - request.level = 254; - request.transitionTime = 0U; - request.optionMask = 1; - request.optionOverride = 1; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_9(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_9(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_9(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_9() { NextTest(); } - - CHIP_ERROR TestWait100ms_10() - { - SetIdentity(kIdentityAlpha); - return WaitForMs(100); - } - - CHIP_ERROR TestSendingOffCommand_11() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::OnOff::Commands::Off::Type; - - RequestType request; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_11(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_11(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_11(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_11() { NextTest(); } -}; - -class Test_TC_MC_1_1Suite : public TestCommand -{ -public: - Test_TC_MC_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_MC_1_1", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_MC_1_1Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_1_1\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_1_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + case 127: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::CharSpan value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueAsString("longCharString", value, chip::CharSpan("", 0))); + } break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : read the global attribute: ClusterRevision\n"); - err = TestReadTheGlobalAttributeClusterRevision_1(); + case 128: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Read the global attribute constraints: ClusterRevision\n"); - err = TestReadTheGlobalAttributeConstraintsClusterRevision_2(); + case 129: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::CharSpan value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueAsString( + "longCharString", value, + chip::CharSpan( + "☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉" + "☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉" + "☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉", + 900))); + } break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Read the global attribute: AttributeList\n"); - err = TestReadTheGlobalAttributeAttributeList_3(); + case 130: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 4; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: + case 131: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + { + auto iter_0 = value.begin(); + VerifyOrReturn(CheckNextListItemDecodes("listLongOctetString", iter_0, 0)); + VerifyOrReturn(CheckValueAsString( + "listLongOctetString[0]", iter_0.GetValue(), + chip::ByteSpan(chip::Uint8::from_const_char( + "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456" + "789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcd" + "ef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef01234" + "56789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789ab" + "cdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef012" + "3456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"), + 512))); + VerifyOrReturn(CheckNextListItemDecodes("listLongOctetString", iter_0, 1)); + VerifyOrReturn(CheckValueAsString( + "listLongOctetString[1]", iter_0.GetValue(), + chip::ByteSpan(chip::Uint8::from_const_char( + "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456" + "789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcd" + "ef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef01234" + "56789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789ab" + "cdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef012" + "3456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"), + 512))); + VerifyOrReturn(CheckNextListItemDecodes("listLongOctetString", iter_0, 2)); + VerifyOrReturn(CheckValueAsString( + "listLongOctetString[2]", iter_0.GetValue(), + chip::ByteSpan(chip::Uint8::from_const_char( + "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456" + "789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcd" + "ef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef01234" + "56789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789ab" + "cdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef012" + "3456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"), + 512))); + VerifyOrReturn(CheckNextListItemDecodes("listLongOctetString", iter_0, 3)); + VerifyOrReturn(CheckValueAsString( + "listLongOctetString[3]", iter_0.GetValue(), + chip::ByteSpan(chip::Uint8::from_const_char( + "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456" + "789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcd" + "ef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef01234" + "56789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789ab" + "cdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef012" + "3456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"), + 512))); + VerifyOrReturn(CheckNoMoreListItems("listLongOctetString", iter_0, 4)); + } + } break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - static void OnFailureCallback_1(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_1(error); - } - - static void OnSuccessCallback_1(void * context, uint16_t clusterRevision) - { - (static_cast(context))->OnSuccessResponse_1(clusterRevision); - } - - static void OnFailureCallback_2(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_2(error); - } - - static void OnSuccessCallback_2(void * context, uint16_t clusterRevision) - { - (static_cast(context))->OnSuccessResponse_2(clusterRevision); - } - - static void OnFailureCallback_3(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_3(error); - } - - static void OnSuccessCallback_3(void * context, const chip::app::DataModel::DecodableList & attributeList) - { - (static_cast(context))->OnSuccessResponse_3(attributeList); - } - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestReadTheGlobalAttributeClusterRevision_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::LowPowerClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_1, OnFailureCallback_1, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_1(uint16_t clusterRevision) - { - VerifyOrReturn(CheckValue("clusterRevision", clusterRevision, 1U)); - - NextTest(); - } - - CHIP_ERROR TestReadTheGlobalAttributeConstraintsClusterRevision_2() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::LowPowerClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_2, OnFailureCallback_2, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_2(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_2(uint16_t clusterRevision) - { - VerifyOrReturn(CheckConstraintType("clusterRevision", "", "uint16")); - NextTest(); - } - - CHIP_ERROR TestReadTheGlobalAttributeAttributeList_3() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::LowPowerClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_3, OnFailureCallback_3, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_3(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_3(const chip::app::DataModel::DecodableList & attributeList) - { - VerifyOrReturn(CheckConstraintType("attributeList", "", "list")); - NextTest(); - } -}; - -class Test_TC_MC_1_2Suite : public TestCommand -{ -public: - Test_TC_MC_1_2Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_MC_1_2", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_MC_1_2Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_1_2\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_1_2\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : read the global attribute: ClusterRevision\n"); - err = TestReadTheGlobalAttributeClusterRevision_1(); + case 132: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Read the global attribute constraints: ClusterRevision\n"); - err = TestReadTheGlobalAttributeConstraintsClusterRevision_2(); + case 133: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + { + auto iter_0 = value.begin(); + VerifyOrReturn(CheckNextListItemDecodes("listLongOctetString", iter_0, 0)); + VerifyOrReturn(CheckValueAsString( + "listLongOctetString[0]", iter_0.GetValue(), + chip::ByteSpan(chip::Uint8::from_const_char( + "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456" + "789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcd" + "ef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef01234" + "56789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789ab" + "cdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef012" + "3456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"), + 512))); + VerifyOrReturn(CheckNextListItemDecodes("listLongOctetString", iter_0, 1)); + VerifyOrReturn(CheckValueAsString( + "listLongOctetString[1]", iter_0.GetValue(), + chip::ByteSpan(chip::Uint8::from_const_char( + "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456" + "789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcd" + "ef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef01234" + "56789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789ab" + "cdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef012" + "3456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"), + 512))); + VerifyOrReturn(CheckNextListItemDecodes("listLongOctetString", iter_0, 2)); + VerifyOrReturn(CheckValueAsString( + "listLongOctetString[2]", iter_0.GetValue(), + chip::ByteSpan(chip::Uint8::from_const_char( + "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456" + "789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcd" + "ef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef01234" + "56789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789ab" + "cdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef012" + "3456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"), + 512))); + VerifyOrReturn(CheckNextListItemDecodes("listLongOctetString", iter_0, 3)); + VerifyOrReturn(CheckValueAsString( + "listLongOctetString[3]", iter_0.GetValue(), + chip::ByteSpan(chip::Uint8::from_const_char( + "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456" + "789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcd" + "ef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef01234" + "56789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789ab" + "cdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef012" + "3456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"), + 512))); + VerifyOrReturn(CheckNextListItemDecodes("listLongOctetString", iter_0, 4)); + VerifyOrReturn(CheckValueAsString( + "listLongOctetString[4]", iter_0.GetValue(), + chip::ByteSpan(chip::Uint8::from_const_char( + "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456" + "789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcd" + "ef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef01234" + "56789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789ab" + "cdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef012" + "3456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"), + 512))); + VerifyOrReturn(CheckNoMoreListItems("listLongOctetString", iter_0, 5)); + } + } break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Read the global attribute: AttributeList\n"); - err = TestReadTheGlobalAttributeAttributeList_3(); + case 134: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint64_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("epochUs", value, 0ULL)); + } break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 4; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: + case 135: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - static void OnFailureCallback_1(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_1(error); - } - - static void OnSuccessCallback_1(void * context, uint16_t clusterRevision) - { - (static_cast(context))->OnSuccessResponse_1(clusterRevision); - } - - static void OnFailureCallback_2(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_2(error); - } - - static void OnSuccessCallback_2(void * context, uint16_t clusterRevision) - { - (static_cast(context))->OnSuccessResponse_2(clusterRevision); - } - - static void OnFailureCallback_3(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_3(error); - } - - static void OnSuccessCallback_3(void * context, const chip::app::DataModel::DecodableList & attributeList) - { - (static_cast(context))->OnSuccessResponse_3(attributeList); - } - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestReadTheGlobalAttributeClusterRevision_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::KeypadInputClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_1, OnFailureCallback_1, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_1(uint16_t clusterRevision) - { - VerifyOrReturn(CheckValue("clusterRevision", clusterRevision, 1U)); - - NextTest(); - } - - CHIP_ERROR TestReadTheGlobalAttributeConstraintsClusterRevision_2() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::KeypadInputClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_2, OnFailureCallback_2, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_2(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_2(uint16_t clusterRevision) - { - VerifyOrReturn(CheckConstraintType("clusterRevision", "", "uint16")); - NextTest(); - } - - CHIP_ERROR TestReadTheGlobalAttributeAttributeList_3() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::KeypadInputClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_3, OnFailureCallback_3, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_3(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_3(const chip::app::DataModel::DecodableList & attributeList) - { - VerifyOrReturn(CheckConstraintType("attributeList", "", "list")); - NextTest(); - } -}; - -class Test_TC_MC_1_3Suite : public TestCommand -{ -public: - Test_TC_MC_1_3Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_MC_1_3", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_MC_1_3Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_1_3\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_1_3\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + case 136: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint64_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("epochUs", value, 18446744073709551615ULL)); + } break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : read the global attribute: ClusterRevision\n"); - err = TestReadTheGlobalAttributeClusterRevision_1(); + case 137: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Read the global attribute constraints: ClusterRevision\n"); - err = TestReadTheGlobalAttributeConstraintsClusterRevision_2(); + case 138: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint64_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("epochUs", value, 0ULL)); + } break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Read the global attribute: AttributeList\n"); - err = TestReadTheGlobalAttributeAttributeList_3(); + case 139: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("epochS", value, 0UL)); + } break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 4; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: + case 140: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - static void OnFailureCallback_1(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_1(error); - } - - static void OnSuccessCallback_1(void * context, uint16_t clusterRevision) - { - (static_cast(context))->OnSuccessResponse_1(clusterRevision); - } - - static void OnFailureCallback_2(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_2(error); - } - - static void OnSuccessCallback_2(void * context, uint16_t clusterRevision) - { - (static_cast(context))->OnSuccessResponse_2(clusterRevision); - } - - static void OnFailureCallback_3(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_3(error); - } - - static void OnSuccessCallback_3(void * context, const chip::app::DataModel::DecodableList & attributeList) - { - (static_cast(context))->OnSuccessResponse_3(attributeList); - } - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestReadTheGlobalAttributeClusterRevision_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ApplicationLauncherClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_1, OnFailureCallback_1, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_1(uint16_t clusterRevision) - { - VerifyOrReturn(CheckValue("clusterRevision", clusterRevision, 1U)); - - NextTest(); - } - - CHIP_ERROR TestReadTheGlobalAttributeConstraintsClusterRevision_2() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ApplicationLauncherClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_2, OnFailureCallback_2, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_2(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_2(uint16_t clusterRevision) - { - VerifyOrReturn(CheckConstraintType("clusterRevision", "", "uint16")); - NextTest(); - } - - CHIP_ERROR TestReadTheGlobalAttributeAttributeList_3() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ApplicationLauncherClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_3, OnFailureCallback_3, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_3(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_3(const chip::app::DataModel::DecodableList & attributeList) - { - VerifyOrReturn(CheckConstraintType("attributeList", "", "list")); - NextTest(); - } -}; - -class Test_TC_MC_1_4Suite : public TestCommand -{ -public: - Test_TC_MC_1_4Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_MC_1_4", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_MC_1_4Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_1_4\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_1_4\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + case 141: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("epochS", value, 4294967295UL)); + } break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : read the global attribute: ClusterRevision\n"); - err = TestReadTheGlobalAttributeClusterRevision_1(); + case 142: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Read the global attribute constraints: ClusterRevision\n"); - err = TestReadTheGlobalAttributeConstraintsClusterRevision_2(); + case 143: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("epochS", value, 0UL)); + } break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Read the global attribute: AttributeList\n"); - err = TestReadTheGlobalAttributeAttributeList_3(); + case 144: + if (IsUnsupported(status.mStatus)) + { + return; + } + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + bool value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("unsupported", value, 0)); + } break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 4; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: + case 145: + if (IsUnsupported(status.mStatus)) + { + return; + } VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - static void OnFailureCallback_1(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_1(error); - } - - static void OnSuccessCallback_1(void * context, uint16_t clusterRevision) - { - (static_cast(context))->OnSuccessResponse_1(clusterRevision); - } - - static void OnFailureCallback_2(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_2(error); - } - - static void OnSuccessCallback_2(void * context, uint16_t clusterRevision) - { - (static_cast(context))->OnSuccessResponse_2(clusterRevision); - } - - static void OnFailureCallback_3(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_3(error); - } - - static void OnSuccessCallback_3(void * context, const chip::app::DataModel::DecodableList & attributeList) - { - (static_cast(context))->OnSuccessResponse_3(attributeList); - } - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestReadTheGlobalAttributeClusterRevision_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::MediaInputClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_1, OnFailureCallback_1, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_1(uint16_t clusterRevision) - { - VerifyOrReturn(CheckValue("clusterRevision", clusterRevision, 1U)); - - NextTest(); - } - - CHIP_ERROR TestReadTheGlobalAttributeConstraintsClusterRevision_2() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::MediaInputClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_2, OnFailureCallback_2, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_2(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_2(uint16_t clusterRevision) - { - VerifyOrReturn(CheckConstraintType("clusterRevision", "", "uint16")); - NextTest(); - } - - CHIP_ERROR TestReadTheGlobalAttributeAttributeList_3() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::MediaInputClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_3, OnFailureCallback_3, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_3(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_3(const chip::app::DataModel::DecodableList & attributeList) - { - VerifyOrReturn(CheckConstraintType("attributeList", "", "list")); - NextTest(); - } -}; - -class Test_TC_MC_1_5Suite : public TestCommand -{ -public: - Test_TC_MC_1_5Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_MC_1_5", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_MC_1_5Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_1_5\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_1_5\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + case 146: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_ENDPOINT)); break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : read the global attribute: ClusterRevision\n"); - err = TestReadTheGlobalAttributeClusterRevision_1(); + case 147: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_CLUSTER)); break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Read the global attribute constraints: ClusterRevision\n"); - err = TestReadTheGlobalAttributeConstraintsClusterRevision_2(); + case 148: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::VendorId value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("vendorId", value, 0U)); + } break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Read the global attribute: AttributeList\n"); - err = TestReadTheGlobalAttributeAttributeList_3(); + case 149: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 4; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: + case 150: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; + { + chip::VendorId value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("vendorId", value, 17U)); + } break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - static void OnFailureCallback_1(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_1(error); - } - - static void OnSuccessCallback_1(void * context, uint16_t clusterRevision) - { - (static_cast(context))->OnSuccessResponse_1(clusterRevision); - } - - static void OnFailureCallback_2(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_2(error); - } - - static void OnSuccessCallback_2(void * context, uint16_t clusterRevision) - { - (static_cast(context))->OnSuccessResponse_2(clusterRevision); - } - - static void OnFailureCallback_3(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_3(error); - } - - static void OnSuccessCallback_3(void * context, const chip::app::DataModel::DecodableList & attributeList) - { - (static_cast(context))->OnSuccessResponse_3(attributeList); - } - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestReadTheGlobalAttributeClusterRevision_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::WakeOnLanClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_1, OnFailureCallback_1, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_1(uint16_t clusterRevision) - { - VerifyOrReturn(CheckValue("clusterRevision", clusterRevision, 1U)); - - NextTest(); - } - - CHIP_ERROR TestReadTheGlobalAttributeConstraintsClusterRevision_2() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::WakeOnLanClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_2, OnFailureCallback_2, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_2(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_2(uint16_t clusterRevision) - { - VerifyOrReturn(CheckConstraintType("clusterRevision", "", "uint16")); - NextTest(); - } - - CHIP_ERROR TestReadTheGlobalAttributeAttributeList_3() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::WakeOnLanClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_3, OnFailureCallback_3, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_3(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_3(const chip::app::DataModel::DecodableList & attributeList) - { - VerifyOrReturn(CheckConstraintType("attributeList", "", "list")); - NextTest(); - } -}; - -class Test_TC_MC_1_6Suite : public TestCommand -{ -public: - Test_TC_MC_1_6Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_MC_1_6", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_MC_1_6Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_1_6\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_1_6\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); + case 151: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 152: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::TestCluster::Commands::TestEnumsResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("arg1", value.arg1, 20003U)); - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + VerifyOrReturn(CheckValue("arg2", value.arg2, 101)); + } break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : read the global attribute: ClusterRevision\n"); - err = TestReadTheGlobalAttributeClusterRevision_1(); + case 153: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::TestCluster::Commands::BooleanResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("value", value.value, true)); + } break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Read the global attribute constraints: ClusterRevision\n"); - err = TestReadTheGlobalAttributeConstraintsClusterRevision_2(); + case 154: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::TestCluster::Commands::BooleanResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("value", value.value, false)); + } break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Read the global attribute: AttributeList\n"); - err = TestReadTheGlobalAttributeAttributeList_3(); + case 155: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::TestCluster::Commands::BooleanResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("value", value.value, true)); + } break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 4; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: + case 156: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; + { + chip::app::Clusters::TestCluster::Commands::BooleanResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("value", value.value, false)); + } break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - static void OnFailureCallback_1(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_1(error); - } - - static void OnSuccessCallback_1(void * context, uint16_t clusterRevision) - { - (static_cast(context))->OnSuccessResponse_1(clusterRevision); - } - - static void OnFailureCallback_2(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_2(error); - } - - static void OnSuccessCallback_2(void * context, uint16_t clusterRevision) - { - (static_cast(context))->OnSuccessResponse_2(clusterRevision); - } - - static void OnFailureCallback_3(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_3(error); - } - - static void OnSuccessCallback_3(void * context, const chip::app::DataModel::DecodableList & attributeList) - { - (static_cast(context))->OnSuccessResponse_3(attributeList); - } - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestReadTheGlobalAttributeClusterRevision_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ChannelClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_1, OnFailureCallback_1, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_1(uint16_t clusterRevision) - { - VerifyOrReturn(CheckValue("clusterRevision", clusterRevision, 1U)); - - NextTest(); - } - - CHIP_ERROR TestReadTheGlobalAttributeConstraintsClusterRevision_2() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ChannelClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_2, OnFailureCallback_2, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_2(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_2(uint16_t clusterRevision) - { - VerifyOrReturn(CheckConstraintType("clusterRevision", "", "uint16")); - NextTest(); - } - - CHIP_ERROR TestReadTheGlobalAttributeAttributeList_3() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ChannelClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_3, OnFailureCallback_3, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_3(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_3(const chip::app::DataModel::DecodableList & attributeList) - { - VerifyOrReturn(CheckConstraintType("attributeList", "", "list")); - NextTest(); - } -}; - -class Test_TC_MC_1_7Suite : public TestCommand -{ -public: - Test_TC_MC_1_7Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_MC_1_7", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_MC_1_7Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_1_7\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_1_7\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + case 157: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::TestCluster::Commands::BooleanResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("value", value.value, true)); + } break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : read the global attribute: ClusterRevision\n"); - err = TestReadTheGlobalAttributeClusterRevision_1(); + case 158: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::TestCluster::Commands::BooleanResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("value", value.value, false)); + } break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Read the global attribute constraints: ClusterRevision\n"); - err = TestReadTheGlobalAttributeConstraintsClusterRevision_2(); + case 159: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::TestCluster::Commands::SimpleStructResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("arg1.a", value.arg1.a, 17)); + VerifyOrReturn(CheckValue("arg1.b", value.arg1.b, false)); + VerifyOrReturn(CheckValue("arg1.c", value.arg1.c, 2)); + VerifyOrReturn( + CheckValueAsString("arg1.d", value.arg1.d, chip::ByteSpan(chip::Uint8::from_const_char("octet_string"), 12))); + VerifyOrReturn(CheckValueAsString("arg1.e", value.arg1.e, chip::CharSpan("char_string", 11))); + VerifyOrReturn(CheckValue("arg1.f", value.arg1.f, 1)); + VerifyOrReturn(CheckValue("arg1.g", value.arg1.g, 0.1f)); + VerifyOrReturn(CheckValue("arg1.h", value.arg1.h, 0.1)); + } break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Read the global attribute: AttributeList\n"); - err = TestReadTheGlobalAttributeAttributeList_3(); + case 160: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::TestCluster::Commands::BooleanResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("value", value.value, true)); + } break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 4; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: + case 161: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; + { + chip::app::Clusters::TestCluster::Commands::BooleanResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("value", value.value, false)); + } break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - static void OnFailureCallback_1(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_1(error); - } - - static void OnSuccessCallback_1(void * context, uint16_t clusterRevision) - { - (static_cast(context))->OnSuccessResponse_1(clusterRevision); - } - - static void OnFailureCallback_2(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_2(error); - } - - static void OnSuccessCallback_2(void * context, uint16_t clusterRevision) - { - (static_cast(context))->OnSuccessResponse_2(clusterRevision); - } - - static void OnFailureCallback_3(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_3(error); - } - - static void OnSuccessCallback_3(void * context, const chip::app::DataModel::DecodableList & attributeList) - { - (static_cast(context))->OnSuccessResponse_3(attributeList); - } - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestReadTheGlobalAttributeClusterRevision_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::MediaPlaybackClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_1, OnFailureCallback_1, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_1(uint16_t clusterRevision) - { - VerifyOrReturn(CheckValue("clusterRevision", clusterRevision, 1U)); - - NextTest(); - } - - CHIP_ERROR TestReadTheGlobalAttributeConstraintsClusterRevision_2() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::MediaPlaybackClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_2, OnFailureCallback_2, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_2(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_2(uint16_t clusterRevision) - { - VerifyOrReturn(CheckConstraintType("clusterRevision", "", "uint16")); - NextTest(); - } - - CHIP_ERROR TestReadTheGlobalAttributeAttributeList_3() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::MediaPlaybackClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_3, OnFailureCallback_3, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_3(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_3(const chip::app::DataModel::DecodableList & attributeList) - { - VerifyOrReturn(CheckConstraintType("attributeList", "", "list")); - NextTest(); - } -}; - -class Test_TC_MC_1_8Suite : public TestCommand -{ -public: - Test_TC_MC_1_8Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_MC_1_8", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_MC_1_8Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_1_8\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_1_8\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + case 162: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::TestCluster::Commands::TestListInt8UReverseResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + { + auto iter_0 = value.arg1.begin(); + VerifyOrReturn(CheckNextListItemDecodes("arg1", iter_0, 0)); + VerifyOrReturn(CheckValue("arg1[0]", iter_0.GetValue(), 9)); + VerifyOrReturn(CheckNextListItemDecodes("arg1", iter_0, 1)); + VerifyOrReturn(CheckValue("arg1[1]", iter_0.GetValue(), 8)); + VerifyOrReturn(CheckNextListItemDecodes("arg1", iter_0, 2)); + VerifyOrReturn(CheckValue("arg1[2]", iter_0.GetValue(), 7)); + VerifyOrReturn(CheckNextListItemDecodes("arg1", iter_0, 3)); + VerifyOrReturn(CheckValue("arg1[3]", iter_0.GetValue(), 6)); + VerifyOrReturn(CheckNextListItemDecodes("arg1", iter_0, 4)); + VerifyOrReturn(CheckValue("arg1[4]", iter_0.GetValue(), 5)); + VerifyOrReturn(CheckNextListItemDecodes("arg1", iter_0, 5)); + VerifyOrReturn(CheckValue("arg1[5]", iter_0.GetValue(), 4)); + VerifyOrReturn(CheckNextListItemDecodes("arg1", iter_0, 6)); + VerifyOrReturn(CheckValue("arg1[6]", iter_0.GetValue(), 3)); + VerifyOrReturn(CheckNextListItemDecodes("arg1", iter_0, 7)); + VerifyOrReturn(CheckValue("arg1[7]", iter_0.GetValue(), 2)); + VerifyOrReturn(CheckNextListItemDecodes("arg1", iter_0, 8)); + VerifyOrReturn(CheckValue("arg1[8]", iter_0.GetValue(), 1)); + VerifyOrReturn(CheckNoMoreListItems("arg1", iter_0, 9)); + } + } break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : read the global attribute: ClusterRevision\n"); - err = TestReadTheGlobalAttributeClusterRevision_1(); + case 163: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::TestCluster::Commands::TestListInt8UReverseResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + { + auto iter_0 = value.arg1.begin(); + VerifyOrReturn(CheckNoMoreListItems("arg1", iter_0, 0)); + } + } break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Read the global attribute constraints: ClusterRevision\n"); - err = TestReadTheGlobalAttributeConstraintsClusterRevision_2(); + case 164: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::TestCluster::Commands::BooleanResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("value", value.value, true)); + } break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Read the global attribute: AttributeList\n"); - err = TestReadTheGlobalAttributeAttributeList_3(); + case 165: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::TestCluster::Commands::BooleanResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("value", value.value, false)); + } break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 4; + case 166: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::TestCluster::Commands::BooleanResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("value", value.value, true)); + } + break; + case 167: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::TestCluster::Commands::BooleanResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("value", value.value, false)); + } + break; + case 168: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 169: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + { + auto iter_0 = value.begin(); + VerifyOrReturn(CheckNextListItemDecodes("listInt8u", iter_0, 0)); + VerifyOrReturn(CheckValue("listInt8u[0]", iter_0.GetValue(), 1)); + VerifyOrReturn(CheckNextListItemDecodes("listInt8u", iter_0, 1)); + VerifyOrReturn(CheckValue("listInt8u[1]", iter_0.GetValue(), 2)); + VerifyOrReturn(CheckNextListItemDecodes("listInt8u", iter_0, 2)); + VerifyOrReturn(CheckValue("listInt8u[2]", iter_0.GetValue(), 3)); + VerifyOrReturn(CheckNextListItemDecodes("listInt8u", iter_0, 3)); + VerifyOrReturn(CheckValue("listInt8u[3]", iter_0.GetValue(), 4)); + VerifyOrReturn(CheckNoMoreListItems("listInt8u", iter_0, 4)); + } + } + break; + case 170: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 171: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + { + auto iter_0 = value.begin(); + VerifyOrReturn(CheckNextListItemDecodes("listOctetString", iter_0, 0)); + VerifyOrReturn(CheckValueAsString("listOctetString[0]", iter_0.GetValue(), + chip::ByteSpan(chip::Uint8::from_const_char("Test0"), 5))); + VerifyOrReturn(CheckNextListItemDecodes("listOctetString", iter_0, 1)); + VerifyOrReturn(CheckValueAsString("listOctetString[1]", iter_0.GetValue(), + chip::ByteSpan(chip::Uint8::from_const_char("Test1"), 5))); + VerifyOrReturn(CheckNextListItemDecodes("listOctetString", iter_0, 2)); + VerifyOrReturn(CheckValueAsString("listOctetString[2]", iter_0.GetValue(), + chip::ByteSpan(chip::Uint8::from_const_char("Test2"), 5))); + VerifyOrReturn(CheckNextListItemDecodes("listOctetString", iter_0, 3)); + VerifyOrReturn(CheckValueAsString("listOctetString[3]", iter_0.GetValue(), + chip::ByteSpan(chip::Uint8::from_const_char("Test3"), 5))); + VerifyOrReturn(CheckNoMoreListItems("listOctetString", iter_0, 4)); + } + } + break; + case 172: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 173: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList + value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + { + auto iter_0 = value.begin(); + VerifyOrReturn(CheckNextListItemDecodes("listStructOctetString", iter_0, 0)); + VerifyOrReturn(CheckValue("listStructOctetString[0].fabricIndex", iter_0.GetValue().fabricIndex, 0ULL)); + VerifyOrReturn(CheckValueAsString("listStructOctetString[0].operationalCert", iter_0.GetValue().operationalCert, + chip::ByteSpan(chip::Uint8::from_const_char("Test0"), 5))); + VerifyOrReturn(CheckNextListItemDecodes("listStructOctetString", iter_0, 1)); + VerifyOrReturn(CheckValue("listStructOctetString[1].fabricIndex", iter_0.GetValue().fabricIndex, 1ULL)); + VerifyOrReturn(CheckValueAsString("listStructOctetString[1].operationalCert", iter_0.GetValue().operationalCert, + chip::ByteSpan(chip::Uint8::from_const_char("Test1"), 5))); + VerifyOrReturn(CheckNextListItemDecodes("listStructOctetString", iter_0, 2)); + VerifyOrReturn(CheckValue("listStructOctetString[2].fabricIndex", iter_0.GetValue().fabricIndex, 2ULL)); + VerifyOrReturn(CheckValueAsString("listStructOctetString[2].operationalCert", iter_0.GetValue().operationalCert, + chip::ByteSpan(chip::Uint8::from_const_char("Test2"), 5))); + VerifyOrReturn(CheckNextListItemDecodes("listStructOctetString", iter_0, 3)); + VerifyOrReturn(CheckValue("listStructOctetString[3].fabricIndex", iter_0.GetValue().fabricIndex, 3ULL)); + VerifyOrReturn(CheckValueAsString("listStructOctetString[3].operationalCert", iter_0.GetValue().operationalCert, + chip::ByteSpan(chip::Uint8::from_const_char("Test3"), 5))); + VerifyOrReturn(CheckNoMoreListItems("listStructOctetString", iter_0, 4)); + } + } + break; + case 174: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::TestCluster::Commands::TestNullableOptionalResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("wasPresent", value.wasPresent, true)); - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; + VerifyOrReturn(CheckValuePresent("wasNull", value.wasNull)); + VerifyOrReturn(CheckValue("wasNull.Value()", value.wasNull.Value(), false)); - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; + VerifyOrReturn(CheckValuePresent("value", value.value)); + VerifyOrReturn(CheckValue("value.Value()", value.value.Value(), 5)); - switch (mTestIndex - 1) - { - case 0: + VerifyOrReturn(CheckValuePresent("originalValue", value.originalValue)); + VerifyOrReturn(CheckValueNonNull("originalValue.Value()", value.originalValue.Value())); + VerifyOrReturn(CheckValue("originalValue.Value().Value()", value.originalValue.Value().Value(), 5)); + } + break; + case 175: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; + { + chip::app::Clusters::TestCluster::Commands::TestNullableOptionalResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("wasPresent", value.wasPresent, false)); + } break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - static void OnFailureCallback_1(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_1(error); - } - - static void OnSuccessCallback_1(void * context, uint16_t clusterRevision) - { - (static_cast(context))->OnSuccessResponse_1(clusterRevision); - } - - static void OnFailureCallback_2(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_2(error); - } - - static void OnSuccessCallback_2(void * context, uint16_t clusterRevision) - { - (static_cast(context))->OnSuccessResponse_2(clusterRevision); - } - - static void OnFailureCallback_3(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_3(error); - } - - static void OnSuccessCallback_3(void * context, const chip::app::DataModel::DecodableList & attributeList) - { - (static_cast(context))->OnSuccessResponse_3(attributeList); - } - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestReadTheGlobalAttributeClusterRevision_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::AudioOutputClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_1, OnFailureCallback_1, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_1(uint16_t clusterRevision) - { - VerifyOrReturn(CheckValue("clusterRevision", clusterRevision, 1U)); - - NextTest(); - } - - CHIP_ERROR TestReadTheGlobalAttributeConstraintsClusterRevision_2() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::AudioOutputClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_2, OnFailureCallback_2, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_2(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_2(uint16_t clusterRevision) - { - VerifyOrReturn(CheckConstraintType("clusterRevision", "", "uint16")); - NextTest(); - } - - CHIP_ERROR TestReadTheGlobalAttributeAttributeList_3() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::AudioOutputClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_3, OnFailureCallback_3, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_3(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_3(const chip::app::DataModel::DecodableList & attributeList) - { - VerifyOrReturn(CheckConstraintType("attributeList", "", "list")); - NextTest(); - } -}; - -class Test_TC_MC_1_9Suite : public TestCommand -{ -public: - Test_TC_MC_1_9Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_MC_1_9", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_MC_1_9Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_1_9\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_1_9\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + case 176: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList< + chip::app::Clusters::TestCluster::Structs::NullablesAndOptionalsStruct::DecodableType> + value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + { + auto iter_0 = value.begin(); + VerifyOrReturn(CheckNextListItemDecodes("listNullablesAndOptionalsStruct", iter_0, 0)); + VerifyOrReturn(CheckValueNull("listNullablesAndOptionalsStruct[0].nullableInt", iter_0.GetValue().nullableInt)); + VerifyOrReturn( + CheckValueNull("listNullablesAndOptionalsStruct[0].nullableString", iter_0.GetValue().nullableString)); + VerifyOrReturn( + CheckValueNull("listNullablesAndOptionalsStruct[0].nullableStruct", iter_0.GetValue().nullableStruct)); + VerifyOrReturn( + CheckValueNull("listNullablesAndOptionalsStruct[0].nullableList", iter_0.GetValue().nullableList)); + VerifyOrReturn(CheckNoMoreListItems("listNullablesAndOptionalsStruct", iter_0, 1)); + } + } break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : read the global attribute: ClusterRevision\n"); - err = TestReadTheGlobalAttributeClusterRevision_1(); + case 177: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Read the global attribute constraints: ClusterRevision\n"); - err = TestReadTheGlobalAttributeConstraintsClusterRevision_2(); + case 178: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList< + chip::app::Clusters::TestCluster::Structs::NullablesAndOptionalsStruct::DecodableType> + value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + { + auto iter_0 = value.begin(); + VerifyOrReturn(CheckNextListItemDecodes("listNullablesAndOptionalsStruct", iter_0, 0)); + VerifyOrReturn(CheckValueNull("listNullablesAndOptionalsStruct[0].nullableInt", iter_0.GetValue().nullableInt)); + VerifyOrReturn( + CheckValueNull("listNullablesAndOptionalsStruct[0].nullableString", iter_0.GetValue().nullableString)); + VerifyOrReturn( + CheckValueNull("listNullablesAndOptionalsStruct[0].nullableStruct", iter_0.GetValue().nullableStruct)); + VerifyOrReturn( + CheckValueNonNull("listNullablesAndOptionalsStruct[0].nullableList", iter_0.GetValue().nullableList)); + { + auto iter_NaN = iter_0.GetValue().nullableList.Value().begin(); + VerifyOrReturn(CheckNextListItemDecodes( + "listNullablesAndOptionalsStruct[0].nullableList.Value()", iter_NaN, 0)); + VerifyOrReturn( + CheckValue("listNullablesAndOptionalsStruct[0].nullableList.Value()[0]", iter_NaN.GetValue(), 1)); + VerifyOrReturn(CheckNextListItemDecodes( + "listNullablesAndOptionalsStruct[0].nullableList.Value()", iter_NaN, 1)); + VerifyOrReturn( + CheckValue("listNullablesAndOptionalsStruct[0].nullableList.Value()[1]", iter_NaN.GetValue(), 2)); + VerifyOrReturn(CheckNoMoreListItems( + "listNullablesAndOptionalsStruct[0].nullableList.Value()", iter_NaN, 2)); + } + VerifyOrReturn(CheckNoMoreListItems("listNullablesAndOptionalsStruct", iter_0, 1)); + } + } break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Read the global attribute: AttributeList\n"); - err = TestReadTheGlobalAttributeAttributeList_3(); + case 179: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 4; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: + case 180: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNull("nullableBoolean", value)); + } break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - static void OnFailureCallback_1(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_1(error); - } - - static void OnSuccessCallback_1(void * context, uint16_t clusterRevision) - { - (static_cast(context))->OnSuccessResponse_1(clusterRevision); - } - - static void OnFailureCallback_2(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_2(error); - } - - static void OnSuccessCallback_2(void * context, uint16_t clusterRevision) - { - (static_cast(context))->OnSuccessResponse_2(clusterRevision); - } - - static void OnFailureCallback_3(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_3(error); - } - - static void OnSuccessCallback_3(void * context, const chip::app::DataModel::DecodableList & attributeList) - { - (static_cast(context))->OnSuccessResponse_3(attributeList); - } - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestReadTheGlobalAttributeClusterRevision_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TargetNavigatorClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_1, OnFailureCallback_1, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_1(uint16_t clusterRevision) - { - VerifyOrReturn(CheckValue("clusterRevision", clusterRevision, 1U)); - - NextTest(); - } - - CHIP_ERROR TestReadTheGlobalAttributeConstraintsClusterRevision_2() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TargetNavigatorClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_2, OnFailureCallback_2, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_2(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_2(uint16_t clusterRevision) - { - VerifyOrReturn(CheckConstraintType("clusterRevision", "", "uint16")); - NextTest(); - } - - CHIP_ERROR TestReadTheGlobalAttributeAttributeList_3() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TargetNavigatorClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_3, OnFailureCallback_3, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_3(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_3(const chip::app::DataModel::DecodableList & attributeList) - { - VerifyOrReturn(CheckConstraintType("attributeList", "", "list")); - NextTest(); - } -}; - -class Test_TC_MC_1_10Suite : public TestCommand -{ -public: - Test_TC_MC_1_10Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_MC_1_10", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_MC_1_10Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_1_10\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_1_10\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + case 181: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : read the global attribute: ClusterRevision\n"); - err = TestReadTheGlobalAttributeClusterRevision_1(); + case 182: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNonNull("nullableBoolean", value)); + VerifyOrReturn(CheckValue("nullableBoolean.Value()", value.Value(), true)); + } break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Read the global attribute constraints: ClusterRevision\n"); - err = TestReadTheGlobalAttributeConstraintsClusterRevision_2(); + case 183: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Read the global attribute: AttributeList\n"); - err = TestReadTheGlobalAttributeAttributeList_3(); + case 184: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable> value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNonNull("nullableBitmap8", value)); + VerifyOrReturn(CheckValue("nullableBitmap8.Value()", value.Value(), 254)); + } break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 4; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: + case 185: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); + break; + case 186: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; + { + chip::app::DataModel::Nullable> value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNonNull("nullableBitmap8", value)); + VerifyOrReturn(CheckValue("nullableBitmap8.Value()", value.Value(), 254)); + } break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - static void OnFailureCallback_1(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_1(error); - } - - static void OnSuccessCallback_1(void * context, uint16_t clusterRevision) - { - (static_cast(context))->OnSuccessResponse_1(clusterRevision); - } - - static void OnFailureCallback_2(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_2(error); - } - - static void OnSuccessCallback_2(void * context, uint16_t clusterRevision) - { - (static_cast(context))->OnSuccessResponse_2(clusterRevision); - } - - static void OnFailureCallback_3(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_3(error); - } - - static void OnSuccessCallback_3(void * context, const chip::app::DataModel::DecodableList & attributeList) - { - (static_cast(context))->OnSuccessResponse_3(attributeList); - } - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestReadTheGlobalAttributeClusterRevision_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ApplicationBasicClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_1, OnFailureCallback_1, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_1(uint16_t clusterRevision) - { - VerifyOrReturn(CheckValue("clusterRevision", clusterRevision, 1U)); - - NextTest(); - } - - CHIP_ERROR TestReadTheGlobalAttributeConstraintsClusterRevision_2() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ApplicationBasicClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_2, OnFailureCallback_2, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_2(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_2(uint16_t clusterRevision) - { - VerifyOrReturn(CheckConstraintType("clusterRevision", "", "uint16")); - NextTest(); - } - - CHIP_ERROR TestReadTheGlobalAttributeAttributeList_3() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ApplicationBasicClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_3, OnFailureCallback_3, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_3(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_3(const chip::app::DataModel::DecodableList & attributeList) - { - VerifyOrReturn(CheckConstraintType("attributeList", "", "list")); - NextTest(); - } -}; - -class Test_TC_MC_1_11Suite : public TestCommand -{ -public: - Test_TC_MC_1_11Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_MC_1_11", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_MC_1_11Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_1_11\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_1_11\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + case 187: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : read the global attribute: ClusterRevision\n"); - err = TestReadTheGlobalAttributeClusterRevision_1(); + case 188: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable> value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNull("nullableBitmap8", value)); + } break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Read the global attribute constraints: ClusterRevision\n"); - err = TestReadTheGlobalAttributeConstraintsClusterRevision_2(); + case 189: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Read the global attribute: AttributeList\n"); - err = TestReadTheGlobalAttributeAttributeList_3(); + case 190: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable> value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNonNull("nullableBitmap16", value)); + VerifyOrReturn(CheckValue("nullableBitmap16.Value()", value.Value(), 65534U)); + } break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 4; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: + case 191: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); + break; + case 192: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; + { + chip::app::DataModel::Nullable> value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNonNull("nullableBitmap16", value)); + VerifyOrReturn(CheckValue("nullableBitmap16.Value()", value.Value(), 65534U)); + } break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - static void OnFailureCallback_1(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_1(error); - } - - static void OnSuccessCallback_1(void * context, uint16_t clusterRevision) - { - (static_cast(context))->OnSuccessResponse_1(clusterRevision); - } - - static void OnFailureCallback_2(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_2(error); - } - - static void OnSuccessCallback_2(void * context, uint16_t clusterRevision) - { - (static_cast(context))->OnSuccessResponse_2(clusterRevision); - } - - static void OnFailureCallback_3(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_3(error); - } - - static void OnSuccessCallback_3(void * context, const chip::app::DataModel::DecodableList & attributeList) - { - (static_cast(context))->OnSuccessResponse_3(attributeList); - } - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestReadTheGlobalAttributeClusterRevision_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ContentLauncherClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_1, OnFailureCallback_1, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_1(uint16_t clusterRevision) - { - VerifyOrReturn(CheckValue("clusterRevision", clusterRevision, 1U)); - - NextTest(); - } - - CHIP_ERROR TestReadTheGlobalAttributeConstraintsClusterRevision_2() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ContentLauncherClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_2, OnFailureCallback_2, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_2(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_2(uint16_t clusterRevision) - { - VerifyOrReturn(CheckConstraintType("clusterRevision", "", "uint16")); - NextTest(); - } - - CHIP_ERROR TestReadTheGlobalAttributeAttributeList_3() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ContentLauncherClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_3, OnFailureCallback_3, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_3(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_3(const chip::app::DataModel::DecodableList & attributeList) - { - VerifyOrReturn(CheckConstraintType("attributeList", "", "list")); - NextTest(); - } -}; - -class Test_TC_MC_1_12Suite : public TestCommand -{ -public: - Test_TC_MC_1_12Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_MC_1_12", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_MC_1_12Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_1_12\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_1_12\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + case 193: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : read the global attribute: ClusterRevision\n"); - err = TestReadTheGlobalAttributeClusterRevision_1(); + case 194: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable> value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNull("nullableBitmap16", value)); + } break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Read the global attribute constraints: ClusterRevision\n"); - err = TestReadTheGlobalAttributeConstraintsClusterRevision_2(); + case 195: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Read the global attribute: AttributeList\n"); - err = TestReadTheGlobalAttributeAttributeList_3(); + case 196: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable> value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNonNull("nullableBitmap32", value)); + VerifyOrReturn(CheckValue("nullableBitmap32.Value()", value.Value(), 4294967294UL)); + } break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 4; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: + case 197: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); + break; + case 198: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; + { + chip::app::DataModel::Nullable> value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNonNull("nullableBitmap32", value)); + VerifyOrReturn(CheckValue("nullableBitmap32.Value()", value.Value(), 4294967294UL)); + } break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - static void OnFailureCallback_1(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_1(error); - } - - static void OnSuccessCallback_1(void * context, uint16_t clusterRevision) - { - (static_cast(context))->OnSuccessResponse_1(clusterRevision); - } - - static void OnFailureCallback_2(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_2(error); - } - - static void OnSuccessCallback_2(void * context, uint16_t clusterRevision) - { - (static_cast(context))->OnSuccessResponse_2(clusterRevision); - } - - static void OnFailureCallback_3(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_3(error); - } - - static void OnSuccessCallback_3(void * context, const chip::app::DataModel::DecodableList & attributeList) - { - (static_cast(context))->OnSuccessResponse_3(attributeList); - } - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestReadTheGlobalAttributeClusterRevision_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::AccountLoginClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_1, OnFailureCallback_1, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_1(uint16_t clusterRevision) - { - VerifyOrReturn(CheckValue("clusterRevision", clusterRevision, 1U)); - - NextTest(); - } - - CHIP_ERROR TestReadTheGlobalAttributeConstraintsClusterRevision_2() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::AccountLoginClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_2, OnFailureCallback_2, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_2(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_2(uint16_t clusterRevision) - { - VerifyOrReturn(CheckConstraintType("clusterRevision", "", "uint16")); - NextTest(); - } - - CHIP_ERROR TestReadTheGlobalAttributeAttributeList_3() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::AccountLoginClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_3, OnFailureCallback_3, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_3(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_3(const chip::app::DataModel::DecodableList & attributeList) - { - VerifyOrReturn(CheckConstraintType("attributeList", "", "list")); - NextTest(); - } -}; - -class Test_TC_MC_2_1Suite : public TestCommand -{ -public: - Test_TC_MC_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_MC_2_1", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_MC_2_1Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_2_1\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_2_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + case 199: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Put the device into low power mode\n"); - err = TestPutTheDeviceIntoLowPowerMode_1(); + case 200: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable> value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNull("nullableBitmap32", value)); + } break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 2; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: + case 201: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestPutTheDeviceIntoLowPowerMode_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::LowPower::Commands::Sleep::Type; - - RequestType request; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_1(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_1(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_1() { NextTest(); } -}; - -class Test_TC_MC_3_1Suite : public TestCommand -{ -public: - Test_TC_MC_3_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_MC_3_1", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_MC_3_1Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_3_1\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_3_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + case 202: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable> value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNonNull("nullableBitmap64", value)); + VerifyOrReturn(CheckValue("nullableBitmap64.Value()", value.Value(), 18446744073709551614ULL)); + } break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 1; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: + case 203: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); + break; + case 204: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; + { + chip::app::DataModel::Nullable> value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNonNull("nullableBitmap64", value)); + VerifyOrReturn(CheckValue("nullableBitmap64.Value()", value.Value(), 18446744073709551614ULL)); + } break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } -}; - -class Test_TC_MC_3_2Suite : public TestCommand -{ -public: - Test_TC_MC_3_2Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_MC_3_2", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_MC_3_2Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_3_2\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_3_2\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + case 205: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 1; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: + case 206: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; + { + chip::app::DataModel::Nullable> value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNull("nullableBitmap64", value)); + } break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } -}; - -class Test_TC_MC_3_3Suite : public TestCommand -{ -public: - Test_TC_MC_3_3Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_MC_3_3", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_MC_3_3Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_3_3\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_3_3\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + case 207: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 1; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: + case 208: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNonNull("nullableInt8u", value)); + VerifyOrReturn(CheckValue("nullableInt8u.Value()", value.Value(), 0)); + } break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } -}; - -class Test_TC_MC_3_4Suite : public TestCommand -{ -public: - Test_TC_MC_3_4Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_MC_3_4", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_MC_3_4Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_3_4\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_3_4\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + case 209: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 1; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: + case 210: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNonNull("nullableInt8u", value)); + VerifyOrReturn(CheckValue("nullableInt8u.Value()", value.Value(), 254)); + } break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } -}; - -class Test_TC_MC_3_5Suite : public TestCommand -{ -public: - Test_TC_MC_3_5Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_MC_3_5", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_MC_3_5Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_3_5\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_3_5\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + case 211: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 1; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: + case 212: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNonNull("nullableInt8u", value)); + VerifyOrReturn(CheckValue("nullableInt8u.Value()", value.Value(), 254)); + } break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } -}; - -class Test_TC_MC_3_6Suite : public TestCommand -{ -public: - Test_TC_MC_3_6Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_MC_3_6", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_MC_3_6Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_3_6\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_3_6\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + case 213: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNonNull("value", value)); + } break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 1; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: + case 214: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } -}; - -class Test_TC_MC_3_7Suite : public TestCommand -{ -public: - Test_TC_MC_3_7Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_MC_3_7", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_MC_3_7Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_3_7\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_3_7\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + case 215: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNull("nullableInt8u", value)); + } break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 1; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: + case 216: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 254)); + } break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } -}; - -class Test_TC_MC_3_8Suite : public TestCommand -{ -public: - Test_TC_MC_3_8Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_MC_3_8", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_MC_3_8Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_3_8\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_3_8\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + case 217: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintNotValue("value", value, 254)); + } break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 1; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: + case 218: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } -}; - -class Test_TC_MC_3_9Suite : public TestCommand -{ -public: - Test_TC_MC_3_9Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_MC_3_9", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_MC_3_9Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_3_9\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_3_9\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + case 219: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 254)); + } break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 1; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: + case 220: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintNotValue("value", value, 129)); + } break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } -}; - -class Test_TC_MC_3_10Suite : public TestCommand -{ -public: - Test_TC_MC_3_10Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_MC_3_10", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_MC_3_10Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_3_10\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_3_10\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + case 221: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 1; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: + case 222: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNonNull("nullableInt16u", value)); + VerifyOrReturn(CheckValue("nullableInt16u.Value()", value.Value(), 0U)); + } break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } -}; - -class Test_TC_MC_3_11Suite : public TestCommand -{ -public: - Test_TC_MC_3_11Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_MC_3_11", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_MC_3_11Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_3_11\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_3_11\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + case 223: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 1; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: + case 224: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNonNull("nullableInt16u", value)); + VerifyOrReturn(CheckValue("nullableInt16u.Value()", value.Value(), 65534U)); + } break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } -}; - -class Test_TC_MC_5_1Suite : public TestCommand -{ -public: - Test_TC_MC_5_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_MC_5_1", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_MC_5_1Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_5_1\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_5_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Reads the ChannelList attribute from the DUT\n"); - err = TestReadsTheChannelListAttributeFromTheDut_1(); + case 225: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 2; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: + case 226: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - static void OnFailureCallback_1(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_1(error); - } - - static void OnSuccessCallback_1( - void * context, - const chip::app::DataModel::DecodableList & channelList) - { - (static_cast(context))->OnSuccessResponse_1(channelList); - } - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestReadsTheChannelListAttributeFromTheDut_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ChannelClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_1, OnFailureCallback_1, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_1( - const chip::app::DataModel::DecodableList & channelList) - { - VerifyOrReturn(CheckConstraintType("channelList", "", "list")); - NextTest(); - } -}; - -class Test_TC_MC_5_2Suite : public TestCommand -{ -public: - Test_TC_MC_5_2Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_MC_5_2", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_MC_5_2Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_5_2\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_5_2\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : log a command\n"); - err = TestLogACommand_1(); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNonNull("nullableInt16u", value)); + VerifyOrReturn(CheckValue("nullableInt16u.Value()", value.Value(), 65534U)); + } break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 2; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: + case 227: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; break; - case 1: + case 228: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestLogACommand_1() - { - SetIdentity(kIdentityAlpha); - return UserPrompt("verify that the channel has changed on the device."); - } -}; - -class Test_TC_MC_5_3Suite : public TestCommand -{ -public: - Test_TC_MC_5_3Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_MC_5_3", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_MC_5_3Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_5_3\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_5_3\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : log a command\n"); - err = TestLogACommand_1(); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNull("nullableInt16u", value)); + } break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 2; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: + case 229: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 65534U)); + } break; - case 1: + case 230: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestLogACommand_1() - { - SetIdentity(kIdentityAlpha); - return UserPrompt("verify that the channel has changed on the device"); - } -}; - -class Test_TC_MC_6_1Suite : public TestCommand -{ -public: - Test_TC_MC_6_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_MC_6_1", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_MC_6_1Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_6_1\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_6_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : log a command\n"); - err = TestLogACommand_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : log a command\n"); - err = TestLogACommand_2(); - break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Reads the playback state attribute\n"); - err = TestReadsThePlaybackStateAttribute_3(); - break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : log a command\n"); - err = TestLogACommand_4(); - break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : log a command\n"); - err = TestLogACommand_5(); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintNotValue("value", value, 65534U)); + } break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 6; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: + case 231: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; break; - case 1: + case 232: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 65534U)); + } break; - case 2: + case 233: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintNotValue("value", value, 32001U)); + } break; - case 4: + case 234: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; break; - case 5: + case 235: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - static void OnFailureCallback_3(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_3(error); - } - - static void OnSuccessCallback_3(void * context, chip::app::Clusters::MediaPlayback::PlaybackStateEnum currentState) - { - (static_cast(context))->OnSuccessResponse_3(currentState); - } - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestLogACommand_1() - { - SetIdentity(kIdentityAlpha); - return UserPrompt("Verify that media is paused"); - } - - CHIP_ERROR TestLogACommand_2() - { - SetIdentity(kIdentityAlpha); - return UserPrompt("Physically verify that the media is playing"); - } - - CHIP_ERROR TestReadsThePlaybackStateAttribute_3() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::MediaPlaybackClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_3, OnFailureCallback_3, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_3(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_3(chip::app::Clusters::MediaPlayback::PlaybackStateEnum currentState) - { - VerifyOrReturn(CheckValue("currentState", currentState, 0)); - - NextTest(); - } - - CHIP_ERROR TestLogACommand_4() - { - SetIdentity(kIdentityAlpha); - return UserPrompt("Physically verify that the media is paused"); - } - - CHIP_ERROR TestLogACommand_5() - { - SetIdentity(kIdentityAlpha); - return UserPrompt("Physically verify that the media is stoped"); - } -}; - -class Test_TC_MC_6_2Suite : public TestCommand -{ -public: - Test_TC_MC_6_2Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_MC_6_2", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_MC_6_2Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_6_2\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_6_2\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : log a command\n"); - err = TestLogACommand_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : log a command\n"); - err = TestLogACommand_2(); - break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Reads the CurrentState attribute\n"); - err = TestReadsTheCurrentStateAttribute_3(); - break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : log a command\n"); - err = TestLogACommand_4(); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNonNull("nullableInt32u", value)); + VerifyOrReturn(CheckValue("nullableInt32u.Value()", value.Value(), 0UL)); + } break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : log a command\n"); - err = TestLogACommand_5(); + case 236: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : log a command\n"); - err = TestLogACommand_6(); + case 237: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNonNull("nullableInt32u", value)); + VerifyOrReturn(CheckValue("nullableInt32u.Value()", value.Value(), 4294967294UL)); + } break; - case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : log a command\n"); - err = TestLogACommand_7(); + case 238: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); break; - case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : log a command\n"); - err = TestLogACommand_8(); + case 239: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNonNull("nullableInt32u", value)); + VerifyOrReturn(CheckValue("nullableInt32u.Value()", value.Value(), 4294967294UL)); + } break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 9; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: + case 240: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; break; - case 1: + case 241: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNull("nullableInt32u", value)); + } break; - case 2: + case 242: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0UL)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 4294967294UL)); + } break; - case 4: + case 243: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintNotValue("value", value, 4294967294UL)); + } break; - case 5: + case 244: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; break; - case 6: + case 245: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0UL)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 4294967294UL)); + } break; - case 7: + case 246: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintNotValue("value", value, 2147483648UL)); + } break; - case 8: + case 247: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - static void OnFailureCallback_3(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_3(error); - } - - static void OnSuccessCallback_3(void * context, chip::app::Clusters::MediaPlayback::PlaybackStateEnum currentState) - { - (static_cast(context))->OnSuccessResponse_3(currentState); - } - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestLogACommand_1() - { - SetIdentity(kIdentityAlpha); - return UserPrompt("Verify that media is paused"); - } - - CHIP_ERROR TestLogACommand_2() - { - SetIdentity(kIdentityAlpha); - return UserPrompt("Physically verify that the media is playing"); - } - - CHIP_ERROR TestReadsTheCurrentStateAttribute_3() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::MediaPlaybackClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_3, OnFailureCallback_3, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_3(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_3(chip::app::Clusters::MediaPlayback::PlaybackStateEnum currentState) - { - VerifyOrReturn(CheckValue("currentState", currentState, 0)); - - NextTest(); - } - - CHIP_ERROR TestLogACommand_4() - { - SetIdentity(kIdentityAlpha); - return UserPrompt("Physically verify that the media is started over"); - } - - CHIP_ERROR TestLogACommand_5() - { - SetIdentity(kIdentityAlpha); - return UserPrompt("Verify that the next media item in the queue has been loaded"); - } - - CHIP_ERROR TestLogACommand_6() - { - SetIdentity(kIdentityAlpha); - return UserPrompt("Verify that the previous media item in the queue has been loaded"); - } - - CHIP_ERROR TestLogACommand_7() - { - SetIdentity(kIdentityAlpha); - return UserPrompt("Verify that the media has skipped forward 10 seconds"); - } - - CHIP_ERROR TestLogACommand_8() - { - SetIdentity(kIdentityAlpha); - return UserPrompt("Verify that the media has skipped backward 10 seconds"); - } -}; - -class Test_TC_MC_6_3Suite : public TestCommand -{ -public: - Test_TC_MC_6_3Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_MC_6_3", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_MC_6_3Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_6_3\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_6_3\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + case 248: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNonNull("nullableInt64u", value)); + VerifyOrReturn(CheckValue("nullableInt64u.Value()", value.Value(), 0ULL)); + } break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : log a command\n"); - err = TestLogACommand_1(); + case 249: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : log a command\n"); - err = TestLogACommand_2(); + case 250: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNonNull("nullableInt64u", value)); + VerifyOrReturn(CheckValue("nullableInt64u.Value()", value.Value(), 18446744073709551614ULL)); + } break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : log a command\n"); - err = TestLogACommand_3(); + case 251: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 4; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: + case 252: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNonNull("nullableInt64u", value)); + VerifyOrReturn(CheckValue("nullableInt64u.Value()", value.Value(), 18446744073709551614ULL)); + } break; - case 1: + case 253: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; break; - case 2: + case 254: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNull("nullableInt64u", value)); + } break; - case 3: + case 255: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0ULL)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 18446744073709551614ULL)); + } break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestLogACommand_1() - { - SetIdentity(kIdentityAlpha); - return UserPrompt("Verify that media is paused"); - } - - CHIP_ERROR TestLogACommand_2() - { - SetIdentity(kIdentityAlpha); - return UserPrompt("Verify that the media has moved to 10 seconds from the starting point."); - } - - CHIP_ERROR TestLogACommand_3() - { - SetIdentity(kIdentityAlpha); - return UserPrompt("User prompt needed to enter the value beyond the furthest valid position"); - } -}; - -class Test_TC_MC_6_4Suite : public TestCommand -{ -public: - Test_TC_MC_6_4Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_MC_6_4", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_MC_6_4Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_6_4\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_6_4\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + case 256: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintNotValue("value", value, 18446744073709551614ULL)); + } break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : log a command\n"); - err = TestLogACommand_1(); + case 257: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Reads the PlaybackSpeed attribute from the DUT\n"); - err = TestReadsThePlaybackSpeedAttributeFromTheDut_2(); + case 258: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0ULL)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 18446744073709551614ULL)); + } break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : log a command\n"); - err = TestLogACommand_3(); + case 259: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintNotValue("value", value, 18000000000000000001ULL)); + } break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Reads the CurrentState attribute\n"); - err = TestReadsTheCurrentStateAttribute_4(); + case 260: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : log a command\n"); - err = TestLogACommand_5(); + case 261: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNonNull("nullableInt8s", value)); + VerifyOrReturn(CheckValue("nullableInt8s.Value()", value.Value(), -127)); + } break; - case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : log a command\n"); - err = TestLogACommand_6(); + case 262: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); break; - case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : Reads the CurrentState attribute\n"); - err = TestReadsTheCurrentStateAttribute_7(); + case 263: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNonNull("nullableInt8s", value)); + VerifyOrReturn(CheckValue("nullableInt8s.Value()", value.Value(), -127)); + } break; - case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : log a command\n"); - err = TestLogACommand_8(); + case 264: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : log a command\n"); - err = TestLogACommand_9(); + case 265: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNull("nullableInt8s", value)); + } break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 10; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: + case 266: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintMinValue("value", value, -127)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 127)); + } break; - case 1: + case 267: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintNotValue("value", value, -127)); + } break; - case 3: + case 268: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; break; - case 5: + case 269: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintMinValue("value", value, -127)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 127)); + } break; - case 6: + case 270: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintNotValue("value", value, -126)); + } break; - case 8: + case 271: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; break; - case 9: + case 272: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNonNull("nullableInt16s", value)); + VerifyOrReturn(CheckValue("nullableInt16s.Value()", value.Value(), -32767)); + } break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - static void OnFailureCallback_2(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_2(error); - } - - static void OnSuccessCallback_2(void * context, float playbackSpeed) - { - (static_cast(context))->OnSuccessResponse_2(playbackSpeed); - } - - static void OnFailureCallback_4(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_4(error); - } - - static void OnSuccessCallback_4(void * context, chip::app::Clusters::MediaPlayback::PlaybackStateEnum currentState) - { - (static_cast(context))->OnSuccessResponse_4(currentState); - } - - static void OnFailureCallback_7(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_7(error); - } - - static void OnSuccessCallback_7(void * context, chip::app::Clusters::MediaPlayback::PlaybackStateEnum currentState) - { - (static_cast(context))->OnSuccessResponse_7(currentState); - } - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestLogACommand_1() - { - SetIdentity(kIdentityAlpha); - return UserPrompt("Verify that media is paused"); - } - - CHIP_ERROR TestReadsThePlaybackSpeedAttributeFromTheDut_2() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::MediaPlaybackClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_2, OnFailureCallback_2, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_2(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_2(float playbackSpeed) - { - VerifyOrReturn(CheckValue("playbackSpeed", playbackSpeed, 0.0f)); - - NextTest(); - } - - CHIP_ERROR TestLogACommand_3() - { - SetIdentity(kIdentityAlpha); - return UserPrompt("Verify that the media is playing"); - } - - CHIP_ERROR TestReadsTheCurrentStateAttribute_4() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::MediaPlaybackClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_4, OnFailureCallback_4, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_4(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_4(chip::app::Clusters::MediaPlayback::PlaybackStateEnum currentState) - { - VerifyOrReturn(CheckValue("currentState", currentState, 0)); - - NextTest(); - } - - CHIP_ERROR TestLogACommand_5() - { - SetIdentity(kIdentityAlpha); - return UserPrompt("Verify that the media play speed has increased"); - } - - CHIP_ERROR TestLogACommand_6() - { - SetIdentity(kIdentityAlpha); - return UserPrompt("Verify that the media play has reversed direction"); - } - - CHIP_ERROR TestReadsTheCurrentStateAttribute_7() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::MediaPlaybackClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_7, OnFailureCallback_7, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_7(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_7(chip::app::Clusters::MediaPlayback::PlaybackStateEnum currentState) - { - VerifyOrReturn(CheckValue("currentState", currentState, 0)); - - NextTest(); - } - - CHIP_ERROR TestLogACommand_8() - { - SetIdentity(kIdentityAlpha); - return UserPrompt("Verify that the media play has reversed direction"); - } - - CHIP_ERROR TestLogACommand_9() - { - SetIdentity(kIdentityAlpha); - return UserPrompt("Verify that the media is has resumed playing forward at the default speed"); - } -}; - -class Test_TC_MC_7_1Suite : public TestCommand -{ -public: - Test_TC_MC_7_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_MC_7_1", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_MC_7_1Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_7_1\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_7_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + case 273: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 1; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: + case 274: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNonNull("nullableInt16s", value)); + VerifyOrReturn(CheckValue("nullableInt16s.Value()", value.Value(), -32767)); + } break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } -}; - -class Test_TC_MC_7_2Suite : public TestCommand -{ -public: - Test_TC_MC_7_2Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_MC_7_2", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_MC_7_2Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_7_2\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_7_2\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + case 275: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 1; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: + case 276: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNull("nullableInt16s", value)); + } break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } -}; - -class Test_TC_MC_8_1Suite : public TestCommand -{ -public: - Test_TC_MC_8_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_MC_8_1", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_MC_8_1Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_8_1\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_8_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + case 277: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintMinValue("value", value, -32767)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 32767)); + } break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Reads the CurrentTarget attribute\n"); - err = TestReadsTheCurrentTargetAttribute_1(); + case 278: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintNotValue("value", value, -32767)); + } break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Reads the TargetList attribute\n"); - err = TestReadsTheTargetListAttribute_2(); + case 279: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 3; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: + case 280: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintMinValue("value", value, -32767)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 32767)); + } break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - static void OnFailureCallback_1(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_1(error); - } - - static void OnSuccessCallback_1(void * context, uint8_t currentTarget) - { - (static_cast(context))->OnSuccessResponse_1(currentTarget); - } - - static void OnFailureCallback_2(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_2(error); - } - - static void OnSuccessCallback_2( - void * context, - const chip::app::DataModel::DecodableList & - targetList) - { - (static_cast(context))->OnSuccessResponse_2(targetList); - } - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestReadsTheCurrentTargetAttribute_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TargetNavigatorClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_1, OnFailureCallback_1, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_1(uint8_t currentTarget) - { - VerifyOrReturn(CheckConstraintType("currentTarget", "", "uint8")); - NextTest(); - } - - CHIP_ERROR TestReadsTheTargetListAttribute_2() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TargetNavigatorClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_2, OnFailureCallback_2, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_2(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_2( - const chip::app::DataModel::DecodableList & - targetList) - { - VerifyOrReturn(CheckConstraintType("targetList", "", "list")); - NextTest(); - } -}; - -class Test_TC_MC_9_1Suite : public TestCommand -{ -public: - Test_TC_MC_9_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_MC_9_1", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_MC_9_1Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_9_1\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_9_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + case 281: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintNotValue("value", value, -32766)); + } break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Precondition\n"); - err = TestPrecondition_1(); + case 282: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Reads the VendorName attribute\n"); - err = TestReadsTheVendorNameAttribute_2(); + case 283: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNonNull("nullableInt32s", value)); + VerifyOrReturn(CheckValue("nullableInt32s.Value()", value.Value(), -2147483647L)); + } break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Reads the VendorID attribute\n"); - err = TestReadsTheVendorIDAttribute_3(); + case 284: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Reads the ApplicationName attribute\n"); - err = TestReadsTheApplicationNameAttribute_4(); + case 285: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNonNull("nullableInt32s", value)); + VerifyOrReturn(CheckValue("nullableInt32s.Value()", value.Value(), -2147483647L)); + } break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Reads the ProductID attribute\n"); - err = TestReadsTheProductIDAttribute_5(); + case 286: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : Reads the Status attribute\n"); - err = TestReadsTheStatusAttribute_6(); + case 287: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNull("nullableInt32s", value)); + } break; - case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : Reads the ApplicationVersion attribute\n"); - err = TestReadsTheApplicationVersionAttribute_7(); + case 288: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintMinValue("value", value, -2147483647L)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 2147483647L)); + } break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 8; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: + case 289: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintNotValue("value", value, -2147483647L)); + } break; - case 1: + case 290: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - static void OnFailureCallback_2(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_2(error); - } - - static void OnSuccessCallback_2(void * context, chip::CharSpan vendorName) - { - (static_cast(context))->OnSuccessResponse_2(vendorName); - } - - static void OnFailureCallback_3(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_3(error); - } - - static void OnSuccessCallback_3(void * context, uint16_t vendorID) - { - (static_cast(context))->OnSuccessResponse_3(vendorID); - } - - static void OnFailureCallback_4(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_4(error); - } - - static void OnSuccessCallback_4(void * context, chip::CharSpan applicationName) - { - (static_cast(context))->OnSuccessResponse_4(applicationName); - } - - static void OnFailureCallback_5(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_5(error); - } - - static void OnSuccessCallback_5(void * context, uint16_t productID) - { - (static_cast(context))->OnSuccessResponse_5(productID); - } - - static void OnFailureCallback_6(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_6(error); - } - - static void OnSuccessCallback_6(void * context, chip::app::Clusters::ApplicationBasic::ApplicationStatusEnum status) - { - (static_cast(context))->OnSuccessResponse_6(status); - } - - static void OnFailureCallback_7(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_7(error); - } - - static void OnSuccessCallback_7(void * context, chip::CharSpan applicationVersion) - { - (static_cast(context))->OnSuccessResponse_7(applicationVersion); - } - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestPrecondition_1() - { - SetIdentity(kIdentityAlpha); - return Log("DUT has one or more Content Apps available"); - } - - CHIP_ERROR TestReadsTheVendorNameAttribute_2() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ApplicationBasicClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_2, OnFailureCallback_2, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_2(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_2(chip::CharSpan vendorName) - { - VerifyOrReturn(CheckConstraintType("vendorName", "", "string")); - VerifyOrReturn(CheckConstraintMaxLength("vendorName", vendorName.size(), 32)); - NextTest(); - } - - CHIP_ERROR TestReadsTheVendorIDAttribute_3() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ApplicationBasicClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_3, OnFailureCallback_3, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_3(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_3(uint16_t vendorID) - { - VerifyOrReturn(CheckConstraintType("vendorID", "", "vendor-id")); - NextTest(); - } - - CHIP_ERROR TestReadsTheApplicationNameAttribute_4() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ApplicationBasicClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_4, OnFailureCallback_4, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_4(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_4(chip::CharSpan applicationName) - { - VerifyOrReturn(CheckConstraintType("applicationName", "", "string")); - VerifyOrReturn(CheckConstraintMaxLength("applicationName", applicationName.size(), 256)); - NextTest(); - } - - CHIP_ERROR TestReadsTheProductIDAttribute_5() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ApplicationBasicClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_5, OnFailureCallback_5, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_5(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_5(uint16_t productID) - { - VerifyOrReturn(CheckConstraintType("productID", "", "uint16")); - NextTest(); - } - - CHIP_ERROR TestReadsTheStatusAttribute_6() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ApplicationBasicClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_6, OnFailureCallback_6, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_6(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_6(chip::app::Clusters::ApplicationBasic::ApplicationStatusEnum status) - { - VerifyOrReturn(CheckValue("status", status, 0)); - - NextTest(); - } - - CHIP_ERROR TestReadsTheApplicationVersionAttribute_7() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ApplicationBasicClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_7, OnFailureCallback_7, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_7(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_7(chip::CharSpan applicationVersion) - { - VerifyOrReturn(CheckConstraintType("applicationVersion", "", "string")); - VerifyOrReturn(CheckConstraintMaxLength("applicationVersion", applicationVersion.size(), 32)); - NextTest(); - } -}; - -class Test_TC_MC_10_1Suite : public TestCommand -{ -public: - Test_TC_MC_10_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_MC_10_1", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_MC_10_1Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_10_1\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_10_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + case 291: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintMinValue("value", value, -2147483647L)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 2147483647L)); + } break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : TH reads the AcceptHeader attribute from the DUT\n"); - err = TestThReadsTheAcceptHeaderAttributeFromTheDut_1(); + case 292: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintNotValue("value", value, -2147483646L)); + } break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : TH reads the SupportedStreamingProtocols attribute from the DUT\n"); - err = TestThReadsTheSupportedStreamingProtocolsAttributeFromTheDut_2(); + case 293: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 3; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: + case 294: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNonNull("nullableInt64s", value)); + VerifyOrReturn(CheckValue("nullableInt64s.Value()", value.Value(), -9223372036854775807LL)); + } break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - static void OnFailureCallback_1(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_1(error); - } - - static void OnSuccessCallback_1(void * context, const chip::app::DataModel::DecodableList & acceptHeader) - { - (static_cast(context))->OnSuccessResponse_1(acceptHeader); - } - - static void OnFailureCallback_2(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_2(error); - } - - static void OnSuccessCallback_2(void * context, uint32_t supportedStreamingProtocols) - { - (static_cast(context))->OnSuccessResponse_2(supportedStreamingProtocols); - } - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestThReadsTheAcceptHeaderAttributeFromTheDut_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ContentLauncherClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_1, OnFailureCallback_1, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_1(const chip::app::DataModel::DecodableList & acceptHeader) - { - VerifyOrReturn(CheckConstraintType("acceptHeader", "", "list")); - NextTest(); - } - - CHIP_ERROR TestThReadsTheSupportedStreamingProtocolsAttributeFromTheDut_2() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ContentLauncherClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_2, OnFailureCallback_2, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_2(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_2(uint32_t supportedStreamingProtocols) - { - VerifyOrReturn(CheckConstraintType("supportedStreamingProtocols", "", "map32")); - NextTest(); - } -}; - -class Test_TC_MOD_1_1Suite : public TestCommand -{ -public: - Test_TC_MOD_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_MOD_1_1", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_MOD_1_1Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MOD_1_1\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MOD_1_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + case 295: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : TH reads the ClusterRevision attribute from the DUT\n"); - err = TestThReadsTheClusterRevisionAttributeFromTheDut_1(); + case 296: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNonNull("nullableInt64s", value)); + VerifyOrReturn(CheckValue("nullableInt64s.Value()", value.Value(), -9223372036854775807LL)); + } break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : TH reads the AttributeList attribute from the DUT\n"); - err = TestThReadsTheAttributeListAttributeFromTheDut_2(); + case 297: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Read the global attribute: AcceptedCommandList\n"); - err = TestReadTheGlobalAttributeAcceptedCommandList_3(); + case 298: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNull("nullableInt64s", value)); + } break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Read the global attribute: GeneratedCommandList\n"); - err = TestReadTheGlobalAttributeGeneratedCommandList_4(); + case 299: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintMinValue("value", value, -9223372036854775807LL)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 9223372036854775807LL)); + } break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 5; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: + case 300: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintNotValue("value", value, -9223372036854775807LL)); + } break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - static void OnFailureCallback_1(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_1(error); - } - - static void OnSuccessCallback_1(void * context, uint16_t clusterRevision) - { - (static_cast(context))->OnSuccessResponse_1(clusterRevision); - } - - static void OnFailureCallback_2(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_2(error); - } - - static void OnSuccessCallback_2(void * context, const chip::app::DataModel::DecodableList & attributeList) - { - (static_cast(context))->OnSuccessResponse_2(attributeList); - } - - static void OnFailureCallback_3(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_3(error); - } - - static void OnSuccessCallback_3(void * context, - const chip::app::DataModel::DecodableList & acceptedCommandList) - { - (static_cast(context))->OnSuccessResponse_3(acceptedCommandList); - } - - static void OnFailureCallback_4(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_4(error); - } - - static void OnSuccessCallback_4(void * context, - const chip::app::DataModel::DecodableList & generatedCommandList) - { - (static_cast(context))->OnSuccessResponse_4(generatedCommandList); - } - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestThReadsTheClusterRevisionAttributeFromTheDut_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ModeSelectClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_1, OnFailureCallback_1, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_1(uint16_t clusterRevision) - { - VerifyOrReturn(CheckValue("clusterRevision", clusterRevision, 1U)); - VerifyOrReturn(CheckConstraintType("clusterRevision", "", "uint16")); - NextTest(); - } - - CHIP_ERROR TestThReadsTheAttributeListAttributeFromTheDut_2() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ModeSelectClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_2, OnFailureCallback_2, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_2(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_2(const chip::app::DataModel::DecodableList & attributeList) - { - VerifyOrReturn(CheckConstraintType("attributeList", "", "list")); - NextTest(); - } - - CHIP_ERROR TestReadTheGlobalAttributeAcceptedCommandList_3() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ModeSelectClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_3, OnFailureCallback_3, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_3(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_3(const chip::app::DataModel::DecodableList & acceptedCommandList) - { - VerifyOrReturn(CheckConstraintType("acceptedCommandList", "", "list")); - NextTest(); - } - - CHIP_ERROR TestReadTheGlobalAttributeGeneratedCommandList_4() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ModeSelectClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_4, OnFailureCallback_4, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_4(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_4(const chip::app::DataModel::DecodableList & generatedCommandList) - { - VerifyOrReturn(CheckConstraintType("generatedCommandList", "", "list")); - NextTest(); - } -}; - -class Test_TC_MF_1_4Suite : public TestCommand -{ -public: - Test_TC_MF_1_4Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_MF_1_4", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("nodeId2", 0, UINT64_MAX, &mNodeId2); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("discriminator", 0, UINT16_MAX, &mDiscriminator); - AddArgument("payload", &mPayload); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_MF_1_4Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MF_1_4\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MF_1_4\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Reboot target device\n"); - err = TestRebootTargetDevice_0(); + case 301: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : TH_CR1 starts a commissioning process with DUT_CE\n"); - err = TestThCr1StartsACommissioningProcessWithDutCe_1(); + case 302: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintMinValue("value", value, -9223372036854775807LL)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 9223372036854775807LL)); + } break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : TH_CR1 opens a commissioning window on DUT_CE\n"); - err = TestThCr1OpensACommissioningWindowOnDutCe_2(); + case 303: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintNotValue("value", value, -9223372036854775806LL)); + } break; - case 3: - ChipLogProgress( - chipTool, - " ***** Test Step 3 : TH_CR1 writes the Basic Information Clusters NodeLabel mandatory attribute of DUT_CE\n"); - err = TestThCr1WritesTheBasicInformationClustersNodeLabelMandatoryAttributeOfDutCe_3(); + case 304: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - case 4: - ChipLogProgress( - chipTool, - " ***** Test Step 4 : TH_CR1 reads the Basic Information Clusters NodeLabel mandatory attribute of DUT_CE\n"); - err = TestThCr1ReadsTheBasicInformationClustersNodeLabelMandatoryAttributeOfDutCe_4(); + case 305: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNonNull("nullableFloatSingle", value)); + VerifyOrReturn(CheckValue("nullableFloatSingle.Value()", value.Value(), 0.1f)); + } break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Commission from beta\n"); - err = TestCommissionFromBeta_5(); + case 306: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : TH_CR2 starts a commissioning process with DUT_CE\n"); - err = TestThCr2StartsACommissioningProcessWithDutCe_6(); + case 307: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNonNull("nullableFloatSingle", value)); + VerifyOrReturn(CheckValue("nullableFloatSingle.Value()", value.Value(), INFINITY)); + } break; - case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : Query fabrics list\n"); - err = TestQueryFabricsList_7(); + case 308: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : Query fabrics list\n"); - err = TestQueryFabricsList_8(); + case 309: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNonNull("nullableFloatSingle", value)); + VerifyOrReturn(CheckValue("nullableFloatSingle.Value()", value.Value(), -INFINITY)); + } break; - case 9: - ChipLogProgress( - chipTool, - " ***** Test Step 9 : TH_CR1 writes the Basic Information Clusters NodeLabel mandatory attribute of DUT_CE\n"); - err = TestThCr1WritesTheBasicInformationClustersNodeLabelMandatoryAttributeOfDutCe_9(); + case 310: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - case 10: - ChipLogProgress( - chipTool, - " ***** Test Step 10 : TH_CR1 reads the Basic Information Clusters NodeLabel mandatory attribute of DUT_CE\n"); - err = TestThCr1ReadsTheBasicInformationClustersNodeLabelMandatoryAttributeOfDutCe_10(); + case 311: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNull("nullableFloatSingle", value)); + } break; - case 11: - ChipLogProgress( - chipTool, - " ***** Test Step 11 : TH_CR1 writes the Basic Information Clusters NodeLabel mandatory attribute of DUT_CE\n"); - err = TestThCr1WritesTheBasicInformationClustersNodeLabelMandatoryAttributeOfDutCe_11(); + case 312: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - case 12: - ChipLogProgress( - chipTool, - " ***** Test Step 12 : TH_CR1 reads the Basic Information Clusters NodeLabel mandatory attribute of DUT_CE\n"); - err = TestThCr1ReadsTheBasicInformationClustersNodeLabelMandatoryAttributeOfDutCe_12(); + case 313: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNonNull("nullableFloatSingle", value)); + VerifyOrReturn(CheckValue("nullableFloatSingle.Value()", value.Value(), 0.0f)); + } break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 13; - - chip::Optional mNodeId; - chip::Optional mNodeId2; - chip::Optional mEndpoint; - chip::Optional mDiscriminator; - chip::Optional mPayload; - chip::Optional mTimeout; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: + case 314: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; break; - case 1: + case 315: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNonNull("nullableFloatDouble", value)); + VerifyOrReturn(CheckValue("nullableFloatDouble.Value()", value.Value(), 0.1234567890123)); + } break; - case 5: + case 316: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; break; - case 6: + case 317: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNonNull("nullableFloatDouble", value)); + VerifyOrReturn(CheckValue("nullableFloatDouble.Value()", value.Value(), INFINITY)); + } break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - static void OnFailureCallback_3(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_3(error); - } - - static void OnSuccessCallback_3(void * context) { (static_cast(context))->OnSuccessResponse_3(); } - - static void OnFailureCallback_4(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_4(error); - } - - static void OnSuccessCallback_4(void * context, chip::CharSpan nodeLabel) - { - (static_cast(context))->OnSuccessResponse_4(nodeLabel); - } - - static void OnFailureCallback_7(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_7(error); - } - - static void - OnSuccessCallback_7(void * context, - const chip::app::DataModel::DecodableList< - chip::app::Clusters::OperationalCredentials::Structs::FabricDescriptor::DecodableType> & fabrics) - { - (static_cast(context))->OnSuccessResponse_7(fabrics); - } - - static void OnFailureCallback_8(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_8(error); - } - - static void - OnSuccessCallback_8(void * context, - const chip::app::DataModel::DecodableList< - chip::app::Clusters::OperationalCredentials::Structs::FabricDescriptor::DecodableType> & fabrics) - { - (static_cast(context))->OnSuccessResponse_8(fabrics); - } - - static void OnFailureCallback_9(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_9(error); - } - - static void OnSuccessCallback_9(void * context) { (static_cast(context))->OnSuccessResponse_9(); } - - static void OnFailureCallback_10(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_10(error); - } - - static void OnSuccessCallback_10(void * context, chip::CharSpan nodeLabel) - { - (static_cast(context))->OnSuccessResponse_10(nodeLabel); - } - - static void OnFailureCallback_11(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_11(error); - } - - static void OnSuccessCallback_11(void * context) { (static_cast(context))->OnSuccessResponse_11(); } - - static void OnFailureCallback_12(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_12(error); - } - - static void OnSuccessCallback_12(void * context, chip::CharSpan nodeLabel) - { - (static_cast(context))->OnSuccessResponse_12(nodeLabel); - } - - // - // Tests methods - // - - CHIP_ERROR TestRebootTargetDevice_0() - { - SetIdentity(kIdentityAlpha); - return Reboot(mDiscriminator.HasValue() ? mDiscriminator.Value() : 3840U); - } - - CHIP_ERROR TestThCr1StartsACommissioningProcessWithDutCe_1() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestThCr1OpensACommissioningWindowOnDutCe_2() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - using RequestType = chip::app::Clusters::AdministratorCommissioning::Commands::OpenBasicCommissioningWindow::Type; - - RequestType request; - request.commissioningTimeout = 180U; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_2(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_2(error); - }; - - ReturnErrorOnFailure( - chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request, 10000)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_2(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_2() { NextTest(); } - - CHIP_ERROR TestThCr1WritesTheBasicInformationClustersNodeLabelMandatoryAttributeOfDutCe_3() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::BasicClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::CharSpan nodeLabelArgument; - nodeLabelArgument = chip::Span("chiptestgarbage: not in length on purpose", 8); - - ReturnErrorOnFailure(cluster.WriteAttribute( - nodeLabelArgument, this, OnSuccessCallback_3, OnFailureCallback_3)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_3(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_3() { NextTest(); } - - CHIP_ERROR TestThCr1ReadsTheBasicInformationClustersNodeLabelMandatoryAttributeOfDutCe_4() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::BasicClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_4, OnFailureCallback_4, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_4(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_4(chip::CharSpan nodeLabel) - { - VerifyOrReturn(CheckConstraintType("nodeLabel", "", "string")); - VerifyOrReturn(CheckConstraintMaxLength("nodeLabel", nodeLabel.size(), 32)); - NextTest(); - } - - CHIP_ERROR TestCommissionFromBeta_5() - { - SetIdentity(kIdentityBeta); - return PairWithQRCode(mNodeId2.HasValue() ? mNodeId2.Value() : 51966ULL, - mPayload.HasValue() ? mPayload.Value() : chip::CharSpan::fromCharString("MT:-24J0AFN00KA0648G00")); - } - - CHIP_ERROR TestThCr2StartsACommissioningProcessWithDutCe_6() - { - SetIdentity(kIdentityBeta); - return WaitForCommissionee(mNodeId2.HasValue() ? mNodeId2.Value() : 51966ULL); - } - - CHIP_ERROR TestQueryFabricsList_7() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::OperationalCredentialsClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_7, OnFailureCallback_7, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_7(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_7(const chip::app::DataModel::DecodableList< - chip::app::Clusters::OperationalCredentials::Structs::FabricDescriptor::DecodableType> & fabrics) - { - { - auto iter_0 = fabrics.begin(); - VerifyOrReturn(CheckNextListItemDecodes("fabrics", iter_0, 0)); - VerifyOrReturn(CheckValueAsString("fabrics[0].label", iter_0.GetValue().label, chip::CharSpan("", 0))); - VerifyOrReturn(CheckNoMoreListItems("fabrics", iter_0, 1)); - } - VerifyOrReturn(CheckConstraintType("fabrics", "", "list")); - NextTest(); - } - - CHIP_ERROR TestQueryFabricsList_8() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::OperationalCredentialsClusterTest cluster; - cluster.Associate(mDevices[kIdentityBeta], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_8, OnFailureCallback_8, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_8(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_8(const chip::app::DataModel::DecodableList< - chip::app::Clusters::OperationalCredentials::Structs::FabricDescriptor::DecodableType> & fabrics) - { - { - auto iter_0 = fabrics.begin(); - VerifyOrReturn(CheckNextListItemDecodes("fabrics", iter_0, 0)); - VerifyOrReturn(CheckValueAsString("fabrics[0].label", iter_0.GetValue().label, chip::CharSpan("", 0))); - VerifyOrReturn(CheckNoMoreListItems("fabrics", iter_0, 1)); - } - VerifyOrReturn(CheckConstraintType("fabrics", "", "list")); - NextTest(); - } - - CHIP_ERROR TestThCr1WritesTheBasicInformationClustersNodeLabelMandatoryAttributeOfDutCe_9() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::BasicClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::CharSpan nodeLabelArgument; - nodeLabelArgument = chip::Span("chiptestgarbage: not in length on purpose", 8); - - ReturnErrorOnFailure(cluster.WriteAttribute( - nodeLabelArgument, this, OnSuccessCallback_9, OnFailureCallback_9)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_9(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_9() { NextTest(); } - - CHIP_ERROR TestThCr1ReadsTheBasicInformationClustersNodeLabelMandatoryAttributeOfDutCe_10() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::BasicClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_10, OnFailureCallback_10, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_10(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_10(chip::CharSpan nodeLabel) - { - VerifyOrReturn(CheckConstraintType("nodeLabel", "", "string")); - VerifyOrReturn(CheckConstraintMaxLength("nodeLabel", nodeLabel.size(), 32)); - NextTest(); - } - - CHIP_ERROR TestThCr1WritesTheBasicInformationClustersNodeLabelMandatoryAttributeOfDutCe_11() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::BasicClusterTest cluster; - cluster.Associate(mDevices[kIdentityBeta], endpoint); - - chip::CharSpan nodeLabelArgument; - nodeLabelArgument = chip::Span("chiptestgarbage: not in length on purpose", 8); - - ReturnErrorOnFailure(cluster.WriteAttribute( - nodeLabelArgument, this, OnSuccessCallback_11, OnFailureCallback_11)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_11(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_11() { NextTest(); } - - CHIP_ERROR TestThCr1ReadsTheBasicInformationClustersNodeLabelMandatoryAttributeOfDutCe_12() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::BasicClusterTest cluster; - cluster.Associate(mDevices[kIdentityBeta], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_12, OnFailureCallback_12, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_12(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_12(chip::CharSpan nodeLabel) - { - VerifyOrReturn(CheckConstraintType("nodeLabel", "", "string")); - VerifyOrReturn(CheckConstraintMaxLength("nodeLabel", nodeLabel.size(), 32)); - NextTest(); - } -}; - -class Test_TC_MF_1_6Suite : public TestCommand -{ -public: - Test_TC_MF_1_6Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_MF_1_6", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("nodeIdForDuplicateCommissioning", 0, UINT64_MAX, &mNodeIdForDuplicateCommissioning); - AddArgument("nodeId2", 0, UINT64_MAX, &mNodeId2); - AddArgument("nodeId3", 0, UINT64_MAX, &mNodeId3); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("discriminator", 0, UINT16_MAX, &mDiscriminator); - AddArgument("payload", &mPayload); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_MF_1_6Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MF_1_6\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MF_1_6\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Reboot target device\n"); - err = TestRebootTargetDevice_0(); + case 318: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : TH_CR1 starts a commissioning process with DUT_CE\n"); - err = TestThCr1StartsACommissioningProcessWithDutCe_1(); + case 319: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNonNull("nullableFloatDouble", value)); + VerifyOrReturn(CheckValue("nullableFloatDouble.Value()", value.Value(), -INFINITY)); + } break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : TH_CR1 opens a commissioning window on DUT_CE\n"); - err = TestThCr1OpensACommissioningWindowOnDutCe_2(); + case 320: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Commission from beta\n"); - err = TestCommissionFromBeta_3(); + case 321: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNull("nullableFloatDouble", value)); + } break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : TH_CR2 starts a commissioning process on DUT_CE\n"); - err = TestThCr2StartsACommissioningProcessOnDutCe_4(); + case 322: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Open Commissioning Window from alpha\n"); - err = TestOpenCommissioningWindowFromAlpha_5(); + case 323: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNonNull("nullableFloatDouble", value)); + VerifyOrReturn(CheckValue("nullableFloatDouble.Value()", value.Value(), 0)); + } break; - case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : TH_CR1 revokes the commissioning window on DUT_CE\n"); - err = TestThCr1RevokesTheCommissioningWindowOnDutCe_6(); + case 324: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : TH_CR2 starts a commissioning process on DUT_CE\n"); - err = TestThCr2StartsACommissioningProcessOnDutCe_7(); + case 325: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNonNull("nullableEnum8", value)); + VerifyOrReturn(CheckValue("nullableEnum8.Value()", value.Value(), 0)); + } break; - case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : TH_CR1 writes the mandatory attribute NodeLabel of DUT_CE\n"); - err = TestThCr1WritesTheMandatoryAttributeNodeLabelOfDutCe_8(); + case 326: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : TH_CR1 read the mandatory attribute NodeLabel of DUT_CE\n"); - err = TestThCr1ReadTheMandatoryAttributeNodeLabelOfDutCe_9(); + case 327: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNonNull("nullableEnum8", value)); + VerifyOrReturn(CheckValue("nullableEnum8.Value()", value.Value(), 254)); + } break; - case 10: - ChipLogProgress(chipTool, " ***** Test Step 10 : TH_CR1 opens a commissioning window on DUT_CE\n"); - err = TestThCr1OpensACommissioningWindowOnDutCe_10(); + case 328: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); break; - case 11: - ChipLogProgress(chipTool, " ***** Test Step 11 : TH_CR2 starts a commissioning process on DUT_CE\n"); - err = TestThCr2StartsACommissioningProcessOnDutCe_11(); + case 329: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNonNull("nullableEnum8", value)); + VerifyOrReturn(CheckValue("nullableEnum8.Value()", value.Value(), 254)); + } break; - case 12: - ChipLogProgress(chipTool, " ***** Test Step 12 : TH_CR3 starts a commissioning process with DUT_CE\n"); - err = TestThCr3StartsACommissioningProcessWithDutCe_12(); + case 330: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - case 13: - ChipLogProgress(chipTool, " ***** Test Step 13 : Wait for the commissioned device to be retrieved for gamma\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrievedForGamma_13(); + case 331: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNull("nullableEnum8", value)); + } break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 14; - - chip::Optional mNodeId; - chip::Optional mNodeIdForDuplicateCommissioning; - chip::Optional mNodeId2; - chip::Optional mNodeId3; - chip::Optional mEndpoint; - chip::Optional mDiscriminator; - chip::Optional mPayload; - chip::Optional mTimeout; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: + case 332: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; break; - case 1: + case 333: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNonNull("nullableEnum16", value)); + VerifyOrReturn(CheckValue("nullableEnum16.Value()", value.Value(), 0U)); + } break; - case 3: + case 334: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; break; - case 4: + case 335: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNonNull("nullableEnum16", value)); + VerifyOrReturn(CheckValue("nullableEnum16.Value()", value.Value(), 65534U)); + } break; - case 7: + case 336: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); + break; + case 337: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNonNull("nullableEnum16", value)); + VerifyOrReturn(CheckValue("nullableEnum16.Value()", value.Value(), 65534U)); + } break; - case 11: + case 338: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; break; - case 12: + case 339: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNull("nullableEnum16", value)); + } break; - case 13: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); - shouldContinue = true; + case 340: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - static void OnFailureCallback_8(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_8(error); - } - - static void OnSuccessCallback_8(void * context) { (static_cast(context))->OnSuccessResponse_8(); } - - static void OnFailureCallback_9(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_9(error); - } - - static void OnSuccessCallback_9(void * context, chip::CharSpan nodeLabel) - { - (static_cast(context))->OnSuccessResponse_9(nodeLabel); - } - - // - // Tests methods - // - - CHIP_ERROR TestRebootTargetDevice_0() - { - SetIdentity(kIdentityAlpha); - return Reboot(mDiscriminator.HasValue() ? mDiscriminator.Value() : 3840U); - } - - CHIP_ERROR TestThCr1StartsACommissioningProcessWithDutCe_1() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestThCr1OpensACommissioningWindowOnDutCe_2() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - using RequestType = chip::app::Clusters::AdministratorCommissioning::Commands::OpenBasicCommissioningWindow::Type; - - RequestType request; - request.commissioningTimeout = 180U; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_2(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_2(error); - }; - - ReturnErrorOnFailure( - chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request, 10000)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_2(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_2() { NextTest(); } - - CHIP_ERROR TestCommissionFromBeta_3() - { - SetIdentity(kIdentityBeta); - return PairWithQRCode(mNodeId2.HasValue() ? mNodeId2.Value() : 51966ULL, - mPayload.HasValue() ? mPayload.Value() : chip::CharSpan::fromCharString("MT:-24J0AFN00KA0648G00")); - } - - CHIP_ERROR TestThCr2StartsACommissioningProcessOnDutCe_4() - { - SetIdentity(kIdentityBeta); - return WaitForCommissionee(mNodeId2.HasValue() ? mNodeId2.Value() : 51966ULL); - } - - CHIP_ERROR TestOpenCommissioningWindowFromAlpha_5() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - using RequestType = chip::app::Clusters::AdministratorCommissioning::Commands::OpenBasicCommissioningWindow::Type; - - RequestType request; - request.commissioningTimeout = 180U; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_5(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_5(error); - }; - - ReturnErrorOnFailure( - chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request, 10000)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_5(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_5() { NextTest(); } - - CHIP_ERROR TestThCr1RevokesTheCommissioningWindowOnDutCe_6() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - using RequestType = chip::app::Clusters::AdministratorCommissioning::Commands::RevokeCommissioning::Type; - - RequestType request; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_6(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_6(error); - }; - - ReturnErrorOnFailure( - chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request, 10000)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_6(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_6() { NextTest(); } - - CHIP_ERROR TestThCr2StartsACommissioningProcessOnDutCe_7() - { - SetIdentity(kIdentityBeta); - return WaitForCommissionee(mNodeId2.HasValue() ? mNodeId2.Value() : 51966ULL); - } - - CHIP_ERROR TestThCr1WritesTheMandatoryAttributeNodeLabelOfDutCe_8() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::BasicClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::CharSpan nodeLabelArgument; - nodeLabelArgument = chip::Span("chiptestgarbage: not in length on purpose", 8); - - ReturnErrorOnFailure(cluster.WriteAttribute( - nodeLabelArgument, this, OnSuccessCallback_8, OnFailureCallback_8)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_8(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_8() { NextTest(); } - - CHIP_ERROR TestThCr1ReadTheMandatoryAttributeNodeLabelOfDutCe_9() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::BasicClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_9, OnFailureCallback_9, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_9(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_9(chip::CharSpan nodeLabel) - { - VerifyOrReturn(CheckValueAsString("nodeLabel", nodeLabel, chip::CharSpan("chiptest", 8))); - - NextTest(); - } - - CHIP_ERROR TestThCr1OpensACommissioningWindowOnDutCe_10() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - using RequestType = chip::app::Clusters::AdministratorCommissioning::Commands::OpenBasicCommissioningWindow::Type; - - RequestType request; - request.commissioningTimeout = 180U; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_10(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_10(error); - }; - - ReturnErrorOnFailure( - chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request, 10000)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_10(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_10() { NextTest(); } - - CHIP_ERROR TestThCr2StartsACommissioningProcessOnDutCe_11() - { - SetIdentity(kIdentityBeta); - return WaitForCommissionee(mNodeId2.HasValue() ? mNodeId2.Value() : 51966ULL); - } - - CHIP_ERROR TestThCr3StartsACommissioningProcessWithDutCe_12() - { - SetIdentity(kIdentityGamma); - return PairWithQRCode(mNodeId3.HasValue() ? mNodeId3.Value() : 12586990ULL, - mPayload.HasValue() ? mPayload.Value() : chip::CharSpan::fromCharString("MT:-24J0AFN00KA0648G00")); - } - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrievedForGamma_13() - { - SetIdentity(kIdentityGamma); - return WaitForCommissionee(mNodeId3.HasValue() ? mNodeId3.Value() : 12586990ULL); - } -}; - -class Test_TC_OCC_1_1Suite : public TestCommand -{ -public: - Test_TC_OCC_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_OCC_1_1", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_OCC_1_1Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_OCC_1_1\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_OCC_1_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + case 341: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNonNull("nullableEnumAttr", value)); + VerifyOrReturn(CheckValue("nullableEnumAttr.Value()", value.Value(), 0)); + } break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Read the global attribute constraints: ClusterRevision\n"); - err = TestReadTheGlobalAttributeConstraintsClusterRevision_1(); + case 342: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - case 2: - ChipLogProgress(chipTool, - " ***** Test Step 2 : write the default values to mandatory global attribute: ClusterRevision\n"); - err = TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_2(); + case 343: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNonNull("nullableEnumAttr", value)); + VerifyOrReturn(CheckValue("nullableEnumAttr.Value()", value.Value(), 254)); + } break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Read the global attribute: AttributeList\n"); - err = TestReadTheGlobalAttributeAttributeList_3(); + case 344: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 4; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: + case 345: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNonNull("nullableEnumAttr", value)); + VerifyOrReturn(CheckValue("nullableEnumAttr.Value()", value.Value(), 254)); + } break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - static void OnFailureCallback_1(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_1(error); - } - - static void OnSuccessCallback_1(void * context, uint16_t clusterRevision) - { - (static_cast(context))->OnSuccessResponse_1(clusterRevision); - } - - static void OnFailureCallback_2(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_2(error); - } - - static void OnSuccessCallback_2(void * context) { (static_cast(context))->OnSuccessResponse_2(); } - - static void OnFailureCallback_3(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_3(error); - } - - static void OnSuccessCallback_3(void * context, const chip::app::DataModel::DecodableList & attributeList) - { - (static_cast(context))->OnSuccessResponse_3(attributeList); - } - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestReadTheGlobalAttributeConstraintsClusterRevision_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::OccupancySensingClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_1, OnFailureCallback_1, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_1(uint16_t clusterRevision) - { - VerifyOrReturn(CheckConstraintType("clusterRevision", "", "uint16")); - NextTest(); - } - - CHIP_ERROR TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_2() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::OccupancySensingClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - uint16_t clusterRevisionArgument; - clusterRevisionArgument = 3U; - - ReturnErrorOnFailure(cluster.WriteAttribute( - clusterRevisionArgument, this, OnSuccessCallback_2, OnFailureCallback_2)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_2(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - NextTest(); - } - - void OnSuccessResponse_2() { ThrowSuccessResponse(); } - - CHIP_ERROR TestReadTheGlobalAttributeAttributeList_3() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::OccupancySensingClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_3, OnFailureCallback_3, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_3(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_3(const chip::app::DataModel::DecodableList & attributeList) - { - VerifyOrReturn(CheckConstraintType("attributeList", "", "list")); - NextTest(); - } -}; - -class Test_TC_OCC_2_1Suite : public TestCommand -{ -public: - Test_TC_OCC_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_OCC_2_1", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_OCC_2_1Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_OCC_2_1\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_OCC_2_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + case 346: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Reads mandatory attribute constrains: Occupancy\n"); - err = TestReadsMandatoryAttributeConstrainsOccupancy_1(); + case 347: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNull("nullableEnumAttr", value)); + } break; - case 2: - ChipLogProgress(chipTool, - " ***** Test Step 2 : Writes the respective default value to mandatory attribute: Occupancy\n"); - err = TestWritesTheRespectiveDefaultValueToMandatoryAttributeOccupancy_2(); + case 348: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNonNull("nullableOctetString", value)); + VerifyOrReturn(CheckValueAsString("nullableOctetString.Value()", value.Value(), + chip::ByteSpan(chip::Uint8::from_const_char(""), 0))); + } break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Reads back mandatory attribute: Occupancy\n"); - err = TestReadsBackMandatoryAttributeOccupancy_3(); + case 349: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Reads mandatory attribute constrains: OccupancySensorType\n"); - err = TestReadsMandatoryAttributeConstrainsOccupancySensorType_4(); + case 350: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNonNull("nullableOctetString", value)); + VerifyOrReturn(CheckValueAsString("nullableOctetString.Value()", value.Value(), + chip::ByteSpan(chip::Uint8::from_const_char("TestValue"), 9))); + } break; - case 5: - ChipLogProgress( - chipTool, " ***** Test Step 5 : Writes the respective default value to mandatory attribute: OccupancySensorType\n"); - err = TestWritesTheRespectiveDefaultValueToMandatoryAttributeOccupancySensorType_5(); + case 351: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : Reads back mandatory attribute: OccupancySensorType\n"); - err = TestReadsBackMandatoryAttributeOccupancySensorType_6(); + case 352: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNull("nullableOctetString", value)); + } break; - case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : Reads mandatory attribute constrains: OccupancySensorTypeBitmap\n"); - err = TestReadsMandatoryAttributeConstrainsOccupancySensorTypeBitmap_7(); + case 353: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - case 8: - ChipLogProgress( - chipTool, - " ***** Test Step 8 : Writes the respective default value to mandatory attribute: OccupancySensorTypeBitmap\n"); - err = TestWritesTheRespectiveDefaultValueToMandatoryAttributeOccupancySensorTypeBitmap_8(); + case 354: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNonNull("nullableOctetString", value)); + VerifyOrReturn(CheckValueAsString("nullableOctetString.Value()", value.Value(), + chip::ByteSpan(chip::Uint8::from_const_char(""), 0))); + } break; - case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : Reads back mandatory attribute: OccupancySensorTypeBitmap\n"); - err = TestReadsBackMandatoryAttributeOccupancySensorTypeBitmap_9(); + case 355: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNonNull("nullableCharString", value)); + VerifyOrReturn(CheckValueAsString("nullableCharString.Value()", value.Value(), chip::CharSpan("", 0))); + } break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 10; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: + case 356: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 357: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNonNull("nullableCharString", value)); + VerifyOrReturn(CheckValueAsString("nullableCharString.Value()", value.Value(), chip::CharSpan("☉T☉", 7))); + } + break; + case 358: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 359: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNull("nullableCharString", value)); + } + break; + case 360: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 361: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNonNull("nullableCharString", value)); + VerifyOrReturn(CheckValueAsString("nullableCharString.Value()", value.Value(), chip::CharSpan("", 0))); + } + break; + case 362: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_ENDPOINT)); + break; + case 363: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_CLUSTER)); + break; + case 364: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_VALUE)); + break; + case 365: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 366: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + { + auto iter_0 = value.begin(); + VerifyOrReturn(CheckNextListItemDecodes("listInt8u", iter_0, 0)); + VerifyOrReturn(CheckValue("listInt8u[0]", iter_0.GetValue(), 1)); + VerifyOrReturn(CheckNextListItemDecodes("listInt8u", iter_0, 1)); + VerifyOrReturn(CheckValue("listInt8u[1]", iter_0.GetValue(), 2)); + VerifyOrReturn(CheckNextListItemDecodes("listInt8u", iter_0, 2)); + VerifyOrReturn(CheckValue("listInt8u[2]", iter_0.GetValue(), 3)); + VerifyOrReturn(CheckNextListItemDecodes("listInt8u", iter_0, 3)); + VerifyOrReturn(CheckValue("listInt8u[3]", iter_0.GetValue(), 4)); + VerifyOrReturn(CheckNoMoreListItems("listInt8u", iter_0, 4)); + } + } + break; + case 367: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 368: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + { + auto iter_0 = value.begin(); + VerifyOrReturn(CheckNextListItemDecodes("listInt8u", iter_0, 0)); + VerifyOrReturn(CheckValue("listInt8u[0]", iter_0.GetValue(), 5)); + VerifyOrReturn(CheckNextListItemDecodes("listInt8u", iter_0, 1)); + VerifyOrReturn(CheckValue("listInt8u[1]", iter_0.GetValue(), 6)); + VerifyOrReturn(CheckNextListItemDecodes("listInt8u", iter_0, 2)); + VerifyOrReturn(CheckValue("listInt8u[2]", iter_0.GetValue(), 7)); + VerifyOrReturn(CheckNextListItemDecodes("listInt8u", iter_0, 3)); + VerifyOrReturn(CheckValue("listInt8u[3]", iter_0.GetValue(), 8)); + VerifyOrReturn(CheckNoMoreListItems("listInt8u", iter_0, 4)); + } + } shouldContinue = true; break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - static void OnFailureCallback_1(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_1(error); - } - - static void OnSuccessCallback_1(void * context, uint8_t occupancy) - { - (static_cast(context))->OnSuccessResponse_1(occupancy); - } - - static void OnFailureCallback_2(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_2(error); - } - - static void OnSuccessCallback_2(void * context) { (static_cast(context))->OnSuccessResponse_2(); } - - static void OnFailureCallback_3(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_3(error); - } - - static void OnSuccessCallback_3(void * context, uint8_t occupancy) - { - (static_cast(context))->OnSuccessResponse_3(occupancy); - } - - static void OnFailureCallback_4(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_4(error); - } - - static void OnSuccessCallback_4(void * context, uint8_t occupancySensorType) - { - (static_cast(context))->OnSuccessResponse_4(occupancySensorType); - } - - static void OnFailureCallback_5(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_5(error); - } - - static void OnSuccessCallback_5(void * context) { (static_cast(context))->OnSuccessResponse_5(); } - - static void OnFailureCallback_6(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_6(error); - } - - static void OnSuccessCallback_6(void * context, uint8_t occupancySensorType) - { - (static_cast(context))->OnSuccessResponse_6(occupancySensorType); - } - - static void OnFailureCallback_7(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_7(error); - } - - static void OnSuccessCallback_7(void * context, uint8_t occupancySensorTypeBitmap) - { - (static_cast(context))->OnSuccessResponse_7(occupancySensorTypeBitmap); - } - - static void OnFailureCallback_8(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_8(error); - } - - static void OnSuccessCallback_8(void * context) { (static_cast(context))->OnSuccessResponse_8(); } - - static void OnFailureCallback_9(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_9(error); - } - - static void OnSuccessCallback_9(void * context, uint8_t occupancySensorTypeBitmap) - { - (static_cast(context))->OnSuccessResponse_9(occupancySensorTypeBitmap); - } - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestReadsMandatoryAttributeConstrainsOccupancy_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::OccupancySensingClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_1, OnFailureCallback_1, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_1(uint8_t occupancy) - { - VerifyOrReturn(CheckConstraintType("occupancy", "", "map8")); - VerifyOrReturn(CheckConstraintMinValue("occupancy", occupancy, 0)); - VerifyOrReturn(CheckConstraintMaxValue("occupancy", occupancy, 1)); - NextTest(); - } - - CHIP_ERROR TestWritesTheRespectiveDefaultValueToMandatoryAttributeOccupancy_2() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::OccupancySensingClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - uint8_t occupancyArgument; - occupancyArgument = 0; - - ReturnErrorOnFailure(cluster.WriteAttribute( - occupancyArgument, this, OnSuccessCallback_2, OnFailureCallback_2)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_2(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - NextTest(); - } - - void OnSuccessResponse_2() { ThrowSuccessResponse(); } - - CHIP_ERROR TestReadsBackMandatoryAttributeOccupancy_3() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::OccupancySensingClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_3, OnFailureCallback_3, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_3(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_3(uint8_t occupancy) - { - VerifyOrReturn(CheckValue("occupancy", occupancy, 0)); - - NextTest(); - } - - CHIP_ERROR TestReadsMandatoryAttributeConstrainsOccupancySensorType_4() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::OccupancySensingClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_4, OnFailureCallback_4, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_4(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_4(uint8_t occupancySensorType) - { - VerifyOrReturn(CheckConstraintType("occupancySensorType", "", "enum8")); - VerifyOrReturn(CheckConstraintMinValue("occupancySensorType", occupancySensorType, 0)); - VerifyOrReturn(CheckConstraintMaxValue("occupancySensorType", occupancySensorType, 3)); - NextTest(); - } - - CHIP_ERROR TestWritesTheRespectiveDefaultValueToMandatoryAttributeOccupancySensorType_5() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::OccupancySensingClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - uint8_t occupancySensorTypeArgument; - occupancySensorTypeArgument = 0; - - ReturnErrorOnFailure( - cluster.WriteAttribute( - occupancySensorTypeArgument, this, OnSuccessCallback_5, OnFailureCallback_5)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_5(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - NextTest(); - } - - void OnSuccessResponse_5() { ThrowSuccessResponse(); } - - CHIP_ERROR TestReadsBackMandatoryAttributeOccupancySensorType_6() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::OccupancySensingClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_6, OnFailureCallback_6, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_6(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_6(uint8_t occupancySensorType) - { - VerifyOrReturn(CheckValue("occupancySensorType", occupancySensorType, 0)); - - NextTest(); - } - - CHIP_ERROR TestReadsMandatoryAttributeConstrainsOccupancySensorTypeBitmap_7() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::OccupancySensingClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_7, OnFailureCallback_7, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_7(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_7(uint8_t occupancySensorTypeBitmap) - { - VerifyOrReturn(CheckConstraintType("occupancySensorTypeBitmap", "", "map8")); - VerifyOrReturn(CheckConstraintMinValue("occupancySensorTypeBitmap", occupancySensorTypeBitmap, 1)); - VerifyOrReturn(CheckConstraintMaxValue("occupancySensorTypeBitmap", occupancySensorTypeBitmap, 7)); - NextTest(); - } - - CHIP_ERROR TestWritesTheRespectiveDefaultValueToMandatoryAttributeOccupancySensorTypeBitmap_8() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::OccupancySensingClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - uint8_t occupancySensorTypeBitmapArgument; - occupancySensorTypeBitmapArgument = 1; - - ReturnErrorOnFailure( - cluster.WriteAttribute( - occupancySensorTypeBitmapArgument, this, OnSuccessCallback_8, OnFailureCallback_8)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_8(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - NextTest(); - } - - void OnSuccessResponse_8() { ThrowSuccessResponse(); } - - CHIP_ERROR TestReadsBackMandatoryAttributeOccupancySensorTypeBitmap_9() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::OccupancySensingClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_9, OnFailureCallback_9, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_9(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_9(uint8_t occupancySensorTypeBitmap) - { - VerifyOrReturn(CheckValue("occupancySensorTypeBitmap", occupancySensorTypeBitmap, 1)); - - NextTest(); - } -}; - -class Test_TC_OCC_2_2Suite : public TestCommand -{ -public: - Test_TC_OCC_2_2Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_OCC_2_2", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_OCC_2_2Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_OCC_2_2\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_OCC_2_2\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + case 369: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("rangeRestrictedInt8u", value, 70)); + } break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Reads Occupancy attribute from DUT\n"); - if (ShouldSkip("A_OCCUPANCY")) + case 370: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); + break; + case 371: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); + break; + case 372: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); + break; + case 373: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); + break; + case 374: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { - NextTest(); - return; + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("rangeRestrictedInt8u", value, 70)); } - err = TestReadsOccupancyAttributeFromDut_1(); break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Reads back Occupancy attribute from DUT after few seconds\n"); - if (ShouldSkip("A_OCCUPANCY")) + case 375: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 376: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { - NextTest(); - return; + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("rangeRestrictedInt8u", value, 20)); } - err = TestReadsBackOccupancyAttributeFromDutAfterFewSeconds_2(); break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 3; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - uint8_t OccupancyValue; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: + case 377: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - static void OnFailureCallback_1(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_1(error); - } - - static void OnSuccessCallback_1(void * context, uint8_t occupancy) - { - (static_cast(context))->OnSuccessResponse_1(occupancy); - } - - static void OnFailureCallback_2(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_2(error); - } - - static void OnSuccessCallback_2(void * context, uint8_t occupancy) - { - (static_cast(context))->OnSuccessResponse_2(occupancy); - } - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestReadsOccupancyAttributeFromDut_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::OccupancySensingClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_1, OnFailureCallback_1, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_1(uint8_t occupancy) - { - VerifyOrReturn(CheckValue("occupancy", occupancy, 0)); - - OccupancyValue = occupancy; - NextTest(); - } - - CHIP_ERROR TestReadsBackOccupancyAttributeFromDutAfterFewSeconds_2() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::OccupancySensingClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_2, OnFailureCallback_2, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_2(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_2(uint8_t occupancy) { NextTest(); } -}; - -class Test_TC_OO_1_1Suite : public TestCommand -{ -public: - Test_TC_OO_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_OO_1_1", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_OO_1_1Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_OO_1_1\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_OO_1_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + case 378: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("rangeRestrictedInt8u", value, 100)); + } break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : read the global attribute: ClusterRevision\n"); - err = TestReadTheGlobalAttributeClusterRevision_1(); + case 379: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Read the global attribute constraints: ClusterRevision\n"); - err = TestReadTheGlobalAttributeConstraintsClusterRevision_2(); + case 380: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("rangeRestrictedInt8u", value, 50)); + } break; - case 3: - ChipLogProgress(chipTool, - " ***** Test Step 3 : write the default values to mandatory global attribute: ClusterRevision\n"); - err = TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_3(); + case 381: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("rangeRestrictedInt16u", value, 200U)); + } break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : reads back global attribute: ClusterRevision\n"); - err = TestReadsBackGlobalAttributeClusterRevision_4(); + case 382: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Read the global attribute: AttributeList\n"); - err = TestReadTheGlobalAttributeAttributeList_5(); + case 383: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); break; - case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : read the optional global attribute: FeatureMap\n"); - err = TestReadTheOptionalGlobalAttributeFeatureMap_6(); + case 384: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); break; - case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : Read the optional global attribute : FeatureMap\n"); - err = TestReadTheOptionalGlobalAttributeFeatureMap_7(); + case 385: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); break; - case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : write the default values to optional global attribute: FeatureMap\n"); - err = TestWriteTheDefaultValuesToOptionalGlobalAttributeFeatureMap_8(); + case 386: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("rangeRestrictedInt16u", value, 200U)); + } break; - case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : reads back optional global attribute: FeatureMap\n"); - err = TestReadsBackOptionalGlobalAttributeFeatureMap_9(); + case 387: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 10; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: + case 388: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("rangeRestrictedInt16u", value, 100U)); + } break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - static void OnFailureCallback_1(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_1(error); - } - - static void OnSuccessCallback_1(void * context, uint16_t clusterRevision) - { - (static_cast(context))->OnSuccessResponse_1(clusterRevision); - } - - static void OnFailureCallback_2(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_2(error); - } - - static void OnSuccessCallback_2(void * context, uint16_t clusterRevision) - { - (static_cast(context))->OnSuccessResponse_2(clusterRevision); - } - - static void OnFailureCallback_3(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_3(error); - } - - static void OnSuccessCallback_3(void * context) { (static_cast(context))->OnSuccessResponse_3(); } - - static void OnFailureCallback_4(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_4(error); - } - - static void OnSuccessCallback_4(void * context, uint16_t clusterRevision) - { - (static_cast(context))->OnSuccessResponse_4(clusterRevision); - } - - static void OnFailureCallback_5(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_5(error); - } - - static void OnSuccessCallback_5(void * context, const chip::app::DataModel::DecodableList & attributeList) - { - (static_cast(context))->OnSuccessResponse_5(attributeList); - } - - static void OnFailureCallback_6(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_6(error); - } - - static void OnSuccessCallback_6(void * context, uint32_t featureMap) - { - (static_cast(context))->OnSuccessResponse_6(featureMap); - } - - static void OnFailureCallback_7(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_7(error); - } - - static void OnSuccessCallback_7(void * context, uint32_t featureMap) - { - (static_cast(context))->OnSuccessResponse_7(featureMap); - } - - static void OnFailureCallback_8(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_8(error); - } - - static void OnSuccessCallback_8(void * context) { (static_cast(context))->OnSuccessResponse_8(); } - - static void OnFailureCallback_9(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_9(error); - } - - static void OnSuccessCallback_9(void * context, uint32_t featureMap) - { - (static_cast(context))->OnSuccessResponse_9(featureMap); - } - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestReadTheGlobalAttributeClusterRevision_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::OnOffClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_1, OnFailureCallback_1, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_1(uint16_t clusterRevision) - { - VerifyOrReturn(CheckValue("clusterRevision", clusterRevision, 4U)); - - NextTest(); - } - - CHIP_ERROR TestReadTheGlobalAttributeConstraintsClusterRevision_2() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::OnOffClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_2, OnFailureCallback_2, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_2(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_2(uint16_t clusterRevision) - { - VerifyOrReturn(CheckConstraintType("clusterRevision", "", "uint16")); - NextTest(); - } - - CHIP_ERROR TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_3() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::OnOffClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - uint16_t clusterRevisionArgument; - clusterRevisionArgument = 3U; - - ReturnErrorOnFailure(cluster.WriteAttribute( - clusterRevisionArgument, this, OnSuccessCallback_3, OnFailureCallback_3)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_3(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - NextTest(); - } - - void OnSuccessResponse_3() { ThrowSuccessResponse(); } - - CHIP_ERROR TestReadsBackGlobalAttributeClusterRevision_4() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::OnOffClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_4, OnFailureCallback_4, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_4(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_4(uint16_t clusterRevision) - { - VerifyOrReturn(CheckValue("clusterRevision", clusterRevision, 4U)); - - NextTest(); - } - - CHIP_ERROR TestReadTheGlobalAttributeAttributeList_5() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::OnOffClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_5, OnFailureCallback_5, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_5(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_5(const chip::app::DataModel::DecodableList & attributeList) - { - VerifyOrReturn(CheckConstraintType("attributeList", "", "list")); - NextTest(); - } - - CHIP_ERROR TestReadTheOptionalGlobalAttributeFeatureMap_6() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::OnOffClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_6, OnFailureCallback_6, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_6(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_6(uint32_t featureMap) - { - VerifyOrReturn(CheckValue("featureMap", featureMap, 1UL)); - - NextTest(); - } - - CHIP_ERROR TestReadTheOptionalGlobalAttributeFeatureMap_7() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::OnOffClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_7, OnFailureCallback_7, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_7(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_7(uint32_t featureMap) - { - VerifyOrReturn(CheckConstraintType("featureMap", "", "map32")); - NextTest(); - } - - CHIP_ERROR TestWriteTheDefaultValuesToOptionalGlobalAttributeFeatureMap_8() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::OnOffClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - uint32_t featureMapArgument; - featureMapArgument = 0UL; - - ReturnErrorOnFailure(cluster.WriteAttribute( - featureMapArgument, this, OnSuccessCallback_8, OnFailureCallback_8)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_8(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - NextTest(); - } - - void OnSuccessResponse_8() { ThrowSuccessResponse(); } - - CHIP_ERROR TestReadsBackOptionalGlobalAttributeFeatureMap_9() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::OnOffClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_9, OnFailureCallback_9, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_9(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_9(uint32_t featureMap) - { - VerifyOrReturn(CheckValue("featureMap", featureMap, 1UL)); - - NextTest(); - } -}; - -class Test_TC_OO_2_1Suite : public TestCommand -{ -public: - Test_TC_OO_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_OO_2_1", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_OO_2_1Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_OO_2_1\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_OO_2_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + case 389: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : read the mandatory attribute: OnOff\n"); - err = TestReadTheMandatoryAttributeOnOff_1(); + case 390: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("rangeRestrictedInt16u", value, 1000U)); + } break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : read LT attribute: GlobalSceneControl\n"); - err = TestReadLtAttributeGlobalSceneControl_2(); + case 391: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : read LT attribute: OnTime\n"); - err = TestReadLtAttributeOnTime_3(); + case 392: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("rangeRestrictedInt16u", value, 500U)); + } break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : read LT attribute: OffWaitTime\n"); - err = TestReadLtAttributeOffWaitTime_4(); + case 393: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + int8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("rangeRestrictedInt8s", value, -20)); + } break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : read LT attribute: StartUpOnOff\n"); - err = TestReadLtAttributeStartUpOnOff_5(); + case 394: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 6; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: + case 395: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); + break; + case 396: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); + break; + case 397: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); + break; + case 398: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; + { + int8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("rangeRestrictedInt8s", value, -20)); + } break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - static void OnFailureCallback_1(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_1(error); - } - - static void OnSuccessCallback_1(void * context, bool onOff) - { - (static_cast(context))->OnSuccessResponse_1(onOff); - } - - static void OnFailureCallback_2(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_2(error); - } - - static void OnSuccessCallback_2(void * context, bool globalSceneControl) - { - (static_cast(context))->OnSuccessResponse_2(globalSceneControl); - } - - static void OnFailureCallback_3(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_3(error); - } - - static void OnSuccessCallback_3(void * context, uint16_t onTime) - { - (static_cast(context))->OnSuccessResponse_3(onTime); - } - - static void OnFailureCallback_4(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_4(error); - } - - static void OnSuccessCallback_4(void * context, uint16_t offWaitTime) - { - (static_cast(context))->OnSuccessResponse_4(offWaitTime); - } - - static void OnFailureCallback_5(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_5(error); - } - - static void - OnSuccessCallback_5(void * context, - const chip::app::DataModel::Nullable & startUpOnOff) - { - (static_cast(context))->OnSuccessResponse_5(startUpOnOff); - } - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestReadTheMandatoryAttributeOnOff_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::OnOffClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_1, OnFailureCallback_1, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_1(bool onOff) - { - VerifyOrReturn(CheckConstraintType("onOff", "", "bool")); - NextTest(); - } - - CHIP_ERROR TestReadLtAttributeGlobalSceneControl_2() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::OnOffClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_2, OnFailureCallback_2, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_2(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() - : ThrowFailureResponse(error); - } - - void OnSuccessResponse_2(bool globalSceneControl) - { - VerifyOrReturn(CheckConstraintType("globalSceneControl", "", "bool")); - NextTest(); - } - - CHIP_ERROR TestReadLtAttributeOnTime_3() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::OnOffClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_3, OnFailureCallback_3, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_3(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() - : ThrowFailureResponse(error); - } - - void OnSuccessResponse_3(uint16_t onTime) - { - VerifyOrReturn(CheckConstraintType("onTime", "", "uint16")); - NextTest(); - } - - CHIP_ERROR TestReadLtAttributeOffWaitTime_4() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::OnOffClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_4, OnFailureCallback_4, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_4(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() - : ThrowFailureResponse(error); - } - - void OnSuccessResponse_4(uint16_t offWaitTime) - { - VerifyOrReturn(CheckConstraintType("offWaitTime", "", "uint16")); - NextTest(); - } - - CHIP_ERROR TestReadLtAttributeStartUpOnOff_5() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::OnOffClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_5, OnFailureCallback_5, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_5(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() - : ThrowFailureResponse(error); - } - - void OnSuccessResponse_5(const chip::app::DataModel::Nullable & startUpOnOff) - { - VerifyOrReturn(CheckConstraintType("startUpOnOff", "", "enum8")); - NextTest(); - } -}; - -class Test_TC_OO_2_2Suite : public TestCommand -{ -public: - Test_TC_OO_2_2Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_OO_2_2", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_OO_2_2Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_OO_2_2\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_OO_2_2\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + case 399: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Send Off Command\n"); - err = TestSendOffCommand_1(); + case 400: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + int8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("rangeRestrictedInt8s", value, -40)); + } break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Check on/off attribute value is false after off command\n"); - err = TestCheckOnOffAttributeValueIsFalseAfterOffCommand_2(); + case 401: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Send On Command\n"); - err = TestSendOnCommand_3(); + case 402: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + int8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("rangeRestrictedInt8s", value, 50)); + } break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Check on/off attribute value is true after on command\n"); - err = TestCheckOnOffAttributeValueIsTrueAfterOnCommand_4(); + case 403: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Send On Command\n"); - err = TestSendOnCommand_5(); + case 404: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + int8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("rangeRestrictedInt8s", value, 6)); + } break; - case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : Check on/off attribute value is true after on command\n"); - err = TestCheckOnOffAttributeValueIsTrueAfterOnCommand_6(); + case 405: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + int16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("rangeRestrictedInt16s", value, -100)); + } break; - case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : Send Off Command\n"); - err = TestSendOffCommand_7(); + case 406: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); break; - case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : Check on/off attribute value is false after off command\n"); - err = TestCheckOnOffAttributeValueIsFalseAfterOffCommand_8(); + case 407: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); break; - case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : Send Off Command\n"); - err = TestSendOffCommand_9(); + case 408: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); break; - case 10: - ChipLogProgress(chipTool, " ***** Test Step 10 : Check on/off attribute value is false after off command\n"); - err = TestCheckOnOffAttributeValueIsFalseAfterOffCommand_10(); + case 409: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); break; - case 11: - ChipLogProgress(chipTool, " ***** Test Step 11 : Send Toggle Command\n"); - err = TestSendToggleCommand_11(); + case 410: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + int16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("rangeRestrictedInt16s", value, -100)); + } break; - case 12: - ChipLogProgress(chipTool, " ***** Test Step 12 : Wait 1000ms\n"); - err = TestWait1000ms_12(); + case 411: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - case 13: - ChipLogProgress(chipTool, " ***** Test Step 13 : Check on/off attribute value is true after toggle command\n"); - err = TestCheckOnOffAttributeValueIsTrueAfterToggleCommand_13(); + case 412: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + int16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("rangeRestrictedInt16s", value, -150)); + } break; - case 14: - ChipLogProgress(chipTool, " ***** Test Step 14 : Send Toggle Command\n"); - err = TestSendToggleCommand_14(); + case 413: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - case 15: - ChipLogProgress(chipTool, " ***** Test Step 15 : Wait 1000ms\n"); - err = TestWait1000ms_15(); + case 414: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + int16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("rangeRestrictedInt16s", value, 200)); + } break; - case 16: - ChipLogProgress(chipTool, " ***** Test Step 16 : Check on/off attribute value is false after toggle command\n"); - err = TestCheckOnOffAttributeValueIsFalseAfterToggleCommand_16(); + case 415: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - case 17: - ChipLogProgress(chipTool, " ***** Test Step 17 : User prompt Set OnOff attribute manually to on\n"); - err = TestUserPromptSetOnOffAttributeManuallyToOn_17(); + case 416: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + int16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("rangeRestrictedInt16s", value, 7)); + } break; - case 18: - ChipLogProgress(chipTool, " ***** Test Step 18 : User prompt Set OnOff attribute manually to off\n"); - err = TestUserPromptSetOnOffAttributeManuallyToOff_18(); + case 417: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNonNull("nullableRangeRestrictedInt8u", value)); + VerifyOrReturn(CheckValue("nullableRangeRestrictedInt8u.Value()", value.Value(), 70)); + } break; - case 19: - ChipLogProgress(chipTool, " ***** Test Step 19 : Reset Off Command\n"); - err = TestResetOffCommand_19(); + case 418: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); break; - case 20: - ChipLogProgress(chipTool, " ***** Test Step 20 : Check on/off attribute value is false after off command\n"); - err = TestCheckOnOffAttributeValueIsFalseAfterOffCommand_20(); + case 419: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 21; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: + case 420: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); + break; + case 421: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); + break; + case 422: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNonNull("nullableRangeRestrictedInt8u", value)); + VerifyOrReturn(CheckValue("nullableRangeRestrictedInt8u.Value()", value.Value(), 70)); + } break; - case 12: + case 423: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; break; - case 15: + case 424: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNonNull("nullableRangeRestrictedInt8u", value)); + VerifyOrReturn(CheckValue("nullableRangeRestrictedInt8u.Value()", value.Value(), 20)); + } break; - case 17: + case 425: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; break; - case 18: + case 426: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNonNull("nullableRangeRestrictedInt8u", value)); + VerifyOrReturn(CheckValue("nullableRangeRestrictedInt8u.Value()", value.Value(), 100)); + } break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - static void OnFailureCallback_2(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_2(error); - } - - static void OnSuccessCallback_2(void * context, bool onOff) - { - (static_cast(context))->OnSuccessResponse_2(onOff); - } - - static void OnFailureCallback_4(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_4(error); - } - - static void OnSuccessCallback_4(void * context, bool onOff) - { - (static_cast(context))->OnSuccessResponse_4(onOff); - } - - static void OnFailureCallback_6(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_6(error); - } - - static void OnSuccessCallback_6(void * context, bool onOff) - { - (static_cast(context))->OnSuccessResponse_6(onOff); - } - - static void OnFailureCallback_8(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_8(error); - } - - static void OnSuccessCallback_8(void * context, bool onOff) - { - (static_cast(context))->OnSuccessResponse_8(onOff); - } - - static void OnFailureCallback_10(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_10(error); - } - - static void OnSuccessCallback_10(void * context, bool onOff) - { - (static_cast(context))->OnSuccessResponse_10(onOff); - } - - static void OnFailureCallback_13(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_13(error); - } - - static void OnSuccessCallback_13(void * context, bool onOff) - { - (static_cast(context))->OnSuccessResponse_13(onOff); - } - - static void OnFailureCallback_16(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_16(error); - } - - static void OnSuccessCallback_16(void * context, bool onOff) - { - (static_cast(context))->OnSuccessResponse_16(onOff); - } - - static void OnFailureCallback_20(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_20(error); - } - - static void OnSuccessCallback_20(void * context, bool onOff) - { - (static_cast(context))->OnSuccessResponse_20(onOff); - } - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestSendOffCommand_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::OnOff::Commands::Off::Type; - - RequestType request; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_1(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_1(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_1() { NextTest(); } - - CHIP_ERROR TestCheckOnOffAttributeValueIsFalseAfterOffCommand_2() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::OnOffClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_2, OnFailureCallback_2, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_2(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_2(bool onOff) - { - VerifyOrReturn(CheckValue("onOff", onOff, 0)); - - NextTest(); - } - - CHIP_ERROR TestSendOnCommand_3() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::OnOff::Commands::On::Type; - - RequestType request; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_3(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_3(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_3(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_3() { NextTest(); } - - CHIP_ERROR TestCheckOnOffAttributeValueIsTrueAfterOnCommand_4() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::OnOffClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_4, OnFailureCallback_4, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_4(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_4(bool onOff) - { - VerifyOrReturn(CheckValue("onOff", onOff, 1)); - - NextTest(); - } - - CHIP_ERROR TestSendOnCommand_5() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::OnOff::Commands::On::Type; - - RequestType request; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_5(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_5(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_5(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_5() { NextTest(); } - - CHIP_ERROR TestCheckOnOffAttributeValueIsTrueAfterOnCommand_6() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::OnOffClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_6, OnFailureCallback_6, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_6(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_6(bool onOff) - { - VerifyOrReturn(CheckValue("onOff", onOff, 1)); - - NextTest(); - } - - CHIP_ERROR TestSendOffCommand_7() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::OnOff::Commands::Off::Type; - - RequestType request; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_7(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_7(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_7(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_7() { NextTest(); } - - CHIP_ERROR TestCheckOnOffAttributeValueIsFalseAfterOffCommand_8() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::OnOffClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_8, OnFailureCallback_8, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_8(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_8(bool onOff) - { - VerifyOrReturn(CheckValue("onOff", onOff, 0)); - - NextTest(); - } - - CHIP_ERROR TestSendOffCommand_9() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::OnOff::Commands::Off::Type; - - RequestType request; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_9(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_9(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_9(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_9() { NextTest(); } - - CHIP_ERROR TestCheckOnOffAttributeValueIsFalseAfterOffCommand_10() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::OnOffClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_10, OnFailureCallback_10, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_10(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_10(bool onOff) - { - VerifyOrReturn(CheckValue("onOff", onOff, 0)); - - NextTest(); - } - - CHIP_ERROR TestSendToggleCommand_11() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::OnOff::Commands::Toggle::Type; - - RequestType request; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_11(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_11(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_11(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_11() { NextTest(); } - - CHIP_ERROR TestWait1000ms_12() - { - SetIdentity(kIdentityAlpha); - return WaitForMs(1000); - } - - CHIP_ERROR TestCheckOnOffAttributeValueIsTrueAfterToggleCommand_13() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::OnOffClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_13, OnFailureCallback_13, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_13(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_13(bool onOff) - { - VerifyOrReturn(CheckValue("onOff", onOff, 1)); - - NextTest(); - } - - CHIP_ERROR TestSendToggleCommand_14() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::OnOff::Commands::Toggle::Type; - - RequestType request; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_14(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_14(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_14(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_14() { NextTest(); } - - CHIP_ERROR TestWait1000ms_15() - { - SetIdentity(kIdentityAlpha); - return WaitForMs(1000); - } - - CHIP_ERROR TestCheckOnOffAttributeValueIsFalseAfterToggleCommand_16() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::OnOffClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_16, OnFailureCallback_16, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_16(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_16(bool onOff) - { - VerifyOrReturn(CheckValue("onOff", onOff, 0)); - - NextTest(); - } - - CHIP_ERROR TestUserPromptSetOnOffAttributeManuallyToOn_17() - { - SetIdentity(kIdentityAlpha); - return UserPrompt("Operate on device to set OnOff attribute manually to on"); - } - - CHIP_ERROR TestUserPromptSetOnOffAttributeManuallyToOff_18() - { - SetIdentity(kIdentityAlpha); - return UserPrompt("Operate on device to set OnOff attribute manually to off"); - } - - CHIP_ERROR TestResetOffCommand_19() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::OnOff::Commands::Off::Type; - - RequestType request; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_19(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_19(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_19(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_19() { NextTest(); } - - CHIP_ERROR TestCheckOnOffAttributeValueIsFalseAfterOffCommand_20() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::OnOffClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_20, OnFailureCallback_20, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_20(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_20(bool onOff) - { - VerifyOrReturn(CheckValue("onOff", onOff, 0)); - - NextTest(); - } -}; - -class Test_TC_OO_2_3Suite : public TestCommand -{ -public: - Test_TC_OO_2_3Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_OO_2_3", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_OO_2_3Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_OO_2_3\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_OO_2_3\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + case 427: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Send On Command\n"); - if (ShouldSkip("CR_ON")) + case 428: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { - NextTest(); - return; + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNonNull("nullableRangeRestrictedInt8u", value)); + VerifyOrReturn(CheckValue("nullableRangeRestrictedInt8u.Value()", value.Value(), 50)); } - err = TestSendOnCommand_1(); break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Wait 1000ms\n"); - err = TestWait1000ms_2(); + case 429: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Reads OnOff attribute from DUT\n"); - if (ShouldSkip("A_ONOFF")) + case 430: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { - NextTest(); - return; + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNull("nullableRangeRestrictedInt8u", value)); } - err = TestReadsOnOffAttributeFromDut_3(); break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Reads GlobalSceneControl attribute from DUT\n"); - if (ShouldSkip("A_GLOBALSCENECONTROL")) + case 431: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { - NextTest(); - return; + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNonNull("nullableRangeRestrictedInt16u", value)); + VerifyOrReturn(CheckValue("nullableRangeRestrictedInt16u.Value()", value.Value(), 200U)); } - err = TestReadsGlobalSceneControlAttributeFromDut_4(); break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Send On Command\n"); - if (ShouldSkip("CR_ON")) - { - NextTest(); - return; - } - err = TestSendOnCommand_5(); + case 432: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); break; - case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : Wait 1000ms\n"); - err = TestWait1000ms_6(); + case 433: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); break; - case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : Reads OnOff attribute from DUT\n"); - if (ShouldSkip("A_ONOFF")) - { - NextTest(); - return; - } - err = TestReadsOnOffAttributeFromDut_7(); + case 434: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); break; - case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : Reads GlobalSceneControl attribute from DUT\n"); - if (ShouldSkip("A_GLOBALSCENECONTROL")) - { - NextTest(); - return; - } - err = TestReadsGlobalSceneControlAttributeFromDut_8(); + case 435: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); break; - case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : Send On Command\n"); - if (ShouldSkip("CR_ON")) + case 436: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { - NextTest(); - return; + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNonNull("nullableRangeRestrictedInt16u", value)); + VerifyOrReturn(CheckValue("nullableRangeRestrictedInt16u.Value()", value.Value(), 200U)); } - err = TestSendOnCommand_9(); break; - case 10: - ChipLogProgress(chipTool, " ***** Test Step 10 : Wait 1000ms\n"); - err = TestWait1000ms_10(); + case 437: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - case 11: - ChipLogProgress(chipTool, " ***** Test Step 11 : Reads OnOff attribute from DUT\n"); - if (ShouldSkip("A_ONOFF")) + case 438: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { - NextTest(); - return; + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNonNull("nullableRangeRestrictedInt16u", value)); + VerifyOrReturn(CheckValue("nullableRangeRestrictedInt16u.Value()", value.Value(), 100U)); } - err = TestReadsOnOffAttributeFromDut_11(); break; - case 12: - ChipLogProgress(chipTool, " ***** Test Step 12 : Reads GlobalSceneControl attribute from DUT\n"); - if (ShouldSkip("A_GLOBALSCENECONTROL")) - { - NextTest(); - return; - } - err = TestReadsGlobalSceneControlAttributeFromDut_12(); + case 439: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - case 13: - ChipLogProgress(chipTool, " ***** Test Step 13 : Reads OnTime attribute from DUT\n"); - if (ShouldSkip("A_ONTIME")) + case 440: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { - NextTest(); - return; + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNonNull("nullableRangeRestrictedInt16u", value)); + VerifyOrReturn(CheckValue("nullableRangeRestrictedInt16u.Value()", value.Value(), 1000U)); } - err = TestReadsOnTimeAttributeFromDut_13(); break; - case 14: - ChipLogProgress(chipTool, " ***** Test Step 14 : Reads OffWaitTime attribute from DUT\n"); - if (ShouldSkip("A_OFFWAITTIME")) - { - NextTest(); - return; - } - err = TestReadsOffWaitTimeAttributeFromDut_14(); + case 441: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - case 15: - ChipLogProgress(chipTool, " ***** Test Step 15 : Send On Command\n"); - if (ShouldSkip("CR_ON")) + case 442: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { - NextTest(); - return; + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNonNull("nullableRangeRestrictedInt16u", value)); + VerifyOrReturn(CheckValue("nullableRangeRestrictedInt16u.Value()", value.Value(), 500U)); } - err = TestSendOnCommand_15(); break; - case 16: - ChipLogProgress(chipTool, " ***** Test Step 16 : Reads OnOff attribute from DUT\n"); - if (ShouldSkip("A_ONOFF")) - { - NextTest(); - return; - } - err = TestReadsOnOffAttributeFromDut_16(); + case 443: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - case 17: - ChipLogProgress(chipTool, " ***** Test Step 17 : Reads OnTime attribute from DUT\n"); - if (ShouldSkip("A_ONTIME")) + case 444: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { - NextTest(); - return; + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNull("nullableRangeRestrictedInt16u", value)); } - err = TestReadsOnTimeAttributeFromDut_17(); break; - case 18: - ChipLogProgress(chipTool, " ***** Test Step 18 : Reads OffWaitTime attribute from DUT\n"); - if (ShouldSkip("A_OFFWAITTIME")) + case 445: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { - NextTest(); - return; + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNonNull("nullableRangeRestrictedInt8s", value)); + VerifyOrReturn(CheckValue("nullableRangeRestrictedInt8s.Value()", value.Value(), -20)); } - err = TestReadsOffWaitTimeAttributeFromDut_18(); break; - case 19: - ChipLogProgress(chipTool, " ***** Test Step 19 : Send Off Command\n"); - if (ShouldSkip("CR_OFF")) - { - NextTest(); - return; - } - err = TestSendOffCommand_19(); + case 446: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); break; - case 20: - ChipLogProgress(chipTool, " ***** Test Step 20 : Reads OnOff attribute from DUT\n"); - if (ShouldSkip("A_ONOFF")) - { - NextTest(); - return; - } - err = TestReadsOnOffAttributeFromDut_20(); + case 447: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); break; - case 21: - ChipLogProgress(chipTool, " ***** Test Step 21 : Reads OnTime attribute from DUT\n"); - if (ShouldSkip("A_ONTIME")) - { - NextTest(); - return; - } - err = TestReadsOnTimeAttributeFromDut_21(); + case 448: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); break; - case 22: - ChipLogProgress(chipTool, " ***** Test Step 22 : Reads OnOff attribute from DUT\n"); - if (ShouldSkip("A_ONOFF")) - { - NextTest(); - return; - } - err = TestReadsOnOffAttributeFromDut_22(); + case 449: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); break; - case 23: - ChipLogProgress(chipTool, " ***** Test Step 23 : Reads OnTime attribute from DUT\n"); - if (ShouldSkip("A_ONTIME")) + case 450: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { - NextTest(); - return; + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNonNull("nullableRangeRestrictedInt8s", value)); + VerifyOrReturn(CheckValue("nullableRangeRestrictedInt8s.Value()", value.Value(), -20)); } - err = TestReadsOnTimeAttributeFromDut_23(); break; - case 24: - ChipLogProgress(chipTool, " ***** Test Step 24 : Reads OffWaitTime attribute from DUT\n"); - if (ShouldSkip("A_OFFWAITTIME")) - { - NextTest(); - return; - } - err = TestReadsOffWaitTimeAttributeFromDut_24(); + case 451: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - case 25: - ChipLogProgress(chipTool, " ***** Test Step 25 : Send On Command\n"); - if (ShouldSkip("CR_ON")) + case 452: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { - NextTest(); - return; + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNonNull("nullableRangeRestrictedInt8s", value)); + VerifyOrReturn(CheckValue("nullableRangeRestrictedInt8s.Value()", value.Value(), -40)); } - err = TestSendOnCommand_25(); break; - case 26: - ChipLogProgress(chipTool, " ***** Test Step 26 : Reads OnTime attribute from DUT\n"); - if (ShouldSkip("A_ONTIME")) - { - NextTest(); - return; - } - err = TestReadsOnTimeAttributeFromDut_26(); + case 453: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - case 27: - ChipLogProgress(chipTool, " ***** Test Step 27 : Reads OffWaitTime attribute from DUT\n"); - if (ShouldSkip("A_OFFWAITTIME")) + case 454: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { - NextTest(); - return; + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNonNull("nullableRangeRestrictedInt8s", value)); + VerifyOrReturn(CheckValue("nullableRangeRestrictedInt8s.Value()", value.Value(), 50)); } - err = TestReadsOffWaitTimeAttributeFromDut_27(); break; - case 28: - ChipLogProgress(chipTool, " ***** Test Step 28 : Send Off Command\n"); - if (ShouldSkip("CR_OFF")) - { - NextTest(); - return; - } - err = TestSendOffCommand_28(); + case 455: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - case 29: - ChipLogProgress(chipTool, " ***** Test Step 29 : Reads OnOff attribute from DUT\n"); - if (ShouldSkip("A_ONOFF")) + case 456: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { - NextTest(); - return; + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNonNull("nullableRangeRestrictedInt8s", value)); + VerifyOrReturn(CheckValue("nullableRangeRestrictedInt8s.Value()", value.Value(), 6)); } - err = TestReadsOnOffAttributeFromDut_29(); break; - case 30: - ChipLogProgress(chipTool, " ***** Test Step 30 : Reads OnTime attribute from DUT\n"); - if (ShouldSkip("A_ONTIME")) - { - NextTest(); - return; - } - err = TestReadsOnTimeAttributeFromDut_30(); + case 457: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - case 31: - ChipLogProgress(chipTool, " ***** Test Step 31 : Reads OnOff attribute from DUT\n"); - if (ShouldSkip("A_ONOFF")) + case 458: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { - NextTest(); - return; + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNull("nullableRangeRestrictedInt8s", value)); } - err = TestReadsOnOffAttributeFromDut_31(); break; - case 32: - ChipLogProgress(chipTool, " ***** Test Step 32 : Reads OnTime attribute from DUT\n"); - if (ShouldSkip("A_ONTIME")) + case 459: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { - NextTest(); - return; + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNonNull("nullableRangeRestrictedInt16s", value)); + VerifyOrReturn(CheckValue("nullableRangeRestrictedInt16s.Value()", value.Value(), -100)); } - err = TestReadsOnTimeAttributeFromDut_32(); break; - case 33: - ChipLogProgress(chipTool, " ***** Test Step 33 : Send On Command\n"); - if (ShouldSkip("CR_ON")) - { - NextTest(); - return; - } - err = TestSendOnCommand_33(); + case 460: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); break; - case 34: - ChipLogProgress(chipTool, " ***** Test Step 34 : Reads OnOff attribute from DUT\n"); - if (ShouldSkip("A_ONOFF")) - { - NextTest(); - return; - } - err = TestReadsOnOffAttributeFromDut_34(); + case 461: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); break; - case 35: - ChipLogProgress(chipTool, " ***** Test Step 35 : Reads OnTime attribute from DUT\n"); - if (ShouldSkip("A_ONTIME")) - { - NextTest(); - return; - } - err = TestReadsOnTimeAttributeFromDut_35(); + case 462: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); break; - case 36: - ChipLogProgress(chipTool, " ***** Test Step 36 : Reads OffWaitTime attribute from DUT\n"); - if (ShouldSkip("A_OFFWAITTIME")) - { - NextTest(); - return; - } - err = TestReadsOffWaitTimeAttributeFromDut_36(); + case 463: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); break; - case 37: - ChipLogProgress(chipTool, " ***** Test Step 37 : Send Off Command\n"); - if (ShouldSkip("CR_OFF")) + case 464: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { - NextTest(); - return; + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNonNull("nullableRangeRestrictedInt16s", value)); + VerifyOrReturn(CheckValue("nullableRangeRestrictedInt16s.Value()", value.Value(), -100)); } - err = TestSendOffCommand_37(); break; - case 38: - ChipLogProgress(chipTool, " ***** Test Step 38 : Reads OnOff attribute from DUT\n"); - if (ShouldSkip("A_ONOFF")) - { - NextTest(); - return; - } - err = TestReadsOnOffAttributeFromDut_38(); + case 465: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - case 39: - ChipLogProgress(chipTool, " ***** Test Step 39 : Reads OnTime attribute from DUT\n"); - if (ShouldSkip("A_ONTIME")) + case 466: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { - NextTest(); - return; + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNonNull("nullableRangeRestrictedInt16s", value)); + VerifyOrReturn(CheckValue("nullableRangeRestrictedInt16s.Value()", value.Value(), -150)); } - err = TestReadsOnTimeAttributeFromDut_39(); break; - case 40: - ChipLogProgress(chipTool, " ***** Test Step 40 : Reads OnOff attribute from DUT\n"); - if (ShouldSkip("A_ONOFF")) - { - NextTest(); - return; - } - err = TestReadsOnOffAttributeFromDut_40(); + case 467: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - case 41: - ChipLogProgress(chipTool, " ***** Test Step 41 : Reads OnTime attribute from DUT\n"); - if (ShouldSkip("A_ONTIME")) + case 468: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { - NextTest(); - return; + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNonNull("nullableRangeRestrictedInt16s", value)); + VerifyOrReturn(CheckValue("nullableRangeRestrictedInt16s.Value()", value.Value(), 200)); } - err = TestReadsOnTimeAttributeFromDut_41(); break; - case 42: - ChipLogProgress(chipTool, " ***** Test Step 42 : Reads OffWaitTime attribute from DUT\n"); - if (ShouldSkip("A_OFFWAITTIME")) - { - NextTest(); - return; - } - err = TestReadsOffWaitTimeAttributeFromDut_42(); + case 469: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - case 43: - ChipLogProgress(chipTool, " ***** Test Step 43 : Reads OnOff attribute from DUT\n"); - if (ShouldSkip("A_ONOFF")) + case 470: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { - NextTest(); - return; + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNonNull("nullableRangeRestrictedInt16s", value)); + VerifyOrReturn(CheckValue("nullableRangeRestrictedInt16s.Value()", value.Value(), 7)); } - err = TestReadsOnOffAttributeFromDut_43(); break; - case 44: - ChipLogProgress(chipTool, " ***** Test Step 44 : Reads OnTime attribute from DUT\n"); - if (ShouldSkip("A_ONTIME")) - { - NextTest(); - return; - } - err = TestReadsOnTimeAttributeFromDut_44(); + case 471: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - case 45: - ChipLogProgress(chipTool, " ***** Test Step 45 : Reads OffWaitTime attribute from DUT\n"); - if (ShouldSkip("A_OFFWAITTIME")) + case 472: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { - NextTest(); - return; + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNull("nullableRangeRestrictedInt16s", value)); } - err = TestReadsOffWaitTimeAttributeFromDut_45(); break; - case 46: - ChipLogProgress(chipTool, " ***** Test Step 46 : Send Off Command\n"); - if (ShouldSkip("CR_OFF")) - { - NextTest(); - return; - } - err = TestSendOffCommand_46(); + case 473: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_DATA_TYPE)); break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 47; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; + case 474: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); break; - case 2: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; + case 475: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_DATA_TYPE)); break; - case 6: + case 476: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); + break; + case 477: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + { + auto iter_0 = value.begin(); + VerifyOrReturn(CheckNextListItemDecodes("acceptedCommandList", iter_0, 0)); + VerifyOrReturn(CheckValue("acceptedCommandList[0]", iter_0.GetValue(), 0UL)); + VerifyOrReturn(CheckNextListItemDecodes("acceptedCommandList", iter_0, 1)); + VerifyOrReturn(CheckValue("acceptedCommandList[1]", iter_0.GetValue(), 1UL)); + VerifyOrReturn(CheckNextListItemDecodes("acceptedCommandList", iter_0, 2)); + VerifyOrReturn(CheckValue("acceptedCommandList[2]", iter_0.GetValue(), 2UL)); + VerifyOrReturn(CheckNextListItemDecodes("acceptedCommandList", iter_0, 3)); + VerifyOrReturn(CheckValue("acceptedCommandList[3]", iter_0.GetValue(), 4UL)); + VerifyOrReturn(CheckNextListItemDecodes("acceptedCommandList", iter_0, 4)); + VerifyOrReturn(CheckValue("acceptedCommandList[4]", iter_0.GetValue(), 7UL)); + VerifyOrReturn(CheckNextListItemDecodes("acceptedCommandList", iter_0, 5)); + VerifyOrReturn(CheckValue("acceptedCommandList[5]", iter_0.GetValue(), 8UL)); + VerifyOrReturn(CheckNextListItemDecodes("acceptedCommandList", iter_0, 6)); + VerifyOrReturn(CheckValue("acceptedCommandList[6]", iter_0.GetValue(), 9UL)); + VerifyOrReturn(CheckNextListItemDecodes("acceptedCommandList", iter_0, 7)); + VerifyOrReturn(CheckValue("acceptedCommandList[7]", iter_0.GetValue(), 10UL)); + VerifyOrReturn(CheckNextListItemDecodes("acceptedCommandList", iter_0, 8)); + VerifyOrReturn(CheckValue("acceptedCommandList[8]", iter_0.GetValue(), 11UL)); + VerifyOrReturn(CheckNextListItemDecodes("acceptedCommandList", iter_0, 9)); + VerifyOrReturn(CheckValue("acceptedCommandList[9]", iter_0.GetValue(), 12UL)); + VerifyOrReturn(CheckNextListItemDecodes("acceptedCommandList", iter_0, 10)); + VerifyOrReturn(CheckValue("acceptedCommandList[10]", iter_0.GetValue(), 13UL)); + VerifyOrReturn(CheckNextListItemDecodes("acceptedCommandList", iter_0, 11)); + VerifyOrReturn(CheckValue("acceptedCommandList[11]", iter_0.GetValue(), 14UL)); + VerifyOrReturn(CheckNextListItemDecodes("acceptedCommandList", iter_0, 12)); + VerifyOrReturn(CheckValue("acceptedCommandList[12]", iter_0.GetValue(), 15UL)); + VerifyOrReturn(CheckNextListItemDecodes("acceptedCommandList", iter_0, 13)); + VerifyOrReturn(CheckValue("acceptedCommandList[13]", iter_0.GetValue(), 17UL)); + VerifyOrReturn(CheckNextListItemDecodes("acceptedCommandList", iter_0, 14)); + VerifyOrReturn(CheckValue("acceptedCommandList[14]", iter_0.GetValue(), 18UL)); + VerifyOrReturn(CheckNextListItemDecodes("acceptedCommandList", iter_0, 15)); + VerifyOrReturn(CheckValue("acceptedCommandList[15]", iter_0.GetValue(), 19UL)); + VerifyOrReturn(CheckNextListItemDecodes("acceptedCommandList", iter_0, 16)); + VerifyOrReturn(CheckValue("acceptedCommandList[16]", iter_0.GetValue(), 20UL)); + VerifyOrReturn(CheckNextListItemDecodes("acceptedCommandList", iter_0, 17)); + VerifyOrReturn(CheckValue("acceptedCommandList[17]", iter_0.GetValue(), 21UL)); + VerifyOrReturn(CheckNoMoreListItems("acceptedCommandList", iter_0, 18)); + } + } break; - case 10: + case 478: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + { + auto iter_0 = value.begin(); + VerifyOrReturn(CheckNextListItemDecodes("generatedCommandList", iter_0, 0)); + VerifyOrReturn(CheckValue("generatedCommandList[0]", iter_0.GetValue(), 0UL)); + VerifyOrReturn(CheckNextListItemDecodes("generatedCommandList", iter_0, 1)); + VerifyOrReturn(CheckValue("generatedCommandList[1]", iter_0.GetValue(), 1UL)); + VerifyOrReturn(CheckNextListItemDecodes("generatedCommandList", iter_0, 2)); + VerifyOrReturn(CheckValue("generatedCommandList[2]", iter_0.GetValue(), 4UL)); + VerifyOrReturn(CheckNextListItemDecodes("generatedCommandList", iter_0, 3)); + VerifyOrReturn(CheckValue("generatedCommandList[3]", iter_0.GetValue(), 5UL)); + VerifyOrReturn(CheckNextListItemDecodes("generatedCommandList", iter_0, 4)); + VerifyOrReturn(CheckValue("generatedCommandList[4]", iter_0.GetValue(), 6UL)); + VerifyOrReturn(CheckNextListItemDecodes("generatedCommandList", iter_0, 5)); + VerifyOrReturn(CheckValue("generatedCommandList[5]", iter_0.GetValue(), 9UL)); + VerifyOrReturn(CheckNextListItemDecodes("generatedCommandList", iter_0, 6)); + VerifyOrReturn(CheckValue("generatedCommandList[6]", iter_0.GetValue(), 10UL)); + VerifyOrReturn(CheckNextListItemDecodes("generatedCommandList", iter_0, 7)); + VerifyOrReturn(CheckValue("generatedCommandList[7]", iter_0.GetValue(), 11UL)); + VerifyOrReturn(CheckNoMoreListItems("generatedCommandList", iter_0, 8)); + } + } break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - static void OnFailureCallback_3(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_3(error); - } - - static void OnSuccessCallback_3(void * context, bool onOff) - { - (static_cast(context))->OnSuccessResponse_3(onOff); - } - - static void OnFailureCallback_4(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_4(error); - } - - static void OnSuccessCallback_4(void * context, bool globalSceneControl) - { - (static_cast(context))->OnSuccessResponse_4(globalSceneControl); - } - - static void OnFailureCallback_7(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_7(error); - } - - static void OnSuccessCallback_7(void * context, bool onOff) - { - (static_cast(context))->OnSuccessResponse_7(onOff); - } - - static void OnFailureCallback_8(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_8(error); - } - - static void OnSuccessCallback_8(void * context, bool globalSceneControl) - { - (static_cast(context))->OnSuccessResponse_8(globalSceneControl); - } - - static void OnFailureCallback_11(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_11(error); - } - - static void OnSuccessCallback_11(void * context, bool onOff) - { - (static_cast(context))->OnSuccessResponse_11(onOff); - } - - static void OnFailureCallback_12(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_12(error); - } - - static void OnSuccessCallback_12(void * context, bool globalSceneControl) - { - (static_cast(context))->OnSuccessResponse_12(globalSceneControl); - } - - static void OnFailureCallback_13(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_13(error); - } - - static void OnSuccessCallback_13(void * context, uint16_t onTime) - { - (static_cast(context))->OnSuccessResponse_13(onTime); - } - - static void OnFailureCallback_14(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_14(error); - } - - static void OnSuccessCallback_14(void * context, uint16_t offWaitTime) - { - (static_cast(context))->OnSuccessResponse_14(offWaitTime); - } - - static void OnFailureCallback_16(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_16(error); - } - - static void OnSuccessCallback_16(void * context, bool onOff) - { - (static_cast(context))->OnSuccessResponse_16(onOff); - } - - static void OnFailureCallback_17(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_17(error); - } - - static void OnSuccessCallback_17(void * context, uint16_t onTime) - { - (static_cast(context))->OnSuccessResponse_17(onTime); - } - - static void OnFailureCallback_18(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_18(error); - } - - static void OnSuccessCallback_18(void * context, uint16_t offWaitTime) - { - (static_cast(context))->OnSuccessResponse_18(offWaitTime); - } - - static void OnFailureCallback_20(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_20(error); - } - - static void OnSuccessCallback_20(void * context, bool onOff) - { - (static_cast(context))->OnSuccessResponse_20(onOff); - } - - static void OnFailureCallback_21(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_21(error); - } - - static void OnSuccessCallback_21(void * context, uint16_t onTime) - { - (static_cast(context))->OnSuccessResponse_21(onTime); - } - - static void OnFailureCallback_22(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_22(error); - } - - static void OnSuccessCallback_22(void * context, bool onOff) - { - (static_cast(context))->OnSuccessResponse_22(onOff); - } - - static void OnFailureCallback_23(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_23(error); - } - - static void OnSuccessCallback_23(void * context, uint16_t onTime) - { - (static_cast(context))->OnSuccessResponse_23(onTime); - } - - static void OnFailureCallback_24(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_24(error); - } - - static void OnSuccessCallback_24(void * context, uint16_t offWaitTime) - { - (static_cast(context))->OnSuccessResponse_24(offWaitTime); - } - - static void OnFailureCallback_26(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_26(error); - } - - static void OnSuccessCallback_26(void * context, uint16_t onTime) - { - (static_cast(context))->OnSuccessResponse_26(onTime); - } - - static void OnFailureCallback_27(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_27(error); - } - - static void OnSuccessCallback_27(void * context, uint16_t offWaitTime) - { - (static_cast(context))->OnSuccessResponse_27(offWaitTime); - } - - static void OnFailureCallback_29(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_29(error); - } - - static void OnSuccessCallback_29(void * context, bool onOff) - { - (static_cast(context))->OnSuccessResponse_29(onOff); - } - - static void OnFailureCallback_30(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_30(error); - } - - static void OnSuccessCallback_30(void * context, uint16_t onTime) - { - (static_cast(context))->OnSuccessResponse_30(onTime); - } - - static void OnFailureCallback_31(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_31(error); - } - - static void OnSuccessCallback_31(void * context, bool onOff) - { - (static_cast(context))->OnSuccessResponse_31(onOff); - } - - static void OnFailureCallback_32(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_32(error); - } - - static void OnSuccessCallback_32(void * context, uint16_t onTime) - { - (static_cast(context))->OnSuccessResponse_32(onTime); - } - - static void OnFailureCallback_34(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_34(error); - } - - static void OnSuccessCallback_34(void * context, bool onOff) - { - (static_cast(context))->OnSuccessResponse_34(onOff); - } - - static void OnFailureCallback_35(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_35(error); - } - - static void OnSuccessCallback_35(void * context, uint16_t onTime) - { - (static_cast(context))->OnSuccessResponse_35(onTime); - } - - static void OnFailureCallback_36(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_36(error); - } - - static void OnSuccessCallback_36(void * context, uint16_t offWaitTime) - { - (static_cast(context))->OnSuccessResponse_36(offWaitTime); - } - - static void OnFailureCallback_38(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_38(error); - } - - static void OnSuccessCallback_38(void * context, bool onOff) - { - (static_cast(context))->OnSuccessResponse_38(onOff); - } - - static void OnFailureCallback_39(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_39(error); - } - - static void OnSuccessCallback_39(void * context, uint16_t onTime) - { - (static_cast(context))->OnSuccessResponse_39(onTime); - } - - static void OnFailureCallback_40(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_40(error); - } - - static void OnSuccessCallback_40(void * context, bool onOff) - { - (static_cast(context))->OnSuccessResponse_40(onOff); - } - - static void OnFailureCallback_41(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_41(error); - } - - static void OnSuccessCallback_41(void * context, uint16_t onTime) - { - (static_cast(context))->OnSuccessResponse_41(onTime); - } - - static void OnFailureCallback_42(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_42(error); - } - - static void OnSuccessCallback_42(void * context, uint16_t offWaitTime) - { - (static_cast(context))->OnSuccessResponse_42(offWaitTime); - } - - static void OnFailureCallback_43(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_43(error); - } - - static void OnSuccessCallback_43(void * context, bool onOff) - { - (static_cast(context))->OnSuccessResponse_43(onOff); - } - - static void OnFailureCallback_44(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_44(error); - } - - static void OnSuccessCallback_44(void * context, uint16_t onTime) - { - (static_cast(context))->OnSuccessResponse_44(onTime); - } - - static void OnFailureCallback_45(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_45(error); - } - - static void OnSuccessCallback_45(void * context, uint16_t offWaitTime) - { - (static_cast(context))->OnSuccessResponse_45(offWaitTime); - } - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestSendOnCommand_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::OnOff::Commands::On::Type; - - RequestType request; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_1(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_1(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_1() { NextTest(); } - - CHIP_ERROR TestWait1000ms_2() - { - SetIdentity(kIdentityAlpha); - return WaitForMs(1000); - } - - CHIP_ERROR TestReadsOnOffAttributeFromDut_3() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::OnOffClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_3, OnFailureCallback_3, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_3(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_3(bool onOff) - { - VerifyOrReturn(CheckValue("onOff", onOff, 1)); - - NextTest(); - } - - CHIP_ERROR TestReadsGlobalSceneControlAttributeFromDut_4() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::OnOffClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_4, OnFailureCallback_4, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_4(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_4(bool globalSceneControl) - { - VerifyOrReturn(CheckValue("globalSceneControl", globalSceneControl, 1)); - - NextTest(); - } - - CHIP_ERROR TestSendOnCommand_5() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::OnOff::Commands::On::Type; - - RequestType request; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_5(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_5(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_5(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_5() { NextTest(); } - - CHIP_ERROR TestWait1000ms_6() - { - SetIdentity(kIdentityAlpha); - return WaitForMs(1000); - } - - CHIP_ERROR TestReadsOnOffAttributeFromDut_7() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::OnOffClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_7, OnFailureCallback_7, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_7(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_7(bool onOff) - { - VerifyOrReturn(CheckValue("onOff", onOff, 1)); - - NextTest(); - } - - CHIP_ERROR TestReadsGlobalSceneControlAttributeFromDut_8() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::OnOffClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_8, OnFailureCallback_8, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_8(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_8(bool globalSceneControl) - { - VerifyOrReturn(CheckValue("globalSceneControl", globalSceneControl, 1)); - - NextTest(); - } - - CHIP_ERROR TestSendOnCommand_9() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::OnOff::Commands::On::Type; - - RequestType request; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_9(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_9(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_9(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_9() { NextTest(); } - - CHIP_ERROR TestWait1000ms_10() - { - SetIdentity(kIdentityAlpha); - return WaitForMs(1000); - } - - CHIP_ERROR TestReadsOnOffAttributeFromDut_11() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::OnOffClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_11, OnFailureCallback_11, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_11(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_11(bool onOff) - { - VerifyOrReturn(CheckValue("onOff", onOff, 1)); - - NextTest(); - } - - CHIP_ERROR TestReadsGlobalSceneControlAttributeFromDut_12() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::OnOffClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_12, OnFailureCallback_12, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_12(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_12(bool globalSceneControl) - { - VerifyOrReturn(CheckValue("globalSceneControl", globalSceneControl, 1)); - - NextTest(); - } - - CHIP_ERROR TestReadsOnTimeAttributeFromDut_13() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::OnOffClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_13, OnFailureCallback_13, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_13(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_13(uint16_t onTime) - { - VerifyOrReturn(CheckValue("onTime", onTime, 0U)); - - NextTest(); - } - - CHIP_ERROR TestReadsOffWaitTimeAttributeFromDut_14() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::OnOffClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_14, OnFailureCallback_14, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_14(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_14(uint16_t offWaitTime) - { - VerifyOrReturn(CheckValue("offWaitTime", offWaitTime, 0U)); - - NextTest(); - } - - CHIP_ERROR TestSendOnCommand_15() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::OnOff::Commands::On::Type; - - RequestType request; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_15(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_15(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_15(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_15() { NextTest(); } - - CHIP_ERROR TestReadsOnOffAttributeFromDut_16() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::OnOffClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_16, OnFailureCallback_16, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_16(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_16(bool onOff) - { - VerifyOrReturn(CheckValue("onOff", onOff, 1)); - - NextTest(); - } - - CHIP_ERROR TestReadsOnTimeAttributeFromDut_17() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::OnOffClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_17, OnFailureCallback_17, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_17(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_17(uint16_t onTime) - { - VerifyOrReturn(CheckValue("onTime", onTime, 0U)); - - NextTest(); - } - - CHIP_ERROR TestReadsOffWaitTimeAttributeFromDut_18() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::OnOffClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_18, OnFailureCallback_18, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_18(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_18(uint16_t offWaitTime) - { - VerifyOrReturn(CheckValue("offWaitTime", offWaitTime, 0U)); - - NextTest(); - } - - CHIP_ERROR TestSendOffCommand_19() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::OnOff::Commands::Off::Type; - - RequestType request; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_19(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_19(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_19(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_19() { NextTest(); } - - CHIP_ERROR TestReadsOnOffAttributeFromDut_20() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::OnOffClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_20, OnFailureCallback_20, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_20(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_20(bool onOff) - { - VerifyOrReturn(CheckValue("onOff", onOff, 0)); - - NextTest(); - } - - CHIP_ERROR TestReadsOnTimeAttributeFromDut_21() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::OnOffClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_21, OnFailureCallback_21, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_21(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_21(uint16_t onTime) - { - VerifyOrReturn(CheckValue("onTime", onTime, 0U)); - - NextTest(); - } - - CHIP_ERROR TestReadsOnOffAttributeFromDut_22() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::OnOffClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_22, OnFailureCallback_22, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_22(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_22(bool onOff) - { - VerifyOrReturn(CheckValue("onOff", onOff, 0)); - - NextTest(); - } - - CHIP_ERROR TestReadsOnTimeAttributeFromDut_23() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::OnOffClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_23, OnFailureCallback_23, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_23(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_23(uint16_t onTime) - { - VerifyOrReturn(CheckValue("onTime", onTime, 0U)); - - NextTest(); - } - - CHIP_ERROR TestReadsOffWaitTimeAttributeFromDut_24() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::OnOffClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_24, OnFailureCallback_24, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_24(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_24(uint16_t offWaitTime) - { - VerifyOrReturn(CheckValue("offWaitTime", offWaitTime, 0U)); - - NextTest(); - } - - CHIP_ERROR TestSendOnCommand_25() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::OnOff::Commands::On::Type; - - RequestType request; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_25(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_25(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_25(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_25() { NextTest(); } - - CHIP_ERROR TestReadsOnTimeAttributeFromDut_26() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::OnOffClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_26, OnFailureCallback_26, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_26(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_26(uint16_t onTime) - { - VerifyOrReturn(CheckValue("onTime", onTime, 0U)); - - NextTest(); - } - - CHIP_ERROR TestReadsOffWaitTimeAttributeFromDut_27() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::OnOffClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_27, OnFailureCallback_27, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_27(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_27(uint16_t offWaitTime) - { - VerifyOrReturn(CheckValue("offWaitTime", offWaitTime, 0U)); - - NextTest(); - } - - CHIP_ERROR TestSendOffCommand_28() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::OnOff::Commands::Off::Type; - - RequestType request; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_28(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_28(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_28(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_28() { NextTest(); } - - CHIP_ERROR TestReadsOnOffAttributeFromDut_29() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::OnOffClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_29, OnFailureCallback_29, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_29(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_29(bool onOff) - { - VerifyOrReturn(CheckValue("onOff", onOff, 0)); - - NextTest(); - } - - CHIP_ERROR TestReadsOnTimeAttributeFromDut_30() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::OnOffClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_30, OnFailureCallback_30, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_30(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_30(uint16_t onTime) - { - VerifyOrReturn(CheckValue("onTime", onTime, 0U)); - - NextTest(); - } - - CHIP_ERROR TestReadsOnOffAttributeFromDut_31() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::OnOffClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_31, OnFailureCallback_31, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_31(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_31(bool onOff) - { - VerifyOrReturn(CheckValue("onOff", onOff, 0)); - - NextTest(); - } - - CHIP_ERROR TestReadsOnTimeAttributeFromDut_32() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::OnOffClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_32, OnFailureCallback_32, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_32(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_32(uint16_t onTime) - { - VerifyOrReturn(CheckValue("onTime", onTime, 0U)); - - NextTest(); - } - - CHIP_ERROR TestSendOnCommand_33() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::OnOff::Commands::On::Type; - - RequestType request; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_33(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_33(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_33(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_33() { NextTest(); } - - CHIP_ERROR TestReadsOnOffAttributeFromDut_34() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::OnOffClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_34, OnFailureCallback_34, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_34(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_34(bool onOff) - { - VerifyOrReturn(CheckValue("onOff", onOff, 1)); - - NextTest(); - } - - CHIP_ERROR TestReadsOnTimeAttributeFromDut_35() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::OnOffClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_35, OnFailureCallback_35, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_35(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_35(uint16_t onTime) - { - VerifyOrReturn(CheckValue("onTime", onTime, 0U)); - - NextTest(); - } - - CHIP_ERROR TestReadsOffWaitTimeAttributeFromDut_36() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::OnOffClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_36, OnFailureCallback_36, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_36(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_36(uint16_t offWaitTime) - { - VerifyOrReturn(CheckValue("offWaitTime", offWaitTime, 0U)); - - NextTest(); - } - - CHIP_ERROR TestSendOffCommand_37() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::OnOff::Commands::Off::Type; - - RequestType request; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_37(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_37(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_37(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_37() { NextTest(); } - - CHIP_ERROR TestReadsOnOffAttributeFromDut_38() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::OnOffClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_38, OnFailureCallback_38, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_38(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_38(bool onOff) - { - VerifyOrReturn(CheckValue("onOff", onOff, 0)); - - NextTest(); - } - - CHIP_ERROR TestReadsOnTimeAttributeFromDut_39() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::OnOffClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_39, OnFailureCallback_39, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_39(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_39(uint16_t onTime) - { - VerifyOrReturn(CheckValue("onTime", onTime, 0U)); - - NextTest(); - } - - CHIP_ERROR TestReadsOnOffAttributeFromDut_40() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::OnOffClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_40, OnFailureCallback_40, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_40(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_40(bool onOff) - { - VerifyOrReturn(CheckValue("onOff", onOff, 0)); - - NextTest(); - } - - CHIP_ERROR TestReadsOnTimeAttributeFromDut_41() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::OnOffClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_41, OnFailureCallback_41, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_41(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_41(uint16_t onTime) - { - VerifyOrReturn(CheckValue("onTime", onTime, 0U)); - - NextTest(); - } - - CHIP_ERROR TestReadsOffWaitTimeAttributeFromDut_42() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::OnOffClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_42, OnFailureCallback_42, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_42(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_42(uint16_t offWaitTime) - { - VerifyOrReturn(CheckValue("offWaitTime", offWaitTime, 0U)); - - NextTest(); - } - - CHIP_ERROR TestReadsOnOffAttributeFromDut_43() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::OnOffClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_43, OnFailureCallback_43, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_43(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_43(bool onOff) - { - VerifyOrReturn(CheckValue("onOff", onOff, 0)); - - NextTest(); - } - - CHIP_ERROR TestReadsOnTimeAttributeFromDut_44() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::OnOffClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_44, OnFailureCallback_44, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_44(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_44(uint16_t onTime) - { - VerifyOrReturn(CheckValue("onTime", onTime, 0U)); - - NextTest(); - } - - CHIP_ERROR TestReadsOffWaitTimeAttributeFromDut_45() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::OnOffClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_45, OnFailureCallback_45, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_45(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_45(uint16_t offWaitTime) - { - VerifyOrReturn(CheckValue("offWaitTime", offWaitTime, 0U)); - - NextTest(); - } - - CHIP_ERROR TestSendOffCommand_46() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::OnOff::Commands::Off::Type; - - RequestType request; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_46(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_46(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_46(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_46() { NextTest(); } -}; - -class Test_TC_OO_2_4Suite : public TestCommand -{ -public: - Test_TC_OO_2_4Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_OO_2_4", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("discriminator", 0, UINT16_MAX, &mDiscriminator); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_OO_2_4Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_OO_2_4\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_OO_2_4\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : TH sends On command to DUT\n"); - err = TestThSendsOnCommandToDut_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : TH writes a value of 0 to StartUpOnOff attribute of DUT\n"); - err = TestThWritesAValueOf0ToStartUpOnOffAttributeOfDut_2(); - break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : TH reads the StartUpOnOff attribute from the DUT\n"); - err = TestThReadsTheStartUpOnOffAttributeFromTheDut_3(); - break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Power off DUT\n"); - err = TestPowerOffDut_4(); - break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_5(); - break; - case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : TH reads the OnOff attribute from the DUT\n"); - err = TestThReadsTheOnOffAttributeFromTheDut_6(); - break; - case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : TH writes a value of 1 to StartUpOnOff attribute of DUT\n"); - err = TestThWritesAValueOf1ToStartUpOnOffAttributeOfDut_7(); - break; - case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : Power off DUT\n"); - err = TestPowerOffDut_8(); - break; - case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_9(); - break; - case 10: - ChipLogProgress(chipTool, " ***** Test Step 10 : TH reads the OnOff attribute from the DUT\n"); - err = TestThReadsTheOnOffAttributeFromTheDut_10(); - break; - case 11: - ChipLogProgress(chipTool, " ***** Test Step 11 : TH writes a value of 2 to StartUpOnOff attribute of DUT\n"); - err = TestThWritesAValueOf2ToStartUpOnOffAttributeOfDut_11(); - break; - case 12: - ChipLogProgress(chipTool, " ***** Test Step 12 : Power off DUT\n"); - err = TestPowerOffDut_12(); - break; - case 13: - ChipLogProgress(chipTool, " ***** Test Step 13 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_13(); - break; - case 14: - ChipLogProgress(chipTool, " ***** Test Step 14 : TH reads the OnOff attribute from the DUT\n"); - err = TestThReadsTheOnOffAttributeFromTheDut_14(); - break; - case 15: - ChipLogProgress(chipTool, " ***** Test Step 15 : Power off DUT\n"); - err = TestPowerOffDut_15(); - break; - case 16: - ChipLogProgress(chipTool, " ***** Test Step 16 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_16(); - break; - case 17: - ChipLogProgress(chipTool, " ***** Test Step 17 : TH reads the OnOff attribute from the DUT\n"); - err = TestThReadsTheOnOffAttributeFromTheDut_17(); - break; - case 18: - ChipLogProgress(chipTool, " ***** Test Step 18 : TH writes NULL to StartUpOnOff attribute of DUT\n"); - err = TestThWritesNullToStartUpOnOffAttributeOfDut_18(); - break; - case 19: - ChipLogProgress(chipTool, " ***** Test Step 19 : Power off DUT\n"); - err = TestPowerOffDut_19(); - break; - case 20: - ChipLogProgress(chipTool, " ***** Test Step 20 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_20(); - break; - case 21: - ChipLogProgress(chipTool, " ***** Test Step 21 : TH reads the OnOff attribute from the DUT\n"); - err = TestThReadsTheOnOffAttributeFromTheDut_21(); - break; - case 22: - ChipLogProgress(chipTool, " ***** Test Step 22 : TH sends Off command to DUT\n"); - err = TestThSendsOffCommandToDut_22(); - break; - case 23: - ChipLogProgress(chipTool, " ***** Test Step 23 : Power off DUT\n"); - err = TestPowerOffDut_23(); - break; - case 24: - ChipLogProgress(chipTool, " ***** Test Step 24 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_24(); - break; - case 25: - ChipLogProgress(chipTool, " ***** Test Step 25 : TH reads the OnOff attribute from the DUT\n"); - err = TestThReadsTheOnOffAttributeFromTheDut_25(); - break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 26; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mDiscriminator; - chip::Optional mTimeout; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 4: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 5: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 8: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 9: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 12: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 13: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 15: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 16: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 19: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 20: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 23: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 24: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - static void OnFailureCallback_2(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_2(error); - } - - static void OnSuccessCallback_2(void * context) { (static_cast(context))->OnSuccessResponse_2(); } - - static void OnFailureCallback_3(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_3(error); - } - - static void - OnSuccessCallback_3(void * context, - const chip::app::DataModel::Nullable & startUpOnOff) - { - (static_cast(context))->OnSuccessResponse_3(startUpOnOff); - } - - static void OnFailureCallback_6(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_6(error); - } - - static void OnSuccessCallback_6(void * context, bool onOff) - { - (static_cast(context))->OnSuccessResponse_6(onOff); - } - - static void OnFailureCallback_7(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_7(error); - } - - static void OnSuccessCallback_7(void * context) { (static_cast(context))->OnSuccessResponse_7(); } - - static void OnFailureCallback_10(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_10(error); - } - - static void OnSuccessCallback_10(void * context, bool onOff) - { - (static_cast(context))->OnSuccessResponse_10(onOff); - } - - static void OnFailureCallback_11(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_11(error); - } - - static void OnSuccessCallback_11(void * context) { (static_cast(context))->OnSuccessResponse_11(); } - - static void OnFailureCallback_14(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_14(error); - } - - static void OnSuccessCallback_14(void * context, bool onOff) - { - (static_cast(context))->OnSuccessResponse_14(onOff); - } - - static void OnFailureCallback_17(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_17(error); - } - - static void OnSuccessCallback_17(void * context, bool onOff) - { - (static_cast(context))->OnSuccessResponse_17(onOff); - } - - static void OnFailureCallback_18(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_18(error); - } - - static void OnSuccessCallback_18(void * context) { (static_cast(context))->OnSuccessResponse_18(); } - - static void OnFailureCallback_21(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_21(error); - } - - static void OnSuccessCallback_21(void * context, bool onOff) - { - (static_cast(context))->OnSuccessResponse_21(onOff); - } - - static void OnFailureCallback_25(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_25(error); - } - - static void OnSuccessCallback_25(void * context, bool onOff) - { - (static_cast(context))->OnSuccessResponse_25(onOff); - } - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestThSendsOnCommandToDut_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::OnOff::Commands::On::Type; - - RequestType request; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_1(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_1(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_1() { NextTest(); } - - CHIP_ERROR TestThWritesAValueOf0ToStartUpOnOffAttributeOfDut_2() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::OnOffClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::DataModel::Nullable startUpOnOffArgument; - startUpOnOffArgument.SetNonNull(); - startUpOnOffArgument.Value() = static_cast(0); - - ReturnErrorOnFailure(cluster.WriteAttribute( - startUpOnOffArgument, this, OnSuccessCallback_2, OnFailureCallback_2)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_2(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_2() { NextTest(); } - - CHIP_ERROR TestThReadsTheStartUpOnOffAttributeFromTheDut_3() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::OnOffClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_3, OnFailureCallback_3, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_3(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_3(const chip::app::DataModel::Nullable & startUpOnOff) - { - VerifyOrReturn(CheckValueNonNull("startUpOnOff", startUpOnOff)); - VerifyOrReturn(CheckValue("startUpOnOff.Value()", startUpOnOff.Value(), 0)); - - NextTest(); - } - - CHIP_ERROR TestPowerOffDut_4() - { - SetIdentity(kIdentityAlpha); - return Reboot(mDiscriminator.HasValue() ? mDiscriminator.Value() : 3840U); - } - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_5() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestThReadsTheOnOffAttributeFromTheDut_6() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::OnOffClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_6, OnFailureCallback_6, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_6(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_6(bool onOff) - { - VerifyOrReturn(CheckValue("onOff", onOff, 0)); - - NextTest(); - } - - CHIP_ERROR TestThWritesAValueOf1ToStartUpOnOffAttributeOfDut_7() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::OnOffClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::DataModel::Nullable startUpOnOffArgument; - startUpOnOffArgument.SetNonNull(); - startUpOnOffArgument.Value() = static_cast(1); - - ReturnErrorOnFailure(cluster.WriteAttribute( - startUpOnOffArgument, this, OnSuccessCallback_7, OnFailureCallback_7)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_7(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_7() { NextTest(); } - - CHIP_ERROR TestPowerOffDut_8() - { - SetIdentity(kIdentityAlpha); - return Reboot(mDiscriminator.HasValue() ? mDiscriminator.Value() : 3840U); - } - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_9() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestThReadsTheOnOffAttributeFromTheDut_10() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::OnOffClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_10, OnFailureCallback_10, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_10(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_10(bool onOff) - { - VerifyOrReturn(CheckValue("onOff", onOff, 1)); - - NextTest(); - } - - CHIP_ERROR TestThWritesAValueOf2ToStartUpOnOffAttributeOfDut_11() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::OnOffClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::DataModel::Nullable startUpOnOffArgument; - startUpOnOffArgument.SetNonNull(); - startUpOnOffArgument.Value() = static_cast(2); - - ReturnErrorOnFailure(cluster.WriteAttribute( - startUpOnOffArgument, this, OnSuccessCallback_11, OnFailureCallback_11)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_11(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_11() { NextTest(); } - - CHIP_ERROR TestPowerOffDut_12() - { - SetIdentity(kIdentityAlpha); - return Reboot(mDiscriminator.HasValue() ? mDiscriminator.Value() : 3840U); - } - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_13() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestThReadsTheOnOffAttributeFromTheDut_14() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::OnOffClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_14, OnFailureCallback_14, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_14(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_14(bool onOff) - { - VerifyOrReturn(CheckValue("onOff", onOff, 0)); - - NextTest(); - } - - CHIP_ERROR TestPowerOffDut_15() - { - SetIdentity(kIdentityAlpha); - return Reboot(mDiscriminator.HasValue() ? mDiscriminator.Value() : 3840U); - } - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_16() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestThReadsTheOnOffAttributeFromTheDut_17() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::OnOffClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_17, OnFailureCallback_17, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_17(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_17(bool onOff) - { - VerifyOrReturn(CheckValue("onOff", onOff, 1)); - - NextTest(); - } - - CHIP_ERROR TestThWritesNullToStartUpOnOffAttributeOfDut_18() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::OnOffClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::DataModel::Nullable startUpOnOffArgument; - startUpOnOffArgument.SetNull(); - - ReturnErrorOnFailure(cluster.WriteAttribute( - startUpOnOffArgument, this, OnSuccessCallback_18, OnFailureCallback_18)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_18(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_18() { NextTest(); } - - CHIP_ERROR TestPowerOffDut_19() - { - SetIdentity(kIdentityAlpha); - return Reboot(mDiscriminator.HasValue() ? mDiscriminator.Value() : 3840U); - } - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_20() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestThReadsTheOnOffAttributeFromTheDut_21() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::OnOffClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_21, OnFailureCallback_21, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_21(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_21(bool onOff) - { - VerifyOrReturn(CheckValue("onOff", onOff, 1)); - - NextTest(); - } - - CHIP_ERROR TestThSendsOffCommandToDut_22() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::OnOff::Commands::Off::Type; - - RequestType request; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_22(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_22(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_22(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_22() { NextTest(); } - - CHIP_ERROR TestPowerOffDut_23() - { - SetIdentity(kIdentityAlpha); - return Reboot(mDiscriminator.HasValue() ? mDiscriminator.Value() : 3840U); - } - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_24() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestThReadsTheOnOffAttributeFromTheDut_25() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::OnOffClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_25, OnFailureCallback_25, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_25(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_25(bool onOff) - { - VerifyOrReturn(CheckValue("onOff", onOff, 0)); - - NextTest(); - } -}; - -class Test_TC_PS_1_1Suite : public TestCommand -{ -public: - Test_TC_PS_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_PS_1_1", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_PS_1_1Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_PS_1_1\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_PS_1_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : read the global attribute: ClusterRevision\n"); - err = TestReadTheGlobalAttributeClusterRevision_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Read the global attribute: AttributeList\n"); - err = TestReadTheGlobalAttributeAttributeList_2(); - break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Read the global attribute: AcceptedCommandList\n"); - err = TestReadTheGlobalAttributeAcceptedCommandList_3(); - break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Read the global attribute: GeneratedCommandList\n"); - err = TestReadTheGlobalAttributeGeneratedCommandList_4(); - break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 5; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - static void OnFailureCallback_1(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_1(error); - } - - static void OnSuccessCallback_1(void * context, uint16_t clusterRevision) - { - (static_cast(context))->OnSuccessResponse_1(clusterRevision); - } - - static void OnFailureCallback_2(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_2(error); - } - - static void OnSuccessCallback_2(void * context, const chip::app::DataModel::DecodableList & attributeList) - { - (static_cast(context))->OnSuccessResponse_2(attributeList); - } - - static void OnFailureCallback_3(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_3(error); - } - - static void OnSuccessCallback_3(void * context, - const chip::app::DataModel::DecodableList & acceptedCommandList) - { - (static_cast(context))->OnSuccessResponse_3(acceptedCommandList); - } - - static void OnFailureCallback_4(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_4(error); - } - - static void OnSuccessCallback_4(void * context, - const chip::app::DataModel::DecodableList & generatedCommandList) - { - (static_cast(context))->OnSuccessResponse_4(generatedCommandList); - } - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestReadTheGlobalAttributeClusterRevision_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::PowerSourceClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_1, OnFailureCallback_1, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_1(uint16_t clusterRevision) - { - VerifyOrReturn(CheckValue("clusterRevision", clusterRevision, 1U)); - - NextTest(); - } - - CHIP_ERROR TestReadTheGlobalAttributeAttributeList_2() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::PowerSourceClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_2, OnFailureCallback_2, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_2(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_2(const chip::app::DataModel::DecodableList & attributeList) - { - VerifyOrReturn(CheckConstraintType("attributeList", "", "list")); - NextTest(); - } - - CHIP_ERROR TestReadTheGlobalAttributeAcceptedCommandList_3() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::PowerSourceClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_3, OnFailureCallback_3, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_3(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_3(const chip::app::DataModel::DecodableList & acceptedCommandList) - { - VerifyOrReturn(CheckConstraintType("acceptedCommandList", "", "list")); - NextTest(); - } - - CHIP_ERROR TestReadTheGlobalAttributeGeneratedCommandList_4() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::PowerSourceClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_4, OnFailureCallback_4, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_4(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_4(const chip::app::DataModel::DecodableList & generatedCommandList) - { - VerifyOrReturn(CheckConstraintType("generatedCommandList", "", "list")); - NextTest(); - } -}; - -class Test_TC_PS_2_1Suite : public TestCommand -{ -public: - Test_TC_PS_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_PS_2_1", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_PS_2_1Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_PS_2_1\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_PS_2_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Test Harness Client reads Status attribute from Server DUT\n"); - err = TestTestHarnessClientReadsStatusAttributeFromServerDut_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Test Harness Client reads Order attribute from Server DUT\n"); - err = TestTestHarnessClientReadsOrderAttributeFromServerDut_2(); - break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Test Harness Client reads Description attribute from Server DUT\n"); - err = TestTestHarnessClientReadsDescriptionAttributeFromServerDut_3(); - break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Test Harness Client reads BatVoltage from Server DUT\n"); - err = TestTestHarnessClientReadsBatVoltageFromServerDut_4(); - break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Test Harness Client reads BatPercentRemaining from Server DUT\n"); - err = TestTestHarnessClientReadsBatPercentRemainingFromServerDut_5(); - break; - case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : Test Harness Client reads BatTimeRemaining from Server DUT\n"); - err = TestTestHarnessClientReadsBatTimeRemainingFromServerDut_6(); - break; - case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : Test Harness Client reads BatChargeLevel from Server DUT\n"); - err = TestTestHarnessClientReadsBatChargeLevelFromServerDut_7(); - break; - case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : Test Harness Client reads ActiveBatFaults from Server DUT\n"); - err = TestTestHarnessClientReadsActiveBatFaultsFromServerDut_8(); - break; - case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : Test Harness Client reads BatChargeState from Server DUT\n"); - err = TestTestHarnessClientReadsBatChargeStateFromServerDut_9(); - break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 10; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - static void OnFailureCallback_1(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_1(error); - } - - static void OnSuccessCallback_1(void * context, uint8_t status) - { - (static_cast(context))->OnSuccessResponse_1(status); - } - - static void OnFailureCallback_2(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_2(error); - } - - static void OnSuccessCallback_2(void * context, uint8_t order) - { - (static_cast(context))->OnSuccessResponse_2(order); - } - - static void OnFailureCallback_3(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_3(error); - } - - static void OnSuccessCallback_3(void * context, chip::CharSpan description) - { - (static_cast(context))->OnSuccessResponse_3(description); - } - - static void OnFailureCallback_4(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_4(error); - } - - static void OnSuccessCallback_4(void * context, uint32_t batteryVoltage) - { - (static_cast(context))->OnSuccessResponse_4(batteryVoltage); - } - - static void OnFailureCallback_5(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_5(error); - } - - static void OnSuccessCallback_5(void * context, uint8_t batteryPercentRemaining) - { - (static_cast(context))->OnSuccessResponse_5(batteryPercentRemaining); - } - - static void OnFailureCallback_6(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_6(error); - } - - static void OnSuccessCallback_6(void * context, uint32_t batteryTimeRemaining) - { - (static_cast(context))->OnSuccessResponse_6(batteryTimeRemaining); - } - - static void OnFailureCallback_7(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_7(error); - } - - static void OnSuccessCallback_7(void * context, uint8_t batteryChargeLevel) - { - (static_cast(context))->OnSuccessResponse_7(batteryChargeLevel); - } - - static void OnFailureCallback_8(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_8(error); - } - - static void OnSuccessCallback_8(void * context, const chip::app::DataModel::DecodableList & activeBatteryFaults) - { - (static_cast(context))->OnSuccessResponse_8(activeBatteryFaults); - } - - static void OnFailureCallback_9(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_9(error); - } - - static void OnSuccessCallback_9(void * context, uint8_t batteryChargeState) - { - (static_cast(context))->OnSuccessResponse_9(batteryChargeState); - } - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestTestHarnessClientReadsStatusAttributeFromServerDut_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::PowerSourceClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_1, OnFailureCallback_1, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_1(uint8_t status) - { - VerifyOrReturn(CheckConstraintType("status", "", "enum8")); - VerifyOrReturn(CheckConstraintMinValue("status", status, 0)); - VerifyOrReturn(CheckConstraintMaxValue("status", status, 3)); - NextTest(); - } - - CHIP_ERROR TestTestHarnessClientReadsOrderAttributeFromServerDut_2() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::PowerSourceClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_2, OnFailureCallback_2, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_2(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_2(uint8_t order) - { - VerifyOrReturn(CheckConstraintType("order", "", "uint8")); - NextTest(); - } - - CHIP_ERROR TestTestHarnessClientReadsDescriptionAttributeFromServerDut_3() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::PowerSourceClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_3, OnFailureCallback_3, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_3(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_3(chip::CharSpan description) - { - VerifyOrReturn(CheckConstraintType("description", "", "string")); - NextTest(); - } - - CHIP_ERROR TestTestHarnessClientReadsBatVoltageFromServerDut_4() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::PowerSourceClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_4, OnFailureCallback_4, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_4(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_4(uint32_t batteryVoltage) - { - VerifyOrReturn(CheckConstraintType("batteryVoltage", "", "uint32")); - NextTest(); - } - - CHIP_ERROR TestTestHarnessClientReadsBatPercentRemainingFromServerDut_5() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::PowerSourceClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_5, OnFailureCallback_5, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_5(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_5(uint8_t batteryPercentRemaining) - { - VerifyOrReturn(CheckConstraintType("batteryPercentRemaining", "", "uint8")); - VerifyOrReturn(CheckConstraintMinValue("batteryPercentRemaining", batteryPercentRemaining, 0)); - VerifyOrReturn(CheckConstraintMaxValue("batteryPercentRemaining", batteryPercentRemaining, 200)); - NextTest(); - } - - CHIP_ERROR TestTestHarnessClientReadsBatTimeRemainingFromServerDut_6() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::PowerSourceClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_6, OnFailureCallback_6, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_6(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_6(uint32_t batteryTimeRemaining) - { - VerifyOrReturn(CheckConstraintType("batteryTimeRemaining", "", "uint32")); - NextTest(); - } - - CHIP_ERROR TestTestHarnessClientReadsBatChargeLevelFromServerDut_7() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::PowerSourceClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_7, OnFailureCallback_7, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_7(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_7(uint8_t batteryChargeLevel) - { - VerifyOrReturn(CheckConstraintType("batteryChargeLevel", "", "enum8")); - VerifyOrReturn(CheckConstraintMinValue("batteryChargeLevel", batteryChargeLevel, 0)); - VerifyOrReturn(CheckConstraintMaxValue("batteryChargeLevel", batteryChargeLevel, 2)); - NextTest(); - } - - CHIP_ERROR TestTestHarnessClientReadsActiveBatFaultsFromServerDut_8() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::PowerSourceClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_8, OnFailureCallback_8, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_8(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_8(const chip::app::DataModel::DecodableList & activeBatteryFaults) - { - VerifyOrReturn(CheckConstraintType("activeBatteryFaults", "", "list")); - NextTest(); - } - - CHIP_ERROR TestTestHarnessClientReadsBatChargeStateFromServerDut_9() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::PowerSourceClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_9, OnFailureCallback_9, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_9(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_9(uint8_t batteryChargeState) - { - VerifyOrReturn(CheckConstraintType("batteryChargeState", "", "enum8")); - VerifyOrReturn(CheckConstraintMinValue("batteryChargeState", batteryChargeState, 0)); - VerifyOrReturn(CheckConstraintMaxValue("batteryChargeState", batteryChargeState, 3)); - NextTest(); - } -}; - -class Test_TC_PRS_1_1Suite : public TestCommand -{ -public: - Test_TC_PRS_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_PRS_1_1", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_PRS_1_1Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_PRS_1_1\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_PRS_1_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Read the global attribute constraints: ClusterRevision\n"); - err = TestReadTheGlobalAttributeConstraintsClusterRevision_1(); - break; - case 2: - ChipLogProgress(chipTool, - " ***** Test Step 2 : Write the default values to mandatory global attribute: ClusterRevision\n"); - err = TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_2(); - break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Read the global attribute constraints: AttributeList\n"); - err = TestReadTheGlobalAttributeConstraintsAttributeList_3(); - break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 4; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - static void OnFailureCallback_1(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_1(error); - } - - static void OnSuccessCallback_1(void * context, uint16_t clusterRevision) - { - (static_cast(context))->OnSuccessResponse_1(clusterRevision); - } - - static void OnFailureCallback_2(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_2(error); - } - - static void OnSuccessCallback_2(void * context) { (static_cast(context))->OnSuccessResponse_2(); } - - static void OnFailureCallback_3(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_3(error); - } - - static void OnSuccessCallback_3(void * context, const chip::app::DataModel::DecodableList & attributeList) - { - (static_cast(context))->OnSuccessResponse_3(attributeList); - } - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestReadTheGlobalAttributeConstraintsClusterRevision_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::PressureMeasurementClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_1, OnFailureCallback_1, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_1(uint16_t clusterRevision) - { - VerifyOrReturn(CheckConstraintType("clusterRevision", "", "uint16")); - NextTest(); - } - - CHIP_ERROR TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_2() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::PressureMeasurementClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - uint16_t clusterRevisionArgument; - clusterRevisionArgument = 3U; - - ReturnErrorOnFailure( - cluster.WriteAttribute( - clusterRevisionArgument, this, OnSuccessCallback_2, OnFailureCallback_2)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_2(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - NextTest(); - } - - void OnSuccessResponse_2() { ThrowSuccessResponse(); } - - CHIP_ERROR TestReadTheGlobalAttributeConstraintsAttributeList_3() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::PressureMeasurementClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_3, OnFailureCallback_3, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_3(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_3(const chip::app::DataModel::DecodableList & attributeList) - { - VerifyOrReturn(CheckConstraintType("attributeList", "", "list")); - NextTest(); - } -}; - -class Test_TC_PRS_2_1Suite : public TestCommand -{ -public: - Test_TC_PRS_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_PRS_2_1", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_PRS_2_1Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_PRS_2_1\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_PRS_2_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Read the mandatory attribute constraints: MeasuredValue\n"); - err = TestReadTheMandatoryAttributeConstraintsMeasuredValue_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Write the default values to mandatory attribute: MeasuredValue\n"); - err = TestWriteTheDefaultValuesToMandatoryAttributeMeasuredValue_2(); - break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Reads back mandatory attribute: MeasuredValue\n"); - err = TestReadsBackMandatoryAttributeMeasuredValue_3(); - break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Read the mandatory attribute constraints: MinMeasuredValue\n"); - err = TestReadTheMandatoryAttributeConstraintsMinMeasuredValue_4(); - break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Write the default values to mandatory attribute: MinMeasuredValue\n"); - err = TestWriteTheDefaultValuesToMandatoryAttributeMinMeasuredValue_5(); - break; - case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : Reads back mandatory attribute: MinMeasuredValue\n"); - err = TestReadsBackMandatoryAttributeMinMeasuredValue_6(); - break; - case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : Read the mandatory attribute constraints: MaxMeasuredValue\n"); - err = TestReadTheMandatoryAttributeConstraintsMaxMeasuredValue_7(); - break; - case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : Write the default values to mandatory attribute: MaxMeasuredValue\n"); - err = TestWriteTheDefaultValuesToMandatoryAttributeMaxMeasuredValue_8(); - break; - case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : Reads back mandatory attribute: MaxMeasuredValue\n"); - err = TestReadsBackMandatoryAttributeMaxMeasuredValue_9(); - break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 10; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - static void OnFailureCallback_1(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_1(error); - } - - static void OnSuccessCallback_1(void * context, const chip::app::DataModel::Nullable & measuredValue) - { - (static_cast(context))->OnSuccessResponse_1(measuredValue); - } - - static void OnFailureCallback_2(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_2(error); - } - - static void OnSuccessCallback_2(void * context) { (static_cast(context))->OnSuccessResponse_2(); } - - static void OnFailureCallback_3(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_3(error); - } - - static void OnSuccessCallback_3(void * context, const chip::app::DataModel::Nullable & measuredValue) - { - (static_cast(context))->OnSuccessResponse_3(measuredValue); - } - - static void OnFailureCallback_4(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_4(error); - } - - static void OnSuccessCallback_4(void * context, const chip::app::DataModel::Nullable & minMeasuredValue) - { - (static_cast(context))->OnSuccessResponse_4(minMeasuredValue); - } - - static void OnFailureCallback_5(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_5(error); - } - - static void OnSuccessCallback_5(void * context) { (static_cast(context))->OnSuccessResponse_5(); } - - static void OnFailureCallback_6(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_6(error); - } - - static void OnSuccessCallback_6(void * context, const chip::app::DataModel::Nullable & minMeasuredValue) - { - (static_cast(context))->OnSuccessResponse_6(minMeasuredValue); - } - - static void OnFailureCallback_7(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_7(error); - } - - static void OnSuccessCallback_7(void * context, const chip::app::DataModel::Nullable & maxMeasuredValue) - { - (static_cast(context))->OnSuccessResponse_7(maxMeasuredValue); - } - - static void OnFailureCallback_8(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_8(error); - } - - static void OnSuccessCallback_8(void * context) { (static_cast(context))->OnSuccessResponse_8(); } - - static void OnFailureCallback_9(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_9(error); - } - - static void OnSuccessCallback_9(void * context, const chip::app::DataModel::Nullable & maxMeasuredValue) - { - (static_cast(context))->OnSuccessResponse_9(maxMeasuredValue); - } - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestReadTheMandatoryAttributeConstraintsMeasuredValue_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::PressureMeasurementClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_1, OnFailureCallback_1, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_1(const chip::app::DataModel::Nullable & measuredValue) - { - VerifyOrReturn(CheckConstraintType("measuredValue", "", "int16")); - NextTest(); - } - - CHIP_ERROR TestWriteTheDefaultValuesToMandatoryAttributeMeasuredValue_2() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::PressureMeasurementClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::DataModel::Nullable measuredValueArgument; - measuredValueArgument.SetNonNull(); - measuredValueArgument.Value() = 0; - - ReturnErrorOnFailure(cluster.WriteAttribute( - measuredValueArgument, this, OnSuccessCallback_2, OnFailureCallback_2)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_2(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - NextTest(); - } - - void OnSuccessResponse_2() { ThrowSuccessResponse(); } - - CHIP_ERROR TestReadsBackMandatoryAttributeMeasuredValue_3() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::PressureMeasurementClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_3, OnFailureCallback_3, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_3(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_3(const chip::app::DataModel::Nullable & measuredValue) - { - VerifyOrReturn(CheckValueNonNull("measuredValue", measuredValue)); - VerifyOrReturn(CheckValue("measuredValue.Value()", measuredValue.Value(), 0)); - - NextTest(); - } - - CHIP_ERROR TestReadTheMandatoryAttributeConstraintsMinMeasuredValue_4() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::PressureMeasurementClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_4, OnFailureCallback_4, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_4(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_4(const chip::app::DataModel::Nullable & minMeasuredValue) - { - VerifyOrReturn(CheckConstraintType("minMeasuredValue", "", "int16")); - NextTest(); - } - - CHIP_ERROR TestWriteTheDefaultValuesToMandatoryAttributeMinMeasuredValue_5() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::PressureMeasurementClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::DataModel::Nullable minMeasuredValueArgument; - minMeasuredValueArgument.SetNonNull(); - minMeasuredValueArgument.Value() = 0; - - ReturnErrorOnFailure( - cluster.WriteAttribute( - minMeasuredValueArgument, this, OnSuccessCallback_5, OnFailureCallback_5)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_5(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - NextTest(); - } - - void OnSuccessResponse_5() { ThrowSuccessResponse(); } - - CHIP_ERROR TestReadsBackMandatoryAttributeMinMeasuredValue_6() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::PressureMeasurementClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_6, OnFailureCallback_6, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_6(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_6(const chip::app::DataModel::Nullable & minMeasuredValue) - { - VerifyOrReturn(CheckValueNonNull("minMeasuredValue", minMeasuredValue)); - VerifyOrReturn(CheckValue("minMeasuredValue.Value()", minMeasuredValue.Value(), 0)); - - NextTest(); - } - - CHIP_ERROR TestReadTheMandatoryAttributeConstraintsMaxMeasuredValue_7() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::PressureMeasurementClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_7, OnFailureCallback_7, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_7(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_7(const chip::app::DataModel::Nullable & maxMeasuredValue) - { - VerifyOrReturn(CheckConstraintType("maxMeasuredValue", "", "int16")); - NextTest(); - } - - CHIP_ERROR TestWriteTheDefaultValuesToMandatoryAttributeMaxMeasuredValue_8() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::PressureMeasurementClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::DataModel::Nullable maxMeasuredValueArgument; - maxMeasuredValueArgument.SetNonNull(); - maxMeasuredValueArgument.Value() = 0; - - ReturnErrorOnFailure( - cluster.WriteAttribute( - maxMeasuredValueArgument, this, OnSuccessCallback_8, OnFailureCallback_8)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_8(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - NextTest(); - } - - void OnSuccessResponse_8() { ThrowSuccessResponse(); } - - CHIP_ERROR TestReadsBackMandatoryAttributeMaxMeasuredValue_9() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::PressureMeasurementClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_9, OnFailureCallback_9, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_9(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_9(const chip::app::DataModel::Nullable & maxMeasuredValue) - { - VerifyOrReturn(CheckValueNonNull("maxMeasuredValue", maxMeasuredValue)); - VerifyOrReturn(CheckValue("maxMeasuredValue.Value()", maxMeasuredValue.Value(), 0)); - - NextTest(); - } -}; - -class Test_TC_PCC_1_1Suite : public TestCommand -{ -public: - Test_TC_PCC_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_PCC_1_1", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_PCC_1_1Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_PCC_1_1\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_PCC_1_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Read the global attribute constraints: ClusterRevision\n"); - err = TestReadTheGlobalAttributeConstraintsClusterRevision_1(); - break; - case 2: - ChipLogProgress(chipTool, - " ***** Test Step 2 : write the default values to mandatory global attribute: ClusterRevision\n"); - err = TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_2(); - break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Read the global attribute: AttributeList\n"); - err = TestReadTheGlobalAttributeAttributeList_3(); - break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Read the global attribute: AcceptedCommandList\n"); - err = TestReadTheGlobalAttributeAcceptedCommandList_4(); - break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Read the global attribute: GeneratedCommandList\n"); - err = TestReadTheGlobalAttributeGeneratedCommandList_5(); - break; - case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : read the optional global attribute: FeatureMap\n"); - err = TestReadTheOptionalGlobalAttributeFeatureMap_6(); - break; - case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : read the optional global attribute: FeatureMap\n"); - err = TestReadTheOptionalGlobalAttributeFeatureMap_7(); - break; - case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : write the default values to optional global attribute: FeatureMap\n"); - err = TestWriteTheDefaultValuesToOptionalGlobalAttributeFeatureMap_8(); - break; - case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : reads back optional global attribute: FeatureMap\n"); - err = TestReadsBackOptionalGlobalAttributeFeatureMap_9(); - break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 10; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - static void OnFailureCallback_1(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_1(error); - } - - static void OnSuccessCallback_1(void * context, uint16_t clusterRevision) - { - (static_cast(context))->OnSuccessResponse_1(clusterRevision); - } - - static void OnFailureCallback_2(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_2(error); - } - - static void OnSuccessCallback_2(void * context) { (static_cast(context))->OnSuccessResponse_2(); } - - static void OnFailureCallback_3(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_3(error); - } - - static void OnSuccessCallback_3(void * context, const chip::app::DataModel::DecodableList & attributeList) - { - (static_cast(context))->OnSuccessResponse_3(attributeList); - } - - static void OnFailureCallback_4(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_4(error); - } - - static void OnSuccessCallback_4(void * context, - const chip::app::DataModel::DecodableList & acceptedCommandList) - { - (static_cast(context))->OnSuccessResponse_4(acceptedCommandList); - } - - static void OnFailureCallback_5(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_5(error); - } - - static void OnSuccessCallback_5(void * context, - const chip::app::DataModel::DecodableList & generatedCommandList) - { - (static_cast(context))->OnSuccessResponse_5(generatedCommandList); - } - - static void OnFailureCallback_6(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_6(error); - } - - static void OnSuccessCallback_6(void * context, uint32_t featureMap) - { - (static_cast(context))->OnSuccessResponse_6(featureMap); - } - - static void OnFailureCallback_7(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_7(error); - } - - static void OnSuccessCallback_7(void * context, uint32_t featureMap) - { - (static_cast(context))->OnSuccessResponse_7(featureMap); - } - - static void OnFailureCallback_8(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_8(error); - } - - static void OnSuccessCallback_8(void * context) { (static_cast(context))->OnSuccessResponse_8(); } - - static void OnFailureCallback_9(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_9(error); - } - - static void OnSuccessCallback_9(void * context, uint32_t featureMap) - { - (static_cast(context))->OnSuccessResponse_9(featureMap); - } - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestReadTheGlobalAttributeConstraintsClusterRevision_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::PumpConfigurationAndControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_1, OnFailureCallback_1, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_1(uint16_t clusterRevision) - { - VerifyOrReturn(CheckConstraintType("clusterRevision", "", "uint16")); - NextTest(); - } - - CHIP_ERROR TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_2() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::PumpConfigurationAndControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - uint16_t clusterRevisionArgument; - clusterRevisionArgument = 3U; - - ReturnErrorOnFailure( - cluster.WriteAttribute( - clusterRevisionArgument, this, OnSuccessCallback_2, OnFailureCallback_2)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_2(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - NextTest(); - } - - void OnSuccessResponse_2() { ThrowSuccessResponse(); } - - CHIP_ERROR TestReadTheGlobalAttributeAttributeList_3() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::PumpConfigurationAndControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_3, OnFailureCallback_3, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_3(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_3(const chip::app::DataModel::DecodableList & attributeList) - { - VerifyOrReturn(CheckConstraintType("attributeList", "", "list")); - NextTest(); - } - - CHIP_ERROR TestReadTheGlobalAttributeAcceptedCommandList_4() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::PumpConfigurationAndControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_4, OnFailureCallback_4, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_4(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_4(const chip::app::DataModel::DecodableList & acceptedCommandList) - { - VerifyOrReturn(CheckConstraintType("acceptedCommandList", "", "list")); - NextTest(); - } - - CHIP_ERROR TestReadTheGlobalAttributeGeneratedCommandList_5() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::PumpConfigurationAndControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_5, OnFailureCallback_5, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_5(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_5(const chip::app::DataModel::DecodableList & generatedCommandList) - { - VerifyOrReturn(CheckConstraintType("generatedCommandList", "", "list")); - NextTest(); - } - - CHIP_ERROR TestReadTheOptionalGlobalAttributeFeatureMap_6() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::PumpConfigurationAndControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_6, OnFailureCallback_6, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_6(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_6(uint32_t featureMap) - { - VerifyOrReturn(CheckValue("featureMap", featureMap, 0UL)); - - NextTest(); - } - - CHIP_ERROR TestReadTheOptionalGlobalAttributeFeatureMap_7() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::PumpConfigurationAndControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_7, OnFailureCallback_7, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_7(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_7(uint32_t featureMap) - { - VerifyOrReturn(CheckConstraintType("featureMap", "", "map32")); - NextTest(); - } - - CHIP_ERROR TestWriteTheDefaultValuesToOptionalGlobalAttributeFeatureMap_8() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::PumpConfigurationAndControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - uint32_t featureMapArgument; - featureMapArgument = 0UL; - - ReturnErrorOnFailure( - cluster.WriteAttribute( - featureMapArgument, this, OnSuccessCallback_8, OnFailureCallback_8)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_8(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - NextTest(); - } - - void OnSuccessResponse_8() { ThrowSuccessResponse(); } - - CHIP_ERROR TestReadsBackOptionalGlobalAttributeFeatureMap_9() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::PumpConfigurationAndControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_9, OnFailureCallback_9, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_9(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_9(uint32_t featureMap) - { - VerifyOrReturn(CheckValue("featureMap", featureMap, 0UL)); - VerifyOrReturn(CheckConstraintType("featureMap", "", "map32")); - NextTest(); - } -}; - -class Test_TC_PCC_2_1Suite : public TestCommand -{ -public: - Test_TC_PCC_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_PCC_2_1", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_PCC_2_1Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_PCC_2_1\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_PCC_2_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : read the mandatory attribute: MaxPressure\n"); - err = TestReadTheMandatoryAttributeMaxPressure_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : read the mandatory attribute: MaxSpeed\n"); - err = TestReadTheMandatoryAttributeMaxSpeed_2(); - break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : read the mandatory attribute: MaxFlow\n"); - err = TestReadTheMandatoryAttributeMaxFlow_3(); - break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : read the mandatory attribute: EffectiveOperationMode\n"); - err = TestReadTheMandatoryAttributeEffectiveOperationMode_4(); - break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : read the mandatory attribute: EffectiveControlMode\n"); - err = TestReadTheMandatoryAttributeEffectiveControlMode_5(); - break; - case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : read the mandatory attribute: Capacity\n"); - err = TestReadTheMandatoryAttributeCapacity_6(); - break; - case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : read the mandatory attribute: MaxPressure\n"); - err = TestReadTheMandatoryAttributeMaxPressure_7(); - break; - case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : read the mandatory attribute: MaxSpeed\n"); - err = TestReadTheMandatoryAttributeMaxSpeed_8(); - break; - case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : read the mandatory attribute: MaxFlow\n"); - err = TestReadTheMandatoryAttributeMaxFlow_9(); - break; - case 10: - ChipLogProgress(chipTool, " ***** Test Step 10 : read the mandatory attribute: EffectiveOperationMode\n"); - err = TestReadTheMandatoryAttributeEffectiveOperationMode_10(); - break; - case 11: - ChipLogProgress(chipTool, " ***** Test Step 11 : read the mandatory attribute: EffectiveControlMode\n"); - err = TestReadTheMandatoryAttributeEffectiveControlMode_11(); - break; - case 12: - ChipLogProgress(chipTool, " ***** Test Step 12 : read the mandatory attribute: Capacity\n"); - err = TestReadTheMandatoryAttributeCapacity_12(); - break; - case 13: - ChipLogProgress(chipTool, " ***** Test Step 13 : read the optional attribute: MinConstPressure\n"); - err = TestReadTheOptionalAttributeMinConstPressure_13(); - break; - case 14: - ChipLogProgress(chipTool, " ***** Test Step 14 : read the optional attribute: MaxConstPressure\n"); - err = TestReadTheOptionalAttributeMaxConstPressure_14(); - break; - case 15: - ChipLogProgress(chipTool, " ***** Test Step 15 : read the optional attribute: MinCompPressure\n"); - err = TestReadTheOptionalAttributeMinCompPressure_15(); - break; - case 16: - ChipLogProgress(chipTool, " ***** Test Step 16 : read the optional attribute: MaxCompPressure\n"); - err = TestReadTheOptionalAttributeMaxCompPressure_16(); - break; - case 17: - ChipLogProgress(chipTool, " ***** Test Step 17 : read the optional attribute: MinConstSpeed\n"); - err = TestReadTheOptionalAttributeMinConstSpeed_17(); - break; - case 18: - ChipLogProgress(chipTool, " ***** Test Step 18 : read the optional attribute: MaxConstSpeed\n"); - err = TestReadTheOptionalAttributeMaxConstSpeed_18(); - break; - case 19: - ChipLogProgress(chipTool, " ***** Test Step 19 : read the optional attribute: MinConstFlow\n"); - err = TestReadTheOptionalAttributeMinConstFlow_19(); - break; - case 20: - ChipLogProgress(chipTool, " ***** Test Step 20 : read the optional attribute: MaxConstFlow\n"); - err = TestReadTheOptionalAttributeMaxConstFlow_20(); - break; - case 21: - ChipLogProgress(chipTool, " ***** Test Step 21 : read the optional attribute: MinConstTemp\n"); - err = TestReadTheOptionalAttributeMinConstTemp_21(); - break; - case 22: - ChipLogProgress(chipTool, " ***** Test Step 22 : read the optional attribute: MaxConstTemp\n"); - err = TestReadTheOptionalAttributeMaxConstTemp_22(); - break; - case 23: - ChipLogProgress(chipTool, " ***** Test Step 23 : read the optional attribute: PumpStatus\n"); - err = TestReadTheOptionalAttributePumpStatus_23(); - break; - case 24: - ChipLogProgress(chipTool, " ***** Test Step 24 : read the optional attribute: PumpStatus\n"); - err = TestReadTheOptionalAttributePumpStatus_24(); - break; - case 25: - ChipLogProgress(chipTool, " ***** Test Step 25 : read the optional attribute: Speed\n"); - err = TestReadTheOptionalAttributeSpeed_25(); - break; - case 26: - ChipLogProgress(chipTool, " ***** Test Step 26 : read the optional attribute: LifetimeRunningHours\n"); - err = TestReadTheOptionalAttributeLifetimeRunningHours_26(); - break; - case 27: - ChipLogProgress(chipTool, " ***** Test Step 27 : read the optional attribute: LifetimeRunningHours\n"); - err = TestReadTheOptionalAttributeLifetimeRunningHours_27(); - break; - case 28: - ChipLogProgress(chipTool, " ***** Test Step 28 : read the optional attribute: Power\n"); - err = TestReadTheOptionalAttributePower_28(); - break; - case 29: - ChipLogProgress(chipTool, " ***** Test Step 29 : read the optional attribute: LifetimeEnergyConsumed\n"); - err = TestReadTheOptionalAttributeLifetimeEnergyConsumed_29(); - break; - case 30: - ChipLogProgress(chipTool, " ***** Test Step 30 : read the optional attribute: LifetimeEnergyConsumed\n"); - err = TestReadTheOptionalAttributeLifetimeEnergyConsumed_30(); - break; - case 31: - ChipLogProgress(chipTool, " ***** Test Step 31 : write to the optional attribute: LifetimeEnergyConsumed\n"); - err = TestWriteToTheOptionalAttributeLifetimeEnergyConsumed_31(); - break; - case 32: - ChipLogProgress(chipTool, " ***** Test Step 32 : read the optional attribute: MinConstPressure\n"); - err = TestReadTheOptionalAttributeMinConstPressure_32(); - break; - case 33: - ChipLogProgress(chipTool, " ***** Test Step 33 : read the optional attribute: MaxConstPressure\n"); - err = TestReadTheOptionalAttributeMaxConstPressure_33(); - break; - case 34: - ChipLogProgress(chipTool, " ***** Test Step 34 : read the optional attribute: MinCompPressure\n"); - err = TestReadTheOptionalAttributeMinCompPressure_34(); - break; - case 35: - ChipLogProgress(chipTool, " ***** Test Step 35 : read the optional attribute: MaxCompPressure\n"); - err = TestReadTheOptionalAttributeMaxCompPressure_35(); - break; - case 36: - ChipLogProgress(chipTool, " ***** Test Step 36 : read the optional attribute: MinConstSpeed\n"); - err = TestReadTheOptionalAttributeMinConstSpeed_36(); - break; - case 37: - ChipLogProgress(chipTool, " ***** Test Step 37 : read the optional attribute: MaxConstSpeed\n"); - err = TestReadTheOptionalAttributeMaxConstSpeed_37(); - break; - case 38: - ChipLogProgress(chipTool, " ***** Test Step 38 : read the optional attribute: MinConstFlow\n"); - err = TestReadTheOptionalAttributeMinConstFlow_38(); - break; - case 39: - ChipLogProgress(chipTool, " ***** Test Step 39 : read the optional attribute: MaxConstFlow\n"); - err = TestReadTheOptionalAttributeMaxConstFlow_39(); - break; - case 40: - ChipLogProgress(chipTool, " ***** Test Step 40 : read the optional attribute: MinConstTemp\n"); - err = TestReadTheOptionalAttributeMinConstTemp_40(); - break; - case 41: - ChipLogProgress(chipTool, " ***** Test Step 41 : read the optional attribute: MaxConstTemp\n"); - err = TestReadTheOptionalAttributeMaxConstTemp_41(); - break; - case 42: - ChipLogProgress(chipTool, " ***** Test Step 42 : read the optional attribute: PumpStatus\n"); - err = TestReadTheOptionalAttributePumpStatus_42(); - break; - case 43: - ChipLogProgress(chipTool, " ***** Test Step 43 : read the optional attribute: PumpStatus\n"); - err = TestReadTheOptionalAttributePumpStatus_43(); - break; - case 44: - ChipLogProgress(chipTool, " ***** Test Step 44 : read the optional attribute: Speed\n"); - err = TestReadTheOptionalAttributeSpeed_44(); - break; - case 45: - ChipLogProgress(chipTool, " ***** Test Step 45 : read the optional attribute: LifetimeRunningHours\n"); - err = TestReadTheOptionalAttributeLifetimeRunningHours_45(); - break; - case 46: - ChipLogProgress(chipTool, " ***** Test Step 46 : read the optional attribute: LifetimeRunningHours\n"); - err = TestReadTheOptionalAttributeLifetimeRunningHours_46(); - break; - case 47: - ChipLogProgress(chipTool, " ***** Test Step 47 : read the optional attribute: Power\n"); - err = TestReadTheOptionalAttributePower_47(); - break; - case 48: - ChipLogProgress(chipTool, " ***** Test Step 48 : read the optional attribute: LifetimeEnergyConsumed\n"); - err = TestReadTheOptionalAttributeLifetimeEnergyConsumed_48(); - break; - case 49: - ChipLogProgress(chipTool, " ***** Test Step 49 : read the optional attribute: LifetimeEnergyConsumed\n"); - err = TestReadTheOptionalAttributeLifetimeEnergyConsumed_49(); - break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 50; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - static void OnFailureCallback_1(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_1(error); - } - - static void OnSuccessCallback_1(void * context, const chip::app::DataModel::Nullable & maxPressure) - { - (static_cast(context))->OnSuccessResponse_1(maxPressure); - } - - static void OnFailureCallback_2(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_2(error); - } - - static void OnSuccessCallback_2(void * context, const chip::app::DataModel::Nullable & maxSpeed) - { - (static_cast(context))->OnSuccessResponse_2(maxSpeed); - } - - static void OnFailureCallback_3(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_3(error); - } - - static void OnSuccessCallback_3(void * context, const chip::app::DataModel::Nullable & maxFlow) - { - (static_cast(context))->OnSuccessResponse_3(maxFlow); - } - - static void OnFailureCallback_4(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_4(error); - } - - static void OnSuccessCallback_4(void * context, - chip::app::Clusters::PumpConfigurationAndControl::PumpOperationMode effectiveOperationMode) - { - (static_cast(context))->OnSuccessResponse_4(effectiveOperationMode); - } - - static void OnFailureCallback_5(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_5(error); - } - - static void OnSuccessCallback_5(void * context, - chip::app::Clusters::PumpConfigurationAndControl::PumpControlMode effectiveControlMode) - { - (static_cast(context))->OnSuccessResponse_5(effectiveControlMode); - } - - static void OnFailureCallback_6(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_6(error); - } - - static void OnSuccessCallback_6(void * context, const chip::app::DataModel::Nullable & capacity) - { - (static_cast(context))->OnSuccessResponse_6(capacity); - } - - static void OnFailureCallback_7(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_7(error); - } - - static void OnSuccessCallback_7(void * context, const chip::app::DataModel::Nullable & maxPressure) - { - (static_cast(context))->OnSuccessResponse_7(maxPressure); - } - - static void OnFailureCallback_8(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_8(error); - } - - static void OnSuccessCallback_8(void * context, const chip::app::DataModel::Nullable & maxSpeed) - { - (static_cast(context))->OnSuccessResponse_8(maxSpeed); - } - - static void OnFailureCallback_9(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_9(error); - } - - static void OnSuccessCallback_9(void * context, const chip::app::DataModel::Nullable & maxFlow) - { - (static_cast(context))->OnSuccessResponse_9(maxFlow); - } - - static void OnFailureCallback_10(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_10(error); - } - - static void OnSuccessCallback_10(void * context, - chip::app::Clusters::PumpConfigurationAndControl::PumpOperationMode effectiveOperationMode) - { - (static_cast(context))->OnSuccessResponse_10(effectiveOperationMode); - } - - static void OnFailureCallback_11(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_11(error); - } - - static void OnSuccessCallback_11(void * context, - chip::app::Clusters::PumpConfigurationAndControl::PumpControlMode effectiveControlMode) - { - (static_cast(context))->OnSuccessResponse_11(effectiveControlMode); - } - - static void OnFailureCallback_12(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_12(error); - } - - static void OnSuccessCallback_12(void * context, const chip::app::DataModel::Nullable & capacity) - { - (static_cast(context))->OnSuccessResponse_12(capacity); - } - - static void OnFailureCallback_13(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_13(error); - } - - static void OnSuccessCallback_13(void * context, const chip::app::DataModel::Nullable & minConstPressure) - { - (static_cast(context))->OnSuccessResponse_13(minConstPressure); - } - - static void OnFailureCallback_14(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_14(error); - } - - static void OnSuccessCallback_14(void * context, const chip::app::DataModel::Nullable & maxConstPressure) - { - (static_cast(context))->OnSuccessResponse_14(maxConstPressure); - } - - static void OnFailureCallback_15(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_15(error); - } - - static void OnSuccessCallback_15(void * context, const chip::app::DataModel::Nullable & minCompPressure) - { - (static_cast(context))->OnSuccessResponse_15(minCompPressure); - } - - static void OnFailureCallback_16(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_16(error); - } - - static void OnSuccessCallback_16(void * context, const chip::app::DataModel::Nullable & maxCompPressure) - { - (static_cast(context))->OnSuccessResponse_16(maxCompPressure); - } - - static void OnFailureCallback_17(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_17(error); - } - - static void OnSuccessCallback_17(void * context, const chip::app::DataModel::Nullable & minConstSpeed) - { - (static_cast(context))->OnSuccessResponse_17(minConstSpeed); - } - - static void OnFailureCallback_18(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_18(error); - } - - static void OnSuccessCallback_18(void * context, const chip::app::DataModel::Nullable & maxConstSpeed) - { - (static_cast(context))->OnSuccessResponse_18(maxConstSpeed); - } - - static void OnFailureCallback_19(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_19(error); - } - - static void OnSuccessCallback_19(void * context, const chip::app::DataModel::Nullable & minConstFlow) - { - (static_cast(context))->OnSuccessResponse_19(minConstFlow); - } - - static void OnFailureCallback_20(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_20(error); - } - - static void OnSuccessCallback_20(void * context, const chip::app::DataModel::Nullable & maxConstFlow) - { - (static_cast(context))->OnSuccessResponse_20(maxConstFlow); - } - - static void OnFailureCallback_21(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_21(error); - } - - static void OnSuccessCallback_21(void * context, const chip::app::DataModel::Nullable & minConstTemp) - { - (static_cast(context))->OnSuccessResponse_21(minConstTemp); - } - - static void OnFailureCallback_22(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_22(error); - } - - static void OnSuccessCallback_22(void * context, const chip::app::DataModel::Nullable & maxConstTemp) - { - (static_cast(context))->OnSuccessResponse_22(maxConstTemp); - } - - static void OnFailureCallback_23(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_23(error); - } - - static void OnSuccessCallback_23(void * context, uint16_t pumpStatus) - { - (static_cast(context))->OnSuccessResponse_23(pumpStatus); - } - - static void OnFailureCallback_24(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_24(error); - } - - static void OnSuccessCallback_24(void * context, uint16_t pumpStatus) - { - (static_cast(context))->OnSuccessResponse_24(pumpStatus); - } - - static void OnFailureCallback_25(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_25(error); - } - - static void OnSuccessCallback_25(void * context, const chip::app::DataModel::Nullable & speed) - { - (static_cast(context))->OnSuccessResponse_25(speed); - } - - static void OnFailureCallback_26(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_26(error); - } - - static void OnSuccessCallback_26(void * context, const chip::app::DataModel::Nullable & lifetimeRunningHours) - { - (static_cast(context))->OnSuccessResponse_26(lifetimeRunningHours); - } - - static void OnFailureCallback_27(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_27(error); - } - - static void OnSuccessCallback_27(void * context, const chip::app::DataModel::Nullable & lifetimeRunningHours) - { - (static_cast(context))->OnSuccessResponse_27(lifetimeRunningHours); - } - - static void OnFailureCallback_28(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_28(error); - } - - static void OnSuccessCallback_28(void * context, const chip::app::DataModel::Nullable & power) - { - (static_cast(context))->OnSuccessResponse_28(power); - } - - static void OnFailureCallback_29(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_29(error); - } - - static void OnSuccessCallback_29(void * context, const chip::app::DataModel::Nullable & lifetimeEnergyConsumed) - { - (static_cast(context))->OnSuccessResponse_29(lifetimeEnergyConsumed); - } - - static void OnFailureCallback_30(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_30(error); - } - - static void OnSuccessCallback_30(void * context, const chip::app::DataModel::Nullable & lifetimeEnergyConsumed) - { - (static_cast(context))->OnSuccessResponse_30(lifetimeEnergyConsumed); - } - - static void OnFailureCallback_31(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_31(error); - } - - static void OnSuccessCallback_31(void * context) { (static_cast(context))->OnSuccessResponse_31(); } - - static void OnFailureCallback_32(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_32(error); - } - - static void OnSuccessCallback_32(void * context, const chip::app::DataModel::Nullable & minConstPressure) - { - (static_cast(context))->OnSuccessResponse_32(minConstPressure); - } - - static void OnFailureCallback_33(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_33(error); - } - - static void OnSuccessCallback_33(void * context, const chip::app::DataModel::Nullable & maxConstPressure) - { - (static_cast(context))->OnSuccessResponse_33(maxConstPressure); - } - - static void OnFailureCallback_34(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_34(error); - } - - static void OnSuccessCallback_34(void * context, const chip::app::DataModel::Nullable & minCompPressure) - { - (static_cast(context))->OnSuccessResponse_34(minCompPressure); - } - - static void OnFailureCallback_35(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_35(error); - } - - static void OnSuccessCallback_35(void * context, const chip::app::DataModel::Nullable & maxCompPressure) - { - (static_cast(context))->OnSuccessResponse_35(maxCompPressure); - } - - static void OnFailureCallback_36(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_36(error); - } - - static void OnSuccessCallback_36(void * context, const chip::app::DataModel::Nullable & minConstSpeed) - { - (static_cast(context))->OnSuccessResponse_36(minConstSpeed); - } - - static void OnFailureCallback_37(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_37(error); - } - - static void OnSuccessCallback_37(void * context, const chip::app::DataModel::Nullable & maxConstSpeed) - { - (static_cast(context))->OnSuccessResponse_37(maxConstSpeed); - } - - static void OnFailureCallback_38(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_38(error); - } - - static void OnSuccessCallback_38(void * context, const chip::app::DataModel::Nullable & minConstFlow) - { - (static_cast(context))->OnSuccessResponse_38(minConstFlow); - } - - static void OnFailureCallback_39(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_39(error); - } - - static void OnSuccessCallback_39(void * context, const chip::app::DataModel::Nullable & maxConstFlow) - { - (static_cast(context))->OnSuccessResponse_39(maxConstFlow); - } - - static void OnFailureCallback_40(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_40(error); - } - - static void OnSuccessCallback_40(void * context, const chip::app::DataModel::Nullable & minConstTemp) - { - (static_cast(context))->OnSuccessResponse_40(minConstTemp); - } - - static void OnFailureCallback_41(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_41(error); - } - - static void OnSuccessCallback_41(void * context, const chip::app::DataModel::Nullable & maxConstTemp) - { - (static_cast(context))->OnSuccessResponse_41(maxConstTemp); - } - - static void OnFailureCallback_42(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_42(error); - } - - static void OnSuccessCallback_42(void * context, uint16_t pumpStatus) - { - (static_cast(context))->OnSuccessResponse_42(pumpStatus); - } - - static void OnFailureCallback_43(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_43(error); - } - - static void OnSuccessCallback_43(void * context, uint16_t pumpStatus) - { - (static_cast(context))->OnSuccessResponse_43(pumpStatus); - } - - static void OnFailureCallback_44(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_44(error); - } - - static void OnSuccessCallback_44(void * context, const chip::app::DataModel::Nullable & speed) - { - (static_cast(context))->OnSuccessResponse_44(speed); - } - - static void OnFailureCallback_45(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_45(error); - } - - static void OnSuccessCallback_45(void * context, const chip::app::DataModel::Nullable & lifetimeRunningHours) - { - (static_cast(context))->OnSuccessResponse_45(lifetimeRunningHours); - } - - static void OnFailureCallback_46(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_46(error); - } - - static void OnSuccessCallback_46(void * context, const chip::app::DataModel::Nullable & lifetimeRunningHours) - { - (static_cast(context))->OnSuccessResponse_46(lifetimeRunningHours); - } - - static void OnFailureCallback_47(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_47(error); - } - - static void OnSuccessCallback_47(void * context, const chip::app::DataModel::Nullable & power) - { - (static_cast(context))->OnSuccessResponse_47(power); - } - - static void OnFailureCallback_48(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_48(error); - } - - static void OnSuccessCallback_48(void * context, const chip::app::DataModel::Nullable & lifetimeEnergyConsumed) - { - (static_cast(context))->OnSuccessResponse_48(lifetimeEnergyConsumed); - } - - static void OnFailureCallback_49(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_49(error); - } - - static void OnSuccessCallback_49(void * context, const chip::app::DataModel::Nullable & lifetimeEnergyConsumed) - { - (static_cast(context))->OnSuccessResponse_49(lifetimeEnergyConsumed); - } - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestReadTheMandatoryAttributeMaxPressure_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::PumpConfigurationAndControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_1, OnFailureCallback_1, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_1(const chip::app::DataModel::Nullable & maxPressure) - { - VerifyOrReturn(CheckConstraintType("maxPressure", "", "int16")); - NextTest(); - } - - CHIP_ERROR TestReadTheMandatoryAttributeMaxSpeed_2() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::PumpConfigurationAndControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_2, OnFailureCallback_2, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_2(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_2(const chip::app::DataModel::Nullable & maxSpeed) - { - VerifyOrReturn(CheckConstraintType("maxSpeed", "", "uint16")); - NextTest(); - } - - CHIP_ERROR TestReadTheMandatoryAttributeMaxFlow_3() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::PumpConfigurationAndControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_3, OnFailureCallback_3, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_3(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_3(const chip::app::DataModel::Nullable & maxFlow) - { - VerifyOrReturn(CheckConstraintType("maxFlow", "", "uint16")); - NextTest(); - } - - CHIP_ERROR TestReadTheMandatoryAttributeEffectiveOperationMode_4() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::PumpConfigurationAndControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_4, OnFailureCallback_4, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_4(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_4(chip::app::Clusters::PumpConfigurationAndControl::PumpOperationMode effectiveOperationMode) - { - VerifyOrReturn(CheckConstraintType("effectiveOperationMode", "", "enum8")); - NextTest(); - } - - CHIP_ERROR TestReadTheMandatoryAttributeEffectiveControlMode_5() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::PumpConfigurationAndControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_5, OnFailureCallback_5, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_5(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_5(chip::app::Clusters::PumpConfigurationAndControl::PumpControlMode effectiveControlMode) - { - VerifyOrReturn(CheckConstraintType("effectiveControlMode", "", "enum8")); - NextTest(); - } - - CHIP_ERROR TestReadTheMandatoryAttributeCapacity_6() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::PumpConfigurationAndControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_6, OnFailureCallback_6, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_6(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_6(const chip::app::DataModel::Nullable & capacity) - { - VerifyOrReturn(CheckConstraintType("capacity", "", "int16")); - NextTest(); - } - - CHIP_ERROR TestReadTheMandatoryAttributeMaxPressure_7() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::PumpConfigurationAndControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_7, OnFailureCallback_7, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_7(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_7(const chip::app::DataModel::Nullable & maxPressure) - { - VerifyOrReturn(CheckConstraintType("maxPressure", "", "int16")); - NextTest(); - } - - CHIP_ERROR TestReadTheMandatoryAttributeMaxSpeed_8() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::PumpConfigurationAndControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_8, OnFailureCallback_8, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_8(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_8(const chip::app::DataModel::Nullable & maxSpeed) - { - VerifyOrReturn(CheckConstraintType("maxSpeed", "", "uint16")); - NextTest(); - } - - CHIP_ERROR TestReadTheMandatoryAttributeMaxFlow_9() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::PumpConfigurationAndControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_9, OnFailureCallback_9, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_9(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_9(const chip::app::DataModel::Nullable & maxFlow) - { - VerifyOrReturn(CheckConstraintType("maxFlow", "", "uint16")); - NextTest(); - } - - CHIP_ERROR TestReadTheMandatoryAttributeEffectiveOperationMode_10() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::PumpConfigurationAndControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_10, OnFailureCallback_10, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_10(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_10(chip::app::Clusters::PumpConfigurationAndControl::PumpOperationMode effectiveOperationMode) - { - VerifyOrReturn(CheckConstraintType("effectiveOperationMode", "", "enum8")); - NextTest(); - } - - CHIP_ERROR TestReadTheMandatoryAttributeEffectiveControlMode_11() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::PumpConfigurationAndControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_11, OnFailureCallback_11, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_11(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_11(chip::app::Clusters::PumpConfigurationAndControl::PumpControlMode effectiveControlMode) - { - VerifyOrReturn(CheckConstraintType("effectiveControlMode", "", "enum8")); - NextTest(); - } - - CHIP_ERROR TestReadTheMandatoryAttributeCapacity_12() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::PumpConfigurationAndControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_12, OnFailureCallback_12, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_12(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_12(const chip::app::DataModel::Nullable & capacity) - { - VerifyOrReturn(CheckConstraintType("capacity", "", "int16")); - NextTest(); - } - - CHIP_ERROR TestReadTheOptionalAttributeMinConstPressure_13() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::PumpConfigurationAndControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_13, OnFailureCallback_13, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_13(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() - : ThrowFailureResponse(error); - } - - void OnSuccessResponse_13(const chip::app::DataModel::Nullable & minConstPressure) - { - VerifyOrReturn(CheckConstraintType("minConstPressure", "", "int16")); - NextTest(); - } - - CHIP_ERROR TestReadTheOptionalAttributeMaxConstPressure_14() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::PumpConfigurationAndControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_14, OnFailureCallback_14, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_14(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() - : ThrowFailureResponse(error); - } - - void OnSuccessResponse_14(const chip::app::DataModel::Nullable & maxConstPressure) - { - VerifyOrReturn(CheckConstraintType("maxConstPressure", "", "int16")); - NextTest(); - } - - CHIP_ERROR TestReadTheOptionalAttributeMinCompPressure_15() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::PumpConfigurationAndControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_15, OnFailureCallback_15, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_15(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() - : ThrowFailureResponse(error); - } - - void OnSuccessResponse_15(const chip::app::DataModel::Nullable & minCompPressure) - { - VerifyOrReturn(CheckConstraintType("minCompPressure", "", "int16")); - NextTest(); - } - - CHIP_ERROR TestReadTheOptionalAttributeMaxCompPressure_16() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::PumpConfigurationAndControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_16, OnFailureCallback_16, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_16(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() - : ThrowFailureResponse(error); - } - - void OnSuccessResponse_16(const chip::app::DataModel::Nullable & maxCompPressure) - { - VerifyOrReturn(CheckConstraintType("maxCompPressure", "", "int16")); - NextTest(); - } - - CHIP_ERROR TestReadTheOptionalAttributeMinConstSpeed_17() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::PumpConfigurationAndControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_17, OnFailureCallback_17, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_17(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() - : ThrowFailureResponse(error); - } - - void OnSuccessResponse_17(const chip::app::DataModel::Nullable & minConstSpeed) - { - VerifyOrReturn(CheckConstraintType("minConstSpeed", "", "uint16")); - NextTest(); - } - - CHIP_ERROR TestReadTheOptionalAttributeMaxConstSpeed_18() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::PumpConfigurationAndControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_18, OnFailureCallback_18, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_18(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() - : ThrowFailureResponse(error); - } - - void OnSuccessResponse_18(const chip::app::DataModel::Nullable & maxConstSpeed) - { - VerifyOrReturn(CheckConstraintType("maxConstSpeed", "", "uint16")); - NextTest(); - } - - CHIP_ERROR TestReadTheOptionalAttributeMinConstFlow_19() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::PumpConfigurationAndControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_19, OnFailureCallback_19, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_19(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() - : ThrowFailureResponse(error); - } - - void OnSuccessResponse_19(const chip::app::DataModel::Nullable & minConstFlow) - { - VerifyOrReturn(CheckConstraintType("minConstFlow", "", "uint16")); - NextTest(); - } - - CHIP_ERROR TestReadTheOptionalAttributeMaxConstFlow_20() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::PumpConfigurationAndControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_20, OnFailureCallback_20, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_20(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() - : ThrowFailureResponse(error); - } - - void OnSuccessResponse_20(const chip::app::DataModel::Nullable & maxConstFlow) - { - VerifyOrReturn(CheckConstraintType("maxConstFlow", "", "uint16")); - NextTest(); - } - - CHIP_ERROR TestReadTheOptionalAttributeMinConstTemp_21() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::PumpConfigurationAndControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_21, OnFailureCallback_21, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_21(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() - : ThrowFailureResponse(error); - } - - void OnSuccessResponse_21(const chip::app::DataModel::Nullable & minConstTemp) - { - VerifyOrReturn(CheckConstraintType("minConstTemp", "", "int16")); - VerifyOrReturn(CheckConstraintMinValue("minConstTemp", minConstTemp, -27315)); - NextTest(); - } - - CHIP_ERROR TestReadTheOptionalAttributeMaxConstTemp_22() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::PumpConfigurationAndControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_22, OnFailureCallback_22, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_22(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() - : ThrowFailureResponse(error); - } - - void OnSuccessResponse_22(const chip::app::DataModel::Nullable & maxConstTemp) - { - VerifyOrReturn(CheckConstraintType("maxConstTemp", "", "int16")); - VerifyOrReturn(CheckConstraintMinValue("maxConstTemp", maxConstTemp, -27315)); - NextTest(); - } - - CHIP_ERROR TestReadTheOptionalAttributePumpStatus_23() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::PumpConfigurationAndControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_23, OnFailureCallback_23, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_23(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() - : ThrowFailureResponse(error); - } - - void OnSuccessResponse_23(uint16_t pumpStatus) - { - VerifyOrReturn(CheckValue("pumpStatus", pumpStatus, 0U)); - - NextTest(); - } - - CHIP_ERROR TestReadTheOptionalAttributePumpStatus_24() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::PumpConfigurationAndControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_24, OnFailureCallback_24, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_24(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() - : ThrowFailureResponse(error); - } - - void OnSuccessResponse_24(uint16_t pumpStatus) - { - VerifyOrReturn(CheckConstraintType("pumpStatus", "", "map16")); - NextTest(); - } - - CHIP_ERROR TestReadTheOptionalAttributeSpeed_25() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::PumpConfigurationAndControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_25, OnFailureCallback_25, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_25(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() - : ThrowFailureResponse(error); - } - - void OnSuccessResponse_25(const chip::app::DataModel::Nullable & speed) - { - VerifyOrReturn(CheckConstraintType("speed", "", "uint16")); - NextTest(); - } - - CHIP_ERROR TestReadTheOptionalAttributeLifetimeRunningHours_26() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::PumpConfigurationAndControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_26, OnFailureCallback_26, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_26(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() - : ThrowFailureResponse(error); - } - - void OnSuccessResponse_26(const chip::app::DataModel::Nullable & lifetimeRunningHours) - { - VerifyOrReturn(CheckValueNonNull("lifetimeRunningHours", lifetimeRunningHours)); - VerifyOrReturn(CheckValue("lifetimeRunningHours.Value()", lifetimeRunningHours.Value(), 0UL)); - - NextTest(); - } - - CHIP_ERROR TestReadTheOptionalAttributeLifetimeRunningHours_27() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::PumpConfigurationAndControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_27, OnFailureCallback_27, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_27(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() - : ThrowFailureResponse(error); - } - - void OnSuccessResponse_27(const chip::app::DataModel::Nullable & lifetimeRunningHours) - { - VerifyOrReturn(CheckConstraintType("lifetimeRunningHours", "", "uint24")); - NextTest(); - } - - CHIP_ERROR TestReadTheOptionalAttributePower_28() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::PumpConfigurationAndControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_28, OnFailureCallback_28, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_28(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() - : ThrowFailureResponse(error); - } - - void OnSuccessResponse_28(const chip::app::DataModel::Nullable & power) - { - VerifyOrReturn(CheckConstraintType("power", "", "uint24")); - NextTest(); - } - - CHIP_ERROR TestReadTheOptionalAttributeLifetimeEnergyConsumed_29() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::PumpConfigurationAndControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_29, OnFailureCallback_29, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_29(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() - : ThrowFailureResponse(error); - } - - void OnSuccessResponse_29(const chip::app::DataModel::Nullable & lifetimeEnergyConsumed) - { - VerifyOrReturn(CheckValueNonNull("lifetimeEnergyConsumed", lifetimeEnergyConsumed)); - VerifyOrReturn(CheckValue("lifetimeEnergyConsumed.Value()", lifetimeEnergyConsumed.Value(), 0UL)); - - NextTest(); - } - - CHIP_ERROR TestReadTheOptionalAttributeLifetimeEnergyConsumed_30() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::PumpConfigurationAndControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_30, OnFailureCallback_30, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_30(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() - : ThrowFailureResponse(error); - } - - void OnSuccessResponse_30(const chip::app::DataModel::Nullable & lifetimeEnergyConsumed) - { - VerifyOrReturn(CheckConstraintType("lifetimeEnergyConsumed", "", "uint32")); - NextTest(); - } - - CHIP_ERROR TestWriteToTheOptionalAttributeLifetimeEnergyConsumed_31() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::PumpConfigurationAndControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::DataModel::Nullable lifetimeEnergyConsumedArgument; - lifetimeEnergyConsumedArgument.SetNonNull(); - lifetimeEnergyConsumedArgument.Value() = 0UL; - - ReturnErrorOnFailure( - cluster.WriteAttribute( - lifetimeEnergyConsumedArgument, this, OnSuccessCallback_31, OnFailureCallback_31)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_31(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() - : ThrowFailureResponse(error); - } - - void OnSuccessResponse_31() { NextTest(); } - - CHIP_ERROR TestReadTheOptionalAttributeMinConstPressure_32() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::PumpConfigurationAndControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_32, OnFailureCallback_32, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_32(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() - : ThrowFailureResponse(error); - } - - void OnSuccessResponse_32(const chip::app::DataModel::Nullable & minConstPressure) - { - VerifyOrReturn(CheckConstraintType("minConstPressure", "", "int16")); - NextTest(); - } - - CHIP_ERROR TestReadTheOptionalAttributeMaxConstPressure_33() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::PumpConfigurationAndControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_33, OnFailureCallback_33, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_33(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() - : ThrowFailureResponse(error); - } - - void OnSuccessResponse_33(const chip::app::DataModel::Nullable & maxConstPressure) - { - VerifyOrReturn(CheckConstraintType("maxConstPressure", "", "int16")); - NextTest(); - } - - CHIP_ERROR TestReadTheOptionalAttributeMinCompPressure_34() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::PumpConfigurationAndControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_34, OnFailureCallback_34, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_34(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() - : ThrowFailureResponse(error); - } - - void OnSuccessResponse_34(const chip::app::DataModel::Nullable & minCompPressure) - { - VerifyOrReturn(CheckConstraintType("minCompPressure", "", "int16")); - NextTest(); - } - - CHIP_ERROR TestReadTheOptionalAttributeMaxCompPressure_35() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::PumpConfigurationAndControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_35, OnFailureCallback_35, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_35(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() - : ThrowFailureResponse(error); - } - - void OnSuccessResponse_35(const chip::app::DataModel::Nullable & maxCompPressure) - { - VerifyOrReturn(CheckConstraintType("maxCompPressure", "", "int16")); - NextTest(); - } - - CHIP_ERROR TestReadTheOptionalAttributeMinConstSpeed_36() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::PumpConfigurationAndControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_36, OnFailureCallback_36, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_36(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() - : ThrowFailureResponse(error); - } - - void OnSuccessResponse_36(const chip::app::DataModel::Nullable & minConstSpeed) - { - VerifyOrReturn(CheckConstraintType("minConstSpeed", "", "uint16")); - NextTest(); - } - - CHIP_ERROR TestReadTheOptionalAttributeMaxConstSpeed_37() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::PumpConfigurationAndControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_37, OnFailureCallback_37, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_37(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() - : ThrowFailureResponse(error); - } - - void OnSuccessResponse_37(const chip::app::DataModel::Nullable & maxConstSpeed) - { - VerifyOrReturn(CheckConstraintType("maxConstSpeed", "", "uint16")); - NextTest(); - } - - CHIP_ERROR TestReadTheOptionalAttributeMinConstFlow_38() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::PumpConfigurationAndControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_38, OnFailureCallback_38, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_38(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() - : ThrowFailureResponse(error); - } - - void OnSuccessResponse_38(const chip::app::DataModel::Nullable & minConstFlow) - { - VerifyOrReturn(CheckConstraintType("minConstFlow", "", "uint16")); - NextTest(); - } - - CHIP_ERROR TestReadTheOptionalAttributeMaxConstFlow_39() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::PumpConfigurationAndControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_39, OnFailureCallback_39, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_39(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() - : ThrowFailureResponse(error); - } - - void OnSuccessResponse_39(const chip::app::DataModel::Nullable & maxConstFlow) - { - VerifyOrReturn(CheckConstraintType("maxConstFlow", "", "uint16")); - NextTest(); - } - - CHIP_ERROR TestReadTheOptionalAttributeMinConstTemp_40() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::PumpConfigurationAndControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_40, OnFailureCallback_40, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_40(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() - : ThrowFailureResponse(error); - } - - void OnSuccessResponse_40(const chip::app::DataModel::Nullable & minConstTemp) - { - VerifyOrReturn(CheckConstraintType("minConstTemp", "", "int16")); - VerifyOrReturn(CheckConstraintMinValue("minConstTemp", minConstTemp, -27315)); - VerifyOrReturn(CheckConstraintMaxValue("minConstTemp", minConstTemp, 32767)); - NextTest(); - } - - CHIP_ERROR TestReadTheOptionalAttributeMaxConstTemp_41() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::PumpConfigurationAndControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_41, OnFailureCallback_41, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_41(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() - : ThrowFailureResponse(error); - } - - void OnSuccessResponse_41(const chip::app::DataModel::Nullable & maxConstTemp) - { - VerifyOrReturn(CheckConstraintType("maxConstTemp", "", "int16")); - VerifyOrReturn(CheckConstraintMinValue("maxConstTemp", maxConstTemp, -27315)); - VerifyOrReturn(CheckConstraintMaxValue("maxConstTemp", maxConstTemp, 32767)); - NextTest(); - } - - CHIP_ERROR TestReadTheOptionalAttributePumpStatus_42() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::PumpConfigurationAndControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_42, OnFailureCallback_42, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_42(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() - : ThrowFailureResponse(error); - } - - void OnSuccessResponse_42(uint16_t pumpStatus) - { - VerifyOrReturn(CheckValue("pumpStatus", pumpStatus, 0U)); - - NextTest(); - } - - CHIP_ERROR TestReadTheOptionalAttributePumpStatus_43() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::PumpConfigurationAndControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_43, OnFailureCallback_43, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_43(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() - : ThrowFailureResponse(error); - } - - void OnSuccessResponse_43(uint16_t pumpStatus) - { - VerifyOrReturn(CheckConstraintType("pumpStatus", "", "map16")); - NextTest(); - } - - CHIP_ERROR TestReadTheOptionalAttributeSpeed_44() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::PumpConfigurationAndControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_44, OnFailureCallback_44, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_44(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() - : ThrowFailureResponse(error); - } - - void OnSuccessResponse_44(const chip::app::DataModel::Nullable & speed) - { - VerifyOrReturn(CheckConstraintType("speed", "", "uint16")); - NextTest(); - } - - CHIP_ERROR TestReadTheOptionalAttributeLifetimeRunningHours_45() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::PumpConfigurationAndControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_45, OnFailureCallback_45, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_45(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_45(const chip::app::DataModel::Nullable & lifetimeRunningHours) - { - VerifyOrReturn(CheckValueNonNull("lifetimeRunningHours", lifetimeRunningHours)); - VerifyOrReturn(CheckValue("lifetimeRunningHours.Value()", lifetimeRunningHours.Value(), 0UL)); - - NextTest(); - } - - CHIP_ERROR TestReadTheOptionalAttributeLifetimeRunningHours_46() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::PumpConfigurationAndControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_46, OnFailureCallback_46, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_46(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() - : ThrowFailureResponse(error); - } - - void OnSuccessResponse_46(const chip::app::DataModel::Nullable & lifetimeRunningHours) - { - VerifyOrReturn(CheckConstraintType("lifetimeRunningHours", "", "uint24")); - NextTest(); - } - - CHIP_ERROR TestReadTheOptionalAttributePower_47() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::PumpConfigurationAndControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_47, OnFailureCallback_47, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_47(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() - : ThrowFailureResponse(error); - } - - void OnSuccessResponse_47(const chip::app::DataModel::Nullable & power) - { - VerifyOrReturn(CheckConstraintType("power", "", "uint24")); - NextTest(); - } - - CHIP_ERROR TestReadTheOptionalAttributeLifetimeEnergyConsumed_48() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::PumpConfigurationAndControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_48, OnFailureCallback_48, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_48(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() - : ThrowFailureResponse(error); - } - - void OnSuccessResponse_48(const chip::app::DataModel::Nullable & lifetimeEnergyConsumed) - { - VerifyOrReturn(CheckValueNonNull("lifetimeEnergyConsumed", lifetimeEnergyConsumed)); - VerifyOrReturn(CheckValue("lifetimeEnergyConsumed.Value()", lifetimeEnergyConsumed.Value(), 0UL)); - - NextTest(); - } - - CHIP_ERROR TestReadTheOptionalAttributeLifetimeEnergyConsumed_49() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::PumpConfigurationAndControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_49, OnFailureCallback_49, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_49(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() - : ThrowFailureResponse(error); - } - - void OnSuccessResponse_49(const chip::app::DataModel::Nullable & lifetimeEnergyConsumed) - { - VerifyOrReturn(CheckConstraintType("lifetimeEnergyConsumed", "", "uint32")); - NextTest(); - } -}; - -class Test_TC_PCC_2_2Suite : public TestCommand -{ -public: - Test_TC_PCC_2_2Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_PCC_2_2", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_PCC_2_2Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_PCC_2_2\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_PCC_2_2\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Write 1 to the OperationMode attribute to DUT: OperationMode\n"); - if (ShouldSkip("A_OPERATIONMODE")) - { - NextTest(); - return; - } - err = TestWrite1ToTheOperationModeAttributeToDutOperationMode_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Reads the attribute: EffectiveOperationMode\n"); - if (ShouldSkip("A_EFFECTIVEOPERATIONMODE")) - { - NextTest(); - return; - } - err = TestReadsTheAttributeEffectiveOperationMode_2(); - break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Write 2 to the OperationMode attribute to DUT: OperationMode\n"); - if (ShouldSkip("A_OPERATIONMODE")) - { - NextTest(); - return; - } - err = TestWrite2ToTheOperationModeAttributeToDutOperationMode_3(); - break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Reads the attribute: EffectiveOperationMode\n"); - if (ShouldSkip("A_EFFECTIVEOPERATIONMODE")) - { - NextTest(); - return; - } - err = TestReadsTheAttributeEffectiveOperationMode_4(); - break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Write 3 to the OperationMode attribute to DUT: OperationMode\n"); - if (ShouldSkip("A_OPERATIONMODE")) - { - NextTest(); - return; - } - err = TestWrite3ToTheOperationModeAttributeToDutOperationMode_5(); - break; - case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : Reads the attribute: EffectiveOperationMode\n"); - if (ShouldSkip("A_EFFECTIVEOPERATIONMODE")) - { - NextTest(); - return; - } - err = TestReadsTheAttributeEffectiveOperationMode_6(); - break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 7; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - static void OnFailureCallback_1(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_1(error); - } - - static void OnSuccessCallback_1(void * context) { (static_cast(context))->OnSuccessResponse_1(); } - - static void OnFailureCallback_2(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_2(error); - } - - static void OnSuccessCallback_2(void * context, - chip::app::Clusters::PumpConfigurationAndControl::PumpOperationMode effectiveOperationMode) - { - (static_cast(context))->OnSuccessResponse_2(effectiveOperationMode); - } - - static void OnFailureCallback_3(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_3(error); - } - - static void OnSuccessCallback_3(void * context) { (static_cast(context))->OnSuccessResponse_3(); } - - static void OnFailureCallback_4(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_4(error); - } - - static void OnSuccessCallback_4(void * context, - chip::app::Clusters::PumpConfigurationAndControl::PumpOperationMode effectiveOperationMode) - { - (static_cast(context))->OnSuccessResponse_4(effectiveOperationMode); - } - - static void OnFailureCallback_5(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_5(error); - } - - static void OnSuccessCallback_5(void * context) { (static_cast(context))->OnSuccessResponse_5(); } - - static void OnFailureCallback_6(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_6(error); - } - - static void OnSuccessCallback_6(void * context, - chip::app::Clusters::PumpConfigurationAndControl::PumpOperationMode effectiveOperationMode) - { - (static_cast(context))->OnSuccessResponse_6(effectiveOperationMode); - } - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestWrite1ToTheOperationModeAttributeToDutOperationMode_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::PumpConfigurationAndControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::Clusters::PumpConfigurationAndControl::PumpOperationMode operationModeArgument; - operationModeArgument = static_cast(1); - - ReturnErrorOnFailure( - cluster.WriteAttribute( - operationModeArgument, this, OnSuccessCallback_1, OnFailureCallback_1)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_1() { NextTest(); } - - CHIP_ERROR TestReadsTheAttributeEffectiveOperationMode_2() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::PumpConfigurationAndControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_2, OnFailureCallback_2, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_2(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_2(chip::app::Clusters::PumpConfigurationAndControl::PumpOperationMode effectiveOperationMode) - { - VerifyOrReturn(CheckValue("effectiveOperationMode", effectiveOperationMode, 1)); - - NextTest(); - } - - CHIP_ERROR TestWrite2ToTheOperationModeAttributeToDutOperationMode_3() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::PumpConfigurationAndControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::Clusters::PumpConfigurationAndControl::PumpOperationMode operationModeArgument; - operationModeArgument = static_cast(2); - - ReturnErrorOnFailure( - cluster.WriteAttribute( - operationModeArgument, this, OnSuccessCallback_3, OnFailureCallback_3)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_3(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_3() { NextTest(); } - - CHIP_ERROR TestReadsTheAttributeEffectiveOperationMode_4() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::PumpConfigurationAndControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_4, OnFailureCallback_4, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_4(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_4(chip::app::Clusters::PumpConfigurationAndControl::PumpOperationMode effectiveOperationMode) - { - VerifyOrReturn(CheckValue("effectiveOperationMode", effectiveOperationMode, 2)); - - NextTest(); - } - - CHIP_ERROR TestWrite3ToTheOperationModeAttributeToDutOperationMode_5() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::PumpConfigurationAndControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::Clusters::PumpConfigurationAndControl::PumpOperationMode operationModeArgument; - operationModeArgument = static_cast(3); - - ReturnErrorOnFailure( - cluster.WriteAttribute( - operationModeArgument, this, OnSuccessCallback_5, OnFailureCallback_5)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_5(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_5() { NextTest(); } - - CHIP_ERROR TestReadsTheAttributeEffectiveOperationMode_6() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::PumpConfigurationAndControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_6, OnFailureCallback_6, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_6(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_6(chip::app::Clusters::PumpConfigurationAndControl::PumpOperationMode effectiveOperationMode) - { - VerifyOrReturn(CheckValue("effectiveOperationMode", effectiveOperationMode, 3)); - - NextTest(); - } -}; - -class Test_TC_PCC_2_3Suite : public TestCommand -{ -public: - Test_TC_PCC_2_3Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_PCC_2_3", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_PCC_2_3Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_PCC_2_3\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_PCC_2_3\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Write 0 to the OperationMode attribute to DUT\n"); - if (ShouldSkip("A_OPERATIONMODE")) - { - NextTest(); - return; - } - err = TestWrite0ToTheOperationModeAttributeToDut_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Reads the attribute: EffectiveOperationMode\n"); - if (ShouldSkip("A_EFFECTIVEOPERATIONMODE")) - { - NextTest(); - return; - } - err = TestReadsTheAttributeEffectiveOperationMode_2(); - break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Write 0 to the ControlMode attribute to DUT\n"); - if (ShouldSkip("A_CONTROLMODE")) - { - NextTest(); - return; - } - err = TestWrite0ToTheControlModeAttributeToDut_3(); - break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Reads the attribute: EffectiveControlMode\n"); - if (ShouldSkip("A_EFFECTIVECONTROLMODE")) - { - NextTest(); - return; - } - err = TestReadsTheAttributeEffectiveControlMode_4(); - break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Write 1 to the ControlMode attribute to DUT\n"); - if (ShouldSkip("A_CONTROLMODE")) - { - NextTest(); - return; - } - err = TestWrite1ToTheControlModeAttributeToDut_5(); - break; - case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : Reads the attribute: EffectiveControlMode\n"); - if (ShouldSkip("A_EFFECTIVECONTROLMODE")) - { - NextTest(); - return; - } - err = TestReadsTheAttributeEffectiveControlMode_6(); - break; - case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : Write 2 to the ControlMode attribute to DUT\n"); - if (ShouldSkip("A_CONTROLMODE")) - { - NextTest(); - return; - } - err = TestWrite2ToTheControlModeAttributeToDut_7(); - break; - case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : Reads the attribute: EffectiveControlMode\n"); - if (ShouldSkip("A_EFFECTIVECONTROLMODE")) - { - NextTest(); - return; - } - err = TestReadsTheAttributeEffectiveControlMode_8(); - break; - case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : Write 3 to the ControlMode attribute to DUT\n"); - if (ShouldSkip("A_CONTROLMODE")) - { - NextTest(); - return; - } - err = TestWrite3ToTheControlModeAttributeToDut_9(); - break; - case 10: - ChipLogProgress(chipTool, " ***** Test Step 10 : Reads the attribute: EffectiveControlMode\n"); - if (ShouldSkip("A_EFFECTIVECONTROLMODE")) - { - NextTest(); - return; - } - err = TestReadsTheAttributeEffectiveControlMode_10(); - break; - case 11: - ChipLogProgress(chipTool, " ***** Test Step 11 : Write 5 to the ControlMode attribute to DUT\n"); - if (ShouldSkip("A_CONTROLMODE")) - { - NextTest(); - return; - } - err = TestWrite5ToTheControlModeAttributeToDut_11(); - break; - case 12: - ChipLogProgress(chipTool, " ***** Test Step 12 : Reads the attribute: EffectiveControlMode\n"); - if (ShouldSkip("A_EFFECTIVECONTROLMODE")) - { - NextTest(); - return; - } - err = TestReadsTheAttributeEffectiveControlMode_12(); - break; - case 13: - ChipLogProgress(chipTool, " ***** Test Step 13 : Write 7 to the ControlMode attribute to DUT\n"); - if (ShouldSkip("A_CONTROLMODE")) - { - NextTest(); - return; - } - err = TestWrite7ToTheControlModeAttributeToDut_13(); - break; - case 14: - ChipLogProgress(chipTool, " ***** Test Step 14 : Reads the attribute: EffectiveControlMode\n"); - if (ShouldSkip("A_EFFECTIVECONTROLMODE")) - { - NextTest(); - return; - } - err = TestReadsTheAttributeEffectiveControlMode_14(); - break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 15; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - static void OnFailureCallback_1(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_1(error); - } - - static void OnSuccessCallback_1(void * context) { (static_cast(context))->OnSuccessResponse_1(); } - - static void OnFailureCallback_2(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_2(error); - } - - static void OnSuccessCallback_2(void * context, - chip::app::Clusters::PumpConfigurationAndControl::PumpOperationMode effectiveOperationMode) - { - (static_cast(context))->OnSuccessResponse_2(effectiveOperationMode); - } - - static void OnFailureCallback_3(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_3(error); - } - - static void OnSuccessCallback_3(void * context) { (static_cast(context))->OnSuccessResponse_3(); } - - static void OnFailureCallback_4(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_4(error); - } - - static void OnSuccessCallback_4(void * context, - chip::app::Clusters::PumpConfigurationAndControl::PumpControlMode effectiveControlMode) - { - (static_cast(context))->OnSuccessResponse_4(effectiveControlMode); - } - - static void OnFailureCallback_5(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_5(error); - } - - static void OnSuccessCallback_5(void * context) { (static_cast(context))->OnSuccessResponse_5(); } - - static void OnFailureCallback_6(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_6(error); - } - - static void OnSuccessCallback_6(void * context, - chip::app::Clusters::PumpConfigurationAndControl::PumpControlMode effectiveControlMode) - { - (static_cast(context))->OnSuccessResponse_6(effectiveControlMode); - } - - static void OnFailureCallback_7(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_7(error); - } - - static void OnSuccessCallback_7(void * context) { (static_cast(context))->OnSuccessResponse_7(); } - - static void OnFailureCallback_8(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_8(error); - } - - static void OnSuccessCallback_8(void * context, - chip::app::Clusters::PumpConfigurationAndControl::PumpControlMode effectiveControlMode) - { - (static_cast(context))->OnSuccessResponse_8(effectiveControlMode); - } - - static void OnFailureCallback_9(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_9(error); - } - - static void OnSuccessCallback_9(void * context) { (static_cast(context))->OnSuccessResponse_9(); } - - static void OnFailureCallback_10(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_10(error); - } - - static void OnSuccessCallback_10(void * context, - chip::app::Clusters::PumpConfigurationAndControl::PumpControlMode effectiveControlMode) - { - (static_cast(context))->OnSuccessResponse_10(effectiveControlMode); - } - - static void OnFailureCallback_11(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_11(error); - } - - static void OnSuccessCallback_11(void * context) { (static_cast(context))->OnSuccessResponse_11(); } - - static void OnFailureCallback_12(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_12(error); - } - - static void OnSuccessCallback_12(void * context, - chip::app::Clusters::PumpConfigurationAndControl::PumpControlMode effectiveControlMode) - { - (static_cast(context))->OnSuccessResponse_12(effectiveControlMode); - } - - static void OnFailureCallback_13(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_13(error); - } - - static void OnSuccessCallback_13(void * context) { (static_cast(context))->OnSuccessResponse_13(); } - - static void OnFailureCallback_14(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_14(error); - } - - static void OnSuccessCallback_14(void * context, - chip::app::Clusters::PumpConfigurationAndControl::PumpControlMode effectiveControlMode) - { - (static_cast(context))->OnSuccessResponse_14(effectiveControlMode); - } - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestWrite0ToTheOperationModeAttributeToDut_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::PumpConfigurationAndControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::Clusters::PumpConfigurationAndControl::PumpOperationMode operationModeArgument; - operationModeArgument = static_cast(0); - - ReturnErrorOnFailure( - cluster.WriteAttribute( - operationModeArgument, this, OnSuccessCallback_1, OnFailureCallback_1)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_1() { NextTest(); } - - CHIP_ERROR TestReadsTheAttributeEffectiveOperationMode_2() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::PumpConfigurationAndControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_2, OnFailureCallback_2, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_2(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_2(chip::app::Clusters::PumpConfigurationAndControl::PumpOperationMode effectiveOperationMode) - { - VerifyOrReturn(CheckValue("effectiveOperationMode", effectiveOperationMode, 0)); - - NextTest(); - } - - CHIP_ERROR TestWrite0ToTheControlModeAttributeToDut_3() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::PumpConfigurationAndControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::Clusters::PumpConfigurationAndControl::PumpControlMode controlModeArgument; - controlModeArgument = static_cast(0); - - ReturnErrorOnFailure( - cluster.WriteAttribute( - controlModeArgument, this, OnSuccessCallback_3, OnFailureCallback_3)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_3(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_3() { NextTest(); } - - CHIP_ERROR TestReadsTheAttributeEffectiveControlMode_4() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::PumpConfigurationAndControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_4, OnFailureCallback_4, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_4(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_4(chip::app::Clusters::PumpConfigurationAndControl::PumpControlMode effectiveControlMode) - { - VerifyOrReturn(CheckValue("effectiveControlMode", effectiveControlMode, 0)); - - NextTest(); - } - - CHIP_ERROR TestWrite1ToTheControlModeAttributeToDut_5() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::PumpConfigurationAndControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::Clusters::PumpConfigurationAndControl::PumpControlMode controlModeArgument; - controlModeArgument = static_cast(1); - - ReturnErrorOnFailure( - cluster.WriteAttribute( - controlModeArgument, this, OnSuccessCallback_5, OnFailureCallback_5)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_5(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_5() { NextTest(); } - - CHIP_ERROR TestReadsTheAttributeEffectiveControlMode_6() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::PumpConfigurationAndControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_6, OnFailureCallback_6, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_6(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_6(chip::app::Clusters::PumpConfigurationAndControl::PumpControlMode effectiveControlMode) - { - VerifyOrReturn(CheckValue("effectiveControlMode", effectiveControlMode, 1)); - - NextTest(); - } - - CHIP_ERROR TestWrite2ToTheControlModeAttributeToDut_7() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::PumpConfigurationAndControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::Clusters::PumpConfigurationAndControl::PumpControlMode controlModeArgument; - controlModeArgument = static_cast(2); - - ReturnErrorOnFailure( - cluster.WriteAttribute( - controlModeArgument, this, OnSuccessCallback_7, OnFailureCallback_7)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_7(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_7() { NextTest(); } - - CHIP_ERROR TestReadsTheAttributeEffectiveControlMode_8() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::PumpConfigurationAndControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_8, OnFailureCallback_8, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_8(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_8(chip::app::Clusters::PumpConfigurationAndControl::PumpControlMode effectiveControlMode) - { - VerifyOrReturn(CheckValue("effectiveControlMode", effectiveControlMode, 2)); - - NextTest(); - } - - CHIP_ERROR TestWrite3ToTheControlModeAttributeToDut_9() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::PumpConfigurationAndControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::Clusters::PumpConfigurationAndControl::PumpControlMode controlModeArgument; - controlModeArgument = static_cast(3); - - ReturnErrorOnFailure( - cluster.WriteAttribute( - controlModeArgument, this, OnSuccessCallback_9, OnFailureCallback_9)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_9(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_9() { NextTest(); } - - CHIP_ERROR TestReadsTheAttributeEffectiveControlMode_10() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::PumpConfigurationAndControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_10, OnFailureCallback_10, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_10(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_10(chip::app::Clusters::PumpConfigurationAndControl::PumpControlMode effectiveControlMode) - { - VerifyOrReturn(CheckValue("effectiveControlMode", effectiveControlMode, 3)); - - NextTest(); - } - - CHIP_ERROR TestWrite5ToTheControlModeAttributeToDut_11() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::PumpConfigurationAndControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::Clusters::PumpConfigurationAndControl::PumpControlMode controlModeArgument; - controlModeArgument = static_cast(5); - - ReturnErrorOnFailure( - cluster.WriteAttribute( - controlModeArgument, this, OnSuccessCallback_11, OnFailureCallback_11)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_11(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_11() { NextTest(); } - - CHIP_ERROR TestReadsTheAttributeEffectiveControlMode_12() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::PumpConfigurationAndControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_12, OnFailureCallback_12, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_12(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_12(chip::app::Clusters::PumpConfigurationAndControl::PumpControlMode effectiveControlMode) - { - VerifyOrReturn(CheckValue("effectiveControlMode", effectiveControlMode, 5)); - - NextTest(); - } - - CHIP_ERROR TestWrite7ToTheControlModeAttributeToDut_13() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::PumpConfigurationAndControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::Clusters::PumpConfigurationAndControl::PumpControlMode controlModeArgument; - controlModeArgument = static_cast(7); - - ReturnErrorOnFailure( - cluster.WriteAttribute( - controlModeArgument, this, OnSuccessCallback_13, OnFailureCallback_13)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_13(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_13() { NextTest(); } - - CHIP_ERROR TestReadsTheAttributeEffectiveControlMode_14() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::PumpConfigurationAndControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_14, OnFailureCallback_14, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_14(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_14(chip::app::Clusters::PumpConfigurationAndControl::PumpControlMode effectiveControlMode) - { - VerifyOrReturn(CheckValue("effectiveControlMode", effectiveControlMode, 7)); - - NextTest(); - } -}; - -class Test_TC_PCC_2_4Suite : public TestCommand -{ -public: - Test_TC_PCC_2_4Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_PCC_2_4", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_PCC_2_4Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_PCC_2_4\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_PCC_2_4\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Write 1 to the LifetimeRunningHours attribute to DUT\n"); - err = TestWrite1ToTheLifetimeRunningHoursAttributeToDut_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Reads the attribute: LifetimeRunningHours\n"); - err = TestReadsTheAttributeLifetimeRunningHours_2(); - break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Write 2 to the LifetimeRunningHours attribute to DUT\n"); - err = TestWrite2ToTheLifetimeRunningHoursAttributeToDut_3(); - break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Reads the attribute: LifetimeRunningHours\n"); - err = TestReadsTheAttributeLifetimeRunningHours_4(); - break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Write 3 to the LifetimeRunningHours attribute to DUT\n"); - err = TestWrite3ToTheLifetimeRunningHoursAttributeToDut_5(); - break; - case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : Reads the attribute: LifetimeRunningHours\n"); - err = TestReadsTheAttributeLifetimeRunningHours_6(); - break; - case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : Write 1 to the LifetimeEnergyConsumed attribute to DUT\n"); - err = TestWrite1ToTheLifetimeEnergyConsumedAttributeToDut_7(); - break; - case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : Reads the attribute: LifetimeEnergyConsumed\n"); - err = TestReadsTheAttributeLifetimeEnergyConsumed_8(); - break; - case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : Write 2 to the LifetimeEnergyConsumed attribute to DUT\n"); - err = TestWrite2ToTheLifetimeEnergyConsumedAttributeToDut_9(); - break; - case 10: - ChipLogProgress(chipTool, " ***** Test Step 10 : Reads the attribute: LifetimeEnergyConsumed\n"); - err = TestReadsTheAttributeLifetimeEnergyConsumed_10(); - break; - case 11: - ChipLogProgress(chipTool, " ***** Test Step 11 : Write 3 to the LifetimeEnergyConsumed attribute to DUT\n"); - err = TestWrite3ToTheLifetimeEnergyConsumedAttributeToDut_11(); - break; - case 12: - ChipLogProgress(chipTool, " ***** Test Step 12 : Reads the attribute: LifetimeEnergyConsumed\n"); - err = TestReadsTheAttributeLifetimeEnergyConsumed_12(); - break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 13; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - static void OnFailureCallback_1(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_1(error); - } - - static void OnSuccessCallback_1(void * context) { (static_cast(context))->OnSuccessResponse_1(); } - - static void OnFailureCallback_2(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_2(error); - } - - static void OnSuccessCallback_2(void * context, const chip::app::DataModel::Nullable & lifetimeRunningHours) - { - (static_cast(context))->OnSuccessResponse_2(lifetimeRunningHours); - } - - static void OnFailureCallback_3(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_3(error); - } - - static void OnSuccessCallback_3(void * context) { (static_cast(context))->OnSuccessResponse_3(); } - - static void OnFailureCallback_4(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_4(error); - } - - static void OnSuccessCallback_4(void * context, const chip::app::DataModel::Nullable & lifetimeRunningHours) - { - (static_cast(context))->OnSuccessResponse_4(lifetimeRunningHours); - } - - static void OnFailureCallback_5(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_5(error); - } - - static void OnSuccessCallback_5(void * context) { (static_cast(context))->OnSuccessResponse_5(); } - - static void OnFailureCallback_6(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_6(error); - } - - static void OnSuccessCallback_6(void * context, const chip::app::DataModel::Nullable & lifetimeRunningHours) - { - (static_cast(context))->OnSuccessResponse_6(lifetimeRunningHours); - } - - static void OnFailureCallback_7(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_7(error); - } - - static void OnSuccessCallback_7(void * context) { (static_cast(context))->OnSuccessResponse_7(); } - - static void OnFailureCallback_8(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_8(error); - } - - static void OnSuccessCallback_8(void * context, const chip::app::DataModel::Nullable & lifetimeEnergyConsumed) - { - (static_cast(context))->OnSuccessResponse_8(lifetimeEnergyConsumed); - } - - static void OnFailureCallback_9(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_9(error); - } - - static void OnSuccessCallback_9(void * context) { (static_cast(context))->OnSuccessResponse_9(); } - - static void OnFailureCallback_10(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_10(error); - } - - static void OnSuccessCallback_10(void * context, const chip::app::DataModel::Nullable & lifetimeEnergyConsumed) - { - (static_cast(context))->OnSuccessResponse_10(lifetimeEnergyConsumed); - } - - static void OnFailureCallback_11(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_11(error); - } - - static void OnSuccessCallback_11(void * context) { (static_cast(context))->OnSuccessResponse_11(); } - - static void OnFailureCallback_12(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_12(error); - } - - static void OnSuccessCallback_12(void * context, const chip::app::DataModel::Nullable & lifetimeEnergyConsumed) - { - (static_cast(context))->OnSuccessResponse_12(lifetimeEnergyConsumed); - } - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestWrite1ToTheLifetimeRunningHoursAttributeToDut_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::PumpConfigurationAndControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::DataModel::Nullable lifetimeRunningHoursArgument; - lifetimeRunningHoursArgument.SetNonNull(); - lifetimeRunningHoursArgument.Value() = 1UL; - - ReturnErrorOnFailure( - cluster.WriteAttribute( - lifetimeRunningHoursArgument, this, OnSuccessCallback_1, OnFailureCallback_1)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_1() { NextTest(); } - - CHIP_ERROR TestReadsTheAttributeLifetimeRunningHours_2() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::PumpConfigurationAndControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_2, OnFailureCallback_2, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_2(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_2(const chip::app::DataModel::Nullable & lifetimeRunningHours) - { - VerifyOrReturn(CheckValueNonNull("lifetimeRunningHours", lifetimeRunningHours)); - VerifyOrReturn(CheckValue("lifetimeRunningHours.Value()", lifetimeRunningHours.Value(), 1UL)); - - NextTest(); - } - - CHIP_ERROR TestWrite2ToTheLifetimeRunningHoursAttributeToDut_3() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::PumpConfigurationAndControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::DataModel::Nullable lifetimeRunningHoursArgument; - lifetimeRunningHoursArgument.SetNonNull(); - lifetimeRunningHoursArgument.Value() = 2UL; - - ReturnErrorOnFailure( - cluster.WriteAttribute( - lifetimeRunningHoursArgument, this, OnSuccessCallback_3, OnFailureCallback_3)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_3(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_3() { NextTest(); } - - CHIP_ERROR TestReadsTheAttributeLifetimeRunningHours_4() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::PumpConfigurationAndControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_4, OnFailureCallback_4, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_4(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_4(const chip::app::DataModel::Nullable & lifetimeRunningHours) - { - VerifyOrReturn(CheckValueNonNull("lifetimeRunningHours", lifetimeRunningHours)); - VerifyOrReturn(CheckValue("lifetimeRunningHours.Value()", lifetimeRunningHours.Value(), 2UL)); - - NextTest(); - } - - CHIP_ERROR TestWrite3ToTheLifetimeRunningHoursAttributeToDut_5() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::PumpConfigurationAndControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::DataModel::Nullable lifetimeRunningHoursArgument; - lifetimeRunningHoursArgument.SetNonNull(); - lifetimeRunningHoursArgument.Value() = 3UL; - - ReturnErrorOnFailure( - cluster.WriteAttribute( - lifetimeRunningHoursArgument, this, OnSuccessCallback_5, OnFailureCallback_5)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_5(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_5() { NextTest(); } - - CHIP_ERROR TestReadsTheAttributeLifetimeRunningHours_6() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::PumpConfigurationAndControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_6, OnFailureCallback_6, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_6(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_6(const chip::app::DataModel::Nullable & lifetimeRunningHours) - { - VerifyOrReturn(CheckValueNonNull("lifetimeRunningHours", lifetimeRunningHours)); - VerifyOrReturn(CheckValue("lifetimeRunningHours.Value()", lifetimeRunningHours.Value(), 3UL)); - - NextTest(); - } - - CHIP_ERROR TestWrite1ToTheLifetimeEnergyConsumedAttributeToDut_7() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::PumpConfigurationAndControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::DataModel::Nullable lifetimeEnergyConsumedArgument; - lifetimeEnergyConsumedArgument.SetNonNull(); - lifetimeEnergyConsumedArgument.Value() = 1UL; - - ReturnErrorOnFailure( - cluster.WriteAttribute( - lifetimeEnergyConsumedArgument, this, OnSuccessCallback_7, OnFailureCallback_7)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_7(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_7() { NextTest(); } - - CHIP_ERROR TestReadsTheAttributeLifetimeEnergyConsumed_8() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::PumpConfigurationAndControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_8, OnFailureCallback_8, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_8(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_8(const chip::app::DataModel::Nullable & lifetimeEnergyConsumed) - { - VerifyOrReturn(CheckValueNonNull("lifetimeEnergyConsumed", lifetimeEnergyConsumed)); - VerifyOrReturn(CheckValue("lifetimeEnergyConsumed.Value()", lifetimeEnergyConsumed.Value(), 1UL)); - - NextTest(); - } - - CHIP_ERROR TestWrite2ToTheLifetimeEnergyConsumedAttributeToDut_9() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::PumpConfigurationAndControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::DataModel::Nullable lifetimeEnergyConsumedArgument; - lifetimeEnergyConsumedArgument.SetNonNull(); - lifetimeEnergyConsumedArgument.Value() = 2UL; - - ReturnErrorOnFailure( - cluster.WriteAttribute( - lifetimeEnergyConsumedArgument, this, OnSuccessCallback_9, OnFailureCallback_9)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_9(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_9() { NextTest(); } - - CHIP_ERROR TestReadsTheAttributeLifetimeEnergyConsumed_10() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::PumpConfigurationAndControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_10, OnFailureCallback_10, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_10(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_10(const chip::app::DataModel::Nullable & lifetimeEnergyConsumed) - { - VerifyOrReturn(CheckValueNonNull("lifetimeEnergyConsumed", lifetimeEnergyConsumed)); - VerifyOrReturn(CheckValue("lifetimeEnergyConsumed.Value()", lifetimeEnergyConsumed.Value(), 2UL)); - - NextTest(); - } - - CHIP_ERROR TestWrite3ToTheLifetimeEnergyConsumedAttributeToDut_11() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::PumpConfigurationAndControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::DataModel::Nullable lifetimeEnergyConsumedArgument; - lifetimeEnergyConsumedArgument.SetNonNull(); - lifetimeEnergyConsumedArgument.Value() = 3UL; - - ReturnErrorOnFailure( - cluster.WriteAttribute( - lifetimeEnergyConsumedArgument, this, OnSuccessCallback_11, OnFailureCallback_11)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_11(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_11() { NextTest(); } - - CHIP_ERROR TestReadsTheAttributeLifetimeEnergyConsumed_12() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::PumpConfigurationAndControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_12, OnFailureCallback_12, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_12(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_12(const chip::app::DataModel::Nullable & lifetimeEnergyConsumed) - { - VerifyOrReturn(CheckValueNonNull("lifetimeEnergyConsumed", lifetimeEnergyConsumed)); - VerifyOrReturn(CheckValue("lifetimeEnergyConsumed.Value()", lifetimeEnergyConsumed.Value(), 3UL)); - - NextTest(); - } -}; - -class Test_TC_PSCFG_1_1Suite : public TestCommand -{ -public: - Test_TC_PSCFG_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_PSCFG_1_1", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_PSCFG_1_1Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_PSCFG_1_1\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_PSCFG_1_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Commission DUT to TH\n"); - err = TestCommissionDutToTh_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : TH reads the ClusterRevision attribute from the DUT\n"); - err = TestThReadsTheClusterRevisionAttributeFromTheDut_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : TH reads the AttributeList attribute from the DUT\n"); - err = TestThReadsTheAttributeListAttributeFromTheDut_2(); - break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : TH reads the AcceptedCommandList attribute from the DUT\n"); - err = TestThReadsTheAcceptedCommandListAttributeFromTheDut_3(); - break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : TH reads the GeneratedCommandList attribute from the DUT\n"); - err = TestThReadsTheGeneratedCommandListAttributeFromTheDut_4(); - break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 5; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - static void OnFailureCallback_1(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_1(error); - } - - static void OnSuccessCallback_1(void * context, uint16_t clusterRevision) - { - (static_cast(context))->OnSuccessResponse_1(clusterRevision); - } - - static void OnFailureCallback_2(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_2(error); - } - - static void OnSuccessCallback_2(void * context, const chip::app::DataModel::DecodableList & attributeList) - { - (static_cast(context))->OnSuccessResponse_2(attributeList); - } - - static void OnFailureCallback_3(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_3(error); - } - - static void OnSuccessCallback_3(void * context, - const chip::app::DataModel::DecodableList & acceptedCommandList) - { - (static_cast(context))->OnSuccessResponse_3(acceptedCommandList); - } - - static void OnFailureCallback_4(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_4(error); - } - - static void OnSuccessCallback_4(void * context, - const chip::app::DataModel::DecodableList & generatedCommandList) - { - (static_cast(context))->OnSuccessResponse_4(generatedCommandList); - } - - // - // Tests methods - // - - CHIP_ERROR TestCommissionDutToTh_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestThReadsTheClusterRevisionAttributeFromTheDut_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::PowerSourceConfigurationClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_1, OnFailureCallback_1, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_1(uint16_t clusterRevision) - { - VerifyOrReturn(CheckValue("clusterRevision", clusterRevision, 1U)); - - NextTest(); - } - - CHIP_ERROR TestThReadsTheAttributeListAttributeFromTheDut_2() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::PowerSourceConfigurationClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_2, OnFailureCallback_2, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_2(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_2(const chip::app::DataModel::DecodableList & attributeList) - { - VerifyOrReturn(CheckConstraintType("attributeList", "", "list")); - NextTest(); - } - - CHIP_ERROR TestThReadsTheAcceptedCommandListAttributeFromTheDut_3() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::PowerSourceConfigurationClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_3, OnFailureCallback_3, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_3(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_3(const chip::app::DataModel::DecodableList & acceptedCommandList) - { - VerifyOrReturn(CheckConstraintType("acceptedCommandList", "", "list")); - NextTest(); - } - - CHIP_ERROR TestThReadsTheGeneratedCommandListAttributeFromTheDut_4() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::PowerSourceConfigurationClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_4, OnFailureCallback_4, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_4(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_4(const chip::app::DataModel::DecodableList & generatedCommandList) - { - VerifyOrReturn(CheckConstraintType("generatedCommandList", "", "list")); - NextTest(); - } -}; - -class Test_TC_RH_1_1Suite : public TestCommand -{ -public: - Test_TC_RH_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_RH_1_1", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_RH_1_1Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_RH_1_1\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_RH_1_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Read the global attribute constraints: ClusterRevision\n"); - err = TestReadTheGlobalAttributeConstraintsClusterRevision_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Read the global attribute: AttributeList\n"); - err = TestReadTheGlobalAttributeAttributeList_2(); - break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Read the global attribute: AcceptedCommandList\n"); - err = TestReadTheGlobalAttributeAcceptedCommandList_3(); - break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Read the global attribute: GeneratedCommandList\n"); - err = TestReadTheGlobalAttributeGeneratedCommandList_4(); - break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 5; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - static void OnFailureCallback_1(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_1(error); - } - - static void OnSuccessCallback_1(void * context, uint16_t clusterRevision) - { - (static_cast(context))->OnSuccessResponse_1(clusterRevision); - } - - static void OnFailureCallback_2(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_2(error); - } - - static void OnSuccessCallback_2(void * context, const chip::app::DataModel::DecodableList & attributeList) - { - (static_cast(context))->OnSuccessResponse_2(attributeList); - } - - static void OnFailureCallback_3(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_3(error); - } - - static void OnSuccessCallback_3(void * context, - const chip::app::DataModel::DecodableList & acceptedCommandList) - { - (static_cast(context))->OnSuccessResponse_3(acceptedCommandList); - } - - static void OnFailureCallback_4(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_4(error); - } - - static void OnSuccessCallback_4(void * context, - const chip::app::DataModel::DecodableList & generatedCommandList) - { - (static_cast(context))->OnSuccessResponse_4(generatedCommandList); - } - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestReadTheGlobalAttributeConstraintsClusterRevision_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::RelativeHumidityMeasurementClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_1, OnFailureCallback_1, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_1(uint16_t clusterRevision) - { - VerifyOrReturn(CheckConstraintType("clusterRevision", "", "uint16")); - NextTest(); - } - - CHIP_ERROR TestReadTheGlobalAttributeAttributeList_2() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::RelativeHumidityMeasurementClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_2, OnFailureCallback_2, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_2(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_2(const chip::app::DataModel::DecodableList & attributeList) - { - VerifyOrReturn(CheckConstraintType("attributeList", "", "list")); - NextTest(); - } - - CHIP_ERROR TestReadTheGlobalAttributeAcceptedCommandList_3() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::RelativeHumidityMeasurementClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_3, OnFailureCallback_3, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_3(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_3(const chip::app::DataModel::DecodableList & acceptedCommandList) - { - VerifyOrReturn(CheckConstraintType("acceptedCommandList", "", "list")); - NextTest(); - } - - CHIP_ERROR TestReadTheGlobalAttributeGeneratedCommandList_4() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::RelativeHumidityMeasurementClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_4, OnFailureCallback_4, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_4(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_4(const chip::app::DataModel::DecodableList & generatedCommandList) - { - VerifyOrReturn(CheckConstraintType("generatedCommandList", "", "list")); - NextTest(); - } -}; - -class Test_TC_RH_2_1Suite : public TestCommand -{ -public: - Test_TC_RH_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_RH_2_1", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_RH_2_1Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_RH_2_1\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_RH_2_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Reads constraints of attribute: MeasuredValue\n"); - err = TestReadsConstraintsOfAttributeMeasuredValue_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Reads constraints of attribute: MinMeasuredValue\n"); - err = TestReadsConstraintsOfAttributeMinMeasuredValue_2(); - break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Reads constraints of attribute: Tolerance\n"); - err = TestReadsConstraintsOfAttributeTolerance_3(); - break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 4; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - static void OnFailureCallback_1(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_1(error); - } - - static void OnSuccessCallback_1(void * context, uint16_t measuredValue) - { - (static_cast(context))->OnSuccessResponse_1(measuredValue); - } - - static void OnFailureCallback_2(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_2(error); - } - - static void OnSuccessCallback_2(void * context, uint16_t minMeasuredValue) - { - (static_cast(context))->OnSuccessResponse_2(minMeasuredValue); - } - - static void OnFailureCallback_3(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_3(error); - } - - static void OnSuccessCallback_3(void * context, uint16_t tolerance) - { - (static_cast(context))->OnSuccessResponse_3(tolerance); - } - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestReadsConstraintsOfAttributeMeasuredValue_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::RelativeHumidityMeasurementClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_1, OnFailureCallback_1, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_1(uint16_t measuredValue) - { - VerifyOrReturn(CheckConstraintType("measuredValue", "", "int16")); - VerifyOrReturn(CheckConstraintMinValue("measuredValue", measuredValue, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("measuredValue", measuredValue, 10000U)); - NextTest(); - } - - CHIP_ERROR TestReadsConstraintsOfAttributeMinMeasuredValue_2() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::RelativeHumidityMeasurementClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_2, OnFailureCallback_2, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_2(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_2(uint16_t minMeasuredValue) - { - VerifyOrReturn(CheckConstraintType("minMeasuredValue", "", "int16")); - VerifyOrReturn(CheckConstraintMinValue("minMeasuredValue", minMeasuredValue, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("minMeasuredValue", minMeasuredValue, 9999U)); - NextTest(); - } - - CHIP_ERROR TestReadsConstraintsOfAttributeTolerance_3() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::RelativeHumidityMeasurementClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_3, OnFailureCallback_3, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_3(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() - : ThrowFailureResponse(error); - } - - void OnSuccessResponse_3(uint16_t tolerance) - { - VerifyOrReturn(CheckConstraintType("tolerance", "", "uint16")); - VerifyOrReturn(CheckConstraintMinValue("tolerance", tolerance, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("tolerance", tolerance, 2048U)); - NextTest(); - } -}; - -class Test_TC_RH_2_2Suite : public TestCommand -{ -public: - Test_TC_RH_2_2Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_RH_2_2", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_RH_2_2Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_RH_2_2\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_RH_2_2\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Reads constraints of attribute: MinMeasuredValue\n"); - err = TestReadsConstraintsOfAttributeMinMeasuredValue_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Reads MeasuredValue attribute from DUT\n"); - if (ShouldSkip("A_RELATIVEHUMIDITY")) - { - NextTest(); - return; - } - err = TestReadsMeasuredValueAttributeFromDut_2(); - break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Read the mandatory attribute: MeasuredValue\n"); - if (ShouldSkip("A_RELATIVEHUMIDITY")) - { - NextTest(); - return; - } - err = TestReadTheMandatoryAttributeMeasuredValue_3(); - break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 4; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - static void OnFailureCallback_1(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_1(error); - } - - static void OnSuccessCallback_1(void * context, uint16_t minMeasuredValue) - { - (static_cast(context))->OnSuccessResponse_1(minMeasuredValue); - } - - static void OnFailureCallback_2(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_2(error); - } - - static void OnSuccessCallback_2(void * context, uint16_t measuredValue) - { - (static_cast(context))->OnSuccessResponse_2(measuredValue); - } - - static void OnFailureCallback_3(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_3(error); - } - - static void OnSuccessCallback_3(void * context, uint16_t measuredValue) - { - (static_cast(context))->OnSuccessResponse_3(measuredValue); - } - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestReadsConstraintsOfAttributeMinMeasuredValue_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::RelativeHumidityMeasurementClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_1, OnFailureCallback_1, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_1(uint16_t minMeasuredValue) - { - VerifyOrReturn(CheckConstraintType("minMeasuredValue", "", "int16")); - VerifyOrReturn(CheckConstraintMinValue("minMeasuredValue", minMeasuredValue, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("minMeasuredValue", minMeasuredValue, 9999U)); - NextTest(); - } - - CHIP_ERROR TestReadsMeasuredValueAttributeFromDut_2() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::RelativeHumidityMeasurementClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_2, OnFailureCallback_2, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_2(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_2(uint16_t measuredValue) - { - VerifyOrReturn(CheckConstraintType("measuredValue", "", "int16")); - VerifyOrReturn(CheckConstraintMinValue("measuredValue", measuredValue, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("measuredValue", measuredValue, 10000U)); - NextTest(); - } - - CHIP_ERROR TestReadTheMandatoryAttributeMeasuredValue_3() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::RelativeHumidityMeasurementClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_3, OnFailureCallback_3, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_3(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_3(uint16_t measuredValue) - { - VerifyOrReturn(CheckConstraintType("measuredValue", "", "uint16")); - NextTest(); - } -}; - -class Test_TC_SC_4_2Suite : public TestCommand -{ -public: - Test_TC_SC_4_2Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_SC_4_2", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("discriminator", 0, UINT16_MAX, &mDiscriminator); - AddArgument("vendorId", 0, UINT16_MAX, &mVendorId); - AddArgument("productId", 0, UINT16_MAX, &mProductId); - AddArgument("deviceType", 0, UINT16_MAX, &mDeviceType); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_SC_4_2Suite() - { - if (deviceInstanceNameBeforeReboot1Buffer != nullptr) - { - chip::Platform::MemoryFree(deviceInstanceNameBeforeReboot1Buffer); - deviceInstanceNameBeforeReboot1Buffer = nullptr; - } - } - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_SC_4_2\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_SC_4_2\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Reboot target device\n"); - err = TestRebootTargetDevice_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_1(); - break; - case 2: - ChipLogProgress(chipTool, - " ***** Test Step 2 : TH is put in Commissioning Mode using Open Basic Commissioning Window command " - "and starts advertising Commissionable Node Discovery service using DNS-SD\n"); - err = - TestThIsPutInCommissioningModeUsingOpenBasicCommissioningWindowCommandAndStartsAdvertisingCommissionableNodeDiscoveryServiceUsingDnsSd_2(); - break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Check Instance Name\n"); - err = TestCheckInstanceName_3(); - break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Check Long Discriminator _L\n"); - err = TestCheckLongDiscriminatorL_4(); - break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Check Short Discriminator (_S)\n"); - err = TestCheckShortDiscriminatorS_5(); - break; - case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : Check Vendor ID (_V)\n"); - if (ShouldSkip("VENDOR_SUBTYPE")) - { - NextTest(); - return; - } - err = TestCheckVendorIdV_6(); - break; - case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : Check Commissioning Mode (_CM)\n"); - err = TestCheckCommissioningModeCm_7(); - break; - case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : TXT key for Vendor ID and Product ID (VP)\n"); - if (ShouldSkip("VP_KEY")) - { - NextTest(); - return; - } - err = TestTxtKeyForVendorIdAndProductIdVp_8(); - break; - case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : TXT key for Vendor ID and Product ID (VP)\n"); - if (ShouldSkip("VP_KEY")) - { - NextTest(); - return; - } - err = TestTxtKeyForVendorIdAndProductIdVp_9(); - break; - case 10: - ChipLogProgress(chipTool, " ***** Test Step 10 : Optional TXT key for MRP Retry Interval Idle (CRI)\n"); - if (ShouldSkip("CRI_COMM_DISCOVERY_KEY")) - { - NextTest(); - return; - } - err = TestOptionalTxtKeyForMrpRetryIntervalIdleCri_10(); - break; - case 11: - ChipLogProgress(chipTool, " ***** Test Step 11 : Optional TXT key for MRP Retry Interval Active (CRA)\n"); - if (ShouldSkip("CRA_COMM_DISCOVERY_KEY")) - { - NextTest(); - return; - } - err = TestOptionalTxtKeyForMrpRetryIntervalActiveCra_11(); - break; - case 12: - ChipLogProgress(chipTool, " ***** Test Step 12 : TXT key for commissioning mode (CM)\n"); - err = TestTxtKeyForCommissioningModeCm_12(); - break; - case 13: - ChipLogProgress(chipTool, " ***** Test Step 13 : Optional TXT key for device name (DN)\n"); - if (ShouldSkip("DN_KEY")) - { - NextTest(); - return; - } - err = TestOptionalTxtKeyForDeviceNameDn_13(); - break; - case 14: - ChipLogProgress(chipTool, " ***** Test Step 14 : Optional TXT key for rotating device identifier (RI)\n"); - if (ShouldSkip("RI_KEY")) - { - NextTest(); - return; - } - err = TestOptionalTxtKeyForRotatingDeviceIdentifierRi_14(); - break; - case 15: - ChipLogProgress(chipTool, " ***** Test Step 15 : Optional TXT key for pairing hint (PH)\n"); - if (ShouldSkip("PH_KEY")) - { - NextTest(); - return; - } - err = TestOptionalTxtKeyForPairingHintPh_15(); - break; - case 16: - ChipLogProgress(chipTool, " ***** Test Step 16 : Optional TXT key for pairing instructions (PI)\n"); - if (ShouldSkip("PI_KEY")) - { - NextTest(); - return; - } - err = TestOptionalTxtKeyForPairingInstructionsPi_16(); - break; - case 17: - ChipLogProgress(chipTool, " ***** Test Step 17 : Check IPs\n"); - err = TestCheckIPs_17(); - break; - case 18: - ChipLogProgress(chipTool, " ***** Test Step 18 : Reboot target device\n"); - err = TestRebootTargetDevice_18(); - break; - case 19: - ChipLogProgress(chipTool, " ***** Test Step 19 : Log commands\n"); - err = TestLogCommands_19(); - break; - case 20: - ChipLogProgress(chipTool, " ***** Test Step 20 : Log commands\n"); - err = TestLogCommands_20(); - break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 21; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mDiscriminator; - chip::Optional mVendorId; - chip::Optional mProductId; - chip::Optional mDeviceType; - chip::Optional mTimeout; - - char * deviceInstanceNameBeforeReboot1Buffer = nullptr; - chip::CharSpan deviceInstanceNameBeforeReboot1; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 1: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 3: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - - VerifyOrReturn(CheckConstraintIsUpperCase("value.instanceName", value.instanceName, true)); - VerifyOrReturn(CheckConstraintIsHexString("value.instanceName", value.instanceName, true)); - VerifyOrReturn(CheckConstraintMinLength("value.instanceName", value.instanceName.size(), 16)); - VerifyOrReturn(CheckConstraintMaxLength("value.instanceName", value.instanceName.size(), 16)); - if (deviceInstanceNameBeforeReboot1Buffer != nullptr) - { - chip::Platform::MemoryFree(deviceInstanceNameBeforeReboot1Buffer); - } - deviceInstanceNameBeforeReboot1Buffer = static_cast(chip::Platform::MemoryAlloc(value.instanceName.size())); - memcpy(deviceInstanceNameBeforeReboot1Buffer, value.instanceName.data(), value.instanceName.size()); - deviceInstanceNameBeforeReboot1 = chip::CharSpan(deviceInstanceNameBeforeReboot1Buffer, value.instanceName.size()); - } - shouldContinue = true; - break; - case 4: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - } - shouldContinue = true; - break; - case 5: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - } - shouldContinue = true; - break; - case 6: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - } - shouldContinue = true; - break; - case 7: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - } - shouldContinue = true; - break; - case 8: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - - VerifyOrReturn(CheckValue("vendorId", value.vendorId, mVendorId.HasValue() ? mVendorId.Value() : 65521U)); - } - shouldContinue = true; - break; - case 9: - if (IsUnsupported(status.mStatus)) - { - shouldContinue = true; - return; - } - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - - VerifyOrReturn(CheckValue("productId", value.productId, mProductId.HasValue() ? mProductId.Value() : 32769U)); - } - shouldContinue = true; - break; - case 10: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - - VerifyOrReturn(CheckValuePresent("value.mrpRetryIntervalIdle", value.mrpRetryIntervalIdle)); - VerifyOrReturn( - CheckConstraintMaxValue("value.mrpRetryIntervalIdle.Value()", value.mrpRetryIntervalIdle.Value(), 3600000UL)); - } - shouldContinue = true; - break; - case 11: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - - VerifyOrReturn(CheckValuePresent("value.mrpRetryIntervalActive", value.mrpRetryIntervalActive)); - VerifyOrReturn(CheckConstraintMaxValue("value.mrpRetryIntervalActive.Value()", value.mrpRetryIntervalActive.Value(), - 3600000UL)); - } - shouldContinue = true; - break; - case 12: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - - VerifyOrReturn(CheckValue("commissioningMode", value.commissioningMode, 1)); - } - shouldContinue = true; - break; - case 13: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - - VerifyOrReturn(CheckConstraintMaxLength("value.deviceName", value.deviceName.size(), 32)); - } - shouldContinue = true; - break; - case 14: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - - VerifyOrReturn(CheckConstraintMaxValue("value.rotatingIdLen", value.rotatingIdLen, 100ULL)); - } - shouldContinue = true; - break; - case 15: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - - VerifyOrReturn(CheckConstraintNotValue("value.pairingHint", value.pairingHint, 0U)); - } - shouldContinue = true; - break; - case 16: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - - VerifyOrReturn(CheckConstraintMaxLength("value.pairingInstruction", value.pairingInstruction.size(), 128)); - } - shouldContinue = true; - break; - case 17: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - - VerifyOrReturn(CheckConstraintMinValue("value.numIPs", value.numIPs, 1)); - } - shouldContinue = true; - break; - case 18: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 19: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 20: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - // - // Tests methods - // - - CHIP_ERROR TestRebootTargetDevice_0() - { - SetIdentity(kIdentityAlpha); - return Reboot(mDiscriminator.HasValue() ? mDiscriminator.Value() : 3840U); - } - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_1() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR - TestThIsPutInCommissioningModeUsingOpenBasicCommissioningWindowCommandAndStartsAdvertisingCommissionableNodeDiscoveryServiceUsingDnsSd_2() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - using RequestType = chip::app::Clusters::AdministratorCommissioning::Commands::OpenBasicCommissioningWindow::Type; - - RequestType request; - request.commissioningTimeout = 180U; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_2(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_2(error); - }; - - ReturnErrorOnFailure( - chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request, 10000)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_2(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_2() { NextTest(); } - - CHIP_ERROR TestCheckInstanceName_3() - { - SetIdentity(kIdentityAlpha); - return FindCommissionable(); - } - - CHIP_ERROR TestCheckLongDiscriminatorL_4() - { - SetIdentity(kIdentityAlpha); - return FindCommissionableByLongDiscriminator(mDiscriminator.HasValue() ? mDiscriminator.Value() : 3840U); - } - - CHIP_ERROR TestCheckShortDiscriminatorS_5() - { - SetIdentity(kIdentityAlpha); - return FindCommissionableByShortDiscriminator(mDiscriminator.HasValue() ? mDiscriminator.Value() : 3840U); - } - - CHIP_ERROR TestCheckVendorIdV_6() - { - SetIdentity(kIdentityAlpha); - return FindCommissionableByVendorId(mVendorId.HasValue() ? mVendorId.Value() : 65521U); - } - - CHIP_ERROR TestCheckCommissioningModeCm_7() - { - SetIdentity(kIdentityAlpha); - return FindCommissionableByCommissioningMode(); - } - - CHIP_ERROR TestTxtKeyForVendorIdAndProductIdVp_8() - { - SetIdentity(kIdentityAlpha); - return FindCommissionable(); - } - - CHIP_ERROR TestTxtKeyForVendorIdAndProductIdVp_9() - { - SetIdentity(kIdentityAlpha); - return FindCommissionable(); - } - - CHIP_ERROR TestOptionalTxtKeyForMrpRetryIntervalIdleCri_10() - { - SetIdentity(kIdentityAlpha); - return FindCommissionable(); - } - - CHIP_ERROR TestOptionalTxtKeyForMrpRetryIntervalActiveCra_11() - { - SetIdentity(kIdentityAlpha); - return FindCommissionable(); - } - - CHIP_ERROR TestTxtKeyForCommissioningModeCm_12() - { - SetIdentity(kIdentityAlpha); - return FindCommissionable(); - } - - CHIP_ERROR TestOptionalTxtKeyForDeviceNameDn_13() - { - SetIdentity(kIdentityAlpha); - return FindCommissionable(); - } - - CHIP_ERROR TestOptionalTxtKeyForRotatingDeviceIdentifierRi_14() - { - SetIdentity(kIdentityAlpha); - return FindCommissionable(); - } - - CHIP_ERROR TestOptionalTxtKeyForPairingHintPh_15() - { - SetIdentity(kIdentityAlpha); - return FindCommissionable(); - } - - CHIP_ERROR TestOptionalTxtKeyForPairingInstructionsPi_16() - { - SetIdentity(kIdentityAlpha); - return FindCommissionable(); - } - - CHIP_ERROR TestCheckIPs_17() - { - SetIdentity(kIdentityAlpha); - return FindCommissionable(); - } - - CHIP_ERROR TestRebootTargetDevice_18() - { - SetIdentity(kIdentityAlpha); - return Reboot(mDiscriminator.HasValue() ? mDiscriminator.Value() : 3840U); - } - - CHIP_ERROR TestLogCommands_19() - { - SetIdentity(kIdentityAlpha); - return Log("TH adds an unknown key/value pair in the advertised data"); - } - - CHIP_ERROR TestLogCommands_20() - { - SetIdentity(kIdentityAlpha); - return Log("Scan for DNS-SD commissioner advertisements from TH"); - } -}; - -class Test_TC_SWTCH_2_1Suite : public TestCommand -{ -public: - Test_TC_SWTCH_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_SWTCH_2_1", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_SWTCH_2_1Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_SWTCH_2_1\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_SWTCH_2_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Read NumberOfPositions attribute\n"); - err = TestReadNumberOfPositionsAttribute_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Read NumberOfPositions attribute\n"); - err = TestReadNumberOfPositionsAttribute_2(); - break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Read CurrentPosition attribute\n"); - err = TestReadCurrentPositionAttribute_3(); - break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Read CurrentPosition attribute\n"); - err = TestReadCurrentPositionAttribute_4(); - break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Read MultiPressMax attribute\n"); - err = TestReadMultiPressMaxAttribute_5(); - break; - case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : Read MultiPressMax attribute\n"); - err = TestReadMultiPressMaxAttribute_6(); - break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 7; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - static void OnFailureCallback_1(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_1(error); - } - - static void OnSuccessCallback_1(void * context, uint8_t numberOfPositions) - { - (static_cast(context))->OnSuccessResponse_1(numberOfPositions); - } - - static void OnFailureCallback_2(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_2(error); - } - - static void OnSuccessCallback_2(void * context, uint8_t numberOfPositions) - { - (static_cast(context))->OnSuccessResponse_2(numberOfPositions); - } - - static void OnFailureCallback_3(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_3(error); - } - - static void OnSuccessCallback_3(void * context, uint8_t currentPosition) - { - (static_cast(context))->OnSuccessResponse_3(currentPosition); - } - - static void OnFailureCallback_4(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_4(error); - } - - static void OnSuccessCallback_4(void * context, uint8_t currentPosition) - { - (static_cast(context))->OnSuccessResponse_4(currentPosition); - } - - static void OnFailureCallback_5(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_5(error); - } - - static void OnSuccessCallback_5(void * context, uint8_t multiPressMax) - { - (static_cast(context))->OnSuccessResponse_5(multiPressMax); - } - - static void OnFailureCallback_6(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_6(error); - } - - static void OnSuccessCallback_6(void * context, uint8_t multiPressMax) - { - (static_cast(context))->OnSuccessResponse_6(multiPressMax); - } - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestReadNumberOfPositionsAttribute_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::SwitchClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_1, OnFailureCallback_1, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_1(uint8_t numberOfPositions) - { - VerifyOrReturn(CheckValue("numberOfPositions", numberOfPositions, 2)); - - NextTest(); - } - - CHIP_ERROR TestReadNumberOfPositionsAttribute_2() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::SwitchClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_2, OnFailureCallback_2, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_2(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_2(uint8_t numberOfPositions) - { - VerifyOrReturn(CheckConstraintType("numberOfPositions", "", "uint8")); - VerifyOrReturn(CheckConstraintMinValue("numberOfPositions", numberOfPositions, 2)); - NextTest(); - } - - CHIP_ERROR TestReadCurrentPositionAttribute_3() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::SwitchClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_3, OnFailureCallback_3, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_3(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_3(uint8_t currentPosition) - { - VerifyOrReturn(CheckValue("currentPosition", currentPosition, 0)); - - NextTest(); - } - - CHIP_ERROR TestReadCurrentPositionAttribute_4() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::SwitchClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_4, OnFailureCallback_4, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_4(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_4(uint8_t currentPosition) - { - VerifyOrReturn(CheckConstraintType("currentPosition", "", "uint8")); - VerifyOrReturn(CheckConstraintMinValue("currentPosition", currentPosition, 0)); - NextTest(); - } - - CHIP_ERROR TestReadMultiPressMaxAttribute_5() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::SwitchClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_5, OnFailureCallback_5, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_5(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_5(uint8_t multiPressMax) - { - VerifyOrReturn(CheckValue("multiPressMax", multiPressMax, 2)); - - NextTest(); - } - - CHIP_ERROR TestReadMultiPressMaxAttribute_6() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::SwitchClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_6, OnFailureCallback_6, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_6(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_6(uint8_t multiPressMax) - { - VerifyOrReturn(CheckConstraintType("multiPressMax", "", "uint8")); - VerifyOrReturn(CheckConstraintMinValue("multiPressMax", multiPressMax, 2)); - NextTest(); - } -}; - -class Test_TC_SWTCH_2_2Suite : public TestCommand -{ -public: - Test_TC_SWTCH_2_2Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_SWTCH_2_2", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_SWTCH_2_2Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_SWTCH_2_2\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_SWTCH_2_2\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : User interaction needed\n"); - err = TestUserInteractionNeeded_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : User interaction needed\n"); - err = TestUserInteractionNeeded_2(); - break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Read CurrentPosition attribute\n"); - err = TestReadCurrentPositionAttribute_3(); - break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : User interaction needed\n"); - err = TestUserInteractionNeeded_4(); - break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : User interaction needed\n"); - err = TestUserInteractionNeeded_5(); - break; - case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : User interaction needed\n"); - err = TestUserInteractionNeeded_6(); - break; - case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : Read CurrentPosition attribute\n"); - err = TestReadCurrentPositionAttribute_7(); - break; - case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : User interaction needed\n"); - err = TestUserInteractionNeeded_8(); - break; - case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : User interaction needed\n"); - err = TestUserInteractionNeeded_9(); - break; - case 10: - ChipLogProgress(chipTool, " ***** Test Step 10 : User interaction needed\n"); - err = TestUserInteractionNeeded_10(); - break; - case 11: - ChipLogProgress(chipTool, " ***** Test Step 11 : User interaction needed\n"); - err = TestUserInteractionNeeded_11(); - break; - case 12: - ChipLogProgress(chipTool, " ***** Test Step 12 : User interaction needed\n"); - err = TestUserInteractionNeeded_12(); - break; - case 13: - ChipLogProgress(chipTool, " ***** Test Step 13 : User interaction needed\n"); - err = TestUserInteractionNeeded_13(); - break; - case 14: - ChipLogProgress(chipTool, " ***** Test Step 14 : User interaction needed\n"); - err = TestUserInteractionNeeded_14(); - break; - case 15: - ChipLogProgress(chipTool, " ***** Test Step 15 : Wait 3000ms\n"); - err = TestWait3000ms_15(); - break; - case 16: - ChipLogProgress(chipTool, " ***** Test Step 16 : User interaction needed\n"); - err = TestUserInteractionNeeded_16(); - break; - case 17: - ChipLogProgress(chipTool, " ***** Test Step 17 : User interaction needed\n"); - err = TestUserInteractionNeeded_17(); - break; - case 18: - ChipLogProgress(chipTool, " ***** Test Step 18 : User interaction needed\n"); - err = TestUserInteractionNeeded_18(); - break; - case 19: - ChipLogProgress(chipTool, " ***** Test Step 19 : User interaction needed\n"); - err = TestUserInteractionNeeded_19(); - break; - case 20: - ChipLogProgress(chipTool, " ***** Test Step 20 : User interaction needed\n"); - err = TestUserInteractionNeeded_20(); - break; - case 21: - ChipLogProgress(chipTool, " ***** Test Step 21 : User interaction needed\n"); - err = TestUserInteractionNeeded_21(); - break; - case 22: - ChipLogProgress(chipTool, " ***** Test Step 22 : Wait 3000ms\n"); - err = TestWait3000ms_22(); - break; - case 23: - ChipLogProgress(chipTool, " ***** Test Step 23 : User interaction needed\n"); - err = TestUserInteractionNeeded_23(); - break; - case 24: - ChipLogProgress(chipTool, " ***** Test Step 24 : User interaction needed\n"); - err = TestUserInteractionNeeded_24(); - break; - case 25: - ChipLogProgress(chipTool, " ***** Test Step 25 : User interaction needed\n"); - err = TestUserInteractionNeeded_25(); - break; - case 26: - ChipLogProgress(chipTool, " ***** Test Step 26 : User interaction needed\n"); - err = TestUserInteractionNeeded_26(); - break; - case 27: - ChipLogProgress(chipTool, " ***** Test Step 27 : User interaction needed\n"); - err = TestUserInteractionNeeded_27(); - break; - case 28: - ChipLogProgress(chipTool, " ***** Test Step 28 : User interaction needed\n"); - err = TestUserInteractionNeeded_28(); - break; - case 29: - ChipLogProgress(chipTool, " ***** Test Step 29 : User interaction needed\n"); - err = TestUserInteractionNeeded_29(); - break; - case 30: - ChipLogProgress(chipTool, " ***** Test Step 30 : User interaction needed\n"); - err = TestUserInteractionNeeded_30(); - break; - case 31: - ChipLogProgress(chipTool, " ***** Test Step 31 : User interaction needed\n"); - err = TestUserInteractionNeeded_31(); - break; - case 32: - ChipLogProgress(chipTool, " ***** Test Step 32 : User interaction needed\n"); - err = TestUserInteractionNeeded_32(); - break; - case 33: - ChipLogProgress(chipTool, " ***** Test Step 33 : User interaction needed\n"); - err = TestUserInteractionNeeded_33(); - break; - case 34: - ChipLogProgress(chipTool, " ***** Test Step 34 : User interaction needed\n"); - err = TestUserInteractionNeeded_34(); - break; - case 35: - ChipLogProgress(chipTool, " ***** Test Step 35 : User interaction needed\n"); - err = TestUserInteractionNeeded_35(); - break; - case 36: - ChipLogProgress(chipTool, " ***** Test Step 36 : User interaction needed\n"); - err = TestUserInteractionNeeded_36(); - break; - case 37: - ChipLogProgress(chipTool, " ***** Test Step 37 : User interaction needed\n"); - err = TestUserInteractionNeeded_37(); - break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 38; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 1: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 2: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 4: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 5: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 6: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 8: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 9: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 10: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 11: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 12: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 13: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 14: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 15: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 16: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 17: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 18: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 19: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 20: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 21: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 22: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 23: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 24: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 25: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 26: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 27: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 28: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 29: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 30: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 31: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 32: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 33: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 34: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 35: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 36: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 37: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - static void OnFailureCallback_3(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_3(error); - } - - static void OnSuccessCallback_3(void * context, uint8_t currentPosition) - { - (static_cast(context))->OnSuccessResponse_3(currentPosition); - } - - static void OnFailureCallback_7(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_7(error); - } - - static void OnSuccessCallback_7(void * context, uint8_t currentPosition) - { - (static_cast(context))->OnSuccessResponse_7(currentPosition); - } - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestUserInteractionNeeded_1() - { - SetIdentity(kIdentityAlpha); - return UserPrompt("Set up subscription to SwitchLatched event"); - } - - CHIP_ERROR TestUserInteractionNeeded_2() - { - SetIdentity(kIdentityAlpha); - return UserPrompt("Operator sets switch to first position"); - } - - CHIP_ERROR TestReadCurrentPositionAttribute_3() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::SwitchClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_3, OnFailureCallback_3, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_3(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_3(uint8_t currentPosition) - { - VerifyOrReturn(CheckValue("currentPosition", currentPosition, 0)); - - NextTest(); - } - - CHIP_ERROR TestUserInteractionNeeded_4() - { - SetIdentity(kIdentityAlpha); - return UserPrompt("Operator sets switch to second position"); - } - - CHIP_ERROR TestUserInteractionNeeded_5() - { - SetIdentity(kIdentityAlpha); - return UserPrompt("Set up subscription to InitialPress event"); - } - - CHIP_ERROR TestUserInteractionNeeded_6() - { - SetIdentity(kIdentityAlpha); - return UserPrompt("Operator does not operate switch"); - } - - CHIP_ERROR TestReadCurrentPositionAttribute_7() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::SwitchClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_7, OnFailureCallback_7, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_7(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_7(uint8_t currentPosition) - { - VerifyOrReturn(CheckValue("currentPosition", currentPosition, 0)); - - NextTest(); - } - - CHIP_ERROR TestUserInteractionNeeded_8() - { - SetIdentity(kIdentityAlpha); - return UserPrompt("Operator sets switch to second position"); - } - - CHIP_ERROR TestUserInteractionNeeded_9() - { - SetIdentity(kIdentityAlpha); - return UserPrompt("Operator does not operate switch (release switch)"); - } - - CHIP_ERROR TestUserInteractionNeeded_10() - { - SetIdentity(kIdentityAlpha); - return UserPrompt("Set up subscription to InitialPress and ShortRelease events"); - } - - CHIP_ERROR TestUserInteractionNeeded_11() - { - SetIdentity(kIdentityAlpha); - return UserPrompt("Operator does not operate switch"); - } - - CHIP_ERROR TestUserInteractionNeeded_12() - { - SetIdentity(kIdentityAlpha); - return UserPrompt("Operator operates switch (press briefly)"); - } - - CHIP_ERROR TestUserInteractionNeeded_13() - { - SetIdentity(kIdentityAlpha); - return UserPrompt("Operator releases switch"); - } - - CHIP_ERROR TestUserInteractionNeeded_14() - { - SetIdentity(kIdentityAlpha); - return UserPrompt("Operator operates switch for 5 seconds"); - } - - CHIP_ERROR TestWait3000ms_15() - { - SetIdentity(kIdentityAlpha); - return WaitForMs(3000); - } - - CHIP_ERROR TestUserInteractionNeeded_16() - { - SetIdentity(kIdentityAlpha); - return UserPrompt("Operator releases switch"); - } - - CHIP_ERROR TestUserInteractionNeeded_17() - { - SetIdentity(kIdentityAlpha); - return UserPrompt("Set up subscription to InitialPress, LongPress, ShortRelease, LongRelease events"); - } - - CHIP_ERROR TestUserInteractionNeeded_18() - { - SetIdentity(kIdentityAlpha); - return UserPrompt("Operator does not operate switch"); - } - - CHIP_ERROR TestUserInteractionNeeded_19() - { - SetIdentity(kIdentityAlpha); - return UserPrompt("Operator operates switch (press briefly)"); - } - - CHIP_ERROR TestUserInteractionNeeded_20() - { - SetIdentity(kIdentityAlpha); - return UserPrompt("Operator releases switch"); - } - - CHIP_ERROR TestUserInteractionNeeded_21() - { - SetIdentity(kIdentityAlpha); - return UserPrompt("Operator operates switch for 5 seconds"); - } - - CHIP_ERROR TestWait3000ms_22() - { - SetIdentity(kIdentityAlpha); - return WaitForMs(3000); - } - - CHIP_ERROR TestUserInteractionNeeded_23() - { - SetIdentity(kIdentityAlpha); - return UserPrompt("Operator releases switch"); - } - - CHIP_ERROR TestUserInteractionNeeded_24() - { - SetIdentity(kIdentityAlpha); - return UserPrompt("Set up subscription to InitialPress, ShortRelease, MultiPressOngoing, MultiPressComplete events"); - } - - CHIP_ERROR TestUserInteractionNeeded_25() - { - SetIdentity(kIdentityAlpha); - return UserPrompt("Operator does not operate switch"); - } - - CHIP_ERROR TestUserInteractionNeeded_26() - { - SetIdentity(kIdentityAlpha); - return UserPrompt("Operator operates switch (press briefly)"); - } - - CHIP_ERROR TestUserInteractionNeeded_27() - { - SetIdentity(kIdentityAlpha); - return UserPrompt("Operator releases switch"); - } - - CHIP_ERROR TestUserInteractionNeeded_28() - { - SetIdentity(kIdentityAlpha); - return UserPrompt("Operator operates switch (press briefly)"); - } - - CHIP_ERROR TestUserInteractionNeeded_29() - { - SetIdentity(kIdentityAlpha); - return UserPrompt("Operator releases switch"); - } - - CHIP_ERROR TestUserInteractionNeeded_30() - { - SetIdentity(kIdentityAlpha); - return UserPrompt("Operator operates switch again (press briefly)"); - } - - CHIP_ERROR TestUserInteractionNeeded_31() - { - SetIdentity(kIdentityAlpha); - return UserPrompt("Operator releases switch"); - } - - CHIP_ERROR TestUserInteractionNeeded_32() - { - SetIdentity(kIdentityAlpha); - return UserPrompt("Operator operates switch again (press briefly)"); - } - - CHIP_ERROR TestUserInteractionNeeded_33() - { - SetIdentity(kIdentityAlpha); - return UserPrompt("Operator releases switch"); - } - - CHIP_ERROR TestUserInteractionNeeded_34() - { - SetIdentity(kIdentityAlpha); - return UserPrompt("Operator operates switch again (press briefly)"); - } - - CHIP_ERROR TestUserInteractionNeeded_35() - { - SetIdentity(kIdentityAlpha); - return UserPrompt("Operator releases switch"); - } - - CHIP_ERROR TestUserInteractionNeeded_36() - { - SetIdentity(kIdentityAlpha); - return UserPrompt("Operator operates switch again (press briefly)"); - } - - CHIP_ERROR TestUserInteractionNeeded_37() - { - SetIdentity(kIdentityAlpha); - return UserPrompt("Operator releases switch"); - } -}; - -class Test_TC_TM_1_1Suite : public TestCommand -{ -public: - Test_TC_TM_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_TM_1_1", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_TM_1_1Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_TM_1_1\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_TM_1_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Read the global attribute constraints: ClusterRevision\n"); - err = TestReadTheGlobalAttributeConstraintsClusterRevision_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Read the global attribute: AttributeList\n"); - err = TestReadTheGlobalAttributeAttributeList_2(); - break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 3; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - static void OnFailureCallback_1(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_1(error); - } - - static void OnSuccessCallback_1(void * context, uint16_t clusterRevision) - { - (static_cast(context))->OnSuccessResponse_1(clusterRevision); - } - - static void OnFailureCallback_2(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_2(error); - } - - static void OnSuccessCallback_2(void * context, const chip::app::DataModel::DecodableList & attributeList) - { - (static_cast(context))->OnSuccessResponse_2(attributeList); - } - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestReadTheGlobalAttributeConstraintsClusterRevision_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TemperatureMeasurementClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_1, OnFailureCallback_1, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_1(uint16_t clusterRevision) - { - VerifyOrReturn(CheckConstraintType("clusterRevision", "", "uint16")); - NextTest(); - } - - CHIP_ERROR TestReadTheGlobalAttributeAttributeList_2() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TemperatureMeasurementClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_2, OnFailureCallback_2, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_2(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_2(const chip::app::DataModel::DecodableList & attributeList) - { - VerifyOrReturn(CheckConstraintType("attributeList", "", "list")); - NextTest(); - } -}; - -class Test_TC_TM_2_1Suite : public TestCommand -{ -public: - Test_TC_TM_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_TM_2_1", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_TM_2_1Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_TM_2_1\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_TM_2_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : read the mandatory attribute: MeasuredValue\n"); - err = TestReadTheMandatoryAttributeMeasuredValue_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : read the mandatory attribute: MinMeasuredValue\n"); - err = TestReadTheMandatoryAttributeMinMeasuredValue_2(); - break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : read the mandatory attribute: MaxMeasuredValue\n"); - err = TestReadTheMandatoryAttributeMaxMeasuredValue_3(); - break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : read the optional attribute: Tolerance\n"); - err = TestReadTheOptionalAttributeTolerance_4(); - break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 5; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - static void OnFailureCallback_1(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_1(error); - } - - static void OnSuccessCallback_1(void * context, const chip::app::DataModel::Nullable & measuredValue) - { - (static_cast(context))->OnSuccessResponse_1(measuredValue); - } - - static void OnFailureCallback_2(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_2(error); - } - - static void OnSuccessCallback_2(void * context, const chip::app::DataModel::Nullable & minMeasuredValue) - { - (static_cast(context))->OnSuccessResponse_2(minMeasuredValue); - } - - static void OnFailureCallback_3(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_3(error); - } - - static void OnSuccessCallback_3(void * context, const chip::app::DataModel::Nullable & maxMeasuredValue) - { - (static_cast(context))->OnSuccessResponse_3(maxMeasuredValue); - } - - static void OnFailureCallback_4(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_4(error); - } - - static void OnSuccessCallback_4(void * context, uint16_t tolerance) - { - (static_cast(context))->OnSuccessResponse_4(tolerance); - } - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestReadTheMandatoryAttributeMeasuredValue_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TemperatureMeasurementClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_1, OnFailureCallback_1, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_1(const chip::app::DataModel::Nullable & measuredValue) - { - VerifyOrReturn(CheckConstraintType("measuredValue", "", "int16")); - NextTest(); - } - - CHIP_ERROR TestReadTheMandatoryAttributeMinMeasuredValue_2() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TemperatureMeasurementClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_2, OnFailureCallback_2, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_2(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_2(const chip::app::DataModel::Nullable & minMeasuredValue) - { - VerifyOrReturn(CheckConstraintType("minMeasuredValue", "", "int16")); - VerifyOrReturn(CheckConstraintMinValue("minMeasuredValue", minMeasuredValue, -27315)); - VerifyOrReturn(CheckConstraintMaxValue("minMeasuredValue", minMeasuredValue, 32766)); - NextTest(); - } - - CHIP_ERROR TestReadTheMandatoryAttributeMaxMeasuredValue_3() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TemperatureMeasurementClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_3, OnFailureCallback_3, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_3(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_3(const chip::app::DataModel::Nullable & maxMeasuredValue) - { - VerifyOrReturn(CheckConstraintType("maxMeasuredValue", "", "int16")); - VerifyOrReturn(CheckConstraintMinValue("maxMeasuredValue", maxMeasuredValue, -27314)); - VerifyOrReturn(CheckConstraintMaxValue("maxMeasuredValue", maxMeasuredValue, 32767)); - NextTest(); - } - - CHIP_ERROR TestReadTheOptionalAttributeTolerance_4() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TemperatureMeasurementClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_4, OnFailureCallback_4, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_4(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() - : ThrowFailureResponse(error); - } - - void OnSuccessResponse_4(uint16_t tolerance) - { - VerifyOrReturn(CheckConstraintType("tolerance", "", "uint16")); - VerifyOrReturn(CheckConstraintMinValue("tolerance", tolerance, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("tolerance", tolerance, 2048U)); - NextTest(); - } -}; - -class Test_TC_TM_2_2Suite : public TestCommand -{ -public: - Test_TC_TM_2_2Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_TM_2_2", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_TM_2_2Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_TM_2_2\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_TM_2_2\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : read the mandatory attribute: MinMeasuredValue\n"); - err = TestReadTheMandatoryAttributeMinMeasuredValue_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : read the mandatory attribute: MaxMeasuredValue\n"); - err = TestReadTheMandatoryAttributeMaxMeasuredValue_2(); - break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Reads MeasuredValue attribute from DUT\n"); - if (ShouldSkip("A_TEMPERATURE")) - { - NextTest(); - return; - } - err = TestReadsMeasuredValueAttributeFromDut_3(); - break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Read the mandatory attribute: MeasuredValue\n"); - if (ShouldSkip("A_TEMPERATURE")) - { - NextTest(); - return; - } - err = TestReadTheMandatoryAttributeMeasuredValue_4(); - break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 5; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - static void OnFailureCallback_1(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_1(error); - } - - static void OnSuccessCallback_1(void * context, const chip::app::DataModel::Nullable & minMeasuredValue) - { - (static_cast(context))->OnSuccessResponse_1(minMeasuredValue); - } - - static void OnFailureCallback_2(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_2(error); - } - - static void OnSuccessCallback_2(void * context, const chip::app::DataModel::Nullable & maxMeasuredValue) - { - (static_cast(context))->OnSuccessResponse_2(maxMeasuredValue); - } - - static void OnFailureCallback_3(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_3(error); - } - - static void OnSuccessCallback_3(void * context, const chip::app::DataModel::Nullable & measuredValue) - { - (static_cast(context))->OnSuccessResponse_3(measuredValue); - } - - static void OnFailureCallback_4(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_4(error); - } - - static void OnSuccessCallback_4(void * context, const chip::app::DataModel::Nullable & measuredValue) - { - (static_cast(context))->OnSuccessResponse_4(measuredValue); - } - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestReadTheMandatoryAttributeMinMeasuredValue_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TemperatureMeasurementClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_1, OnFailureCallback_1, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_1(const chip::app::DataModel::Nullable & minMeasuredValue) - { - VerifyOrReturn(CheckConstraintType("minMeasuredValue", "", "int16")); - VerifyOrReturn(CheckConstraintMinValue("minMeasuredValue", minMeasuredValue, -27315)); - VerifyOrReturn(CheckConstraintMaxValue("minMeasuredValue", minMeasuredValue, 32766)); - NextTest(); - } - - CHIP_ERROR TestReadTheMandatoryAttributeMaxMeasuredValue_2() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TemperatureMeasurementClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_2, OnFailureCallback_2, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_2(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_2(const chip::app::DataModel::Nullable & maxMeasuredValue) - { - VerifyOrReturn(CheckConstraintType("maxMeasuredValue", "", "int16")); - VerifyOrReturn(CheckConstraintMinValue("maxMeasuredValue", maxMeasuredValue, -27314)); - VerifyOrReturn(CheckConstraintMaxValue("maxMeasuredValue", maxMeasuredValue, 32767)); - NextTest(); - } - - CHIP_ERROR TestReadsMeasuredValueAttributeFromDut_3() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TemperatureMeasurementClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_3, OnFailureCallback_3, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_3(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_3(const chip::app::DataModel::Nullable & measuredValue) - { - VerifyOrReturn(CheckConstraintType("measuredValue", "", "uint16")); - NextTest(); - } - - CHIP_ERROR TestReadTheMandatoryAttributeMeasuredValue_4() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TemperatureMeasurementClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_4, OnFailureCallback_4, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_4(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_4(const chip::app::DataModel::Nullable & measuredValue) - { - VerifyOrReturn(CheckConstraintType("measuredValue", "", "uint16")); - NextTest(); - } -}; - -class Test_TC_TSTAT_1_1Suite : public TestCommand -{ -public: - Test_TC_TSTAT_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_TSTAT_1_1", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_TSTAT_1_1Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_TSTAT_1_1\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_TSTAT_1_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Read the global attribute constraints: ClusterRevision\n"); - err = TestReadTheGlobalAttributeConstraintsClusterRevision_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Read the global attribute: AttributeList\n"); - err = TestReadTheGlobalAttributeAttributeList_2(); - break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Read the optional global attribute constraints: FeatureMap\n"); - err = TestReadTheOptionalGlobalAttributeConstraintsFeatureMap_3(); - break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 4; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - static void OnFailureCallback_1(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_1(error); - } - - static void OnSuccessCallback_1(void * context, uint16_t clusterRevision) - { - (static_cast(context))->OnSuccessResponse_1(clusterRevision); - } - - static void OnFailureCallback_2(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_2(error); - } - - static void OnSuccessCallback_2(void * context, const chip::app::DataModel::DecodableList & attributeList) - { - (static_cast(context))->OnSuccessResponse_2(attributeList); - } - - static void OnFailureCallback_3(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_3(error); - } - - static void OnSuccessCallback_3(void * context, uint32_t featureMap) - { - (static_cast(context))->OnSuccessResponse_3(featureMap); - } - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestReadTheGlobalAttributeConstraintsClusterRevision_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ThermostatClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_1, OnFailureCallback_1, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_1(uint16_t clusterRevision) - { - VerifyOrReturn(CheckConstraintType("clusterRevision", "", "uint16")); - NextTest(); - } - - CHIP_ERROR TestReadTheGlobalAttributeAttributeList_2() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ThermostatClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_2, OnFailureCallback_2, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_2(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_2(const chip::app::DataModel::DecodableList & attributeList) - { - VerifyOrReturn(CheckConstraintType("attributeList", "", "list")); - NextTest(); - } - - CHIP_ERROR TestReadTheOptionalGlobalAttributeConstraintsFeatureMap_3() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ThermostatClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_3, OnFailureCallback_3, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_3(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_3(uint32_t featureMap) - { - VerifyOrReturn(CheckConstraintType("featureMap", "", "map32")); - NextTest(); - } -}; - -class Test_TC_TSTAT_2_1Suite : public TestCommand -{ -public: - Test_TC_TSTAT_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_TSTAT_2_1", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_TSTAT_2_1Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_TSTAT_2_1\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_TSTAT_2_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - case 1: - ChipLogProgress(chipTool, - " ***** Test Step 1 : Reads constraints of mandatory attributes from DUT: LocalTemperature\n"); - err = TestReadsConstraintsOfMandatoryAttributesFromDutLocalTemperature_1(); - break; - case 2: - ChipLogProgress(chipTool, - " ***** Test Step 2 : Reads constraints of mandatory attributes from DUT: AbsMinHeatSetpointLimit\n"); - err = TestReadsConstraintsOfMandatoryAttributesFromDutAbsMinHeatSetpointLimit_2(); - break; - case 3: - ChipLogProgress(chipTool, - " ***** Test Step 3 : Reads constraints of mandatory attributes from DUT: AbsMaxHeatSetpointLimit\n"); - err = TestReadsConstraintsOfMandatoryAttributesFromDutAbsMaxHeatSetpointLimit_3(); - break; - case 4: - ChipLogProgress(chipTool, - " ***** Test Step 4 : Reads constraints of optional attributes from DUT: AbsMinCoolSetpointLimit\n"); - err = TestReadsConstraintsOfOptionalAttributesFromDutAbsMinCoolSetpointLimit_4(); - break; - case 5: - ChipLogProgress(chipTool, - " ***** Test Step 5 : Reads constraints of optional attributes from DUT: AbsMaxCoolSetpointLimit\n"); - err = TestReadsConstraintsOfOptionalAttributesFromDutAbsMaxCoolSetpointLimit_5(); - break; - case 6: - ChipLogProgress(chipTool, - " ***** Test Step 6 : Reads constraints of optional attributes from DUT: OccupiedCoolingSetpoint\n"); - err = TestReadsConstraintsOfOptionalAttributesFromDutOccupiedCoolingSetpoint_6(); - break; - case 7: - ChipLogProgress(chipTool, - " ***** Test Step 7 : Reads constraints of mandatory attributes from DUT: OccupiedHeatingSetpoint\n"); - err = TestReadsConstraintsOfMandatoryAttributesFromDutOccupiedHeatingSetpoint_7(); - break; - case 8: - ChipLogProgress(chipTool, - " ***** Test Step 8 : Reads constraints of mandatory attributes from DUT: MinHeatSetpointLimit\n"); - err = TestReadsConstraintsOfMandatoryAttributesFromDutMinHeatSetpointLimit_8(); - break; - case 9: - ChipLogProgress(chipTool, - " ***** Test Step 9 : Reads constraints of mandatory attributes from DUT: MaxHeatSetpointLimit\n"); - err = TestReadsConstraintsOfMandatoryAttributesFromDutMaxHeatSetpointLimit_9(); - break; - case 10: - ChipLogProgress(chipTool, - " ***** Test Step 10 : Reads constraints of optional attributes from DUT: MinCoolSetpointLimit\n"); - err = TestReadsConstraintsOfOptionalAttributesFromDutMinCoolSetpointLimit_10(); - break; - case 11: - ChipLogProgress(chipTool, - " ***** Test Step 11 : Reads constraints of optional attributes from DUT: MaxCoolSetpointLimit\n"); - err = TestReadsConstraintsOfOptionalAttributesFromDutMaxCoolSetpointLimit_11(); - break; - case 12: - ChipLogProgress( - chipTool, " ***** Test Step 12 : Reads constraints of mandatory attributes from DUT: ControlSequenceOfOperation\n"); - err = TestReadsConstraintsOfMandatoryAttributesFromDutControlSequenceOfOperation_12(); - break; - case 13: - ChipLogProgress(chipTool, " ***** Test Step 13 : Reads constraints of mandatory attributes from DUT: SystemMode\n"); - err = TestReadsConstraintsOfMandatoryAttributesFromDutSystemMode_13(); - break; - case 14: - ChipLogProgress(chipTool, - " ***** Test Step 14 : Reads constraints of optional attributes from DUT: MinSetpointDeadBand\n"); - err = TestReadsConstraintsOfOptionalAttributesFromDutMinSetpointDeadBand_14(); - break; - case 15: - ChipLogProgress(chipTool, " ***** Test Step 15 : Reads constraints of optional attributes from DUT: StartOfWeek\n"); - err = TestReadsConstraintsOfOptionalAttributesFromDutStartOfWeek_15(); - break; - case 16: - ChipLogProgress(chipTool, - " ***** Test Step 16 : Reads constraints of optional attributes from DUT: NumberOfWeeklyTransitions\n"); - err = TestReadsConstraintsOfOptionalAttributesFromDutNumberOfWeeklyTransitions_16(); - break; - case 17: - ChipLogProgress(chipTool, - " ***** Test Step 17 : Reads constraints of optional attributes from DUT: NumberOfDailyTransitions\n"); - err = TestReadsConstraintsOfOptionalAttributesFromDutNumberOfDailyTransitions_17(); - break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 18; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - static void OnFailureCallback_1(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_1(error); - } - - static void OnSuccessCallback_1(void * context, int16_t localTemperature) - { - (static_cast(context))->OnSuccessResponse_1(localTemperature); - } - - static void OnFailureCallback_2(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_2(error); - } - - static void OnSuccessCallback_2(void * context, int16_t absMinHeatSetpointLimit) - { - (static_cast(context))->OnSuccessResponse_2(absMinHeatSetpointLimit); - } - - static void OnFailureCallback_3(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_3(error); - } - - static void OnSuccessCallback_3(void * context, int16_t absMaxHeatSetpointLimit) - { - (static_cast(context))->OnSuccessResponse_3(absMaxHeatSetpointLimit); - } - - static void OnFailureCallback_4(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_4(error); - } - - static void OnSuccessCallback_4(void * context, int16_t absMinCoolSetpointLimit) - { - (static_cast(context))->OnSuccessResponse_4(absMinCoolSetpointLimit); - } - - static void OnFailureCallback_5(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_5(error); - } - - static void OnSuccessCallback_5(void * context, int16_t absMaxCoolSetpointLimit) - { - (static_cast(context))->OnSuccessResponse_5(absMaxCoolSetpointLimit); - } - - static void OnFailureCallback_6(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_6(error); - } - - static void OnSuccessCallback_6(void * context, int16_t occupiedCoolingSetpoint) - { - (static_cast(context))->OnSuccessResponse_6(occupiedCoolingSetpoint); - } - - static void OnFailureCallback_7(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_7(error); - } - - static void OnSuccessCallback_7(void * context, int16_t occupiedHeatingSetpoint) - { - (static_cast(context))->OnSuccessResponse_7(occupiedHeatingSetpoint); - } - - static void OnFailureCallback_8(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_8(error); - } - - static void OnSuccessCallback_8(void * context, int16_t minHeatSetpointLimit) - { - (static_cast(context))->OnSuccessResponse_8(minHeatSetpointLimit); - } - - static void OnFailureCallback_9(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_9(error); - } - - static void OnSuccessCallback_9(void * context, int16_t maxHeatSetpointLimit) - { - (static_cast(context))->OnSuccessResponse_9(maxHeatSetpointLimit); - } - - static void OnFailureCallback_10(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_10(error); - } - - static void OnSuccessCallback_10(void * context, int16_t minCoolSetpointLimit) - { - (static_cast(context))->OnSuccessResponse_10(minCoolSetpointLimit); - } - - static void OnFailureCallback_11(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_11(error); - } - - static void OnSuccessCallback_11(void * context, int16_t maxCoolSetpointLimit) - { - (static_cast(context))->OnSuccessResponse_11(maxCoolSetpointLimit); - } - - static void OnFailureCallback_12(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_12(error); - } - - static void OnSuccessCallback_12(void * context, - chip::app::Clusters::Thermostat::ThermostatControlSequence controlSequenceOfOperation) - { - (static_cast(context))->OnSuccessResponse_12(controlSequenceOfOperation); - } - - static void OnFailureCallback_13(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_13(error); - } - - static void OnSuccessCallback_13(void * context, uint8_t systemMode) - { - (static_cast(context))->OnSuccessResponse_13(systemMode); - } - - static void OnFailureCallback_14(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_14(error); - } - - static void OnSuccessCallback_14(void * context, int8_t minSetpointDeadBand) - { - (static_cast(context))->OnSuccessResponse_14(minSetpointDeadBand); - } - - static void OnFailureCallback_15(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_15(error); - } - - static void OnSuccessCallback_15(void * context, uint8_t startOfWeek) - { - (static_cast(context))->OnSuccessResponse_15(startOfWeek); - } - - static void OnFailureCallback_16(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_16(error); - } - - static void OnSuccessCallback_16(void * context, uint8_t numberOfWeeklyTransitions) - { - (static_cast(context))->OnSuccessResponse_16(numberOfWeeklyTransitions); - } - - static void OnFailureCallback_17(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_17(error); - } - - static void OnSuccessCallback_17(void * context, uint8_t numberOfDailyTransitions) - { - (static_cast(context))->OnSuccessResponse_17(numberOfDailyTransitions); - } - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestReadsConstraintsOfMandatoryAttributesFromDutLocalTemperature_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ThermostatClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_1, OnFailureCallback_1, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_1(int16_t localTemperature) - { - VerifyOrReturn(CheckConstraintType("localTemperature", "", "int16")); - NextTest(); - } - - CHIP_ERROR TestReadsConstraintsOfMandatoryAttributesFromDutAbsMinHeatSetpointLimit_2() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ThermostatClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_2, OnFailureCallback_2, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_2(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_2(int16_t absMinHeatSetpointLimit) - { - VerifyOrReturn(CheckConstraintType("absMinHeatSetpointLimit", "", "int16")); - VerifyOrReturn(CheckConstraintMinValue("absMinHeatSetpointLimit", absMinHeatSetpointLimit, 700)); - VerifyOrReturn(CheckConstraintMaxValue("absMinHeatSetpointLimit", absMinHeatSetpointLimit, 3000)); - NextTest(); - } - - CHIP_ERROR TestReadsConstraintsOfMandatoryAttributesFromDutAbsMaxHeatSetpointLimit_3() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ThermostatClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_3, OnFailureCallback_3, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_3(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_3(int16_t absMaxHeatSetpointLimit) - { - VerifyOrReturn(CheckConstraintType("absMaxHeatSetpointLimit", "", "int16")); - VerifyOrReturn(CheckConstraintMinValue("absMaxHeatSetpointLimit", absMaxHeatSetpointLimit, 700)); - VerifyOrReturn(CheckConstraintMaxValue("absMaxHeatSetpointLimit", absMaxHeatSetpointLimit, 3000)); - NextTest(); - } - - CHIP_ERROR TestReadsConstraintsOfOptionalAttributesFromDutAbsMinCoolSetpointLimit_4() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ThermostatClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_4, OnFailureCallback_4, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_4(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() - : ThrowFailureResponse(error); - } - - void OnSuccessResponse_4(int16_t absMinCoolSetpointLimit) - { - VerifyOrReturn(CheckConstraintType("absMinCoolSetpointLimit", "", "int16")); - VerifyOrReturn(CheckConstraintMinValue("absMinCoolSetpointLimit", absMinCoolSetpointLimit, 1600)); - VerifyOrReturn(CheckConstraintMaxValue("absMinCoolSetpointLimit", absMinCoolSetpointLimit, 3200)); - NextTest(); - } - - CHIP_ERROR TestReadsConstraintsOfOptionalAttributesFromDutAbsMaxCoolSetpointLimit_5() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ThermostatClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_5, OnFailureCallback_5, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_5(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() - : ThrowFailureResponse(error); - } - - void OnSuccessResponse_5(int16_t absMaxCoolSetpointLimit) - { - VerifyOrReturn(CheckConstraintType("absMaxCoolSetpointLimit", "", "int16")); - VerifyOrReturn(CheckConstraintMinValue("absMaxCoolSetpointLimit", absMaxCoolSetpointLimit, 1600)); - VerifyOrReturn(CheckConstraintMaxValue("absMaxCoolSetpointLimit", absMaxCoolSetpointLimit, 3200)); - NextTest(); - } - - CHIP_ERROR TestReadsConstraintsOfOptionalAttributesFromDutOccupiedCoolingSetpoint_6() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ThermostatClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_6, OnFailureCallback_6, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_6(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() - : ThrowFailureResponse(error); - } - - void OnSuccessResponse_6(int16_t occupiedCoolingSetpoint) - { - VerifyOrReturn(CheckConstraintType("occupiedCoolingSetpoint", "", "int16")); - VerifyOrReturn(CheckConstraintMinValue("occupiedCoolingSetpoint", occupiedCoolingSetpoint, 1600)); - VerifyOrReturn(CheckConstraintMaxValue("occupiedCoolingSetpoint", occupiedCoolingSetpoint, 2600)); - NextTest(); - } - - CHIP_ERROR TestReadsConstraintsOfMandatoryAttributesFromDutOccupiedHeatingSetpoint_7() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ThermostatClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_7, OnFailureCallback_7, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_7(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_7(int16_t occupiedHeatingSetpoint) - { - VerifyOrReturn(CheckConstraintType("occupiedHeatingSetpoint", "", "int16")); - VerifyOrReturn(CheckConstraintMinValue("occupiedHeatingSetpoint", occupiedHeatingSetpoint, 700)); - VerifyOrReturn(CheckConstraintMaxValue("occupiedHeatingSetpoint", occupiedHeatingSetpoint, 2600)); - NextTest(); - } - - CHIP_ERROR TestReadsConstraintsOfMandatoryAttributesFromDutMinHeatSetpointLimit_8() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ThermostatClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_8, OnFailureCallback_8, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_8(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_8(int16_t minHeatSetpointLimit) - { - VerifyOrReturn(CheckConstraintType("minHeatSetpointLimit", "", "int16")); - VerifyOrReturn(CheckConstraintMinValue("minHeatSetpointLimit", minHeatSetpointLimit, 700)); - VerifyOrReturn(CheckConstraintMaxValue("minHeatSetpointLimit", minHeatSetpointLimit, 3000)); - NextTest(); - } - - CHIP_ERROR TestReadsConstraintsOfMandatoryAttributesFromDutMaxHeatSetpointLimit_9() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ThermostatClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_9, OnFailureCallback_9, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_9(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_9(int16_t maxHeatSetpointLimit) - { - VerifyOrReturn(CheckConstraintType("maxHeatSetpointLimit", "", "int16")); - VerifyOrReturn(CheckConstraintMinValue("maxHeatSetpointLimit", maxHeatSetpointLimit, 700)); - VerifyOrReturn(CheckConstraintMaxValue("maxHeatSetpointLimit", maxHeatSetpointLimit, 3000)); - NextTest(); - } - - CHIP_ERROR TestReadsConstraintsOfOptionalAttributesFromDutMinCoolSetpointLimit_10() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ThermostatClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_10, OnFailureCallback_10, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_10(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() - : ThrowFailureResponse(error); - } - - void OnSuccessResponse_10(int16_t minCoolSetpointLimit) - { - VerifyOrReturn(CheckConstraintType("minCoolSetpointLimit", "", "int16")); - VerifyOrReturn(CheckConstraintMinValue("minCoolSetpointLimit", minCoolSetpointLimit, 1600)); - VerifyOrReturn(CheckConstraintMaxValue("minCoolSetpointLimit", minCoolSetpointLimit, 3200)); - NextTest(); - } - - CHIP_ERROR TestReadsConstraintsOfOptionalAttributesFromDutMaxCoolSetpointLimit_11() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ThermostatClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_11, OnFailureCallback_11, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_11(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() - : ThrowFailureResponse(error); - } - - void OnSuccessResponse_11(int16_t maxCoolSetpointLimit) - { - VerifyOrReturn(CheckConstraintType("maxCoolSetpointLimit", "", "int16")); - VerifyOrReturn(CheckConstraintMinValue("maxCoolSetpointLimit", maxCoolSetpointLimit, 1600)); - VerifyOrReturn(CheckConstraintMaxValue("maxCoolSetpointLimit", maxCoolSetpointLimit, 3200)); - NextTest(); - } - - CHIP_ERROR TestReadsConstraintsOfMandatoryAttributesFromDutControlSequenceOfOperation_12() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ThermostatClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_12, OnFailureCallback_12, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_12(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_12(chip::app::Clusters::Thermostat::ThermostatControlSequence controlSequenceOfOperation) - { - VerifyOrReturn(CheckConstraintType("controlSequenceOfOperation", "", "enum8")); - VerifyOrReturn(CheckConstraintMinValue("controlSequenceOfOperation", controlSequenceOfOperation, 0)); - VerifyOrReturn(CheckConstraintMaxValue("controlSequenceOfOperation", controlSequenceOfOperation, 5)); - NextTest(); - } - - CHIP_ERROR TestReadsConstraintsOfMandatoryAttributesFromDutSystemMode_13() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ThermostatClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_13, OnFailureCallback_13, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_13(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_13(uint8_t systemMode) - { - VerifyOrReturn(CheckConstraintType("systemMode", "", "enum8")); - VerifyOrReturn(CheckConstraintMinValue("systemMode", systemMode, 0)); - VerifyOrReturn(CheckConstraintMaxValue("systemMode", systemMode, 9)); - NextTest(); - } - - CHIP_ERROR TestReadsConstraintsOfOptionalAttributesFromDutMinSetpointDeadBand_14() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ThermostatClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_14, OnFailureCallback_14, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_14(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() - : ThrowFailureResponse(error); - } - - void OnSuccessResponse_14(int8_t minSetpointDeadBand) - { - VerifyOrReturn(CheckConstraintType("minSetpointDeadBand", "", "int8")); - VerifyOrReturn(CheckConstraintMinValue("minSetpointDeadBand", minSetpointDeadBand, 0)); - VerifyOrReturn(CheckConstraintMaxValue("minSetpointDeadBand", minSetpointDeadBand, 25)); - NextTest(); - } - - CHIP_ERROR TestReadsConstraintsOfOptionalAttributesFromDutStartOfWeek_15() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ThermostatClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_15, OnFailureCallback_15, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_15(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() - : ThrowFailureResponse(error); - } - - void OnSuccessResponse_15(uint8_t startOfWeek) - { - VerifyOrReturn(CheckConstraintType("startOfWeek", "", "enum8")); - VerifyOrReturn(CheckConstraintMinValue("startOfWeek", startOfWeek, 0)); - VerifyOrReturn(CheckConstraintMaxValue("startOfWeek", startOfWeek, 6)); - NextTest(); - } - - CHIP_ERROR TestReadsConstraintsOfOptionalAttributesFromDutNumberOfWeeklyTransitions_16() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ThermostatClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_16, OnFailureCallback_16, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_16(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() - : ThrowFailureResponse(error); - } - - void OnSuccessResponse_16(uint8_t numberOfWeeklyTransitions) - { - VerifyOrReturn(CheckConstraintType("numberOfWeeklyTransitions", "", "uint8")); - NextTest(); - } - - CHIP_ERROR TestReadsConstraintsOfOptionalAttributesFromDutNumberOfDailyTransitions_17() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ThermostatClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_17, OnFailureCallback_17, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_17(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() - : ThrowFailureResponse(error); - } - - void OnSuccessResponse_17(uint8_t numberOfDailyTransitions) - { - VerifyOrReturn(CheckConstraintType("numberOfDailyTransitions", "", "uint8")); - NextTest(); - } -}; - -class Test_TC_TSTAT_2_2Suite : public TestCommand -{ -public: - Test_TC_TSTAT_2_2Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_TSTAT_2_2", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_TSTAT_2_2Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_TSTAT_2_2\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_TSTAT_2_2\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - case 1: - ChipLogProgress(chipTool, - " ***** Test Step 1 : Reads OccupiedCoolingSetpoint attribute from Server DUT and verifies that the " - "value is within range\n"); - if (ShouldSkip("A_OCCUPIEDCOOLINGSETPOINT")) - { - NextTest(); - return; - } - err = TestReadsOccupiedCoolingSetpointAttributeFromServerDutAndVerifiesThatTheValueIsWithinRange_1(); - break; - case 2: - ChipLogProgress( - chipTool, - " ***** Test Step 2 : Writes a value back that is different but valid for OccupiedCoolingSetpoint attribute\n"); - if (ShouldSkip("A_OCCUPIEDCOOLINGSETPOINT")) - { - NextTest(); - return; - } - err = TestWritesAValueBackThatIsDifferentButValidForOccupiedCoolingSetpointAttribute_2(); - break; - case 3: - ChipLogProgress( - chipTool, - " ***** Test Step 3 : Reads it back again to confirm the successful write of OccupiedCoolingSetpoint attribute\n"); - if (ShouldSkip("A_OCCUPIEDCOOLINGSETPOINT")) - { - NextTest(); - return; - } - err = TestReadsItBackAgainToConfirmTheSuccessfulWriteOfOccupiedCoolingSetpointAttribute_3(); - break; - case 4: - ChipLogProgress(chipTool, - " ***** Test Step 4 : Writes the limit of MinCoolSetpointLimit to OccupiedCoolingSetpoint attribute\n"); - if (ShouldSkip("A_OCCUPIEDCOOLINGSETPOINT")) - { - NextTest(); - return; - } - err = TestWritesTheLimitOfMinCoolSetpointLimitToOccupiedCoolingSetpointAttribute_4(); - break; - case 5: - ChipLogProgress(chipTool, - " ***** Test Step 5 : Writes the limit of MaxCoolSetpointLimit to OccupiedCoolingSetpoint attribute\n"); - if (ShouldSkip("A_OCCUPIEDCOOLINGSETPOINT")) - { - NextTest(); - return; - } - err = TestWritesTheLimitOfMaxCoolSetpointLimitToOccupiedCoolingSetpointAttribute_5(); - break; - case 6: - ChipLogProgress(chipTool, - " ***** Test Step 6 : Reads OccupiedHeatingSetpoint attribute from Server DUT and verifies that the " - "value is within range\n"); - if (ShouldSkip("A_OCCUPIEDHEATINGSETPOINT")) - { - NextTest(); - return; - } - err = TestReadsOccupiedHeatingSetpointAttributeFromServerDutAndVerifiesThatTheValueIsWithinRange_6(); - break; - case 7: - ChipLogProgress( - chipTool, - " ***** Test Step 7 : Writes a value back that is different but valid for OccupiedHeatingSetpoint attribute\n"); - if (ShouldSkip("A_OCCUPIEDHEATINGSETPOINT")) - { - NextTest(); - return; - } - err = TestWritesAValueBackThatIsDifferentButValidForOccupiedHeatingSetpointAttribute_7(); - break; - case 8: - ChipLogProgress( - chipTool, - " ***** Test Step 8 : Reads it back again to confirm the successful write of OccupiedHeatingSetpoint attribute\n"); - if (ShouldSkip("A_OCCUPIEDHEATINGSETPOINT")) - { - NextTest(); - return; - } - err = TestReadsItBackAgainToConfirmTheSuccessfulWriteOfOccupiedHeatingSetpointAttribute_8(); - break; - case 9: - ChipLogProgress(chipTool, - " ***** Test Step 9 : Writes the limit of MinHeatSetpointLimit to OccupiedHeatingSetpoint attribute\n"); - if (ShouldSkip("A_OCCUPIEDHEATINGSETPOINT")) - { - NextTest(); - return; - } - err = TestWritesTheLimitOfMinHeatSetpointLimitToOccupiedHeatingSetpointAttribute_9(); - break; - case 10: - ChipLogProgress( - chipTool, " ***** Test Step 10 : Writes the limit of MaxHeatSetpointLimit to OccupiedHeatingSetpoint attribute\n"); - if (ShouldSkip("A_OCCUPIEDHEATINGSETPOINT")) - { - NextTest(); - return; - } - err = TestWritesTheLimitOfMaxHeatSetpointLimitToOccupiedHeatingSetpointAttribute_10(); - break; - case 11: - ChipLogProgress(chipTool, - " ***** Test Step 11 : Reads MinHeatSetpointLimit attribute from Server DUT and verifies that the " - "value is within range\n"); - if (ShouldSkip("A_MINHEATSETPOINTLIMIT")) - { - NextTest(); - return; - } - err = TestReadsMinHeatSetpointLimitAttributeFromServerDutAndVerifiesThatTheValueIsWithinRange_11(); - break; - case 12: - ChipLogProgress( - chipTool, - " ***** Test Step 12 : Writes a value back that is different but valid for MinHeatSetpointLimit attribute\n"); - if (ShouldSkip("A_MINHEATSETPOINTLIMIT")) - { - NextTest(); - return; - } - err = TestWritesAValueBackThatIsDifferentButValidForMinHeatSetpointLimitAttribute_12(); - break; - case 13: - ChipLogProgress( - chipTool, - " ***** Test Step 13 : Reads it back again to confirm the successful write of MinHeatSetpointLimit attribute\n"); - if (ShouldSkip("A_MINHEATSETPOINTLIMIT")) - { - NextTest(); - return; - } - err = TestReadsItBackAgainToConfirmTheSuccessfulWriteOfMinHeatSetpointLimitAttribute_13(); - break; - case 14: - ChipLogProgress( - chipTool, " ***** Test Step 14 : Writes the limit of AbsMinHeatSetpointLimit to MinHeatSetpointLimit attribute\n"); - if (ShouldSkip("A_MINHEATSETPOINTLIMIT")) - { - NextTest(); - return; - } - err = TestWritesTheLimitOfAbsMinHeatSetpointLimitToMinHeatSetpointLimitAttribute_14(); - break; - case 15: - ChipLogProgress( - chipTool, " ***** Test Step 15 : Writes the limit of AbsMaxHeatSetpointLimit to MinHeatSetpointLimit attribute\n"); - if (ShouldSkip("A_MINHEATSETPOINTLIMIT")) - { - NextTest(); - return; - } - err = TestWritesTheLimitOfAbsMaxHeatSetpointLimitToMinHeatSetpointLimitAttribute_15(); - break; - case 16: - ChipLogProgress(chipTool, - " ***** Test Step 16 : Reads MaxHeatSetpointLimit attribute from Server DUT and verifies that the " - "value is within range\n"); - if (ShouldSkip("A_MAXHEATSETPOINTLIMIT")) - { - NextTest(); - return; - } - err = TestReadsMaxHeatSetpointLimitAttributeFromServerDutAndVerifiesThatTheValueIsWithinRange_16(); - break; - case 17: - ChipLogProgress( - chipTool, - " ***** Test Step 17 : Writes a value back that is different but valid for MaxHeatSetpointLimit attribute\n"); - if (ShouldSkip("A_MAXHEATSETPOINTLIMIT")) - { - NextTest(); - return; - } - err = TestWritesAValueBackThatIsDifferentButValidForMaxHeatSetpointLimitAttribute_17(); - break; - case 18: - ChipLogProgress( - chipTool, - " ***** Test Step 18 : Reads it back again to confirm the successful write of MaxHeatSetpointLimit attribute\n"); - if (ShouldSkip("A_MAXHEATSETPOINTLIMIT")) - { - NextTest(); - return; - } - err = TestReadsItBackAgainToConfirmTheSuccessfulWriteOfMaxHeatSetpointLimitAttribute_18(); - break; - case 19: - ChipLogProgress( - chipTool, " ***** Test Step 19 : Writes the limit of AbsMinHeatSetpointLimit to MaxHeatSetpointLimit attribute\n"); - if (ShouldSkip("A_MAXHEATSETPOINTLIMIT")) - { - NextTest(); - return; - } - err = TestWritesTheLimitOfAbsMinHeatSetpointLimitToMaxHeatSetpointLimitAttribute_19(); - break; - case 20: - ChipLogProgress( - chipTool, " ***** Test Step 20 : Writes the limit of AbsMaxHeatSetpointLimit to MaxHeatSetpointLimit attribute\n"); - if (ShouldSkip("A_MAXHEATSETPOINTLIMIT")) - { - NextTest(); - return; - } - err = TestWritesTheLimitOfAbsMaxHeatSetpointLimitToMaxHeatSetpointLimitAttribute_20(); - break; - case 21: - ChipLogProgress(chipTool, - " ***** Test Step 21 : Reads MinCoolSetpointLimit attribute from Server DUT and verifies that the " - "value is within range\n"); - if (ShouldSkip("A_MINCOOLSETPOINTLIMIT")) - { - NextTest(); - return; - } - err = TestReadsMinCoolSetpointLimitAttributeFromServerDutAndVerifiesThatTheValueIsWithinRange_21(); - break; - case 22: - ChipLogProgress( - chipTool, - " ***** Test Step 22 : Writes a value back that is different but valid for MinCoolSetpointLimit attribute\n"); - if (ShouldSkip("A_MINCOOLSETPOINTLIMIT")) - { - NextTest(); - return; - } - err = TestWritesAValueBackThatIsDifferentButValidForMinCoolSetpointLimitAttribute_22(); - break; - case 23: - ChipLogProgress( - chipTool, - " ***** Test Step 23 : Reads it back again to confirm the successful write of MinCoolSetpointLimit attribute\n"); - if (ShouldSkip("A_MINCOOLSETPOINTLIMIT")) - { - NextTest(); - return; - } - err = TestReadsItBackAgainToConfirmTheSuccessfulWriteOfMinCoolSetpointLimitAttribute_23(); - break; - case 24: - ChipLogProgress( - chipTool, " ***** Test Step 24 : Writes the limit of AbsMinCoolSetpointLimit to MinCoolSetpointLimit attribute\n"); - if (ShouldSkip("A_MINCOOLSETPOINTLIMIT")) - { - NextTest(); - return; - } - err = TestWritesTheLimitOfAbsMinCoolSetpointLimitToMinCoolSetpointLimitAttribute_24(); - break; - case 25: - ChipLogProgress(chipTool, - " ***** Test Step 25 : Writes the limit of MaxCoolSetpointLimit to MinCoolSetpointLimit attribute\n"); - if (ShouldSkip("A_MINCOOLSETPOINTLIMIT")) - { - NextTest(); - return; - } - err = TestWritesTheLimitOfMaxCoolSetpointLimitToMinCoolSetpointLimitAttribute_25(); - break; - case 26: - ChipLogProgress(chipTool, - " ***** Test Step 26 : Reads MaxCoolSetpointLimit attribute from Server DUT and verifies that the " - "value is within range\n"); - if (ShouldSkip("A_MAXCOOLSETPOINTLIMIT")) - { - NextTest(); - return; - } - err = TestReadsMaxCoolSetpointLimitAttributeFromServerDutAndVerifiesThatTheValueIsWithinRange_26(); - break; - case 27: - ChipLogProgress( - chipTool, - " ***** Test Step 27 : Writes a value back that is different but valid for MaxCoolSetpointLimit attribute\n"); - if (ShouldSkip("A_MAXCOOLSETPOINTLIMIT")) - { - NextTest(); - return; - } - err = TestWritesAValueBackThatIsDifferentButValidForMaxCoolSetpointLimitAttribute_27(); - break; - case 28: - ChipLogProgress( - chipTool, - " ***** Test Step 28 : Reads it back again to confirm the successful write of MaxCoolSetpointLimit attribute\n"); - if (ShouldSkip("A_MAXCOOLSETPOINTLIMIT")) - { - NextTest(); - return; - } - err = TestReadsItBackAgainToConfirmTheSuccessfulWriteOfMaxCoolSetpointLimitAttribute_28(); - break; - case 29: - ChipLogProgress( - chipTool, " ***** Test Step 29 : Writes the limit of AbsMinCoolSetpointLimit to MaxCoolSetpointLimit attribute\n"); - if (ShouldSkip("A_MAXCOOLSETPOINTLIMIT")) - { - NextTest(); - return; - } - err = TestWritesTheLimitOfAbsMinCoolSetpointLimitToMaxCoolSetpointLimitAttribute_29(); - break; - case 30: - ChipLogProgress(chipTool, - " ***** Test Step 30 : Writes the limit of MaxCoolSetpointLimit to MaxCoolSetpointLimit attribute\n"); - if (ShouldSkip("A_MAXCOOLSETPOINTLIMIT")) - { - NextTest(); - return; - } - err = TestWritesTheLimitOfMaxCoolSetpointLimitToMaxCoolSetpointLimitAttribute_30(); - break; - case 31: - ChipLogProgress( - chipTool, - " ***** Test Step 31 : Writes (sets back) the limit of MinHeatSetpointLimit to MinHeatSetpointLimit attribute\n"); - if (ShouldSkip("A_MINHEATSETPOINTLIMIT")) - { - NextTest(); - return; - } - err = TestWritesSetsBackTheLimitOfMinHeatSetpointLimitToMinHeatSetpointLimitAttribute_31(); - break; - case 32: - ChipLogProgress( - chipTool, - " ***** Test Step 32 : Writes (sets back) the limit of MaxHeatSetpointLimit to MinHeatSetpointLimit attribute\n"); - if (ShouldSkip("A_MINHEATSETPOINTLIMIT")) - { - NextTest(); - return; - } - err = TestWritesSetsBackTheLimitOfMaxHeatSetpointLimitToMinHeatSetpointLimitAttribute_32(); - break; - case 33: - ChipLogProgress( - chipTool, - " ***** Test Step 33 : Writes (sets back) the limit of MinHeatSetpointLimit to MaxHeatSetpointLimit attribute\n"); - if (ShouldSkip("A_MINHEATSETPOINTLIMIT")) - { - NextTest(); - return; - } - err = TestWritesSetsBackTheLimitOfMinHeatSetpointLimitToMaxHeatSetpointLimitAttribute_33(); - break; - case 34: - ChipLogProgress( - chipTool, - " ***** Test Step 34 : Writes (sets back) the limit of MaxHeatSetpointLimit to MaxHeatSetpointLimit attribute\n"); - if (ShouldSkip("A_MINHEATSETPOINTLIMIT")) - { - NextTest(); - return; - } - err = TestWritesSetsBackTheLimitOfMaxHeatSetpointLimitToMaxHeatSetpointLimitAttribute_34(); - break; - case 35: - ChipLogProgress( - chipTool, - " ***** Test Step 35 : Writes (sets back) the limit of MinCoolSetpointLimit to MinCoolSetpointLimit attribute\n"); - if (ShouldSkip("A_MINCOOLSETPOINTLIMIT")) - { - NextTest(); - return; - } - err = TestWritesSetsBackTheLimitOfMinCoolSetpointLimitToMinCoolSetpointLimitAttribute_35(); - break; - case 36: - ChipLogProgress( - chipTool, - " ***** Test Step 36 : Writes (sets back) the limit of MaxCoolSetpointLimit to MinCoolSetpointLimit attribute\n"); - if (ShouldSkip("A_MINCOOLSETPOINTLIMIT")) - { - NextTest(); - return; - } - err = TestWritesSetsBackTheLimitOfMaxCoolSetpointLimitToMinCoolSetpointLimitAttribute_36(); - break; - case 37: - ChipLogProgress( - chipTool, - " ***** Test Step 37 : Writes (sets back) the limit of MinCoolSetpointLimit to MaxCoolSetpointLimit attribute\n"); - if (ShouldSkip("A_MAXCOOLSETPOINTLIMIT")) - { - NextTest(); - return; - } - err = TestWritesSetsBackTheLimitOfMinCoolSetpointLimitToMaxCoolSetpointLimitAttribute_37(); - break; - case 38: - ChipLogProgress( - chipTool, - " ***** Test Step 38 : Writes (sets back) the limit of MaxCoolSetpointLimit to MaxCoolSetpointLimit attribute\n"); - if (ShouldSkip("A_MAXCOOLSETPOINTLIMIT")) - { - NextTest(); - return; - } - err = TestWritesSetsBackTheLimitOfMaxCoolSetpointLimitToMaxCoolSetpointLimitAttribute_38(); - break; - case 39: - ChipLogProgress( - chipTool, - " ***** Test Step 39 : Reads ControlSequenceOfOperation from Server DUT and verifies that the value is valid\n"); - if (ShouldSkip("A_CONTROLSEQUENCEOFOPERATION")) - { - NextTest(); - return; - } - err = TestReadsControlSequenceOfOperationFromServerDutAndVerifiesThatTheValueIsValid_39(); - break; - case 40: - ChipLogProgress( - chipTool, " ***** Test Step 40 : Write Attribute command for ControlSequenceOfOperation with a new valid value\n"); - if (ShouldSkip("A_CONTROLSEQUENCEOFOPERATION")) - { - NextTest(); - return; - } - err = TestWriteAttributeCommandForControlSequenceOfOperationWithANewValidValue_40(); - break; - case 41: - ChipLogProgress(chipTool, " ***** Test Step 41 : Read it back again to confirm the successful write\n"); - if (ShouldSkip("A_CONTROLSEQUENCEOFOPERATION")) - { - NextTest(); - return; - } - err = TestReadItBackAgainToConfirmTheSuccessfulWrite_41(); - break; - case 42: - ChipLogProgress(chipTool, " ***** Test Step 42 : Sets OccupiedHeatingSetpoint to default value\n"); - if (ShouldSkip("A_OCCUPIEDHEATINGSETPOINT")) - { - NextTest(); - return; - } - err = TestSetsOccupiedHeatingSetpointToDefaultValue_42(); - break; - case 43: - ChipLogProgress(chipTool, " ***** Test Step 43 : Sets OccupiedHeatingSetpoint to default value\n"); - if (ShouldSkip("A_OCCUPIEDHEATINGSETPOINT")) - { - NextTest(); - return; - } - err = TestSetsOccupiedHeatingSetpointToDefaultValue_43(); - break; - case 44: - ChipLogProgress(chipTool, " ***** Test Step 44 : Sets OccupiedCoolingSetpoint to default value\n"); - if (ShouldSkip("A_OCCUPIEDCOOLINGSETPOINT")) - { - NextTest(); - return; - } - err = TestSetsOccupiedCoolingSetpointToDefaultValue_44(); - break; - case 45: - ChipLogProgress(chipTool, " ***** Test Step 45 : Sets OccupiedCoolingSetpoint to default value\n"); - if (ShouldSkip("A_OCCUPIEDCOOLINGSETPOINT")) - { - NextTest(); - return; - } - err = TestSetsOccupiedCoolingSetpointToDefaultValue_45(); - break; - case 46: - ChipLogProgress(chipTool, " ***** Test Step 46 : Sets OccupiedCoolingSetpoint to default value\n"); - if (ShouldSkip("A_OCCUPIEDCOOLINGSETPOINT")) - { - NextTest(); - return; - } - err = TestSetsOccupiedCoolingSetpointToDefaultValue_46(); - break; - case 47: - ChipLogProgress(chipTool, " ***** Test Step 47 : Sets OccupiedHeatingSetpoint to default value\n"); - if (ShouldSkip("A_OCCUPIEDHEATINGSETPOINT")) - { - NextTest(); - return; - } - err = TestSetsOccupiedHeatingSetpointToDefaultValue_47(); - break; - case 48: - ChipLogProgress(chipTool, " ***** Test Step 48 : Sets OccupiedCoolingSetpoint to default value\n"); - if (ShouldSkip("A_OCCUPIEDCOOLINGSETPOINT")) - { - NextTest(); - return; - } - err = TestSetsOccupiedCoolingSetpointToDefaultValue_48(); - break; - case 49: - ChipLogProgress(chipTool, " ***** Test Step 49 : Sets OccupiedHeatingSetpoint to default value\n"); - if (ShouldSkip("A_OCCUPIEDHEATINGSETPOINT")) - { - NextTest(); - return; - } - err = TestSetsOccupiedHeatingSetpointToDefaultValue_49(); - break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 50; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - static void OnFailureCallback_1(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_1(error); - } - - static void OnSuccessCallback_1(void * context, int16_t occupiedCoolingSetpoint) - { - (static_cast(context))->OnSuccessResponse_1(occupiedCoolingSetpoint); - } - - static void OnFailureCallback_2(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_2(error); - } - - static void OnSuccessCallback_2(void * context) { (static_cast(context))->OnSuccessResponse_2(); } - - static void OnFailureCallback_3(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_3(error); - } - - static void OnSuccessCallback_3(void * context, int16_t occupiedCoolingSetpoint) - { - (static_cast(context))->OnSuccessResponse_3(occupiedCoolingSetpoint); - } - - static void OnFailureCallback_4(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_4(error); - } - - static void OnSuccessCallback_4(void * context) { (static_cast(context))->OnSuccessResponse_4(); } - - static void OnFailureCallback_5(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_5(error); - } - - static void OnSuccessCallback_5(void * context) { (static_cast(context))->OnSuccessResponse_5(); } - - static void OnFailureCallback_6(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_6(error); - } - - static void OnSuccessCallback_6(void * context, int16_t occupiedHeatingSetpoint) - { - (static_cast(context))->OnSuccessResponse_6(occupiedHeatingSetpoint); - } - - static void OnFailureCallback_7(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_7(error); - } - - static void OnSuccessCallback_7(void * context) { (static_cast(context))->OnSuccessResponse_7(); } - - static void OnFailureCallback_8(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_8(error); - } - - static void OnSuccessCallback_8(void * context, int16_t occupiedHeatingSetpoint) - { - (static_cast(context))->OnSuccessResponse_8(occupiedHeatingSetpoint); - } - - static void OnFailureCallback_9(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_9(error); - } - - static void OnSuccessCallback_9(void * context) { (static_cast(context))->OnSuccessResponse_9(); } - - static void OnFailureCallback_10(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_10(error); - } - - static void OnSuccessCallback_10(void * context) { (static_cast(context))->OnSuccessResponse_10(); } - - static void OnFailureCallback_11(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_11(error); - } - - static void OnSuccessCallback_11(void * context, int16_t minHeatSetpointLimit) - { - (static_cast(context))->OnSuccessResponse_11(minHeatSetpointLimit); - } - - static void OnFailureCallback_12(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_12(error); - } - - static void OnSuccessCallback_12(void * context) { (static_cast(context))->OnSuccessResponse_12(); } - - static void OnFailureCallback_13(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_13(error); - } - - static void OnSuccessCallback_13(void * context, int16_t minHeatSetpointLimit) - { - (static_cast(context))->OnSuccessResponse_13(minHeatSetpointLimit); - } - - static void OnFailureCallback_14(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_14(error); - } - - static void OnSuccessCallback_14(void * context) { (static_cast(context))->OnSuccessResponse_14(); } - - static void OnFailureCallback_15(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_15(error); - } - - static void OnSuccessCallback_15(void * context) { (static_cast(context))->OnSuccessResponse_15(); } - - static void OnFailureCallback_16(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_16(error); - } - - static void OnSuccessCallback_16(void * context, int16_t maxHeatSetpointLimit) - { - (static_cast(context))->OnSuccessResponse_16(maxHeatSetpointLimit); - } - - static void OnFailureCallback_17(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_17(error); - } - - static void OnSuccessCallback_17(void * context) { (static_cast(context))->OnSuccessResponse_17(); } - - static void OnFailureCallback_18(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_18(error); - } - - static void OnSuccessCallback_18(void * context, int16_t maxHeatSetpointLimit) - { - (static_cast(context))->OnSuccessResponse_18(maxHeatSetpointLimit); - } - - static void OnFailureCallback_19(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_19(error); - } - - static void OnSuccessCallback_19(void * context) { (static_cast(context))->OnSuccessResponse_19(); } - - static void OnFailureCallback_20(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_20(error); - } - - static void OnSuccessCallback_20(void * context) { (static_cast(context))->OnSuccessResponse_20(); } - - static void OnFailureCallback_21(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_21(error); - } - - static void OnSuccessCallback_21(void * context, int16_t minCoolSetpointLimit) - { - (static_cast(context))->OnSuccessResponse_21(minCoolSetpointLimit); - } - - static void OnFailureCallback_22(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_22(error); - } - - static void OnSuccessCallback_22(void * context) { (static_cast(context))->OnSuccessResponse_22(); } - - static void OnFailureCallback_23(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_23(error); - } - - static void OnSuccessCallback_23(void * context, int16_t minCoolSetpointLimit) - { - (static_cast(context))->OnSuccessResponse_23(minCoolSetpointLimit); - } - - static void OnFailureCallback_24(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_24(error); - } - - static void OnSuccessCallback_24(void * context) { (static_cast(context))->OnSuccessResponse_24(); } - - static void OnFailureCallback_25(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_25(error); - } - - static void OnSuccessCallback_25(void * context) { (static_cast(context))->OnSuccessResponse_25(); } - - static void OnFailureCallback_26(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_26(error); - } - - static void OnSuccessCallback_26(void * context, int16_t maxCoolSetpointLimit) - { - (static_cast(context))->OnSuccessResponse_26(maxCoolSetpointLimit); - } - - static void OnFailureCallback_27(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_27(error); - } - - static void OnSuccessCallback_27(void * context) { (static_cast(context))->OnSuccessResponse_27(); } - - static void OnFailureCallback_28(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_28(error); - } - - static void OnSuccessCallback_28(void * context, int16_t maxCoolSetpointLimit) - { - (static_cast(context))->OnSuccessResponse_28(maxCoolSetpointLimit); - } - - static void OnFailureCallback_29(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_29(error); - } - - static void OnSuccessCallback_29(void * context) { (static_cast(context))->OnSuccessResponse_29(); } - - static void OnFailureCallback_30(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_30(error); - } - - static void OnSuccessCallback_30(void * context) { (static_cast(context))->OnSuccessResponse_30(); } - - static void OnFailureCallback_31(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_31(error); - } - - static void OnSuccessCallback_31(void * context) { (static_cast(context))->OnSuccessResponse_31(); } - - static void OnFailureCallback_32(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_32(error); - } - - static void OnSuccessCallback_32(void * context) { (static_cast(context))->OnSuccessResponse_32(); } - - static void OnFailureCallback_33(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_33(error); - } - - static void OnSuccessCallback_33(void * context) { (static_cast(context))->OnSuccessResponse_33(); } - - static void OnFailureCallback_34(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_34(error); - } - - static void OnSuccessCallback_34(void * context) { (static_cast(context))->OnSuccessResponse_34(); } - - static void OnFailureCallback_35(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_35(error); - } - - static void OnSuccessCallback_35(void * context) { (static_cast(context))->OnSuccessResponse_35(); } - - static void OnFailureCallback_36(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_36(error); - } - - static void OnSuccessCallback_36(void * context) { (static_cast(context))->OnSuccessResponse_36(); } - - static void OnFailureCallback_37(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_37(error); - } - - static void OnSuccessCallback_37(void * context) { (static_cast(context))->OnSuccessResponse_37(); } - - static void OnFailureCallback_38(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_38(error); - } - - static void OnSuccessCallback_38(void * context) { (static_cast(context))->OnSuccessResponse_38(); } - - static void OnFailureCallback_39(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_39(error); - } - - static void OnSuccessCallback_39(void * context, - chip::app::Clusters::Thermostat::ThermostatControlSequence controlSequenceOfOperation) - { - (static_cast(context))->OnSuccessResponse_39(controlSequenceOfOperation); - } - - static void OnFailureCallback_40(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_40(error); - } - - static void OnSuccessCallback_40(void * context) { (static_cast(context))->OnSuccessResponse_40(); } - - static void OnFailureCallback_41(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_41(error); - } - - static void OnSuccessCallback_41(void * context, - chip::app::Clusters::Thermostat::ThermostatControlSequence controlSequenceOfOperation) - { - (static_cast(context))->OnSuccessResponse_41(controlSequenceOfOperation); - } - - static void OnFailureCallback_42(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_42(error); - } - - static void OnSuccessCallback_42(void * context) { (static_cast(context))->OnSuccessResponse_42(); } - - static void OnFailureCallback_43(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_43(error); - } - - static void OnSuccessCallback_43(void * context) { (static_cast(context))->OnSuccessResponse_43(); } - - static void OnFailureCallback_44(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_44(error); - } - - static void OnSuccessCallback_44(void * context) { (static_cast(context))->OnSuccessResponse_44(); } - - static void OnFailureCallback_45(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_45(error); - } - - static void OnSuccessCallback_45(void * context) { (static_cast(context))->OnSuccessResponse_45(); } - - static void OnFailureCallback_46(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_46(error); - } - - static void OnSuccessCallback_46(void * context) { (static_cast(context))->OnSuccessResponse_46(); } - - static void OnFailureCallback_47(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_47(error); - } - - static void OnSuccessCallback_47(void * context) { (static_cast(context))->OnSuccessResponse_47(); } - - static void OnFailureCallback_48(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_48(error); - } - - static void OnSuccessCallback_48(void * context) { (static_cast(context))->OnSuccessResponse_48(); } - - static void OnFailureCallback_49(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_49(error); - } - - static void OnSuccessCallback_49(void * context) { (static_cast(context))->OnSuccessResponse_49(); } - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestReadsOccupiedCoolingSetpointAttributeFromServerDutAndVerifiesThatTheValueIsWithinRange_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ThermostatClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_1, OnFailureCallback_1, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() - : ThrowFailureResponse(error); - } - - void OnSuccessResponse_1(int16_t occupiedCoolingSetpoint) - { - VerifyOrReturn(CheckValue("occupiedCoolingSetpoint", occupiedCoolingSetpoint, 2600)); - VerifyOrReturn(CheckConstraintType("occupiedCoolingSetpoint", "", "int16")); - VerifyOrReturn(CheckConstraintMinValue("occupiedCoolingSetpoint", occupiedCoolingSetpoint, 1600)); - VerifyOrReturn(CheckConstraintMaxValue("occupiedCoolingSetpoint", occupiedCoolingSetpoint, 2600)); - NextTest(); - } - - CHIP_ERROR TestWritesAValueBackThatIsDifferentButValidForOccupiedCoolingSetpointAttribute_2() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ThermostatClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - int16_t occupiedCoolingSetpointArgument; - occupiedCoolingSetpointArgument = 2000; - - ReturnErrorOnFailure(cluster.WriteAttribute( - occupiedCoolingSetpointArgument, this, OnSuccessCallback_2, OnFailureCallback_2)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_2(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() - : ThrowFailureResponse(error); - } - - void OnSuccessResponse_2() { NextTest(); } - - CHIP_ERROR TestReadsItBackAgainToConfirmTheSuccessfulWriteOfOccupiedCoolingSetpointAttribute_3() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ThermostatClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_3, OnFailureCallback_3, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_3(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() - : ThrowFailureResponse(error); - } - - void OnSuccessResponse_3(int16_t occupiedCoolingSetpoint) - { - VerifyOrReturn(CheckValue("occupiedCoolingSetpoint", occupiedCoolingSetpoint, 2000)); - - NextTest(); - } - - CHIP_ERROR TestWritesTheLimitOfMinCoolSetpointLimitToOccupiedCoolingSetpointAttribute_4() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ThermostatClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - int16_t occupiedCoolingSetpointArgument; - occupiedCoolingSetpointArgument = 1600; - - ReturnErrorOnFailure(cluster.WriteAttribute( - occupiedCoolingSetpointArgument, this, OnSuccessCallback_4, OnFailureCallback_4)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_4(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() - : ThrowFailureResponse(error); - } - - void OnSuccessResponse_4() { NextTest(); } - - CHIP_ERROR TestWritesTheLimitOfMaxCoolSetpointLimitToOccupiedCoolingSetpointAttribute_5() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ThermostatClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - int16_t occupiedCoolingSetpointArgument; - occupiedCoolingSetpointArgument = 2600; - - ReturnErrorOnFailure(cluster.WriteAttribute( - occupiedCoolingSetpointArgument, this, OnSuccessCallback_5, OnFailureCallback_5)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_5(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() - : ThrowFailureResponse(error); - } - - void OnSuccessResponse_5() { NextTest(); } - - CHIP_ERROR TestReadsOccupiedHeatingSetpointAttributeFromServerDutAndVerifiesThatTheValueIsWithinRange_6() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ThermostatClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_6, OnFailureCallback_6, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_6(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_6(int16_t occupiedHeatingSetpoint) - { - VerifyOrReturn(CheckValue("occupiedHeatingSetpoint", occupiedHeatingSetpoint, 2000)); - VerifyOrReturn(CheckConstraintType("occupiedHeatingSetpoint", "", "int16")); - VerifyOrReturn(CheckConstraintMinValue("occupiedHeatingSetpoint", occupiedHeatingSetpoint, 700)); - VerifyOrReturn(CheckConstraintMaxValue("occupiedHeatingSetpoint", occupiedHeatingSetpoint, 3000)); - NextTest(); - } - - CHIP_ERROR TestWritesAValueBackThatIsDifferentButValidForOccupiedHeatingSetpointAttribute_7() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ThermostatClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - int16_t occupiedHeatingSetpointArgument; - occupiedHeatingSetpointArgument = 2100; - - ReturnErrorOnFailure(cluster.WriteAttribute( - occupiedHeatingSetpointArgument, this, OnSuccessCallback_7, OnFailureCallback_7)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_7(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_7() { NextTest(); } - - CHIP_ERROR TestReadsItBackAgainToConfirmTheSuccessfulWriteOfOccupiedHeatingSetpointAttribute_8() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ThermostatClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_8, OnFailureCallback_8, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_8(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_8(int16_t occupiedHeatingSetpoint) - { - VerifyOrReturn(CheckValue("occupiedHeatingSetpoint", occupiedHeatingSetpoint, 2100)); - - NextTest(); - } - - CHIP_ERROR TestWritesTheLimitOfMinHeatSetpointLimitToOccupiedHeatingSetpointAttribute_9() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ThermostatClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - int16_t occupiedHeatingSetpointArgument; - occupiedHeatingSetpointArgument = 700; - - ReturnErrorOnFailure(cluster.WriteAttribute( - occupiedHeatingSetpointArgument, this, OnSuccessCallback_9, OnFailureCallback_9)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_9(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_9() { NextTest(); } - - CHIP_ERROR TestWritesTheLimitOfMaxHeatSetpointLimitToOccupiedHeatingSetpointAttribute_10() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ThermostatClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - int16_t occupiedHeatingSetpointArgument; - occupiedHeatingSetpointArgument = 3000; - - ReturnErrorOnFailure(cluster.WriteAttribute( - occupiedHeatingSetpointArgument, this, OnSuccessCallback_10, OnFailureCallback_10)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_10(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_10() { NextTest(); } - - CHIP_ERROR TestReadsMinHeatSetpointLimitAttributeFromServerDutAndVerifiesThatTheValueIsWithinRange_11() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ThermostatClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_11, OnFailureCallback_11, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_11(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_11(int16_t minHeatSetpointLimit) - { - VerifyOrReturn(CheckValue("minHeatSetpointLimit", minHeatSetpointLimit, 700)); - VerifyOrReturn(CheckConstraintType("minHeatSetpointLimit", "", "int16")); - VerifyOrReturn(CheckConstraintMinValue("minHeatSetpointLimit", minHeatSetpointLimit, 700)); - VerifyOrReturn(CheckConstraintMaxValue("minHeatSetpointLimit", minHeatSetpointLimit, 3000)); - NextTest(); - } - - CHIP_ERROR TestWritesAValueBackThatIsDifferentButValidForMinHeatSetpointLimitAttribute_12() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ThermostatClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - int16_t minHeatSetpointLimitArgument; - minHeatSetpointLimitArgument = 2000; - - ReturnErrorOnFailure(cluster.WriteAttribute( - minHeatSetpointLimitArgument, this, OnSuccessCallback_12, OnFailureCallback_12)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_12(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_12() { NextTest(); } - - CHIP_ERROR TestReadsItBackAgainToConfirmTheSuccessfulWriteOfMinHeatSetpointLimitAttribute_13() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ThermostatClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_13, OnFailureCallback_13, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_13(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_13(int16_t minHeatSetpointLimit) - { - VerifyOrReturn(CheckValue("minHeatSetpointLimit", minHeatSetpointLimit, 2000)); - - NextTest(); - } - - CHIP_ERROR TestWritesTheLimitOfAbsMinHeatSetpointLimitToMinHeatSetpointLimitAttribute_14() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ThermostatClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - int16_t minHeatSetpointLimitArgument; - minHeatSetpointLimitArgument = 700; - - ReturnErrorOnFailure(cluster.WriteAttribute( - minHeatSetpointLimitArgument, this, OnSuccessCallback_14, OnFailureCallback_14)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_14(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_14() { NextTest(); } - - CHIP_ERROR TestWritesTheLimitOfAbsMaxHeatSetpointLimitToMinHeatSetpointLimitAttribute_15() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ThermostatClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - int16_t minHeatSetpointLimitArgument; - minHeatSetpointLimitArgument = 3000; - - ReturnErrorOnFailure(cluster.WriteAttribute( - minHeatSetpointLimitArgument, this, OnSuccessCallback_15, OnFailureCallback_15)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_15(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_15() { NextTest(); } - - CHIP_ERROR TestReadsMaxHeatSetpointLimitAttributeFromServerDutAndVerifiesThatTheValueIsWithinRange_16() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ThermostatClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_16, OnFailureCallback_16, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_16(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_16(int16_t maxHeatSetpointLimit) - { - VerifyOrReturn(CheckValue("maxHeatSetpointLimit", maxHeatSetpointLimit, 3000)); - VerifyOrReturn(CheckConstraintType("maxHeatSetpointLimit", "", "int16")); - VerifyOrReturn(CheckConstraintMinValue("maxHeatSetpointLimit", maxHeatSetpointLimit, 700)); - VerifyOrReturn(CheckConstraintMaxValue("maxHeatSetpointLimit", maxHeatSetpointLimit, 3000)); - NextTest(); - } - - CHIP_ERROR TestWritesAValueBackThatIsDifferentButValidForMaxHeatSetpointLimitAttribute_17() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ThermostatClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - int16_t maxHeatSetpointLimitArgument; - maxHeatSetpointLimitArgument = 2000; - - ReturnErrorOnFailure(cluster.WriteAttribute( - maxHeatSetpointLimitArgument, this, OnSuccessCallback_17, OnFailureCallback_17)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_17(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_17() { NextTest(); } - - CHIP_ERROR TestReadsItBackAgainToConfirmTheSuccessfulWriteOfMaxHeatSetpointLimitAttribute_18() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ThermostatClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_18, OnFailureCallback_18, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_18(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_18(int16_t maxHeatSetpointLimit) - { - VerifyOrReturn(CheckValue("maxHeatSetpointLimit", maxHeatSetpointLimit, 2000)); - - NextTest(); - } - - CHIP_ERROR TestWritesTheLimitOfAbsMinHeatSetpointLimitToMaxHeatSetpointLimitAttribute_19() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ThermostatClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - int16_t maxHeatSetpointLimitArgument; - maxHeatSetpointLimitArgument = 700; - - ReturnErrorOnFailure(cluster.WriteAttribute( - maxHeatSetpointLimitArgument, this, OnSuccessCallback_19, OnFailureCallback_19)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_19(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_19() { NextTest(); } - - CHIP_ERROR TestWritesTheLimitOfAbsMaxHeatSetpointLimitToMaxHeatSetpointLimitAttribute_20() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ThermostatClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - int16_t maxHeatSetpointLimitArgument; - maxHeatSetpointLimitArgument = 3000; - - ReturnErrorOnFailure(cluster.WriteAttribute( - maxHeatSetpointLimitArgument, this, OnSuccessCallback_20, OnFailureCallback_20)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_20(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_20() { NextTest(); } - - CHIP_ERROR TestReadsMinCoolSetpointLimitAttributeFromServerDutAndVerifiesThatTheValueIsWithinRange_21() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ThermostatClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_21, OnFailureCallback_21, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_21(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() - : ThrowFailureResponse(error); - } - - void OnSuccessResponse_21(int16_t minCoolSetpointLimit) - { - VerifyOrReturn(CheckValue("minCoolSetpointLimit", minCoolSetpointLimit, 1600)); - VerifyOrReturn(CheckConstraintType("minCoolSetpointLimit", "", "int16")); - VerifyOrReturn(CheckConstraintMinValue("minCoolSetpointLimit", minCoolSetpointLimit, 1600)); - VerifyOrReturn(CheckConstraintMaxValue("minCoolSetpointLimit", minCoolSetpointLimit, 3200)); - NextTest(); - } - - CHIP_ERROR TestWritesAValueBackThatIsDifferentButValidForMinCoolSetpointLimitAttribute_22() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ThermostatClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - int16_t minCoolSetpointLimitArgument; - minCoolSetpointLimitArgument = 2000; - - ReturnErrorOnFailure(cluster.WriteAttribute( - minCoolSetpointLimitArgument, this, OnSuccessCallback_22, OnFailureCallback_22)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_22(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() - : ThrowFailureResponse(error); - } - - void OnSuccessResponse_22() { NextTest(); } - - CHIP_ERROR TestReadsItBackAgainToConfirmTheSuccessfulWriteOfMinCoolSetpointLimitAttribute_23() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ThermostatClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_23, OnFailureCallback_23, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_23(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() - : ThrowFailureResponse(error); - } - - void OnSuccessResponse_23(int16_t minCoolSetpointLimit) - { - VerifyOrReturn(CheckValue("minCoolSetpointLimit", minCoolSetpointLimit, 2000)); - - NextTest(); - } - - CHIP_ERROR TestWritesTheLimitOfAbsMinCoolSetpointLimitToMinCoolSetpointLimitAttribute_24() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ThermostatClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - int16_t minCoolSetpointLimitArgument; - minCoolSetpointLimitArgument = 1600; - - ReturnErrorOnFailure(cluster.WriteAttribute( - minCoolSetpointLimitArgument, this, OnSuccessCallback_24, OnFailureCallback_24)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_24(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() - : ThrowFailureResponse(error); - } - - void OnSuccessResponse_24() { NextTest(); } - - CHIP_ERROR TestWritesTheLimitOfMaxCoolSetpointLimitToMinCoolSetpointLimitAttribute_25() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ThermostatClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - int16_t minCoolSetpointLimitArgument; - minCoolSetpointLimitArgument = 3200; - - ReturnErrorOnFailure(cluster.WriteAttribute( - minCoolSetpointLimitArgument, this, OnSuccessCallback_25, OnFailureCallback_25)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_25(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() - : ThrowFailureResponse(error); - } - - void OnSuccessResponse_25() { NextTest(); } - - CHIP_ERROR TestReadsMaxCoolSetpointLimitAttributeFromServerDutAndVerifiesThatTheValueIsWithinRange_26() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ThermostatClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_26, OnFailureCallback_26, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_26(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() - : ThrowFailureResponse(error); - } - - void OnSuccessResponse_26(int16_t maxCoolSetpointLimit) - { - VerifyOrReturn(CheckValue("maxCoolSetpointLimit", maxCoolSetpointLimit, 3200)); - VerifyOrReturn(CheckConstraintType("maxCoolSetpointLimit", "", "int16")); - VerifyOrReturn(CheckConstraintMinValue("maxCoolSetpointLimit", maxCoolSetpointLimit, 1600)); - VerifyOrReturn(CheckConstraintMaxValue("maxCoolSetpointLimit", maxCoolSetpointLimit, 3200)); - NextTest(); - } - - CHIP_ERROR TestWritesAValueBackThatIsDifferentButValidForMaxCoolSetpointLimitAttribute_27() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ThermostatClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - int16_t maxCoolSetpointLimitArgument; - maxCoolSetpointLimitArgument = 2000; - - ReturnErrorOnFailure(cluster.WriteAttribute( - maxCoolSetpointLimitArgument, this, OnSuccessCallback_27, OnFailureCallback_27)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_27(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() - : ThrowFailureResponse(error); - } - - void OnSuccessResponse_27() { NextTest(); } - - CHIP_ERROR TestReadsItBackAgainToConfirmTheSuccessfulWriteOfMaxCoolSetpointLimitAttribute_28() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ThermostatClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_28, OnFailureCallback_28, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_28(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() - : ThrowFailureResponse(error); - } - - void OnSuccessResponse_28(int16_t maxCoolSetpointLimit) - { - VerifyOrReturn(CheckValue("maxCoolSetpointLimit", maxCoolSetpointLimit, 2000)); - - NextTest(); - } - - CHIP_ERROR TestWritesTheLimitOfAbsMinCoolSetpointLimitToMaxCoolSetpointLimitAttribute_29() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ThermostatClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - int16_t maxCoolSetpointLimitArgument; - maxCoolSetpointLimitArgument = 1600; - - ReturnErrorOnFailure(cluster.WriteAttribute( - maxCoolSetpointLimitArgument, this, OnSuccessCallback_29, OnFailureCallback_29)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_29(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() - : ThrowFailureResponse(error); - } - - void OnSuccessResponse_29() { NextTest(); } - - CHIP_ERROR TestWritesTheLimitOfMaxCoolSetpointLimitToMaxCoolSetpointLimitAttribute_30() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ThermostatClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - int16_t maxCoolSetpointLimitArgument; - maxCoolSetpointLimitArgument = 3200; - - ReturnErrorOnFailure(cluster.WriteAttribute( - maxCoolSetpointLimitArgument, this, OnSuccessCallback_30, OnFailureCallback_30)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_30(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() - : ThrowFailureResponse(error); - } - - void OnSuccessResponse_30() { NextTest(); } - - CHIP_ERROR TestWritesSetsBackTheLimitOfMinHeatSetpointLimitToMinHeatSetpointLimitAttribute_31() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ThermostatClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - int16_t minHeatSetpointLimitArgument; - minHeatSetpointLimitArgument = 700; - - ReturnErrorOnFailure(cluster.WriteAttribute( - minHeatSetpointLimitArgument, this, OnSuccessCallback_31, OnFailureCallback_31)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_31(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_31() { NextTest(); } - - CHIP_ERROR TestWritesSetsBackTheLimitOfMaxHeatSetpointLimitToMinHeatSetpointLimitAttribute_32() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ThermostatClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - int16_t minHeatSetpointLimitArgument; - minHeatSetpointLimitArgument = 3000; - - ReturnErrorOnFailure(cluster.WriteAttribute( - minHeatSetpointLimitArgument, this, OnSuccessCallback_32, OnFailureCallback_32)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_32(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_32() { NextTest(); } - - CHIP_ERROR TestWritesSetsBackTheLimitOfMinHeatSetpointLimitToMaxHeatSetpointLimitAttribute_33() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ThermostatClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - int16_t maxHeatSetpointLimitArgument; - maxHeatSetpointLimitArgument = 700; - - ReturnErrorOnFailure(cluster.WriteAttribute( - maxHeatSetpointLimitArgument, this, OnSuccessCallback_33, OnFailureCallback_33)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_33(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_33() { NextTest(); } - - CHIP_ERROR TestWritesSetsBackTheLimitOfMaxHeatSetpointLimitToMaxHeatSetpointLimitAttribute_34() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ThermostatClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - int16_t maxHeatSetpointLimitArgument; - maxHeatSetpointLimitArgument = 3000; - - ReturnErrorOnFailure(cluster.WriteAttribute( - maxHeatSetpointLimitArgument, this, OnSuccessCallback_34, OnFailureCallback_34)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_34(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_34() { NextTest(); } - - CHIP_ERROR TestWritesSetsBackTheLimitOfMinCoolSetpointLimitToMinCoolSetpointLimitAttribute_35() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ThermostatClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - int16_t minCoolSetpointLimitArgument; - minCoolSetpointLimitArgument = 1600; - - ReturnErrorOnFailure(cluster.WriteAttribute( - minCoolSetpointLimitArgument, this, OnSuccessCallback_35, OnFailureCallback_35)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_35(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() - : ThrowFailureResponse(error); - } - - void OnSuccessResponse_35() { NextTest(); } - - CHIP_ERROR TestWritesSetsBackTheLimitOfMaxCoolSetpointLimitToMinCoolSetpointLimitAttribute_36() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ThermostatClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - int16_t minCoolSetpointLimitArgument; - minCoolSetpointLimitArgument = 3200; - - ReturnErrorOnFailure(cluster.WriteAttribute( - minCoolSetpointLimitArgument, this, OnSuccessCallback_36, OnFailureCallback_36)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_36(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() - : ThrowFailureResponse(error); - } - - void OnSuccessResponse_36() { NextTest(); } - - CHIP_ERROR TestWritesSetsBackTheLimitOfMinCoolSetpointLimitToMaxCoolSetpointLimitAttribute_37() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ThermostatClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - int16_t maxCoolSetpointLimitArgument; - maxCoolSetpointLimitArgument = 1600; - - ReturnErrorOnFailure(cluster.WriteAttribute( - maxCoolSetpointLimitArgument, this, OnSuccessCallback_37, OnFailureCallback_37)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_37(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() - : ThrowFailureResponse(error); - } - - void OnSuccessResponse_37() { NextTest(); } - - CHIP_ERROR TestWritesSetsBackTheLimitOfMaxCoolSetpointLimitToMaxCoolSetpointLimitAttribute_38() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ThermostatClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - int16_t maxCoolSetpointLimitArgument; - maxCoolSetpointLimitArgument = 3200; - - ReturnErrorOnFailure(cluster.WriteAttribute( - maxCoolSetpointLimitArgument, this, OnSuccessCallback_38, OnFailureCallback_38)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_38(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() - : ThrowFailureResponse(error); - } - - void OnSuccessResponse_38() { NextTest(); } - - CHIP_ERROR TestReadsControlSequenceOfOperationFromServerDutAndVerifiesThatTheValueIsValid_39() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ThermostatClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_39, OnFailureCallback_39, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_39(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_39(chip::app::Clusters::Thermostat::ThermostatControlSequence controlSequenceOfOperation) - { - VerifyOrReturn(CheckValue("controlSequenceOfOperation", controlSequenceOfOperation, 4)); - VerifyOrReturn(CheckConstraintType("controlSequenceOfOperation", "", "enum8")); - VerifyOrReturn(CheckConstraintMinValue("controlSequenceOfOperation", controlSequenceOfOperation, 0)); - VerifyOrReturn(CheckConstraintMaxValue("controlSequenceOfOperation", controlSequenceOfOperation, 5)); - NextTest(); - } - - CHIP_ERROR TestWriteAttributeCommandForControlSequenceOfOperationWithANewValidValue_40() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ThermostatClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::Clusters::Thermostat::ThermostatControlSequence controlSequenceOfOperationArgument; - controlSequenceOfOperationArgument = static_cast(2); - - ReturnErrorOnFailure( - cluster.WriteAttribute( - controlSequenceOfOperationArgument, this, OnSuccessCallback_40, OnFailureCallback_40)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_40(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_40() { NextTest(); } - - CHIP_ERROR TestReadItBackAgainToConfirmTheSuccessfulWrite_41() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ThermostatClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_41, OnFailureCallback_41, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_41(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_41(chip::app::Clusters::Thermostat::ThermostatControlSequence controlSequenceOfOperation) - { - VerifyOrReturn(CheckValue("controlSequenceOfOperation", controlSequenceOfOperation, 2)); - - NextTest(); - } - - CHIP_ERROR TestSetsOccupiedHeatingSetpointToDefaultValue_42() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ThermostatClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - int16_t occupiedHeatingSetpointArgument; - occupiedHeatingSetpointArgument = 2000; - - ReturnErrorOnFailure(cluster.WriteAttribute( - occupiedHeatingSetpointArgument, this, OnSuccessCallback_42, OnFailureCallback_42)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_42(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_42() { NextTest(); } - - CHIP_ERROR TestSetsOccupiedHeatingSetpointToDefaultValue_43() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ThermostatClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - int16_t occupiedHeatingSetpointArgument; - occupiedHeatingSetpointArgument = 2000; - - ReturnErrorOnFailure(cluster.WriteAttribute( - occupiedHeatingSetpointArgument, this, OnSuccessCallback_43, OnFailureCallback_43)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_43(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_43() { NextTest(); } - - CHIP_ERROR TestSetsOccupiedCoolingSetpointToDefaultValue_44() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ThermostatClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - int16_t occupiedCoolingSetpointArgument; - occupiedCoolingSetpointArgument = 2600; - - ReturnErrorOnFailure(cluster.WriteAttribute( - occupiedCoolingSetpointArgument, this, OnSuccessCallback_44, OnFailureCallback_44)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_44(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() - : ThrowFailureResponse(error); - } - - void OnSuccessResponse_44() { NextTest(); } - - CHIP_ERROR TestSetsOccupiedCoolingSetpointToDefaultValue_45() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ThermostatClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - int16_t occupiedCoolingSetpointArgument; - occupiedCoolingSetpointArgument = 2600; - - ReturnErrorOnFailure(cluster.WriteAttribute( - occupiedCoolingSetpointArgument, this, OnSuccessCallback_45, OnFailureCallback_45)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_45(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() - : ThrowFailureResponse(error); - } - - void OnSuccessResponse_45() { NextTest(); } - - CHIP_ERROR TestSetsOccupiedCoolingSetpointToDefaultValue_46() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ThermostatClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - int16_t occupiedCoolingSetpointArgument; - occupiedCoolingSetpointArgument = 2600; - - ReturnErrorOnFailure(cluster.WriteAttribute( - occupiedCoolingSetpointArgument, this, OnSuccessCallback_46, OnFailureCallback_46)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_46(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() - : ThrowFailureResponse(error); - } - - void OnSuccessResponse_46() { NextTest(); } - - CHIP_ERROR TestSetsOccupiedHeatingSetpointToDefaultValue_47() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ThermostatClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - int16_t occupiedHeatingSetpointArgument; - occupiedHeatingSetpointArgument = 2000; - - ReturnErrorOnFailure(cluster.WriteAttribute( - occupiedHeatingSetpointArgument, this, OnSuccessCallback_47, OnFailureCallback_47)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_47(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_47() { NextTest(); } - - CHIP_ERROR TestSetsOccupiedCoolingSetpointToDefaultValue_48() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ThermostatClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - int16_t occupiedCoolingSetpointArgument; - occupiedCoolingSetpointArgument = 2600; - - ReturnErrorOnFailure(cluster.WriteAttribute( - occupiedCoolingSetpointArgument, this, OnSuccessCallback_48, OnFailureCallback_48)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_48(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() - : ThrowFailureResponse(error); - } - - void OnSuccessResponse_48() { NextTest(); } - - CHIP_ERROR TestSetsOccupiedHeatingSetpointToDefaultValue_49() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ThermostatClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - int16_t occupiedHeatingSetpointArgument; - occupiedHeatingSetpointArgument = 2000; - - ReturnErrorOnFailure(cluster.WriteAttribute( - occupiedHeatingSetpointArgument, this, OnSuccessCallback_49, OnFailureCallback_49)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_49(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_49() { NextTest(); } -}; - -class Test_TC_TSUIC_1_1Suite : public TestCommand -{ -public: - Test_TC_TSUIC_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_TSUIC_1_1", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_TSUIC_1_1Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_TSUIC_1_1\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_TSUIC_1_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Read the global attribute constraints: ClusterRevision\n"); - err = TestReadTheGlobalAttributeConstraintsClusterRevision_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Read the global attribute: AttributeList\n"); - err = TestReadTheGlobalAttributeAttributeList_2(); - break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Read the global attribute: AcceptedCommandList\n"); - err = TestReadTheGlobalAttributeAcceptedCommandList_3(); - break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Read the global attribute: GeneratedCommandList\n"); - err = TestReadTheGlobalAttributeGeneratedCommandList_4(); - break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 5; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - static void OnFailureCallback_1(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_1(error); - } - - static void OnSuccessCallback_1(void * context, uint16_t clusterRevision) - { - (static_cast(context))->OnSuccessResponse_1(clusterRevision); - } - - static void OnFailureCallback_2(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_2(error); - } - - static void OnSuccessCallback_2(void * context, const chip::app::DataModel::DecodableList & attributeList) - { - (static_cast(context))->OnSuccessResponse_2(attributeList); - } - - static void OnFailureCallback_3(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_3(error); - } - - static void OnSuccessCallback_3(void * context, - const chip::app::DataModel::DecodableList & acceptedCommandList) - { - (static_cast(context))->OnSuccessResponse_3(acceptedCommandList); - } - - static void OnFailureCallback_4(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_4(error); - } - - static void OnSuccessCallback_4(void * context, - const chip::app::DataModel::DecodableList & generatedCommandList) - { - (static_cast(context))->OnSuccessResponse_4(generatedCommandList); - } - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestReadTheGlobalAttributeConstraintsClusterRevision_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ThermostatUserInterfaceConfigurationClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_1, OnFailureCallback_1, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_1(uint16_t clusterRevision) - { - VerifyOrReturn(CheckConstraintType("clusterRevision", "", "uint16")); - NextTest(); - } - - CHIP_ERROR TestReadTheGlobalAttributeAttributeList_2() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ThermostatUserInterfaceConfigurationClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_2, OnFailureCallback_2, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_2(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_2(const chip::app::DataModel::DecodableList & attributeList) - { - VerifyOrReturn(CheckConstraintType("attributeList", "", "list")); - NextTest(); - } - - CHIP_ERROR TestReadTheGlobalAttributeAcceptedCommandList_3() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ThermostatUserInterfaceConfigurationClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute< - chip::app::Clusters::ThermostatUserInterfaceConfiguration::Attributes::AcceptedCommandList::TypeInfo>( - this, OnSuccessCallback_3, OnFailureCallback_3, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_3(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_3(const chip::app::DataModel::DecodableList & acceptedCommandList) - { - VerifyOrReturn(CheckConstraintType("acceptedCommandList", "", "list")); - NextTest(); - } - - CHIP_ERROR TestReadTheGlobalAttributeGeneratedCommandList_4() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ThermostatUserInterfaceConfigurationClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute< - chip::app::Clusters::ThermostatUserInterfaceConfiguration::Attributes::GeneratedCommandList::TypeInfo>( - this, OnSuccessCallback_4, OnFailureCallback_4, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_4(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_4(const chip::app::DataModel::DecodableList & generatedCommandList) - { - VerifyOrReturn(CheckConstraintType("generatedCommandList", "", "list")); - NextTest(); - } -}; - -class Test_TC_TSUIC_2_1Suite : public TestCommand -{ -public: - Test_TC_TSUIC_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_TSUIC_2_1", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_TSUIC_2_1Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_TSUIC_2_1\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_TSUIC_2_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : read the mandatory attribute: TemperatureDisplayMode\n"); - err = TestReadTheMandatoryAttributeTemperatureDisplayMode_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : read the mandatory attribute: TemperatureDisplayMode\n"); - err = TestReadTheMandatoryAttributeTemperatureDisplayMode_2(); - break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : read the mandatory attribute: KeypadLockout\n"); - err = TestReadTheMandatoryAttributeKeypadLockout_3(); - break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : read the mandatory attribute: KeypadLockout\n"); - err = TestReadTheMandatoryAttributeKeypadLockout_4(); - break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : read the optional attribute: ScheduleProgrammingVisibility\n"); - err = TestReadTheOptionalAttributeScheduleProgrammingVisibility_5(); - break; - case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : read the optional attribute: ScheduleProgrammingVisibility\n"); - err = TestReadTheOptionalAttributeScheduleProgrammingVisibility_6(); - break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 7; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - static void OnFailureCallback_1(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_1(error); - } - - static void OnSuccessCallback_1(void * context, uint8_t temperatureDisplayMode) - { - (static_cast(context))->OnSuccessResponse_1(temperatureDisplayMode); - } - - static void OnFailureCallback_2(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_2(error); - } - - static void OnSuccessCallback_2(void * context, uint8_t temperatureDisplayMode) - { - (static_cast(context))->OnSuccessResponse_2(temperatureDisplayMode); - } - - static void OnFailureCallback_3(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_3(error); - } - - static void OnSuccessCallback_3(void * context, uint8_t keypadLockout) - { - (static_cast(context))->OnSuccessResponse_3(keypadLockout); - } - - static void OnFailureCallback_4(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_4(error); - } - - static void OnSuccessCallback_4(void * context, uint8_t keypadLockout) - { - (static_cast(context))->OnSuccessResponse_4(keypadLockout); - } - - static void OnFailureCallback_5(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_5(error); - } - - static void OnSuccessCallback_5(void * context, uint8_t scheduleProgrammingVisibility) - { - (static_cast(context))->OnSuccessResponse_5(scheduleProgrammingVisibility); - } - - static void OnFailureCallback_6(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_6(error); - } - - static void OnSuccessCallback_6(void * context, uint8_t scheduleProgrammingVisibility) - { - (static_cast(context))->OnSuccessResponse_6(scheduleProgrammingVisibility); - } - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestReadTheMandatoryAttributeTemperatureDisplayMode_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ThermostatUserInterfaceConfigurationClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute< - chip::app::Clusters::ThermostatUserInterfaceConfiguration::Attributes::TemperatureDisplayMode::TypeInfo>( - this, OnSuccessCallback_1, OnFailureCallback_1, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_1(uint8_t temperatureDisplayMode) - { - VerifyOrReturn(CheckValue("temperatureDisplayMode", temperatureDisplayMode, 0)); - - NextTest(); - } - - CHIP_ERROR TestReadTheMandatoryAttributeTemperatureDisplayMode_2() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ThermostatUserInterfaceConfigurationClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute< - chip::app::Clusters::ThermostatUserInterfaceConfiguration::Attributes::TemperatureDisplayMode::TypeInfo>( - this, OnSuccessCallback_2, OnFailureCallback_2, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_2(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_2(uint8_t temperatureDisplayMode) - { - VerifyOrReturn(CheckConstraintType("temperatureDisplayMode", "", "enum8")); - VerifyOrReturn(CheckConstraintMinValue("temperatureDisplayMode", temperatureDisplayMode, 0)); - VerifyOrReturn(CheckConstraintMaxValue("temperatureDisplayMode", temperatureDisplayMode, 1)); - NextTest(); - } - - CHIP_ERROR TestReadTheMandatoryAttributeKeypadLockout_3() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ThermostatUserInterfaceConfigurationClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_3, OnFailureCallback_3, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_3(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_3(uint8_t keypadLockout) - { - VerifyOrReturn(CheckValue("keypadLockout", keypadLockout, 0)); - - NextTest(); - } - - CHIP_ERROR TestReadTheMandatoryAttributeKeypadLockout_4() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ThermostatUserInterfaceConfigurationClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_4, OnFailureCallback_4, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_4(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_4(uint8_t keypadLockout) - { - VerifyOrReturn(CheckConstraintType("keypadLockout", "", "enum8")); - VerifyOrReturn(CheckConstraintMinValue("keypadLockout", keypadLockout, 0)); - VerifyOrReturn(CheckConstraintMaxValue("keypadLockout", keypadLockout, 5)); - NextTest(); - } - - CHIP_ERROR TestReadTheOptionalAttributeScheduleProgrammingVisibility_5() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ThermostatUserInterfaceConfigurationClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute< - chip::app::Clusters::ThermostatUserInterfaceConfiguration::Attributes::ScheduleProgrammingVisibility::TypeInfo>( - this, OnSuccessCallback_5, OnFailureCallback_5, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_5(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_5(uint8_t scheduleProgrammingVisibility) - { - VerifyOrReturn(CheckValue("scheduleProgrammingVisibility", scheduleProgrammingVisibility, 0)); - - NextTest(); - } - - CHIP_ERROR TestReadTheOptionalAttributeScheduleProgrammingVisibility_6() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ThermostatUserInterfaceConfigurationClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute< - chip::app::Clusters::ThermostatUserInterfaceConfiguration::Attributes::ScheduleProgrammingVisibility::TypeInfo>( - this, OnSuccessCallback_6, OnFailureCallback_6, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_6(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_6(uint8_t scheduleProgrammingVisibility) - { - VerifyOrReturn(CheckConstraintType("scheduleProgrammingVisibility", "", "enum8")); - VerifyOrReturn(CheckConstraintMinValue("scheduleProgrammingVisibility", scheduleProgrammingVisibility, 0)); - VerifyOrReturn(CheckConstraintMaxValue("scheduleProgrammingVisibility", scheduleProgrammingVisibility, 1)); - NextTest(); - } -}; - -class Test_TC_TSUIC_2_2Suite : public TestCommand -{ -public: - Test_TC_TSUIC_2_2Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_TSUIC_2_2", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_TSUIC_2_2Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_TSUIC_2_2\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_TSUIC_2_2\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Writes a value of 0 to TemperatureDisplayMode attribute of DUT\n"); - if (ShouldSkip("A_TEMPERATURE_DISPLAY_MODE")) - { - NextTest(); - return; - } - err = TestWritesAValueOf0ToTemperatureDisplayModeAttributeOfDut_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Writes a value of 1 to TemperatureDisplayMode attribute of DUT\n"); - if (ShouldSkip("A_TEMPERATURE_DISPLAY_MODE")) - { - NextTest(); - return; - } - err = TestWritesAValueOf1ToTemperatureDisplayModeAttributeOfDut_2(); - break; - case 3: - ChipLogProgress(chipTool, - " ***** Test Step 3 : Writes a value of greater than 1 to TemperatureDisplayMode attribute of DUT\n"); - if (ShouldSkip("A_TEMPERATURE_DISPLAY_MODE")) - { - NextTest(); - return; - } - err = TestWritesAValueOfGreaterThan1ToTemperatureDisplayModeAttributeOfDut_3(); - break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Writes a value of 0 to KeypadLockout attribute of DUT\n"); - if (ShouldSkip("A_KEYPAD_LOCKOUT")) - { - NextTest(); - return; - } - err = TestWritesAValueOf0ToKeypadLockoutAttributeOfDut_4(); - break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Writes a value of 1 to KeypadLockout attribute of DUT\n"); - if (ShouldSkip("A_KEYPAD_LOCKOUT")) - { - NextTest(); - return; - } - err = TestWritesAValueOf1ToKeypadLockoutAttributeOfDut_5(); - break; - case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : Writes a value of 2 to KeypadLockout attribute of DUT\n"); - if (ShouldSkip("A_KEYPAD_LOCKOUT")) - { - NextTest(); - return; - } - err = TestWritesAValueOf2ToKeypadLockoutAttributeOfDut_6(); - break; - case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : Writes a value of 3 to KeypadLockout attribute of DUT\n"); - if (ShouldSkip("A_KEYPAD_LOCKOUT")) - { - NextTest(); - return; - } - err = TestWritesAValueOf3ToKeypadLockoutAttributeOfDut_7(); - break; - case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : Writes a value of 4 to KeypadLockout attribute of DUT\n"); - if (ShouldSkip("A_KEYPAD_LOCKOUT")) - { - NextTest(); - return; - } - err = TestWritesAValueOf4ToKeypadLockoutAttributeOfDut_8(); - break; - case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : Writes a value of 5 to KeypadLockout attribute of DUT\n"); - if (ShouldSkip("A_KEYPAD_LOCKOUT")) - { - NextTest(); - return; - } - err = TestWritesAValueOf5ToKeypadLockoutAttributeOfDut_9(); - break; - case 10: - ChipLogProgress(chipTool, " ***** Test Step 10 : Writes a value of greater than 5 to KeypadLockout attribute of DUT\n"); - if (ShouldSkip("A_KEYPAD_LOCKOUT")) - { - NextTest(); - return; - } - err = TestWritesAValueOfGreaterThan5ToKeypadLockoutAttributeOfDut_10(); - break; - case 11: - ChipLogProgress(chipTool, - " ***** Test Step 11 : Writes a value of 0 to ScheduleProgrammingVisibility attribute of DUT\n"); - if (ShouldSkip("A_SCHEDULE_PROGRAMMING_VISIBILITY")) - { - NextTest(); - return; - } - err = TestWritesAValueOf0ToScheduleProgrammingVisibilityAttributeOfDut_11(); - break; - case 12: - ChipLogProgress(chipTool, - " ***** Test Step 12 : Writes a value of 1 to ScheduleProgrammingVisibility attribute of DUT\n"); - if (ShouldSkip("A_SCHEDULE_PROGRAMMING_VISIBILITY")) - { - NextTest(); - return; - } - err = TestWritesAValueOf1ToScheduleProgrammingVisibilityAttributeOfDut_12(); - break; - case 13: - ChipLogProgress( - chipTool, - " ***** Test Step 13 : Writes a value of greater than 1 to ScheduleProgrammingVisibility attribute of DUT\n"); - if (ShouldSkip("A_SCHEDULE_PROGRAMMING_VISIBILITY")) - { - NextTest(); - return; - } - err = TestWritesAValueOfGreaterThan1ToScheduleProgrammingVisibilityAttributeOfDut_13(); - break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 14; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - static void OnFailureCallback_1(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_1(error); - } - - static void OnSuccessCallback_1(void * context) { (static_cast(context))->OnSuccessResponse_1(); } - - static void OnFailureCallback_2(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_2(error); - } - - static void OnSuccessCallback_2(void * context) { (static_cast(context))->OnSuccessResponse_2(); } - - static void OnFailureCallback_3(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_3(error); - } - - static void OnSuccessCallback_3(void * context) { (static_cast(context))->OnSuccessResponse_3(); } - - static void OnFailureCallback_4(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_4(error); - } - - static void OnSuccessCallback_4(void * context) { (static_cast(context))->OnSuccessResponse_4(); } - - static void OnFailureCallback_5(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_5(error); - } - - static void OnSuccessCallback_5(void * context) { (static_cast(context))->OnSuccessResponse_5(); } - - static void OnFailureCallback_6(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_6(error); - } - - static void OnSuccessCallback_6(void * context) { (static_cast(context))->OnSuccessResponse_6(); } - - static void OnFailureCallback_7(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_7(error); - } - - static void OnSuccessCallback_7(void * context) { (static_cast(context))->OnSuccessResponse_7(); } - - static void OnFailureCallback_8(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_8(error); - } - - static void OnSuccessCallback_8(void * context) { (static_cast(context))->OnSuccessResponse_8(); } - - static void OnFailureCallback_9(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_9(error); - } - - static void OnSuccessCallback_9(void * context) { (static_cast(context))->OnSuccessResponse_9(); } - - static void OnFailureCallback_10(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_10(error); - } - - static void OnSuccessCallback_10(void * context) { (static_cast(context))->OnSuccessResponse_10(); } - - static void OnFailureCallback_11(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_11(error); - } - - static void OnSuccessCallback_11(void * context) { (static_cast(context))->OnSuccessResponse_11(); } - - static void OnFailureCallback_12(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_12(error); - } - - static void OnSuccessCallback_12(void * context) { (static_cast(context))->OnSuccessResponse_12(); } - - static void OnFailureCallback_13(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_13(error); - } - - static void OnSuccessCallback_13(void * context) { (static_cast(context))->OnSuccessResponse_13(); } - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestWritesAValueOf0ToTemperatureDisplayModeAttributeOfDut_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ThermostatUserInterfaceConfigurationClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - uint8_t temperatureDisplayModeArgument; - temperatureDisplayModeArgument = 0; - - ReturnErrorOnFailure( - cluster.WriteAttribute< - chip::app::Clusters::ThermostatUserInterfaceConfiguration::Attributes::TemperatureDisplayMode::TypeInfo>( - temperatureDisplayModeArgument, this, OnSuccessCallback_1, OnFailureCallback_1)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_1() { NextTest(); } - - CHIP_ERROR TestWritesAValueOf1ToTemperatureDisplayModeAttributeOfDut_2() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ThermostatUserInterfaceConfigurationClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - uint8_t temperatureDisplayModeArgument; - temperatureDisplayModeArgument = 1; - - ReturnErrorOnFailure( - cluster.WriteAttribute< - chip::app::Clusters::ThermostatUserInterfaceConfiguration::Attributes::TemperatureDisplayMode::TypeInfo>( - temperatureDisplayModeArgument, this, OnSuccessCallback_2, OnFailureCallback_2)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_2(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_2() { NextTest(); } - - CHIP_ERROR TestWritesAValueOfGreaterThan1ToTemperatureDisplayModeAttributeOfDut_3() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ThermostatUserInterfaceConfigurationClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - uint8_t temperatureDisplayModeArgument; - temperatureDisplayModeArgument = 2; - - ReturnErrorOnFailure( - cluster.WriteAttribute< - chip::app::Clusters::ThermostatUserInterfaceConfiguration::Attributes::TemperatureDisplayMode::TypeInfo>( - temperatureDisplayModeArgument, this, OnSuccessCallback_3, OnFailureCallback_3)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_3(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - NextTest(); - } - - void OnSuccessResponse_3() { ThrowSuccessResponse(); } - - CHIP_ERROR TestWritesAValueOf0ToKeypadLockoutAttributeOfDut_4() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ThermostatUserInterfaceConfigurationClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - uint8_t keypadLockoutArgument; - keypadLockoutArgument = 0; - - ReturnErrorOnFailure( - cluster.WriteAttribute( - keypadLockoutArgument, this, OnSuccessCallback_4, OnFailureCallback_4)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_4(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_4() { NextTest(); } - - CHIP_ERROR TestWritesAValueOf1ToKeypadLockoutAttributeOfDut_5() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ThermostatUserInterfaceConfigurationClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - uint8_t keypadLockoutArgument; - keypadLockoutArgument = 1; - - ReturnErrorOnFailure( - cluster.WriteAttribute( - keypadLockoutArgument, this, OnSuccessCallback_5, OnFailureCallback_5)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_5(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_5() { NextTest(); } - - CHIP_ERROR TestWritesAValueOf2ToKeypadLockoutAttributeOfDut_6() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ThermostatUserInterfaceConfigurationClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - uint8_t keypadLockoutArgument; - keypadLockoutArgument = 2; - - ReturnErrorOnFailure( - cluster.WriteAttribute( - keypadLockoutArgument, this, OnSuccessCallback_6, OnFailureCallback_6)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_6(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_6() { NextTest(); } - - CHIP_ERROR TestWritesAValueOf3ToKeypadLockoutAttributeOfDut_7() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ThermostatUserInterfaceConfigurationClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - uint8_t keypadLockoutArgument; - keypadLockoutArgument = 3; - - ReturnErrorOnFailure( - cluster.WriteAttribute( - keypadLockoutArgument, this, OnSuccessCallback_7, OnFailureCallback_7)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_7(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_7() { NextTest(); } - - CHIP_ERROR TestWritesAValueOf4ToKeypadLockoutAttributeOfDut_8() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ThermostatUserInterfaceConfigurationClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - uint8_t keypadLockoutArgument; - keypadLockoutArgument = 4; - - ReturnErrorOnFailure( - cluster.WriteAttribute( - keypadLockoutArgument, this, OnSuccessCallback_8, OnFailureCallback_8)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_8(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_8() { NextTest(); } - - CHIP_ERROR TestWritesAValueOf5ToKeypadLockoutAttributeOfDut_9() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ThermostatUserInterfaceConfigurationClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - uint8_t keypadLockoutArgument; - keypadLockoutArgument = 5; - - ReturnErrorOnFailure( - cluster.WriteAttribute( - keypadLockoutArgument, this, OnSuccessCallback_9, OnFailureCallback_9)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_9(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_9() { NextTest(); } - - CHIP_ERROR TestWritesAValueOfGreaterThan5ToKeypadLockoutAttributeOfDut_10() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ThermostatUserInterfaceConfigurationClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - uint8_t keypadLockoutArgument; - keypadLockoutArgument = 6; - - ReturnErrorOnFailure( - cluster.WriteAttribute( - keypadLockoutArgument, this, OnSuccessCallback_10, OnFailureCallback_10)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_10(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - NextTest(); - } - - void OnSuccessResponse_10() { ThrowSuccessResponse(); } - - CHIP_ERROR TestWritesAValueOf0ToScheduleProgrammingVisibilityAttributeOfDut_11() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ThermostatUserInterfaceConfigurationClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - uint8_t scheduleProgrammingVisibilityArgument; - scheduleProgrammingVisibilityArgument = 0; - - ReturnErrorOnFailure( - cluster.WriteAttribute< - chip::app::Clusters::ThermostatUserInterfaceConfiguration::Attributes::ScheduleProgrammingVisibility::TypeInfo>( - scheduleProgrammingVisibilityArgument, this, OnSuccessCallback_11, OnFailureCallback_11)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_11(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_11() { NextTest(); } - - CHIP_ERROR TestWritesAValueOf1ToScheduleProgrammingVisibilityAttributeOfDut_12() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ThermostatUserInterfaceConfigurationClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - uint8_t scheduleProgrammingVisibilityArgument; - scheduleProgrammingVisibilityArgument = 1; - - ReturnErrorOnFailure( - cluster.WriteAttribute< - chip::app::Clusters::ThermostatUserInterfaceConfiguration::Attributes::ScheduleProgrammingVisibility::TypeInfo>( - scheduleProgrammingVisibilityArgument, this, OnSuccessCallback_12, OnFailureCallback_12)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_12(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_12() { NextTest(); } - - CHIP_ERROR TestWritesAValueOfGreaterThan1ToScheduleProgrammingVisibilityAttributeOfDut_13() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ThermostatUserInterfaceConfigurationClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - uint8_t scheduleProgrammingVisibilityArgument; - scheduleProgrammingVisibilityArgument = 2; - - ReturnErrorOnFailure( - cluster.WriteAttribute< - chip::app::Clusters::ThermostatUserInterfaceConfiguration::Attributes::ScheduleProgrammingVisibility::TypeInfo>( - scheduleProgrammingVisibilityArgument, this, OnSuccessCallback_13, OnFailureCallback_13)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_13(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - NextTest(); - } - - void OnSuccessResponse_13() { ThrowSuccessResponse(); } -}; - -class Test_TC_DIAG_TH_NW_1_1Suite : public TestCommand -{ -public: - Test_TC_DIAG_TH_NW_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_DIAG_TH_NW_1_1", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_DIAG_TH_NW_1_1Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_DIAG_TH_NW_1_1\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_DIAG_TH_NW_1_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Sends ResetCounts command\n"); - err = TestSendsResetCountsCommand_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Read the Overruncount attribute\n"); - err = TestReadTheOverruncountAttribute_2(); - break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 3; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - static void OnFailureCallback_2(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_2(error); - } - - static void OnSuccessCallback_2(void * context, uint64_t overrunCount) - { - (static_cast(context))->OnSuccessResponse_2(overrunCount); - } - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestSendsResetCountsCommand_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - using RequestType = chip::app::Clusters::ThreadNetworkDiagnostics::Commands::ResetCounts::Type; - - RequestType request; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_1(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_1(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_1() { NextTest(); } - - CHIP_ERROR TestReadTheOverruncountAttribute_2() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::ThreadNetworkDiagnosticsClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_2, OnFailureCallback_2, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_2(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_2(uint64_t overrunCount) - { - VerifyOrReturn(CheckValue("overrunCount", overrunCount, 0ULL)); - - NextTest(); - } -}; - -class Test_TC_DIAG_TH_NW_1_2Suite : public TestCommand -{ -public: - Test_TC_DIAG_TH_NW_1_2Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_DIAG_TH_NW_1_2", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_DIAG_TH_NW_1_2Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_DIAG_TH_NW_1_2\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_DIAG_TH_NW_1_2\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Validate constraints of attribute: Channel\n"); - err = TestValidateConstraintsOfAttributeChannel_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Validate constraints of attribute: NetworkName\n"); - err = TestValidateConstraintsOfAttributeNetworkName_2(); - break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Validate constraints of attribute: PanId\n"); - err = TestValidateConstraintsOfAttributePanId_3(); - break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Validate constraints of attribute: ExtendedPanId\n"); - err = TestValidateConstraintsOfAttributeExtendedPanId_4(); - break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Validate constraints of attribute: OverrunCount\n"); - err = TestValidateConstraintsOfAttributeOverrunCount_5(); - break; - case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : read PartitionId attribute value\n"); - err = TestReadPartitionIdAttributeValue_6(); - break; - case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : Validate constraints of attribute: PartitionId\n"); - err = TestValidateConstraintsOfAttributePartitionId_7(); - break; - case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : read Weighting attribute value\n"); - err = TestReadWeightingAttributeValue_8(); - break; - case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : Validate constraints of attribute: weighting\n"); - err = TestValidateConstraintsOfAttributeWeighting_9(); - break; - case 10: - ChipLogProgress(chipTool, " ***** Test Step 10 : read DataVersion attribute value\n"); - err = TestReadDataVersionAttributeValue_10(); - break; - case 11: - ChipLogProgress(chipTool, " ***** Test Step 11 : Validate constraints of attribute: DataVersion\n"); - err = TestValidateConstraintsOfAttributeDataVersion_11(); - break; - case 12: - ChipLogProgress(chipTool, " ***** Test Step 12 : read StableDataVersion attribute value\n"); - err = TestReadStableDataVersionAttributeValue_12(); - break; - case 13: - ChipLogProgress(chipTool, " ***** Test Step 13 : Validate constraints of attribute: StableDataVersion\n"); - err = TestValidateConstraintsOfAttributeStableDataVersion_13(); - break; - case 14: - ChipLogProgress(chipTool, " ***** Test Step 14 : read LeaderRouterId attribute value\n"); - err = TestReadLeaderRouterIdAttributeValue_14(); - break; - case 15: - ChipLogProgress(chipTool, " ***** Test Step 15 : Validate constraints of attribute: LeaderRouterId\n"); - err = TestValidateConstraintsOfAttributeLeaderRouterId_15(); - break; - case 16: - ChipLogProgress(chipTool, " ***** Test Step 16 : read DetachedRoleCount attribute value\n"); - err = TestReadDetachedRoleCountAttributeValue_16(); - break; - case 17: - ChipLogProgress(chipTool, " ***** Test Step 17 : Validate constraints of attribute: DetachedRoleCount\n"); - err = TestValidateConstraintsOfAttributeDetachedRoleCount_17(); - break; - case 18: - ChipLogProgress(chipTool, " ***** Test Step 18 : read ChildRoleCount attribute value\n"); - err = TestReadChildRoleCountAttributeValue_18(); - break; - case 19: - ChipLogProgress(chipTool, " ***** Test Step 19 : Validate constraints of attribute: ChildRoleCount\n"); - err = TestValidateConstraintsOfAttributeChildRoleCount_19(); - break; - case 20: - ChipLogProgress(chipTool, " ***** Test Step 20 : read RouterRoleCount attribute value\n"); - err = TestReadRouterRoleCountAttributeValue_20(); - break; - case 21: - ChipLogProgress(chipTool, " ***** Test Step 21 : Validate constraints of attribute: RouterRoleCount\n"); - err = TestValidateConstraintsOfAttributeRouterRoleCount_21(); - break; - case 22: - ChipLogProgress(chipTool, " ***** Test Step 22 : read LeaderRoleCount attribute value\n"); - err = TestReadLeaderRoleCountAttributeValue_22(); - break; - case 23: - ChipLogProgress(chipTool, " ***** Test Step 23 : Validate constraints of attribute: LeaderRoleCount\n"); - err = TestValidateConstraintsOfAttributeLeaderRoleCount_23(); - break; - case 24: - ChipLogProgress(chipTool, " ***** Test Step 24 : read AttachAttemptCount attribute value\n"); - err = TestReadAttachAttemptCountAttributeValue_24(); - break; - case 25: - ChipLogProgress(chipTool, " ***** Test Step 25 : Validate constraints of attribute: AttachAttemptCount\n"); - err = TestValidateConstraintsOfAttributeAttachAttemptCount_25(); - break; - case 26: - ChipLogProgress(chipTool, " ***** Test Step 26 : read PartitionIdChangeCount attribute value\n"); - err = TestReadPartitionIdChangeCountAttributeValue_26(); - break; - case 27: - ChipLogProgress(chipTool, " ***** Test Step 27 : Validate constraints of attribute: PartitionIdChangeCount\n"); - err = TestValidateConstraintsOfAttributePartitionIdChangeCount_27(); - break; - case 28: - ChipLogProgress(chipTool, " ***** Test Step 28 : read BetterPartitionAttachAttemptCount attribute value\n"); - err = TestReadBetterPartitionAttachAttemptCountAttributeValue_28(); - break; - case 29: - ChipLogProgress(chipTool, - " ***** Test Step 29 : Validate constraints of attribute: BetterPartitionAttachAttemptCount\n"); - err = TestValidateConstraintsOfAttributeBetterPartitionAttachAttemptCount_29(); - break; - case 30: - ChipLogProgress(chipTool, " ***** Test Step 30 : read ParentChangeCount attribute value\n"); - err = TestReadParentChangeCountAttributeValue_30(); - break; - case 31: - ChipLogProgress(chipTool, " ***** Test Step 31 : Validate constraints of attribute: ParentChangeCount\n"); - err = TestValidateConstraintsOfAttributeParentChangeCount_31(); - break; - case 32: - ChipLogProgress(chipTool, " ***** Test Step 32 : read TxTotalCount attribute value\n"); - err = TestReadTxTotalCountAttributeValue_32(); - break; - case 33: - ChipLogProgress(chipTool, " ***** Test Step 33 : Validate constraints of attribute: TxTotalCount\n"); - err = TestValidateConstraintsOfAttributeTxTotalCount_33(); - break; - case 34: - ChipLogProgress(chipTool, " ***** Test Step 34 : read TxUnicastCount attribute value\n"); - err = TestReadTxUnicastCountAttributeValue_34(); - break; - case 35: - ChipLogProgress(chipTool, " ***** Test Step 35 : Validate constraints of attribute: TxUnicastCount\n"); - err = TestValidateConstraintsOfAttributeTxUnicastCount_35(); - break; - case 36: - ChipLogProgress(chipTool, " ***** Test Step 36 : read TxBroadcastCount attribute value\n"); - err = TestReadTxBroadcastCountAttributeValue_36(); - break; - case 37: - ChipLogProgress(chipTool, " ***** Test Step 37 : Validate constraints of attribute: TxBroadcastCount\n"); - err = TestValidateConstraintsOfAttributeTxBroadcastCount_37(); - break; - case 38: - ChipLogProgress(chipTool, " ***** Test Step 38 : read TxNoAckRequestedCount attribute value\n"); - err = TestReadTxNoAckRequestedCountAttributeValue_38(); - break; - case 39: - ChipLogProgress(chipTool, " ***** Test Step 39 : Validate constraints of attribute: TxNoAckRequestedCount\n"); - err = TestValidateConstraintsOfAttributeTxNoAckRequestedCount_39(); - break; - case 40: - ChipLogProgress(chipTool, " ***** Test Step 40 : read TxDataCount attribute value\n"); - err = TestReadTxDataCountAttributeValue_40(); - break; - case 41: - ChipLogProgress(chipTool, " ***** Test Step 41 : Validate constraints of attribute: TxDataCount\n"); - err = TestValidateConstraintsOfAttributeTxDataCount_41(); - break; - case 42: - ChipLogProgress(chipTool, " ***** Test Step 42 : read TxDataPollCount attribute value\n"); - err = TestReadTxDataPollCountAttributeValue_42(); - break; - case 43: - ChipLogProgress(chipTool, " ***** Test Step 43 : Validate constraints of attribute: TxDataPollCount\n"); - err = TestValidateConstraintsOfAttributeTxDataPollCount_43(); - break; - case 44: - ChipLogProgress(chipTool, " ***** Test Step 44 : read TxBeaconCount attribute value\n"); - err = TestReadTxBeaconCountAttributeValue_44(); - break; - case 45: - ChipLogProgress(chipTool, " ***** Test Step 45 : Validate constraints of attribute: TxBeaconCount\n"); - err = TestValidateConstraintsOfAttributeTxBeaconCount_45(); - break; - case 46: - ChipLogProgress(chipTool, " ***** Test Step 46 : read TxBeaconRequestCount attribute value\n"); - err = TestReadTxBeaconRequestCountAttributeValue_46(); - break; - case 47: - ChipLogProgress(chipTool, " ***** Test Step 47 : Validate constraints of attribute: TxBeaconRequestCount\n"); - err = TestValidateConstraintsOfAttributeTxBeaconRequestCount_47(); - break; - case 48: - ChipLogProgress(chipTool, " ***** Test Step 48 : read TxOtherCount attribute value\n"); - err = TestReadTxOtherCountAttributeValue_48(); - break; - case 49: - ChipLogProgress(chipTool, " ***** Test Step 49 : Validate constraints of attribute: TxOtherCount\n"); - err = TestValidateConstraintsOfAttributeTxOtherCount_49(); - break; - case 50: - ChipLogProgress(chipTool, " ***** Test Step 50 : read TxRetryCount attribute value\n"); - err = TestReadTxRetryCountAttributeValue_50(); - break; - case 51: - ChipLogProgress(chipTool, " ***** Test Step 51 : Validate constraints of attribute: TxRetryCount\n"); - err = TestValidateConstraintsOfAttributeTxRetryCount_51(); - break; - case 52: - ChipLogProgress(chipTool, " ***** Test Step 52 : read TxDirectMaxRetryExpiryCount attribute value\n"); - err = TestReadTxDirectMaxRetryExpiryCountAttributeValue_52(); - break; - case 53: - ChipLogProgress(chipTool, " ***** Test Step 53 : Validate constraints of attribute: TxDirectMaxRetryExpiryCount\n"); - err = TestValidateConstraintsOfAttributeTxDirectMaxRetryExpiryCount_53(); - break; - case 54: - ChipLogProgress(chipTool, " ***** Test Step 54 : read TxIndirectMaxRetryExpiryCount attribute value\n"); - err = TestReadTxIndirectMaxRetryExpiryCountAttributeValue_54(); - break; - case 55: - ChipLogProgress(chipTool, " ***** Test Step 55 : Validate constraints of attribute: TxIndirectMaxRetryExpiryCount\n"); - err = TestValidateConstraintsOfAttributeTxIndirectMaxRetryExpiryCount_55(); - break; - case 56: - ChipLogProgress(chipTool, " ***** Test Step 56 : read TxErrCcaCount attribute value\n"); - err = TestReadTxErrCcaCountAttributeValue_56(); - break; - case 57: - ChipLogProgress(chipTool, " ***** Test Step 57 : Validate constraints of attribute: TxErrCcaCount\n"); - err = TestValidateConstraintsOfAttributeTxErrCcaCount_57(); - break; - case 58: - ChipLogProgress(chipTool, " ***** Test Step 58 : read TxErrAbortCount attribute value\n"); - err = TestReadTxErrAbortCountAttributeValue_58(); - break; - case 59: - ChipLogProgress(chipTool, " ***** Test Step 59 : Validate constraints of attribute: TxErrAbortCount\n"); - err = TestValidateConstraintsOfAttributeTxErrAbortCount_59(); - break; - case 60: - ChipLogProgress(chipTool, " ***** Test Step 60 : read TxErrBusyChannelCount attribute value\n"); - err = TestReadTxErrBusyChannelCountAttributeValue_60(); - break; - case 61: - ChipLogProgress(chipTool, " ***** Test Step 61 : Validate constraints of attribute: TxErrBusyChannelCount\n"); - err = TestValidateConstraintsOfAttributeTxErrBusyChannelCount_61(); - break; - case 62: - ChipLogProgress(chipTool, " ***** Test Step 62 : read RxTotalCount attribute value\n"); - err = TestReadRxTotalCountAttributeValue_62(); - break; - case 63: - ChipLogProgress(chipTool, " ***** Test Step 63 : Validate constraints of attribute: RxTotalCount\n"); - err = TestValidateConstraintsOfAttributeRxTotalCount_63(); - break; - case 64: - ChipLogProgress(chipTool, " ***** Test Step 64 : read RxUnicastCount attribute value\n"); - err = TestReadRxUnicastCountAttributeValue_64(); - break; - case 65: - ChipLogProgress(chipTool, " ***** Test Step 65 : Validate constraints of attribute: RxUnicastCount\n"); - err = TestValidateConstraintsOfAttributeRxUnicastCount_65(); - break; - case 66: - ChipLogProgress(chipTool, " ***** Test Step 66 : read RxBroadcastCount attribute value\n"); - err = TestReadRxBroadcastCountAttributeValue_66(); - break; - case 67: - ChipLogProgress(chipTool, " ***** Test Step 67 : Validate constraints of attribute: RxBroadcastCount\n"); - err = TestValidateConstraintsOfAttributeRxBroadcastCount_67(); - break; - case 68: - ChipLogProgress(chipTool, " ***** Test Step 68 : read RxDataCount attribute value\n"); - err = TestReadRxDataCountAttributeValue_68(); - break; - case 69: - ChipLogProgress(chipTool, " ***** Test Step 69 : Validate constraints of attribute: RxDataCount\n"); - err = TestValidateConstraintsOfAttributeRxDataCount_69(); - break; - case 70: - ChipLogProgress(chipTool, " ***** Test Step 70 : read RxDataPollCount attribute value\n"); - err = TestReadRxDataPollCountAttributeValue_70(); - break; - case 71: - ChipLogProgress(chipTool, " ***** Test Step 71 : Validate constraints of attribute: RxDataPollCount\n"); - err = TestValidateConstraintsOfAttributeRxDataPollCount_71(); - break; - case 72: - ChipLogProgress(chipTool, " ***** Test Step 72 : read RxBeaconCount attribute value\n"); - err = TestReadRxBeaconCountAttributeValue_72(); - break; - case 73: - ChipLogProgress(chipTool, " ***** Test Step 73 : Validate constraints of attribute: RxBeaconCount\n"); - err = TestValidateConstraintsOfAttributeRxBeaconCount_73(); - break; - case 74: - ChipLogProgress(chipTool, " ***** Test Step 74 : read RxBeaconRequestCount attribute value\n"); - err = TestReadRxBeaconRequestCountAttributeValue_74(); - break; - case 75: - ChipLogProgress(chipTool, " ***** Test Step 75 : Validate constraints of attribute: RxBeaconRequestCount\n"); - err = TestValidateConstraintsOfAttributeRxBeaconRequestCount_75(); - break; - case 76: - ChipLogProgress(chipTool, " ***** Test Step 76 : read RxOtherCount attribute value\n"); - err = TestReadRxOtherCountAttributeValue_76(); - break; - case 77: - ChipLogProgress(chipTool, " ***** Test Step 77 : Validate constraints of attribute: RxOtherCount\n"); - err = TestValidateConstraintsOfAttributeRxOtherCount_77(); - break; - case 78: - ChipLogProgress(chipTool, " ***** Test Step 78 : read RxAddressFilteredCount attribute value\n"); - err = TestReadRxAddressFilteredCountAttributeValue_78(); - break; - case 79: - ChipLogProgress(chipTool, " ***** Test Step 79 : Validate constraints of attribute: RxAddressFilteredCount\n"); - err = TestValidateConstraintsOfAttributeRxAddressFilteredCount_79(); - break; - case 80: - ChipLogProgress(chipTool, " ***** Test Step 80 : read RxDestAddrFilteredCount attribute value\n"); - err = TestReadRxDestAddrFilteredCountAttributeValue_80(); - break; - case 81: - ChipLogProgress(chipTool, " ***** Test Step 81 : Validate constraints of attribute: RxDestAddrFilteredCount\n"); - err = TestValidateConstraintsOfAttributeRxDestAddrFilteredCount_81(); - break; - case 82: - ChipLogProgress(chipTool, " ***** Test Step 82 : read RxDuplicatedCount attribute value\n"); - err = TestReadRxDuplicatedCountAttributeValue_82(); - break; - case 83: - ChipLogProgress(chipTool, " ***** Test Step 83 : Validate constraints of attribute: RxDuplicatedCount\n"); - err = TestValidateConstraintsOfAttributeRxDuplicatedCount_83(); - break; - case 84: - ChipLogProgress(chipTool, " ***** Test Step 84 : read RxErrNoFrameCount attribute value\n"); - err = TestReadRxErrNoFrameCountAttributeValue_84(); - break; - case 85: - ChipLogProgress(chipTool, " ***** Test Step 85 : Validate constraints of attribute: RxErrNoFrameCount\n"); - err = TestValidateConstraintsOfAttributeRxErrNoFrameCount_85(); - break; - case 86: - ChipLogProgress(chipTool, " ***** Test Step 86 : read RxErrUnknownNeighborCount attribute value\n"); - err = TestReadRxErrUnknownNeighborCountAttributeValue_86(); - break; - case 87: - ChipLogProgress(chipTool, " ***** Test Step 87 : Validate constraints of attribute: RxErrUnknownNeighborCount\n"); - err = TestValidateConstraintsOfAttributeRxErrUnknownNeighborCount_87(); - break; - case 88: - ChipLogProgress(chipTool, " ***** Test Step 88 : read RxErrInvalidScrAddrCount attribute value\n"); - err = TestReadRxErrInvalidScrAddrCountAttributeValue_88(); - break; - case 89: - ChipLogProgress(chipTool, " ***** Test Step 89 : Validate constraints of attribute: RxErrInvalidSrcAddrCount\n"); - err = TestValidateConstraintsOfAttributeRxErrInvalidSrcAddrCount_89(); - break; - case 90: - ChipLogProgress(chipTool, " ***** Test Step 90 : read RxErrSecCount attribute value\n"); - err = TestReadRxErrSecCountAttributeValue_90(); - break; - case 91: - ChipLogProgress(chipTool, " ***** Test Step 91 : Validate constraints of attribute: RxErrInvalidSrcAddrCount\n"); - err = TestValidateConstraintsOfAttributeRxErrInvalidSrcAddrCount_91(); - break; - case 92: - ChipLogProgress(chipTool, " ***** Test Step 92 : read RxErrFcsCount attribute value\n"); - err = TestReadRxErrFcsCountAttributeValue_92(); - break; - case 93: - ChipLogProgress(chipTool, " ***** Test Step 93 : Validate constraints of attribute: RxErrFcsCount\n"); - err = TestValidateConstraintsOfAttributeRxErrFcsCount_93(); - break; - case 94: - ChipLogProgress(chipTool, " ***** Test Step 94 : read RxErrOtherCount attribute value\n"); - err = TestReadRxErrOtherCountAttributeValue_94(); - break; - case 95: - ChipLogProgress(chipTool, " ***** Test Step 95 : Validate constraints of attribute: RxErrOtherCount\n"); - err = TestValidateConstraintsOfAttributeRxErrOtherCount_95(); - break; - case 96: - ChipLogProgress(chipTool, " ***** Test Step 96 : read ActiveTimestamp attribute value\n"); - err = TestReadActiveTimestampAttributeValue_96(); - break; - case 97: - ChipLogProgress(chipTool, " ***** Test Step 97 : Validate constraints of attribute: ActiveTimestamp\n"); - err = TestValidateConstraintsOfAttributeActiveTimestamp_97(); - break; - case 98: - ChipLogProgress(chipTool, " ***** Test Step 98 : read PendingTimestamp attribute value\n"); - err = TestReadPendingTimestampAttributeValue_98(); - break; - case 99: - ChipLogProgress(chipTool, " ***** Test Step 99 : Validate constraints of attribute: PendingTimestamp\n"); - err = TestValidateConstraintsOfAttributePendingTimestamp_99(); - break; - case 100: - ChipLogProgress(chipTool, " ***** Test Step 100 : read Delay attribute value\n"); - err = TestReadDelayAttributeValue_100(); - break; - case 101: - ChipLogProgress(chipTool, " ***** Test Step 101 : Validate constraints of attribute: delay\n"); - err = TestValidateConstraintsOfAttributeDelay_101(); - break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 102; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - static void OnFailureCallback_1(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_1(error); - } - - static void OnSuccessCallback_1(void * context, uint16_t channel) - { - (static_cast(context))->OnSuccessResponse_1(channel); - } - - static void OnFailureCallback_2(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_2(error); - } - - static void OnSuccessCallback_2(void * context, chip::CharSpan networkName) - { - (static_cast(context))->OnSuccessResponse_2(networkName); - } - - static void OnFailureCallback_3(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_3(error); - } - - static void OnSuccessCallback_3(void * context, uint16_t panId) - { - (static_cast(context))->OnSuccessResponse_3(panId); - } - - static void OnFailureCallback_4(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_4(error); - } - - static void OnSuccessCallback_4(void * context, uint64_t extendedPanId) - { - (static_cast(context))->OnSuccessResponse_4(extendedPanId); - } - - static void OnFailureCallback_5(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_5(error); - } - - static void OnSuccessCallback_5(void * context, uint64_t overrunCount) - { - (static_cast(context))->OnSuccessResponse_5(overrunCount); - } - - static void OnFailureCallback_6(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_6(error); - } - - static void OnSuccessCallback_6(void * context, uint32_t partitionId) - { - (static_cast(context))->OnSuccessResponse_6(partitionId); - } - - static void OnFailureCallback_7(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_7(error); - } - - static void OnSuccessCallback_7(void * context, uint32_t partitionId) - { - (static_cast(context))->OnSuccessResponse_7(partitionId); - } - - static void OnFailureCallback_8(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_8(error); - } - - static void OnSuccessCallback_8(void * context, uint8_t weighting) - { - (static_cast(context))->OnSuccessResponse_8(weighting); - } - - static void OnFailureCallback_9(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_9(error); - } - - static void OnSuccessCallback_9(void * context, uint8_t weighting) - { - (static_cast(context))->OnSuccessResponse_9(weighting); - } - - static void OnFailureCallback_10(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_10(error); - } - - static void OnSuccessCallback_10(void * context, uint8_t dataVersion) - { - (static_cast(context))->OnSuccessResponse_10(dataVersion); - } - - static void OnFailureCallback_11(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_11(error); - } - - static void OnSuccessCallback_11(void * context, uint8_t dataVersion) - { - (static_cast(context))->OnSuccessResponse_11(dataVersion); - } - - static void OnFailureCallback_12(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_12(error); - } - - static void OnSuccessCallback_12(void * context, uint8_t stableDataVersion) - { - (static_cast(context))->OnSuccessResponse_12(stableDataVersion); - } - - static void OnFailureCallback_13(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_13(error); - } - - static void OnSuccessCallback_13(void * context, uint8_t stableDataVersion) - { - (static_cast(context))->OnSuccessResponse_13(stableDataVersion); - } - - static void OnFailureCallback_14(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_14(error); - } - - static void OnSuccessCallback_14(void * context, uint8_t leaderRouterId) - { - (static_cast(context))->OnSuccessResponse_14(leaderRouterId); - } - - static void OnFailureCallback_15(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_15(error); - } - - static void OnSuccessCallback_15(void * context, uint8_t leaderRouterId) - { - (static_cast(context))->OnSuccessResponse_15(leaderRouterId); - } - - static void OnFailureCallback_16(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_16(error); - } - - static void OnSuccessCallback_16(void * context, uint16_t detachedRoleCount) - { - (static_cast(context))->OnSuccessResponse_16(detachedRoleCount); - } - - static void OnFailureCallback_17(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_17(error); - } - - static void OnSuccessCallback_17(void * context, uint16_t detachedRoleCount) - { - (static_cast(context))->OnSuccessResponse_17(detachedRoleCount); - } - - static void OnFailureCallback_18(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_18(error); - } - - static void OnSuccessCallback_18(void * context, uint16_t childRoleCount) - { - (static_cast(context))->OnSuccessResponse_18(childRoleCount); - } - - static void OnFailureCallback_19(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_19(error); - } - - static void OnSuccessCallback_19(void * context, uint16_t childRoleCount) - { - (static_cast(context))->OnSuccessResponse_19(childRoleCount); - } - - static void OnFailureCallback_20(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_20(error); - } - - static void OnSuccessCallback_20(void * context, uint16_t routerRoleCount) - { - (static_cast(context))->OnSuccessResponse_20(routerRoleCount); - } - - static void OnFailureCallback_21(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_21(error); - } - - static void OnSuccessCallback_21(void * context, uint16_t routerRoleCount) - { - (static_cast(context))->OnSuccessResponse_21(routerRoleCount); - } - - static void OnFailureCallback_22(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_22(error); - } - - static void OnSuccessCallback_22(void * context, uint16_t leaderRoleCount) - { - (static_cast(context))->OnSuccessResponse_22(leaderRoleCount); - } - - static void OnFailureCallback_23(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_23(error); - } - - static void OnSuccessCallback_23(void * context, uint16_t leaderRoleCount) - { - (static_cast(context))->OnSuccessResponse_23(leaderRoleCount); - } - - static void OnFailureCallback_24(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_24(error); - } - - static void OnSuccessCallback_24(void * context, uint16_t attachAttemptCount) - { - (static_cast(context))->OnSuccessResponse_24(attachAttemptCount); - } - - static void OnFailureCallback_25(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_25(error); - } - - static void OnSuccessCallback_25(void * context, uint16_t attachAttemptCount) - { - (static_cast(context))->OnSuccessResponse_25(attachAttemptCount); - } - - static void OnFailureCallback_26(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_26(error); - } - - static void OnSuccessCallback_26(void * context, uint16_t partitionIdChangeCount) - { - (static_cast(context))->OnSuccessResponse_26(partitionIdChangeCount); - } - - static void OnFailureCallback_27(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_27(error); - } - - static void OnSuccessCallback_27(void * context, uint16_t partitionIdChangeCount) - { - (static_cast(context))->OnSuccessResponse_27(partitionIdChangeCount); - } - - static void OnFailureCallback_28(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_28(error); - } - - static void OnSuccessCallback_28(void * context, uint16_t betterPartitionAttachAttemptCount) - { - (static_cast(context))->OnSuccessResponse_28(betterPartitionAttachAttemptCount); - } - - static void OnFailureCallback_29(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_29(error); - } - - static void OnSuccessCallback_29(void * context, uint16_t betterPartitionAttachAttemptCount) - { - (static_cast(context))->OnSuccessResponse_29(betterPartitionAttachAttemptCount); - } - - static void OnFailureCallback_30(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_30(error); - } - - static void OnSuccessCallback_30(void * context, uint16_t parentChangeCount) - { - (static_cast(context))->OnSuccessResponse_30(parentChangeCount); - } - - static void OnFailureCallback_31(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_31(error); - } - - static void OnSuccessCallback_31(void * context, uint16_t parentChangeCount) - { - (static_cast(context))->OnSuccessResponse_31(parentChangeCount); - } - - static void OnFailureCallback_32(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_32(error); - } - - static void OnSuccessCallback_32(void * context, uint32_t txTotalCount) - { - (static_cast(context))->OnSuccessResponse_32(txTotalCount); - } - - static void OnFailureCallback_33(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_33(error); - } - - static void OnSuccessCallback_33(void * context, uint32_t txTotalCount) - { - (static_cast(context))->OnSuccessResponse_33(txTotalCount); - } - - static void OnFailureCallback_34(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_34(error); - } - - static void OnSuccessCallback_34(void * context, uint32_t txUnicastCount) - { - (static_cast(context))->OnSuccessResponse_34(txUnicastCount); - } - - static void OnFailureCallback_35(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_35(error); - } - - static void OnSuccessCallback_35(void * context, uint32_t txUnicastCount) - { - (static_cast(context))->OnSuccessResponse_35(txUnicastCount); - } - - static void OnFailureCallback_36(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_36(error); - } - - static void OnSuccessCallback_36(void * context, uint32_t txBroadcastCount) - { - (static_cast(context))->OnSuccessResponse_36(txBroadcastCount); - } - - static void OnFailureCallback_37(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_37(error); - } - - static void OnSuccessCallback_37(void * context, uint32_t txBroadcastCount) - { - (static_cast(context))->OnSuccessResponse_37(txBroadcastCount); - } - - static void OnFailureCallback_38(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_38(error); - } - - static void OnSuccessCallback_38(void * context, uint32_t txNoAckRequestedCount) - { - (static_cast(context))->OnSuccessResponse_38(txNoAckRequestedCount); - } - - static void OnFailureCallback_39(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_39(error); - } - - static void OnSuccessCallback_39(void * context, uint32_t txNoAckRequestedCount) - { - (static_cast(context))->OnSuccessResponse_39(txNoAckRequestedCount); - } - - static void OnFailureCallback_40(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_40(error); - } - - static void OnSuccessCallback_40(void * context, uint32_t txDataCount) - { - (static_cast(context))->OnSuccessResponse_40(txDataCount); - } - - static void OnFailureCallback_41(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_41(error); - } - - static void OnSuccessCallback_41(void * context, uint32_t txDataCount) - { - (static_cast(context))->OnSuccessResponse_41(txDataCount); - } - - static void OnFailureCallback_42(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_42(error); - } - - static void OnSuccessCallback_42(void * context, uint32_t txDataPollCount) - { - (static_cast(context))->OnSuccessResponse_42(txDataPollCount); - } - - static void OnFailureCallback_43(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_43(error); - } - - static void OnSuccessCallback_43(void * context, uint32_t txDataPollCount) - { - (static_cast(context))->OnSuccessResponse_43(txDataPollCount); - } - - static void OnFailureCallback_44(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_44(error); - } - - static void OnSuccessCallback_44(void * context, uint32_t txBeaconCount) - { - (static_cast(context))->OnSuccessResponse_44(txBeaconCount); - } - - static void OnFailureCallback_45(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_45(error); - } - - static void OnSuccessCallback_45(void * context, uint32_t txBeaconCount) - { - (static_cast(context))->OnSuccessResponse_45(txBeaconCount); - } - - static void OnFailureCallback_46(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_46(error); - } - - static void OnSuccessCallback_46(void * context, uint32_t txBeaconRequestCount) - { - (static_cast(context))->OnSuccessResponse_46(txBeaconRequestCount); - } - - static void OnFailureCallback_47(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_47(error); - } - - static void OnSuccessCallback_47(void * context, uint32_t txBeaconRequestCount) - { - (static_cast(context))->OnSuccessResponse_47(txBeaconRequestCount); - } - - static void OnFailureCallback_48(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_48(error); - } - - static void OnSuccessCallback_48(void * context, uint32_t txOtherCount) - { - (static_cast(context))->OnSuccessResponse_48(txOtherCount); - } - - static void OnFailureCallback_49(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_49(error); - } - - static void OnSuccessCallback_49(void * context, uint32_t txOtherCount) - { - (static_cast(context))->OnSuccessResponse_49(txOtherCount); - } - - static void OnFailureCallback_50(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_50(error); - } - - static void OnSuccessCallback_50(void * context, uint32_t txRetryCount) - { - (static_cast(context))->OnSuccessResponse_50(txRetryCount); - } - - static void OnFailureCallback_51(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_51(error); - } - - static void OnSuccessCallback_51(void * context, uint32_t txRetryCount) - { - (static_cast(context))->OnSuccessResponse_51(txRetryCount); - } - - static void OnFailureCallback_52(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_52(error); - } - - static void OnSuccessCallback_52(void * context, uint32_t txDirectMaxRetryExpiryCount) - { - (static_cast(context))->OnSuccessResponse_52(txDirectMaxRetryExpiryCount); - } - - static void OnFailureCallback_53(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_53(error); - } - - static void OnSuccessCallback_53(void * context, uint32_t txDirectMaxRetryExpiryCount) - { - (static_cast(context))->OnSuccessResponse_53(txDirectMaxRetryExpiryCount); - } - - static void OnFailureCallback_54(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_54(error); - } - - static void OnSuccessCallback_54(void * context, uint32_t txIndirectMaxRetryExpiryCount) - { - (static_cast(context))->OnSuccessResponse_54(txIndirectMaxRetryExpiryCount); - } - - static void OnFailureCallback_55(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_55(error); - } - - static void OnSuccessCallback_55(void * context, uint32_t txIndirectMaxRetryExpiryCount) - { - (static_cast(context))->OnSuccessResponse_55(txIndirectMaxRetryExpiryCount); - } - - static void OnFailureCallback_56(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_56(error); - } - - static void OnSuccessCallback_56(void * context, uint32_t txErrCcaCount) - { - (static_cast(context))->OnSuccessResponse_56(txErrCcaCount); - } - - static void OnFailureCallback_57(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_57(error); - } - - static void OnSuccessCallback_57(void * context, uint32_t txErrCcaCount) - { - (static_cast(context))->OnSuccessResponse_57(txErrCcaCount); - } - - static void OnFailureCallback_58(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_58(error); - } - - static void OnSuccessCallback_58(void * context, uint32_t txErrAbortCount) - { - (static_cast(context))->OnSuccessResponse_58(txErrAbortCount); - } - - static void OnFailureCallback_59(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_59(error); - } - - static void OnSuccessCallback_59(void * context, uint32_t txErrAbortCount) - { - (static_cast(context))->OnSuccessResponse_59(txErrAbortCount); - } - - static void OnFailureCallback_60(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_60(error); - } - - static void OnSuccessCallback_60(void * context, uint32_t txErrBusyChannelCount) - { - (static_cast(context))->OnSuccessResponse_60(txErrBusyChannelCount); - } - - static void OnFailureCallback_61(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_61(error); - } - - static void OnSuccessCallback_61(void * context, uint32_t txErrBusyChannelCount) - { - (static_cast(context))->OnSuccessResponse_61(txErrBusyChannelCount); - } - - static void OnFailureCallback_62(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_62(error); - } - - static void OnSuccessCallback_62(void * context, uint32_t rxTotalCount) - { - (static_cast(context))->OnSuccessResponse_62(rxTotalCount); - } - - static void OnFailureCallback_63(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_63(error); - } - - static void OnSuccessCallback_63(void * context, uint32_t rxTotalCount) - { - (static_cast(context))->OnSuccessResponse_63(rxTotalCount); - } - - static void OnFailureCallback_64(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_64(error); - } - - static void OnSuccessCallback_64(void * context, uint32_t rxUnicastCount) - { - (static_cast(context))->OnSuccessResponse_64(rxUnicastCount); - } - - static void OnFailureCallback_65(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_65(error); - } - - static void OnSuccessCallback_65(void * context, uint32_t rxUnicastCount) - { - (static_cast(context))->OnSuccessResponse_65(rxUnicastCount); - } - - static void OnFailureCallback_66(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_66(error); - } - - static void OnSuccessCallback_66(void * context, uint32_t rxBroadcastCount) - { - (static_cast(context))->OnSuccessResponse_66(rxBroadcastCount); - } - - static void OnFailureCallback_67(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_67(error); - } - - static void OnSuccessCallback_67(void * context, uint32_t rxBroadcastCount) - { - (static_cast(context))->OnSuccessResponse_67(rxBroadcastCount); - } - - static void OnFailureCallback_68(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_68(error); - } - - static void OnSuccessCallback_68(void * context, uint32_t rxDataCount) - { - (static_cast(context))->OnSuccessResponse_68(rxDataCount); - } - - static void OnFailureCallback_69(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_69(error); - } - - static void OnSuccessCallback_69(void * context, uint32_t rxDataCount) - { - (static_cast(context))->OnSuccessResponse_69(rxDataCount); - } - - static void OnFailureCallback_70(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_70(error); - } - - static void OnSuccessCallback_70(void * context, uint32_t rxDataPollCount) - { - (static_cast(context))->OnSuccessResponse_70(rxDataPollCount); - } - - static void OnFailureCallback_71(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_71(error); - } - - static void OnSuccessCallback_71(void * context, uint32_t rxDataPollCount) - { - (static_cast(context))->OnSuccessResponse_71(rxDataPollCount); - } - - static void OnFailureCallback_72(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_72(error); - } - - static void OnSuccessCallback_72(void * context, uint32_t rxBeaconCount) - { - (static_cast(context))->OnSuccessResponse_72(rxBeaconCount); - } - - static void OnFailureCallback_73(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_73(error); - } - - static void OnSuccessCallback_73(void * context, uint32_t rxBeaconCount) - { - (static_cast(context))->OnSuccessResponse_73(rxBeaconCount); - } - - static void OnFailureCallback_74(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_74(error); - } - - static void OnSuccessCallback_74(void * context, uint32_t rxBeaconRequestCount) - { - (static_cast(context))->OnSuccessResponse_74(rxBeaconRequestCount); - } - - static void OnFailureCallback_75(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_75(error); - } - - static void OnSuccessCallback_75(void * context, uint32_t rxBeaconRequestCount) - { - (static_cast(context))->OnSuccessResponse_75(rxBeaconRequestCount); - } - - static void OnFailureCallback_76(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_76(error); - } - - static void OnSuccessCallback_76(void * context, uint32_t rxOtherCount) - { - (static_cast(context))->OnSuccessResponse_76(rxOtherCount); - } - - static void OnFailureCallback_77(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_77(error); - } - - static void OnSuccessCallback_77(void * context, uint32_t rxOtherCount) - { - (static_cast(context))->OnSuccessResponse_77(rxOtherCount); - } - - static void OnFailureCallback_78(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_78(error); - } - - static void OnSuccessCallback_78(void * context, uint32_t rxAddressFilteredCount) - { - (static_cast(context))->OnSuccessResponse_78(rxAddressFilteredCount); - } - - static void OnFailureCallback_79(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_79(error); - } - - static void OnSuccessCallback_79(void * context, uint32_t rxAddressFilteredCount) - { - (static_cast(context))->OnSuccessResponse_79(rxAddressFilteredCount); - } - - static void OnFailureCallback_80(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_80(error); - } - - static void OnSuccessCallback_80(void * context, uint32_t rxDestAddrFilteredCount) - { - (static_cast(context))->OnSuccessResponse_80(rxDestAddrFilteredCount); - } - - static void OnFailureCallback_81(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_81(error); - } - - static void OnSuccessCallback_81(void * context, uint32_t rxDestAddrFilteredCount) - { - (static_cast(context))->OnSuccessResponse_81(rxDestAddrFilteredCount); - } - - static void OnFailureCallback_82(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_82(error); - } - - static void OnSuccessCallback_82(void * context, uint32_t rxDuplicatedCount) - { - (static_cast(context))->OnSuccessResponse_82(rxDuplicatedCount); - } - - static void OnFailureCallback_83(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_83(error); - } - - static void OnSuccessCallback_83(void * context, uint32_t rxDuplicatedCount) - { - (static_cast(context))->OnSuccessResponse_83(rxDuplicatedCount); - } - - static void OnFailureCallback_84(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_84(error); - } - - static void OnSuccessCallback_84(void * context, uint32_t rxErrNoFrameCount) - { - (static_cast(context))->OnSuccessResponse_84(rxErrNoFrameCount); - } - - static void OnFailureCallback_85(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_85(error); - } - - static void OnSuccessCallback_85(void * context, uint32_t rxErrNoFrameCount) - { - (static_cast(context))->OnSuccessResponse_85(rxErrNoFrameCount); - } - - static void OnFailureCallback_86(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_86(error); - } - - static void OnSuccessCallback_86(void * context, uint32_t rxErrUnknownNeighborCount) - { - (static_cast(context))->OnSuccessResponse_86(rxErrUnknownNeighborCount); - } - - static void OnFailureCallback_87(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_87(error); - } - - static void OnSuccessCallback_87(void * context, uint32_t rxErrUnknownNeighborCount) - { - (static_cast(context))->OnSuccessResponse_87(rxErrUnknownNeighborCount); - } - - static void OnFailureCallback_88(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_88(error); - } - - static void OnSuccessCallback_88(void * context, uint32_t rxErrInvalidSrcAddrCount) - { - (static_cast(context))->OnSuccessResponse_88(rxErrInvalidSrcAddrCount); - } - - static void OnFailureCallback_89(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_89(error); - } - - static void OnSuccessCallback_89(void * context, uint32_t rxErrInvalidSrcAddrCount) - { - (static_cast(context))->OnSuccessResponse_89(rxErrInvalidSrcAddrCount); - } - - static void OnFailureCallback_90(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_90(error); - } - - static void OnSuccessCallback_90(void * context, uint32_t rxErrSecCount) - { - (static_cast(context))->OnSuccessResponse_90(rxErrSecCount); - } - - static void OnFailureCallback_91(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_91(error); - } - - static void OnSuccessCallback_91(void * context, uint32_t rxErrSecCount) - { - (static_cast(context))->OnSuccessResponse_91(rxErrSecCount); - } - - static void OnFailureCallback_92(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_92(error); - } - - static void OnSuccessCallback_92(void * context, uint32_t rxErrFcsCount) - { - (static_cast(context))->OnSuccessResponse_92(rxErrFcsCount); - } - - static void OnFailureCallback_93(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_93(error); - } - - static void OnSuccessCallback_93(void * context, uint32_t rxErrFcsCount) - { - (static_cast(context))->OnSuccessResponse_93(rxErrFcsCount); - } - - static void OnFailureCallback_94(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_94(error); - } - - static void OnSuccessCallback_94(void * context, uint32_t rxErrOtherCount) - { - (static_cast(context))->OnSuccessResponse_94(rxErrOtherCount); - } - - static void OnFailureCallback_95(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_95(error); - } - - static void OnSuccessCallback_95(void * context, uint32_t rxErrOtherCount) - { - (static_cast(context))->OnSuccessResponse_95(rxErrOtherCount); - } - - static void OnFailureCallback_96(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_96(error); - } - - static void OnSuccessCallback_96(void * context, uint64_t activeTimestamp) - { - (static_cast(context))->OnSuccessResponse_96(activeTimestamp); - } - - static void OnFailureCallback_97(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_97(error); - } - - static void OnSuccessCallback_97(void * context, uint64_t activeTimestamp) - { - (static_cast(context))->OnSuccessResponse_97(activeTimestamp); - } - - static void OnFailureCallback_98(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_98(error); - } - - static void OnSuccessCallback_98(void * context, uint64_t pendingTimestamp) - { - (static_cast(context))->OnSuccessResponse_98(pendingTimestamp); - } - - static void OnFailureCallback_99(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_99(error); - } - - static void OnSuccessCallback_99(void * context, uint64_t pendingTimestamp) - { - (static_cast(context))->OnSuccessResponse_99(pendingTimestamp); - } - - static void OnFailureCallback_100(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_100(error); - } - - static void OnSuccessCallback_100(void * context, uint32_t delay) - { - (static_cast(context))->OnSuccessResponse_100(delay); - } - - static void OnFailureCallback_101(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_101(error); - } - - static void OnSuccessCallback_101(void * context, uint32_t delay) - { - (static_cast(context))->OnSuccessResponse_101(delay); - } - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestValidateConstraintsOfAttributeChannel_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::ThreadNetworkDiagnosticsClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_1, OnFailureCallback_1, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_1(uint16_t channel) - { - VerifyOrReturn(CheckConstraintType("channel", "", "uint16")); - NextTest(); - } - - CHIP_ERROR TestValidateConstraintsOfAttributeNetworkName_2() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::ThreadNetworkDiagnosticsClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_2, OnFailureCallback_2, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_2(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_2(chip::CharSpan networkName) - { - VerifyOrReturn(CheckConstraintType("networkName", "", "string")); - VerifyOrReturn(CheckConstraintMaxLength("networkName", networkName.size(), 16)); - NextTest(); - } - - CHIP_ERROR TestValidateConstraintsOfAttributePanId_3() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::ThreadNetworkDiagnosticsClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_3, OnFailureCallback_3, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_3(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_3(uint16_t panId) - { - VerifyOrReturn(CheckConstraintType("panId", "", "uint16")); - NextTest(); - } - - CHIP_ERROR TestValidateConstraintsOfAttributeExtendedPanId_4() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::ThreadNetworkDiagnosticsClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_4, OnFailureCallback_4, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_4(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_4(uint64_t extendedPanId) - { - VerifyOrReturn(CheckConstraintType("extendedPanId", "", "uint64")); - NextTest(); - } - - CHIP_ERROR TestValidateConstraintsOfAttributeOverrunCount_5() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::ThreadNetworkDiagnosticsClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_5, OnFailureCallback_5, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_5(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_5(uint64_t overrunCount) - { - VerifyOrReturn(CheckConstraintType("overrunCount", "", "uint64")); - NextTest(); - } - - CHIP_ERROR TestReadPartitionIdAttributeValue_6() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::ThreadNetworkDiagnosticsClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_6, OnFailureCallback_6, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_6(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_6(uint32_t partitionId) - { - VerifyOrReturn(CheckValue("partitionId", partitionId, 0UL)); - - NextTest(); - } - - CHIP_ERROR TestValidateConstraintsOfAttributePartitionId_7() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::ThreadNetworkDiagnosticsClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_7, OnFailureCallback_7, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_7(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_7(uint32_t partitionId) - { - VerifyOrReturn(CheckConstraintType("partitionId", "", "uint32")); - NextTest(); - } - - CHIP_ERROR TestReadWeightingAttributeValue_8() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::ThreadNetworkDiagnosticsClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_8, OnFailureCallback_8, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_8(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_8(uint8_t weighting) - { - VerifyOrReturn(CheckValue("weighting", weighting, 0)); - - NextTest(); - } - - CHIP_ERROR TestValidateConstraintsOfAttributeWeighting_9() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::ThreadNetworkDiagnosticsClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_9, OnFailureCallback_9, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_9(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_9(uint8_t weighting) - { - VerifyOrReturn(CheckConstraintType("weighting", "", "uint8")); - NextTest(); - } - - CHIP_ERROR TestReadDataVersionAttributeValue_10() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::ThreadNetworkDiagnosticsClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_10, OnFailureCallback_10, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_10(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_10(uint8_t dataVersion) - { - VerifyOrReturn(CheckValue("dataVersion", dataVersion, 0)); - - NextTest(); - } - - CHIP_ERROR TestValidateConstraintsOfAttributeDataVersion_11() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::ThreadNetworkDiagnosticsClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_11, OnFailureCallback_11, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_11(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_11(uint8_t dataVersion) - { - VerifyOrReturn(CheckConstraintType("dataVersion", "", "uint8")); - NextTest(); - } - - CHIP_ERROR TestReadStableDataVersionAttributeValue_12() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::ThreadNetworkDiagnosticsClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_12, OnFailureCallback_12, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_12(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_12(uint8_t stableDataVersion) - { - VerifyOrReturn(CheckValue("stableDataVersion", stableDataVersion, 0)); - - NextTest(); - } - - CHIP_ERROR TestValidateConstraintsOfAttributeStableDataVersion_13() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::ThreadNetworkDiagnosticsClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_13, OnFailureCallback_13, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_13(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_13(uint8_t stableDataVersion) - { - VerifyOrReturn(CheckConstraintType("stableDataVersion", "", "uint8")); - NextTest(); - } - - CHIP_ERROR TestReadLeaderRouterIdAttributeValue_14() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::ThreadNetworkDiagnosticsClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_14, OnFailureCallback_14, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_14(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_14(uint8_t leaderRouterId) - { - VerifyOrReturn(CheckValue("leaderRouterId", leaderRouterId, 0)); - - NextTest(); - } - - CHIP_ERROR TestValidateConstraintsOfAttributeLeaderRouterId_15() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::ThreadNetworkDiagnosticsClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_15, OnFailureCallback_15, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_15(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_15(uint8_t leaderRouterId) - { - VerifyOrReturn(CheckConstraintType("leaderRouterId", "", "uint8")); - NextTest(); - } - - CHIP_ERROR TestReadDetachedRoleCountAttributeValue_16() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::ThreadNetworkDiagnosticsClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_16, OnFailureCallback_16, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_16(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_16(uint16_t detachedRoleCount) - { - VerifyOrReturn(CheckValue("detachedRoleCount", detachedRoleCount, 0U)); - - NextTest(); - } - - CHIP_ERROR TestValidateConstraintsOfAttributeDetachedRoleCount_17() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::ThreadNetworkDiagnosticsClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_17, OnFailureCallback_17, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_17(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_17(uint16_t detachedRoleCount) - { - VerifyOrReturn(CheckConstraintType("detachedRoleCount", "", "uint16")); - NextTest(); - } - - CHIP_ERROR TestReadChildRoleCountAttributeValue_18() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::ThreadNetworkDiagnosticsClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_18, OnFailureCallback_18, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_18(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_18(uint16_t childRoleCount) - { - VerifyOrReturn(CheckValue("childRoleCount", childRoleCount, 0U)); - - NextTest(); - } - - CHIP_ERROR TestValidateConstraintsOfAttributeChildRoleCount_19() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::ThreadNetworkDiagnosticsClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_19, OnFailureCallback_19, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_19(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_19(uint16_t childRoleCount) - { - VerifyOrReturn(CheckConstraintType("childRoleCount", "", "uint16")); - NextTest(); - } - - CHIP_ERROR TestReadRouterRoleCountAttributeValue_20() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::ThreadNetworkDiagnosticsClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_20, OnFailureCallback_20, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_20(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_20(uint16_t routerRoleCount) - { - VerifyOrReturn(CheckValue("routerRoleCount", routerRoleCount, 0U)); - - NextTest(); - } - - CHIP_ERROR TestValidateConstraintsOfAttributeRouterRoleCount_21() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::ThreadNetworkDiagnosticsClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_21, OnFailureCallback_21, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_21(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_21(uint16_t routerRoleCount) - { - VerifyOrReturn(CheckConstraintType("routerRoleCount", "", "uint16")); - NextTest(); - } - - CHIP_ERROR TestReadLeaderRoleCountAttributeValue_22() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::ThreadNetworkDiagnosticsClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_22, OnFailureCallback_22, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_22(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_22(uint16_t leaderRoleCount) - { - VerifyOrReturn(CheckValue("leaderRoleCount", leaderRoleCount, 0U)); - - NextTest(); - } - - CHIP_ERROR TestValidateConstraintsOfAttributeLeaderRoleCount_23() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::ThreadNetworkDiagnosticsClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_23, OnFailureCallback_23, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_23(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_23(uint16_t leaderRoleCount) - { - VerifyOrReturn(CheckConstraintType("leaderRoleCount", "", "uint16")); - NextTest(); - } - - CHIP_ERROR TestReadAttachAttemptCountAttributeValue_24() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::ThreadNetworkDiagnosticsClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_24, OnFailureCallback_24, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_24(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_24(uint16_t attachAttemptCount) - { - VerifyOrReturn(CheckValue("attachAttemptCount", attachAttemptCount, 0U)); - - NextTest(); - } - - CHIP_ERROR TestValidateConstraintsOfAttributeAttachAttemptCount_25() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::ThreadNetworkDiagnosticsClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_25, OnFailureCallback_25, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_25(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_25(uint16_t attachAttemptCount) - { - VerifyOrReturn(CheckConstraintType("attachAttemptCount", "", "uint16")); - NextTest(); - } - - CHIP_ERROR TestReadPartitionIdChangeCountAttributeValue_26() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::ThreadNetworkDiagnosticsClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_26, OnFailureCallback_26, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_26(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_26(uint16_t partitionIdChangeCount) - { - VerifyOrReturn(CheckValue("partitionIdChangeCount", partitionIdChangeCount, 0U)); - - NextTest(); - } - - CHIP_ERROR TestValidateConstraintsOfAttributePartitionIdChangeCount_27() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::ThreadNetworkDiagnosticsClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_27, OnFailureCallback_27, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_27(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_27(uint16_t partitionIdChangeCount) - { - VerifyOrReturn(CheckConstraintType("partitionIdChangeCount", "", "uint16")); - NextTest(); - } - - CHIP_ERROR TestReadBetterPartitionAttachAttemptCountAttributeValue_28() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::ThreadNetworkDiagnosticsClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute< - chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::BetterPartitionAttachAttemptCount::TypeInfo>( - this, OnSuccessCallback_28, OnFailureCallback_28, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_28(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_28(uint16_t betterPartitionAttachAttemptCount) - { - VerifyOrReturn(CheckValue("betterPartitionAttachAttemptCount", betterPartitionAttachAttemptCount, 0U)); - - NextTest(); - } - - CHIP_ERROR TestValidateConstraintsOfAttributeBetterPartitionAttachAttemptCount_29() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::ThreadNetworkDiagnosticsClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute< - chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::BetterPartitionAttachAttemptCount::TypeInfo>( - this, OnSuccessCallback_29, OnFailureCallback_29, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_29(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_29(uint16_t betterPartitionAttachAttemptCount) - { - VerifyOrReturn(CheckConstraintType("betterPartitionAttachAttemptCount", "", "uint16")); - NextTest(); - } - - CHIP_ERROR TestReadParentChangeCountAttributeValue_30() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::ThreadNetworkDiagnosticsClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_30, OnFailureCallback_30, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_30(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_30(uint16_t parentChangeCount) - { - VerifyOrReturn(CheckValue("parentChangeCount", parentChangeCount, 0U)); - - NextTest(); - } - - CHIP_ERROR TestValidateConstraintsOfAttributeParentChangeCount_31() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::ThreadNetworkDiagnosticsClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_31, OnFailureCallback_31, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_31(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_31(uint16_t parentChangeCount) - { - VerifyOrReturn(CheckConstraintType("parentChangeCount", "", "uint16")); - NextTest(); - } - - CHIP_ERROR TestReadTxTotalCountAttributeValue_32() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::ThreadNetworkDiagnosticsClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_32, OnFailureCallback_32, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_32(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_32(uint32_t txTotalCount) - { - VerifyOrReturn(CheckValue("txTotalCount", txTotalCount, 0UL)); - - NextTest(); - } - - CHIP_ERROR TestValidateConstraintsOfAttributeTxTotalCount_33() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::ThreadNetworkDiagnosticsClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_33, OnFailureCallback_33, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_33(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_33(uint32_t txTotalCount) - { - VerifyOrReturn(CheckConstraintType("txTotalCount", "", "uint32")); - NextTest(); - } - - CHIP_ERROR TestReadTxUnicastCountAttributeValue_34() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::ThreadNetworkDiagnosticsClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_34, OnFailureCallback_34, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_34(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_34(uint32_t txUnicastCount) - { - VerifyOrReturn(CheckValue("txUnicastCount", txUnicastCount, 0UL)); - - NextTest(); - } - - CHIP_ERROR TestValidateConstraintsOfAttributeTxUnicastCount_35() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::ThreadNetworkDiagnosticsClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_35, OnFailureCallback_35, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_35(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_35(uint32_t txUnicastCount) - { - VerifyOrReturn(CheckConstraintType("txUnicastCount", "", "uint32")); - NextTest(); - } - - CHIP_ERROR TestReadTxBroadcastCountAttributeValue_36() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::ThreadNetworkDiagnosticsClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_36, OnFailureCallback_36, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_36(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_36(uint32_t txBroadcastCount) - { - VerifyOrReturn(CheckValue("txBroadcastCount", txBroadcastCount, 0UL)); - - NextTest(); - } - - CHIP_ERROR TestValidateConstraintsOfAttributeTxBroadcastCount_37() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::ThreadNetworkDiagnosticsClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_37, OnFailureCallback_37, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_37(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_37(uint32_t txBroadcastCount) - { - VerifyOrReturn(CheckConstraintType("txBroadcastCount", "", "uint32")); - NextTest(); - } - - CHIP_ERROR TestReadTxNoAckRequestedCountAttributeValue_38() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::ThreadNetworkDiagnosticsClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_38, OnFailureCallback_38, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_38(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_38(uint32_t txNoAckRequestedCount) - { - VerifyOrReturn(CheckValue("txNoAckRequestedCount", txNoAckRequestedCount, 0UL)); - - NextTest(); - } - - CHIP_ERROR TestValidateConstraintsOfAttributeTxNoAckRequestedCount_39() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::ThreadNetworkDiagnosticsClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_39, OnFailureCallback_39, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_39(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_39(uint32_t txNoAckRequestedCount) - { - VerifyOrReturn(CheckConstraintType("txNoAckRequestedCount", "", "uint32")); - NextTest(); - } - - CHIP_ERROR TestReadTxDataCountAttributeValue_40() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::ThreadNetworkDiagnosticsClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_40, OnFailureCallback_40, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_40(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_40(uint32_t txDataCount) - { - VerifyOrReturn(CheckValue("txDataCount", txDataCount, 0UL)); - - NextTest(); - } - - CHIP_ERROR TestValidateConstraintsOfAttributeTxDataCount_41() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::ThreadNetworkDiagnosticsClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_41, OnFailureCallback_41, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_41(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_41(uint32_t txDataCount) - { - VerifyOrReturn(CheckConstraintType("txDataCount", "", "uint32")); - NextTest(); - } - - CHIP_ERROR TestReadTxDataPollCountAttributeValue_42() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::ThreadNetworkDiagnosticsClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_42, OnFailureCallback_42, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_42(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_42(uint32_t txDataPollCount) - { - VerifyOrReturn(CheckValue("txDataPollCount", txDataPollCount, 0UL)); - - NextTest(); - } - - CHIP_ERROR TestValidateConstraintsOfAttributeTxDataPollCount_43() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::ThreadNetworkDiagnosticsClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_43, OnFailureCallback_43, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_43(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_43(uint32_t txDataPollCount) - { - VerifyOrReturn(CheckConstraintType("txDataPollCount", "", "uint32")); - NextTest(); - } - - CHIP_ERROR TestReadTxBeaconCountAttributeValue_44() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::ThreadNetworkDiagnosticsClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_44, OnFailureCallback_44, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_44(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_44(uint32_t txBeaconCount) - { - VerifyOrReturn(CheckValue("txBeaconCount", txBeaconCount, 0UL)); - - NextTest(); - } - - CHIP_ERROR TestValidateConstraintsOfAttributeTxBeaconCount_45() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::ThreadNetworkDiagnosticsClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_45, OnFailureCallback_45, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_45(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_45(uint32_t txBeaconCount) - { - VerifyOrReturn(CheckConstraintType("txBeaconCount", "", "uint32")); - NextTest(); - } - - CHIP_ERROR TestReadTxBeaconRequestCountAttributeValue_46() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::ThreadNetworkDiagnosticsClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_46, OnFailureCallback_46, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_46(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_46(uint32_t txBeaconRequestCount) - { - VerifyOrReturn(CheckValue("txBeaconRequestCount", txBeaconRequestCount, 0UL)); - - NextTest(); - } - - CHIP_ERROR TestValidateConstraintsOfAttributeTxBeaconRequestCount_47() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::ThreadNetworkDiagnosticsClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_47, OnFailureCallback_47, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_47(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_47(uint32_t txBeaconRequestCount) - { - VerifyOrReturn(CheckConstraintType("txBeaconRequestCount", "", "uint32")); - NextTest(); - } - - CHIP_ERROR TestReadTxOtherCountAttributeValue_48() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::ThreadNetworkDiagnosticsClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_48, OnFailureCallback_48, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_48(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_48(uint32_t txOtherCount) - { - VerifyOrReturn(CheckValue("txOtherCount", txOtherCount, 0UL)); - - NextTest(); - } - - CHIP_ERROR TestValidateConstraintsOfAttributeTxOtherCount_49() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::ThreadNetworkDiagnosticsClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_49, OnFailureCallback_49, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_49(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_49(uint32_t txOtherCount) - { - VerifyOrReturn(CheckConstraintType("txOtherCount", "", "uint32")); - NextTest(); - } - - CHIP_ERROR TestReadTxRetryCountAttributeValue_50() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::ThreadNetworkDiagnosticsClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_50, OnFailureCallback_50, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_50(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_50(uint32_t txRetryCount) - { - VerifyOrReturn(CheckValue("txRetryCount", txRetryCount, 0UL)); - - NextTest(); - } - - CHIP_ERROR TestValidateConstraintsOfAttributeTxRetryCount_51() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::ThreadNetworkDiagnosticsClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_51, OnFailureCallback_51, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_51(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_51(uint32_t txRetryCount) - { - VerifyOrReturn(CheckConstraintType("txRetryCount", "", "uint32")); - NextTest(); - } - - CHIP_ERROR TestReadTxDirectMaxRetryExpiryCountAttributeValue_52() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::ThreadNetworkDiagnosticsClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_52, OnFailureCallback_52, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_52(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_52(uint32_t txDirectMaxRetryExpiryCount) - { - VerifyOrReturn(CheckValue("txDirectMaxRetryExpiryCount", txDirectMaxRetryExpiryCount, 0UL)); - - NextTest(); - } - - CHIP_ERROR TestValidateConstraintsOfAttributeTxDirectMaxRetryExpiryCount_53() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::ThreadNetworkDiagnosticsClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_53, OnFailureCallback_53, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_53(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_53(uint32_t txDirectMaxRetryExpiryCount) - { - VerifyOrReturn(CheckConstraintType("txDirectMaxRetryExpiryCount", "", "uint32")); - NextTest(); - } - - CHIP_ERROR TestReadTxIndirectMaxRetryExpiryCountAttributeValue_54() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::ThreadNetworkDiagnosticsClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster - .ReadAttribute( - this, OnSuccessCallback_54, OnFailureCallback_54, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_54(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_54(uint32_t txIndirectMaxRetryExpiryCount) - { - VerifyOrReturn(CheckValue("txIndirectMaxRetryExpiryCount", txIndirectMaxRetryExpiryCount, 0UL)); - - NextTest(); - } - - CHIP_ERROR TestValidateConstraintsOfAttributeTxIndirectMaxRetryExpiryCount_55() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::ThreadNetworkDiagnosticsClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster - .ReadAttribute( - this, OnSuccessCallback_55, OnFailureCallback_55, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_55(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_55(uint32_t txIndirectMaxRetryExpiryCount) - { - VerifyOrReturn(CheckConstraintType("txIndirectMaxRetryExpiryCount", "", "uint32")); - NextTest(); - } - - CHIP_ERROR TestReadTxErrCcaCountAttributeValue_56() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::ThreadNetworkDiagnosticsClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_56, OnFailureCallback_56, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_56(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_56(uint32_t txErrCcaCount) - { - VerifyOrReturn(CheckValue("txErrCcaCount", txErrCcaCount, 0UL)); - - NextTest(); - } - - CHIP_ERROR TestValidateConstraintsOfAttributeTxErrCcaCount_57() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::ThreadNetworkDiagnosticsClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_57, OnFailureCallback_57, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_57(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_57(uint32_t txErrCcaCount) - { - VerifyOrReturn(CheckConstraintType("txErrCcaCount", "", "uint32")); - NextTest(); - } - - CHIP_ERROR TestReadTxErrAbortCountAttributeValue_58() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::ThreadNetworkDiagnosticsClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_58, OnFailureCallback_58, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_58(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_58(uint32_t txErrAbortCount) - { - VerifyOrReturn(CheckValue("txErrAbortCount", txErrAbortCount, 0UL)); - - NextTest(); - } - - CHIP_ERROR TestValidateConstraintsOfAttributeTxErrAbortCount_59() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::ThreadNetworkDiagnosticsClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_59, OnFailureCallback_59, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_59(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_59(uint32_t txErrAbortCount) - { - VerifyOrReturn(CheckConstraintType("txErrAbortCount", "", "uint32")); - NextTest(); - } - - CHIP_ERROR TestReadTxErrBusyChannelCountAttributeValue_60() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::ThreadNetworkDiagnosticsClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_60, OnFailureCallback_60, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_60(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_60(uint32_t txErrBusyChannelCount) - { - VerifyOrReturn(CheckValue("txErrBusyChannelCount", txErrBusyChannelCount, 0UL)); - - NextTest(); - } - - CHIP_ERROR TestValidateConstraintsOfAttributeTxErrBusyChannelCount_61() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::ThreadNetworkDiagnosticsClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_61, OnFailureCallback_61, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_61(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_61(uint32_t txErrBusyChannelCount) - { - VerifyOrReturn(CheckConstraintType("txErrBusyChannelCount", "", "uint32")); - NextTest(); - } - - CHIP_ERROR TestReadRxTotalCountAttributeValue_62() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::ThreadNetworkDiagnosticsClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_62, OnFailureCallback_62, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_62(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_62(uint32_t rxTotalCount) - { - VerifyOrReturn(CheckValue("rxTotalCount", rxTotalCount, 0UL)); - - NextTest(); - } - - CHIP_ERROR TestValidateConstraintsOfAttributeRxTotalCount_63() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::ThreadNetworkDiagnosticsClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_63, OnFailureCallback_63, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_63(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_63(uint32_t rxTotalCount) - { - VerifyOrReturn(CheckConstraintType("rxTotalCount", "", "uint32")); - NextTest(); - } - - CHIP_ERROR TestReadRxUnicastCountAttributeValue_64() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::ThreadNetworkDiagnosticsClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_64, OnFailureCallback_64, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_64(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_64(uint32_t rxUnicastCount) - { - VerifyOrReturn(CheckValue("rxUnicastCount", rxUnicastCount, 0UL)); - - NextTest(); - } - - CHIP_ERROR TestValidateConstraintsOfAttributeRxUnicastCount_65() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::ThreadNetworkDiagnosticsClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_65, OnFailureCallback_65, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_65(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_65(uint32_t rxUnicastCount) - { - VerifyOrReturn(CheckConstraintType("rxUnicastCount", "", "uint32")); - NextTest(); - } - - CHIP_ERROR TestReadRxBroadcastCountAttributeValue_66() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::ThreadNetworkDiagnosticsClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_66, OnFailureCallback_66, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_66(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_66(uint32_t rxBroadcastCount) - { - VerifyOrReturn(CheckValue("rxBroadcastCount", rxBroadcastCount, 0UL)); - - NextTest(); - } - - CHIP_ERROR TestValidateConstraintsOfAttributeRxBroadcastCount_67() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::ThreadNetworkDiagnosticsClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_67, OnFailureCallback_67, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_67(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_67(uint32_t rxBroadcastCount) - { - VerifyOrReturn(CheckConstraintType("rxBroadcastCount", "", "uint32")); - NextTest(); - } - - CHIP_ERROR TestReadRxDataCountAttributeValue_68() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::ThreadNetworkDiagnosticsClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_68, OnFailureCallback_68, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_68(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_68(uint32_t rxDataCount) - { - VerifyOrReturn(CheckValue("rxDataCount", rxDataCount, 0UL)); - - NextTest(); - } - - CHIP_ERROR TestValidateConstraintsOfAttributeRxDataCount_69() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::ThreadNetworkDiagnosticsClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_69, OnFailureCallback_69, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_69(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_69(uint32_t rxDataCount) - { - VerifyOrReturn(CheckConstraintType("rxDataCount", "", "uint32")); - NextTest(); - } - - CHIP_ERROR TestReadRxDataPollCountAttributeValue_70() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::ThreadNetworkDiagnosticsClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_70, OnFailureCallback_70, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_70(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_70(uint32_t rxDataPollCount) - { - VerifyOrReturn(CheckValue("rxDataPollCount", rxDataPollCount, 0UL)); - - NextTest(); - } - - CHIP_ERROR TestValidateConstraintsOfAttributeRxDataPollCount_71() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::ThreadNetworkDiagnosticsClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_71, OnFailureCallback_71, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_71(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_71(uint32_t rxDataPollCount) - { - VerifyOrReturn(CheckConstraintType("rxDataPollCount", "", "uint32")); - NextTest(); - } - - CHIP_ERROR TestReadRxBeaconCountAttributeValue_72() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::ThreadNetworkDiagnosticsClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_72, OnFailureCallback_72, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_72(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_72(uint32_t rxBeaconCount) - { - VerifyOrReturn(CheckValue("rxBeaconCount", rxBeaconCount, 0UL)); - - NextTest(); - } - - CHIP_ERROR TestValidateConstraintsOfAttributeRxBeaconCount_73() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::ThreadNetworkDiagnosticsClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_73, OnFailureCallback_73, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_73(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_73(uint32_t rxBeaconCount) - { - VerifyOrReturn(CheckConstraintType("rxBeaconCount", "", "uint32")); - NextTest(); - } - - CHIP_ERROR TestReadRxBeaconRequestCountAttributeValue_74() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::ThreadNetworkDiagnosticsClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_74, OnFailureCallback_74, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_74(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_74(uint32_t rxBeaconRequestCount) - { - VerifyOrReturn(CheckValue("rxBeaconRequestCount", rxBeaconRequestCount, 0UL)); - - NextTest(); - } - - CHIP_ERROR TestValidateConstraintsOfAttributeRxBeaconRequestCount_75() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::ThreadNetworkDiagnosticsClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_75, OnFailureCallback_75, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_75(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_75(uint32_t rxBeaconRequestCount) - { - VerifyOrReturn(CheckConstraintType("rxBeaconRequestCount", "", "uint32")); - NextTest(); - } - - CHIP_ERROR TestReadRxOtherCountAttributeValue_76() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::ThreadNetworkDiagnosticsClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_76, OnFailureCallback_76, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_76(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_76(uint32_t rxOtherCount) - { - VerifyOrReturn(CheckValue("rxOtherCount", rxOtherCount, 0UL)); - - NextTest(); - } - - CHIP_ERROR TestValidateConstraintsOfAttributeRxOtherCount_77() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::ThreadNetworkDiagnosticsClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_77, OnFailureCallback_77, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_77(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_77(uint32_t rxOtherCount) - { - VerifyOrReturn(CheckConstraintType("rxOtherCount", "", "uint32")); - NextTest(); - } - - CHIP_ERROR TestReadRxAddressFilteredCountAttributeValue_78() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::ThreadNetworkDiagnosticsClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_78, OnFailureCallback_78, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_78(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_78(uint32_t rxAddressFilteredCount) - { - VerifyOrReturn(CheckValue("rxAddressFilteredCount", rxAddressFilteredCount, 0UL)); - - NextTest(); - } - - CHIP_ERROR TestValidateConstraintsOfAttributeRxAddressFilteredCount_79() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::ThreadNetworkDiagnosticsClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_79, OnFailureCallback_79, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_79(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_79(uint32_t rxAddressFilteredCount) - { - VerifyOrReturn(CheckConstraintType("rxAddressFilteredCount", "", "uint32")); - NextTest(); - } - - CHIP_ERROR TestReadRxDestAddrFilteredCountAttributeValue_80() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::ThreadNetworkDiagnosticsClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_80, OnFailureCallback_80, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_80(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_80(uint32_t rxDestAddrFilteredCount) - { - VerifyOrReturn(CheckValue("rxDestAddrFilteredCount", rxDestAddrFilteredCount, 0UL)); - - NextTest(); - } - - CHIP_ERROR TestValidateConstraintsOfAttributeRxDestAddrFilteredCount_81() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::ThreadNetworkDiagnosticsClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_81, OnFailureCallback_81, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_81(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_81(uint32_t rxDestAddrFilteredCount) - { - VerifyOrReturn(CheckConstraintType("rxDestAddrFilteredCount", "", "uint32")); - NextTest(); - } - - CHIP_ERROR TestReadRxDuplicatedCountAttributeValue_82() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::ThreadNetworkDiagnosticsClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_82, OnFailureCallback_82, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_82(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_82(uint32_t rxDuplicatedCount) - { - VerifyOrReturn(CheckValue("rxDuplicatedCount", rxDuplicatedCount, 0UL)); - - NextTest(); - } - - CHIP_ERROR TestValidateConstraintsOfAttributeRxDuplicatedCount_83() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::ThreadNetworkDiagnosticsClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_83, OnFailureCallback_83, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_83(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_83(uint32_t rxDuplicatedCount) - { - VerifyOrReturn(CheckConstraintType("rxDuplicatedCount", "", "uint32")); - NextTest(); - } - - CHIP_ERROR TestReadRxErrNoFrameCountAttributeValue_84() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::ThreadNetworkDiagnosticsClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_84, OnFailureCallback_84, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_84(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_84(uint32_t rxErrNoFrameCount) - { - VerifyOrReturn(CheckValue("rxErrNoFrameCount", rxErrNoFrameCount, 0UL)); - - NextTest(); - } - - CHIP_ERROR TestValidateConstraintsOfAttributeRxErrNoFrameCount_85() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::ThreadNetworkDiagnosticsClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_85, OnFailureCallback_85, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_85(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_85(uint32_t rxErrNoFrameCount) - { - VerifyOrReturn(CheckConstraintType("rxErrNoFrameCount", "", "uint32")); - NextTest(); - } - - CHIP_ERROR TestReadRxErrUnknownNeighborCountAttributeValue_86() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::ThreadNetworkDiagnosticsClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_86, OnFailureCallback_86, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_86(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_86(uint32_t rxErrUnknownNeighborCount) - { - VerifyOrReturn(CheckValue("rxErrUnknownNeighborCount", rxErrUnknownNeighborCount, 0UL)); - - NextTest(); - } - - CHIP_ERROR TestValidateConstraintsOfAttributeRxErrUnknownNeighborCount_87() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::ThreadNetworkDiagnosticsClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_87, OnFailureCallback_87, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_87(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_87(uint32_t rxErrUnknownNeighborCount) - { - VerifyOrReturn(CheckConstraintType("rxErrUnknownNeighborCount", "", "uint32")); - NextTest(); - } - - CHIP_ERROR TestReadRxErrInvalidScrAddrCountAttributeValue_88() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::ThreadNetworkDiagnosticsClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_88, OnFailureCallback_88, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_88(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_88(uint32_t rxErrInvalidSrcAddrCount) - { - VerifyOrReturn(CheckValue("rxErrInvalidSrcAddrCount", rxErrInvalidSrcAddrCount, 0UL)); - - NextTest(); - } - - CHIP_ERROR TestValidateConstraintsOfAttributeRxErrInvalidSrcAddrCount_89() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::ThreadNetworkDiagnosticsClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_89, OnFailureCallback_89, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_89(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_89(uint32_t rxErrInvalidSrcAddrCount) - { - VerifyOrReturn(CheckConstraintType("rxErrInvalidSrcAddrCount", "", "uint32")); - NextTest(); - } - - CHIP_ERROR TestReadRxErrSecCountAttributeValue_90() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::ThreadNetworkDiagnosticsClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_90, OnFailureCallback_90, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_90(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_90(uint32_t rxErrSecCount) - { - VerifyOrReturn(CheckValue("rxErrSecCount", rxErrSecCount, 0UL)); - - NextTest(); - } - - CHIP_ERROR TestValidateConstraintsOfAttributeRxErrInvalidSrcAddrCount_91() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::ThreadNetworkDiagnosticsClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_91, OnFailureCallback_91, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_91(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_91(uint32_t rxErrSecCount) - { - VerifyOrReturn(CheckConstraintType("rxErrSecCount", "", "uint32")); - NextTest(); - } - - CHIP_ERROR TestReadRxErrFcsCountAttributeValue_92() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::ThreadNetworkDiagnosticsClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_92, OnFailureCallback_92, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_92(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_92(uint32_t rxErrFcsCount) - { - VerifyOrReturn(CheckValue("rxErrFcsCount", rxErrFcsCount, 0UL)); - - NextTest(); - } - - CHIP_ERROR TestValidateConstraintsOfAttributeRxErrFcsCount_93() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::ThreadNetworkDiagnosticsClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_93, OnFailureCallback_93, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_93(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_93(uint32_t rxErrFcsCount) - { - VerifyOrReturn(CheckConstraintType("rxErrFcsCount", "", "uint32")); - NextTest(); - } - - CHIP_ERROR TestReadRxErrOtherCountAttributeValue_94() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::ThreadNetworkDiagnosticsClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_94, OnFailureCallback_94, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_94(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_94(uint32_t rxErrOtherCount) - { - VerifyOrReturn(CheckValue("rxErrOtherCount", rxErrOtherCount, 0UL)); - - NextTest(); - } - - CHIP_ERROR TestValidateConstraintsOfAttributeRxErrOtherCount_95() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::ThreadNetworkDiagnosticsClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_95, OnFailureCallback_95, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_95(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_95(uint32_t rxErrOtherCount) - { - VerifyOrReturn(CheckConstraintType("rxErrOtherCount", "", "uint32")); - NextTest(); - } - - CHIP_ERROR TestReadActiveTimestampAttributeValue_96() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::ThreadNetworkDiagnosticsClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_96, OnFailureCallback_96, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_96(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_96(uint64_t activeTimestamp) - { - VerifyOrReturn(CheckValue("activeTimestamp", activeTimestamp, 0ULL)); - - NextTest(); - } - - CHIP_ERROR TestValidateConstraintsOfAttributeActiveTimestamp_97() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::ThreadNetworkDiagnosticsClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_97, OnFailureCallback_97, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_97(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_97(uint64_t activeTimestamp) - { - VerifyOrReturn(CheckConstraintType("activeTimestamp", "", "uint64")); - NextTest(); - } - - CHIP_ERROR TestReadPendingTimestampAttributeValue_98() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::ThreadNetworkDiagnosticsClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_98, OnFailureCallback_98, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_98(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_98(uint64_t pendingTimestamp) - { - VerifyOrReturn(CheckValue("pendingTimestamp", pendingTimestamp, 0ULL)); - - NextTest(); - } - - CHIP_ERROR TestValidateConstraintsOfAttributePendingTimestamp_99() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::ThreadNetworkDiagnosticsClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_99, OnFailureCallback_99, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_99(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_99(uint64_t pendingTimestamp) - { - VerifyOrReturn(CheckConstraintType("pendingTimestamp", "", "uint64")); - NextTest(); - } - - CHIP_ERROR TestReadDelayAttributeValue_100() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::ThreadNetworkDiagnosticsClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_100, OnFailureCallback_100, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_100(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_100(uint32_t delay) - { - VerifyOrReturn(CheckValue("delay", delay, 0UL)); - - NextTest(); - } - - CHIP_ERROR TestValidateConstraintsOfAttributeDelay_101() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::ThreadNetworkDiagnosticsClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_101, OnFailureCallback_101, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_101(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_101(uint32_t delay) - { - VerifyOrReturn(CheckConstraintType("delay", "", "uint32")); - NextTest(); - } -}; - -class Test_TC_LC_1_2Suite : public TestCommand -{ -public: - Test_TC_LC_1_2Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_LC_1_2", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_LC_1_2Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_LC_1_2\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_LC_1_2\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : TH1 reads LabelList attribute from the DUT\n"); - err = TestTh1ReadsLabelListAttributeFromTheDut_1(); - break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 2; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - static void OnFailureCallback_1(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_1(error); - } - - static void OnSuccessCallback_1( - void * context, - const chip::app::DataModel::DecodableList & labelList) - { - (static_cast(context))->OnSuccessResponse_1(labelList); - } - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestTh1ReadsLabelListAttributeFromTheDut_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::UserLabelClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_1, OnFailureCallback_1, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_1( - const chip::app::DataModel::DecodableList & labelList) - { - NextTest(); - } -}; - -class Test_TC_WIFIDIAG_1_1Suite : public TestCommand -{ -public: - Test_TC_WIFIDIAG_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_WIFIDIAG_1_1", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_WIFIDIAG_1_1Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_WIFIDIAG_1_1\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_WIFIDIAG_1_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Reads NetworkInterface structure attribute from DUT\n"); - err = TestReadsNetworkInterfaceStructureAttributeFromDut_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Reads SecurityType attribute from DUT\n"); - err = TestReadsSecurityTypeAttributeFromDut_2(); - break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Reads SecurityType attribute constraints\n"); - err = TestReadsSecurityTypeAttributeConstraints_3(); - break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Reads WiFiVersion attribute constraints\n"); - err = TestReadsWiFiVersionAttributeConstraints_4(); - break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Reads ChannelNumber attribute constraints\n"); - err = TestReadsChannelNumberAttributeConstraints_5(); - break; - case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : Reads RSSI attribute constraints\n"); - err = TestReadsRssiAttributeConstraints_6(); - break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 7; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - static void OnFailureCallback_1(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_1(error); - } - - static void OnSuccessCallback_1( - void * context, - const chip::app::DataModel::DecodableList< - chip::app::Clusters::GeneralDiagnostics::Structs::NetworkInterfaceType::DecodableType> & networkInterfaces) - { - (static_cast(context))->OnSuccessResponse_1(networkInterfaces); - } - - static void OnFailureCallback_2(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_2(error); - } - - static void OnSuccessCallback_2( - void * context, - const chip::app::DataModel::Nullable & securityType) - { - (static_cast(context))->OnSuccessResponse_2(securityType); - } - - static void OnFailureCallback_3(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_3(error); - } - - static void OnSuccessCallback_3( - void * context, - const chip::app::DataModel::Nullable & securityType) - { - (static_cast(context))->OnSuccessResponse_3(securityType); - } - - static void OnFailureCallback_4(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_4(error); - } - - static void OnSuccessCallback_4( - void * context, - const chip::app::DataModel::Nullable & wiFiVersion) - { - (static_cast(context))->OnSuccessResponse_4(wiFiVersion); - } - - static void OnFailureCallback_5(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_5(error); - } - - static void OnSuccessCallback_5(void * context, const chip::app::DataModel::Nullable & channelNumber) - { - (static_cast(context))->OnSuccessResponse_5(channelNumber); - } - - static void OnFailureCallback_6(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_6(error); - } - - static void OnSuccessCallback_6(void * context, const chip::app::DataModel::Nullable & rssi) - { - (static_cast(context))->OnSuccessResponse_6(rssi); - } - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestReadsNetworkInterfaceStructureAttributeFromDut_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::GeneralDiagnosticsClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_1, OnFailureCallback_1, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void - OnSuccessResponse_1(const chip::app::DataModel::DecodableList< - chip::app::Clusters::GeneralDiagnostics::Structs::NetworkInterfaceType::DecodableType> & networkInterfaces) - { - VerifyOrReturn(CheckConstraintType("networkInterfaces", "", "list")); - NextTest(); - } - - CHIP_ERROR TestReadsSecurityTypeAttributeFromDut_2() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::WiFiNetworkDiagnosticsClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_2, OnFailureCallback_2, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_2(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_2( - const chip::app::DataModel::Nullable & securityType) - { - VerifyOrReturn(CheckValueNull("securityType", securityType)); - - NextTest(); - } - - CHIP_ERROR TestReadsSecurityTypeAttributeConstraints_3() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::WiFiNetworkDiagnosticsClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_3, OnFailureCallback_3, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_3(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_3( - const chip::app::DataModel::Nullable & securityType) - { - VerifyOrReturn(CheckConstraintType("securityType", "", "enum")); - NextTest(); - } - - CHIP_ERROR TestReadsWiFiVersionAttributeConstraints_4() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::WiFiNetworkDiagnosticsClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_4, OnFailureCallback_4, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_4(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_4( - const chip::app::DataModel::Nullable & wiFiVersion) - { - VerifyOrReturn(CheckConstraintType("wiFiVersion", "", "enum")); - VerifyOrReturn(CheckConstraintMinValue("wiFiVersion", wiFiVersion, 0)); - VerifyOrReturn(CheckConstraintMaxValue("wiFiVersion", wiFiVersion, 5)); - NextTest(); - } - - CHIP_ERROR TestReadsChannelNumberAttributeConstraints_5() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::WiFiNetworkDiagnosticsClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_5, OnFailureCallback_5, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_5(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_5(const chip::app::DataModel::Nullable & channelNumber) - { - VerifyOrReturn(CheckConstraintType("channelNumber", "", "uint16")); - NextTest(); - } - - CHIP_ERROR TestReadsRssiAttributeConstraints_6() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::WiFiNetworkDiagnosticsClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_6, OnFailureCallback_6, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_6(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_6(const chip::app::DataModel::Nullable & rssi) - { - VerifyOrReturn(CheckConstraintType("rssi", "", "int8")); - VerifyOrReturn(CheckConstraintMinValue("rssi", rssi, -120)); - VerifyOrReturn(CheckConstraintMaxValue("rssi", rssi, 0)); - NextTest(); - } -}; - -class Test_TC_WIFIDIAG_3_1Suite : public TestCommand -{ -public: - Test_TC_WIFIDIAG_3_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_WIFIDIAG_3_1", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_WIFIDIAG_3_1Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_WIFIDIAG_3_1\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_WIFIDIAG_3_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 1; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } -}; - -class Test_TC_WNCV_1_1Suite : public TestCommand -{ -public: - Test_TC_WNCV_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_WNCV_1_1", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_WNCV_1_1Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_WNCV_1_1\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_WNCV_1_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : 2: read the global attribute: ClusterRevision\n"); - err = Test2ReadTheGlobalAttributeClusterRevision_1(); - break; - case 2: - ChipLogProgress(chipTool, - " ***** Test Step 2 : 3a: write a value into the RO mandatory global attribute: ClusterRevision\n"); - err = Test3aWriteAValueIntoTheRoMandatoryGlobalAttributeClusterRevision_2(); - break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : 3b: reads back global attribute: ClusterRevision\n"); - err = Test3bReadsBackGlobalAttributeClusterRevision_3(); - break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Read the global attribute: AttributeList\n"); - err = TestReadTheGlobalAttributeAttributeList_4(); - break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : 2: read the global attribute: FeatureMap\n"); - err = Test2ReadTheGlobalAttributeFeatureMap_5(); - break; - case 6: - ChipLogProgress(chipTool, - " ***** Test Step 6 : 3a: write the default value to optional global attribute: FeatureMap\n"); - err = Test3aWriteTheDefaultValueToOptionalGlobalAttributeFeatureMap_6(); - break; - case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : 3b: reads back global attribute: FeatureMap\n"); - err = Test3bReadsBackGlobalAttributeFeatureMap_7(); - break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 8; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - static void OnFailureCallback_1(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_1(error); - } - - static void OnSuccessCallback_1(void * context, uint16_t clusterRevision) - { - (static_cast(context))->OnSuccessResponse_1(clusterRevision); - } - - static void OnFailureCallback_2(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_2(error); - } - - static void OnSuccessCallback_2(void * context) { (static_cast(context))->OnSuccessResponse_2(); } - - static void OnFailureCallback_3(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_3(error); - } - - static void OnSuccessCallback_3(void * context, uint16_t clusterRevision) - { - (static_cast(context))->OnSuccessResponse_3(clusterRevision); - } - - static void OnFailureCallback_4(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_4(error); - } - - static void OnSuccessCallback_4(void * context, const chip::app::DataModel::DecodableList & attributeList) - { - (static_cast(context))->OnSuccessResponse_4(attributeList); - } - - static void OnFailureCallback_5(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_5(error); - } - - static void OnSuccessCallback_5(void * context, uint32_t featureMap) - { - (static_cast(context))->OnSuccessResponse_5(featureMap); - } - - static void OnFailureCallback_6(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_6(error); - } - - static void OnSuccessCallback_6(void * context) { (static_cast(context))->OnSuccessResponse_6(); } - - static void OnFailureCallback_7(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_7(error); - } - - static void OnSuccessCallback_7(void * context, uint32_t featureMap) - { - (static_cast(context))->OnSuccessResponse_7(featureMap); - } - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR Test2ReadTheGlobalAttributeClusterRevision_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::WindowCoveringClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_1, OnFailureCallback_1, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_1(uint16_t clusterRevision) - { - VerifyOrReturn(CheckConstraintType("clusterRevision", "", "uint16")); - VerifyOrReturn(CheckConstraintMinValue("clusterRevision", clusterRevision, 5U)); - VerifyOrReturn(CheckConstraintMaxValue("clusterRevision", clusterRevision, 200U)); - NextTest(); - } - - CHIP_ERROR Test3aWriteAValueIntoTheRoMandatoryGlobalAttributeClusterRevision_2() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::WindowCoveringClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - uint16_t clusterRevisionArgument; - clusterRevisionArgument = 201U; - - ReturnErrorOnFailure(cluster.WriteAttribute( - clusterRevisionArgument, this, OnSuccessCallback_2, OnFailureCallback_2)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_2(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - NextTest(); - } - - void OnSuccessResponse_2() { ThrowSuccessResponse(); } - - CHIP_ERROR Test3bReadsBackGlobalAttributeClusterRevision_3() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::WindowCoveringClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_3, OnFailureCallback_3, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_3(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_3(uint16_t clusterRevision) - { - VerifyOrReturn(CheckConstraintType("clusterRevision", "", "uint16")); - VerifyOrReturn(CheckConstraintNotValue("clusterRevision", clusterRevision, 201U)); - - NextTest(); - } - - CHIP_ERROR TestReadTheGlobalAttributeAttributeList_4() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::WindowCoveringClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_4, OnFailureCallback_4, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_4(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_4(const chip::app::DataModel::DecodableList & attributeList) - { - VerifyOrReturn(CheckConstraintType("attributeList", "", "list")); - NextTest(); - } - - CHIP_ERROR Test2ReadTheGlobalAttributeFeatureMap_5() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::WindowCoveringClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_5, OnFailureCallback_5, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_5(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_5(uint32_t featureMap) - { - VerifyOrReturn(CheckConstraintType("featureMap", "", "uint32")); - VerifyOrReturn(CheckConstraintMinValue("featureMap", featureMap, 0UL)); - VerifyOrReturn(CheckConstraintMaxValue("featureMap", featureMap, 32768UL)); - NextTest(); - } - - CHIP_ERROR Test3aWriteTheDefaultValueToOptionalGlobalAttributeFeatureMap_6() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::WindowCoveringClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - uint32_t featureMapArgument; - featureMapArgument = 32769UL; - - ReturnErrorOnFailure(cluster.WriteAttribute( - featureMapArgument, this, OnSuccessCallback_6, OnFailureCallback_6)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_6(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - NextTest(); - } - - void OnSuccessResponse_6() { ThrowSuccessResponse(); } - - CHIP_ERROR Test3bReadsBackGlobalAttributeFeatureMap_7() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::WindowCoveringClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_7, OnFailureCallback_7, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_7(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_7(uint32_t featureMap) - { - VerifyOrReturn(CheckConstraintType("featureMap", "", "uint32")); - VerifyOrReturn(CheckConstraintNotValue("featureMap", featureMap, 32769UL)); - - NextTest(); - } -}; - -class Test_TC_WNCV_2_1Suite : public TestCommand -{ -public: - Test_TC_WNCV_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_WNCV_2_1", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_WNCV_2_1Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_WNCV_2_1\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_WNCV_2_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : 2: read the RO mandatory attribute default: Type\n"); - err = Test2ReadTheRoMandatoryAttributeDefaultType_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : 3a: write a value into the RO mandatory attribute: Type\n"); - err = Test3aWriteAValueIntoTheRoMandatoryAttributeType_2(); - break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : 3b: reads back the RO mandatory attribute: Type\n"); - err = Test3bReadsBackTheRoMandatoryAttributeType_3(); - break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : 2: read the RO mandatory attribute default: ConfigStatus\n"); - err = Test2ReadTheRoMandatoryAttributeDefaultConfigStatus_4(); - break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : 3a: write a value into the RO mandatory attribute: ConfigStatus\n"); - err = Test3aWriteAValueIntoTheRoMandatoryAttributeConfigStatus_5(); - break; - case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : 3b: reads back the RO mandatory attribute: ConfigStatus\n"); - err = Test3bReadsBackTheRoMandatoryAttributeConfigStatus_6(); - break; - case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : 2: read the RO mandatory attribute default: OperationalStatus\n"); - err = Test2ReadTheRoMandatoryAttributeDefaultOperationalStatus_7(); - break; - case 8: - ChipLogProgress(chipTool, - " ***** Test Step 8 : 3a: write a value into the RO mandatory attribute: OperationalStatus\n"); - err = Test3aWriteAValueIntoTheRoMandatoryAttributeOperationalStatus_8(); - break; - case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : 3b: reads back the RO mandatory attribute: OperationalStatus\n"); - err = Test3bReadsBackTheRoMandatoryAttributeOperationalStatus_9(); - break; - case 10: - ChipLogProgress(chipTool, " ***** Test Step 10 : 2: read the RO mandatory attribute default: EndProductType\n"); - err = Test2ReadTheRoMandatoryAttributeDefaultEndProductType_10(); - break; - case 11: - ChipLogProgress(chipTool, " ***** Test Step 11 : 3a: write a value into the RO mandatory attribute: EndProductType\n"); - err = Test3aWriteAValueIntoTheRoMandatoryAttributeEndProductType_11(); - break; - case 12: - ChipLogProgress(chipTool, " ***** Test Step 12 : 3b: reads back the RO mandatory attribute: EndProductType\n"); - err = Test3bReadsBackTheRoMandatoryAttributeEndProductType_12(); - break; - case 13: - ChipLogProgress(chipTool, " ***** Test Step 13 : 2: read the RW mandatory attribute default: Mode\n"); - err = Test2ReadTheRwMandatoryAttributeDefaultMode_13(); - break; - case 14: - ChipLogProgress(chipTool, " ***** Test Step 14 : 3a: write a value into the RW mandatory attribute:: Mode\n"); - err = Test3aWriteAValueIntoTheRwMandatoryAttributeMode_14(); - break; - case 15: - ChipLogProgress(chipTool, " ***** Test Step 15 : 3b: reads back the RW mandatory attribute: Mode\n"); - err = Test3bReadsBackTheRwMandatoryAttributeMode_15(); - break; - case 16: - ChipLogProgress(chipTool, - " ***** Test Step 16 : 2: read the RO optional attribute default: TargetPositionLiftPercent100ths\n"); - err = Test2ReadTheRoOptionalAttributeDefaultTargetPositionLiftPercent100ths_16(); - break; - case 17: - ChipLogProgress( - chipTool, - " ***** Test Step 17 : 3a: write a value into the RO optional attribute: TargetPositionLiftPercent100ths\n"); - err = Test3aWriteAValueIntoTheRoOptionalAttributeTargetPositionLiftPercent100ths_17(); - break; - case 18: - ChipLogProgress(chipTool, - " ***** Test Step 18 : 3b: reads back the RO optional attribute: TargetPositionLiftPercent100ths\n"); - err = Test3bReadsBackTheRoOptionalAttributeTargetPositionLiftPercent100ths_18(); - break; - case 19: - ChipLogProgress(chipTool, - " ***** Test Step 19 : 2: read the RO optional attribute default: TargetPositionTiltPercent100ths\n"); - err = Test2ReadTheRoOptionalAttributeDefaultTargetPositionTiltPercent100ths_19(); - break; - case 20: - ChipLogProgress( - chipTool, - " ***** Test Step 20 : 3a: write a value into the RO optional attribute: TargetPositionTiltPercent100ths\n"); - err = Test3aWriteAValueIntoTheRoOptionalAttributeTargetPositionTiltPercent100ths_20(); - break; - case 21: - ChipLogProgress(chipTool, - " ***** Test Step 21 : 3b: reads back the RO optional attribute: TargetPositionTiltPercent100ths\n"); - err = Test3bReadsBackTheRoOptionalAttributeTargetPositionTiltPercent100ths_21(); - break; - case 22: - ChipLogProgress(chipTool, - " ***** Test Step 22 : 2: read the RO optional attribute default: CurrentPositionLiftPercent100ths\n"); - err = Test2ReadTheRoOptionalAttributeDefaultCurrentPositionLiftPercent100ths_22(); - break; - case 23: - ChipLogProgress( - chipTool, - " ***** Test Step 23 : 3a: write a value into the RO optional attribute: CurrentPositionLiftPercent100ths\n"); - err = Test3aWriteAValueIntoTheRoOptionalAttributeCurrentPositionLiftPercent100ths_23(); - break; - case 24: - ChipLogProgress(chipTool, - " ***** Test Step 24 : 3b: reads back the RO optional attribute: CurrentPositionLiftPercent100ths\n"); - err = Test3bReadsBackTheRoOptionalAttributeCurrentPositionLiftPercent100ths_24(); - break; - case 25: - ChipLogProgress(chipTool, - " ***** Test Step 25 : 2: read the RO optional attribute default: CurrentPositionTiltPercent100ths\n"); - err = Test2ReadTheRoOptionalAttributeDefaultCurrentPositionTiltPercent100ths_25(); - break; - case 26: - ChipLogProgress( - chipTool, - " ***** Test Step 26 : 3a: write a value into the RO optional attribute: CurrentPositionTiltPercent100ths\n"); - err = Test3aWriteAValueIntoTheRoOptionalAttributeCurrentPositionTiltPercent100ths_26(); - break; - case 27: - ChipLogProgress(chipTool, - " ***** Test Step 27 : 3b: reads back the RO optional attribute: CurrentPositionTiltPercent100ths\n"); - err = Test3bReadsBackTheRoOptionalAttributeCurrentPositionTiltPercent100ths_27(); - break; - case 28: - ChipLogProgress(chipTool, " ***** Test Step 28 : 2: read the RO optional attribute default: InstalledOpenLimitLift\n"); - err = Test2ReadTheRoOptionalAttributeDefaultInstalledOpenLimitLift_28(); - break; - case 29: - ChipLogProgress(chipTool, - " ***** Test Step 29 : 3a: write a value into the RO optional attribute: InstalledOpenLimitLift\n"); - err = Test3aWriteAValueIntoTheRoOptionalAttributeInstalledOpenLimitLift_29(); - break; - case 30: - ChipLogProgress(chipTool, " ***** Test Step 30 : 3b: reads back the RO optional attribute: InstalledOpenLimitLift\n"); - err = Test3bReadsBackTheRoOptionalAttributeInstalledOpenLimitLift_30(); - break; - case 31: - ChipLogProgress(chipTool, - " ***** Test Step 31 : 2: read the RO optional attribute default: InstalledClosedLimitLift\n"); - err = Test2ReadTheRoOptionalAttributeDefaultInstalledClosedLimitLift_31(); - break; - case 32: - ChipLogProgress(chipTool, - " ***** Test Step 32 : 3a: write a value into the RO optional attribute: InstalledClosedLimitLift\n"); - err = Test3aWriteAValueIntoTheRoOptionalAttributeInstalledClosedLimitLift_32(); - break; - case 33: - ChipLogProgress(chipTool, " ***** Test Step 33 : 3b: reads back the RO optional attribute: InstalledClosedLimitLift\n"); - err = Test3bReadsBackTheRoOptionalAttributeInstalledClosedLimitLift_33(); - break; - case 34: - ChipLogProgress(chipTool, " ***** Test Step 34 : 2: read the RO optional attribute default: InstalledOpenLimitTilt\n"); - err = Test2ReadTheRoOptionalAttributeDefaultInstalledOpenLimitTilt_34(); - break; - case 35: - ChipLogProgress(chipTool, - " ***** Test Step 35 : 3a: write a value into the RO optional attribute: InstalledOpenLimitTilt\n"); - err = Test3aWriteAValueIntoTheRoOptionalAttributeInstalledOpenLimitTilt_35(); - break; - case 36: - ChipLogProgress(chipTool, " ***** Test Step 36 : 3b: reads back the RO optional attribute: InstalledOpenLimitTilt\n"); - err = Test3bReadsBackTheRoOptionalAttributeInstalledOpenLimitTilt_36(); - break; - case 37: - ChipLogProgress(chipTool, - " ***** Test Step 37 : 2: read the RO optional attribute default: InstalledClosedLimitTilt\n"); - err = Test2ReadTheRoOptionalAttributeDefaultInstalledClosedLimitTilt_37(); - break; - case 38: - ChipLogProgress(chipTool, - " ***** Test Step 38 : 3a: write a value into the RO optional attribute: InstalledClosedLimitTilt\n"); - err = Test3aWriteAValueIntoTheRoOptionalAttributeInstalledClosedLimitTilt_38(); - break; - case 39: - ChipLogProgress(chipTool, " ***** Test Step 39 : 3b: reads back the RO optional attribute: InstalledClosedLimitTilt\n"); - err = Test3bReadsBackTheRoOptionalAttributeInstalledClosedLimitTilt_39(); - break; - case 40: - ChipLogProgress(chipTool, " ***** Test Step 40 : 4: read the RO mandatory attribute default: SafetyStatus\n"); - err = Test4ReadTheRoMandatoryAttributeDefaultSafetyStatus_40(); - break; - case 41: - ChipLogProgress(chipTool, " ***** Test Step 41 : 5a: write a value into the RO mandatory attribute: SafetyStatus\n"); - err = Test5aWriteAValueIntoTheRoMandatoryAttributeSafetyStatus_41(); - break; - case 42: - ChipLogProgress(chipTool, " ***** Test Step 42 : 5b: reads back the RO mandatory attribute: SafetyStatus\n"); - err = Test5bReadsBackTheRoMandatoryAttributeSafetyStatus_42(); - break; - case 43: - ChipLogProgress(chipTool, " ***** Test Step 43 : 4: read the RO optional attribute default: CurrentPositionLift\n"); - err = Test4ReadTheRoOptionalAttributeDefaultCurrentPositionLift_43(); - break; - case 44: - ChipLogProgress(chipTool, - " ***** Test Step 44 : 5a: write a value into the RO optional attribute: CurrentPositionLift\n"); - err = Test5aWriteAValueIntoTheRoOptionalAttributeCurrentPositionLift_44(); - break; - case 45: - ChipLogProgress(chipTool, " ***** Test Step 45 : 5b: reads back the RO optional attribute: CurrentPositionLift\n"); - err = Test5bReadsBackTheRoOptionalAttributeCurrentPositionLift_45(); - break; - case 46: - ChipLogProgress(chipTool, " ***** Test Step 46 : 4: read the RO optional attribute default: CurrentPositionTilt\n"); - err = Test4ReadTheRoOptionalAttributeDefaultCurrentPositionTilt_46(); - break; - case 47: - ChipLogProgress(chipTool, - " ***** Test Step 47 : 5a: write a value into the RO optional attribute: CurrentPositionTilt\n"); - err = Test5aWriteAValueIntoTheRoOptionalAttributeCurrentPositionTilt_47(); - break; - case 48: - ChipLogProgress(chipTool, " ***** Test Step 48 : 5b: reads back the RO optional attribute: CurrentPositionTilt\n"); - err = Test5bReadsBackTheRoOptionalAttributeCurrentPositionTilt_48(); - break; - case 49: - ChipLogProgress(chipTool, - " ***** Test Step 49 : 4: read the RO optional attribute default: CurrentPositionLiftPercentage\n"); - err = Test4ReadTheRoOptionalAttributeDefaultCurrentPositionLiftPercentage_49(); - break; - case 50: - ChipLogProgress( - chipTool, - " ***** Test Step 50 : 5a: write a value into the RO optional attribute: CurrentPositionLiftPercentage\n"); - err = Test5aWriteAValueIntoTheRoOptionalAttributeCurrentPositionLiftPercentage_50(); - break; - case 51: - ChipLogProgress(chipTool, - " ***** Test Step 51 : 5b: reads back the RO optional attribute: CurrentPositionLiftPercentage\n"); - err = Test5bReadsBackTheRoOptionalAttributeCurrentPositionLiftPercentage_51(); - break; - case 52: - ChipLogProgress(chipTool, - " ***** Test Step 52 : 4: read the RO optional attribute default: CurrentPositionTiltPercentage\n"); - err = Test4ReadTheRoOptionalAttributeDefaultCurrentPositionTiltPercentage_52(); - break; - case 53: - ChipLogProgress( - chipTool, - " ***** Test Step 53 : 5a: write a value into the RO optional attribute: CurrentPositionTiltPercentage\n"); - err = Test5aWriteAValueIntoTheRoOptionalAttributeCurrentPositionTiltPercentage_53(); - break; - case 54: - ChipLogProgress(chipTool, - " ***** Test Step 54 : 5b: reads back the RO optional attribute: CurrentPositionTiltPercentage\n"); - err = Test5bReadsBackTheRoOptionalAttributeCurrentPositionTiltPercentage_54(); - break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 55; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - static void OnFailureCallback_1(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_1(error); - } - - static void OnSuccessCallback_1(void * context, chip::app::Clusters::WindowCovering::Type type) - { - (static_cast(context))->OnSuccessResponse_1(type); - } - - static void OnFailureCallback_2(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_2(error); - } - - static void OnSuccessCallback_2(void * context) { (static_cast(context))->OnSuccessResponse_2(); } - - static void OnFailureCallback_3(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_3(error); - } - - static void OnSuccessCallback_3(void * context, chip::app::Clusters::WindowCovering::Type type) - { - (static_cast(context))->OnSuccessResponse_3(type); - } - - static void OnFailureCallback_4(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_4(error); - } - - static void OnSuccessCallback_4(void * context, chip::BitFlags configStatus) - { - (static_cast(context))->OnSuccessResponse_4(configStatus); - } - - static void OnFailureCallback_5(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_5(error); - } - - static void OnSuccessCallback_5(void * context) { (static_cast(context))->OnSuccessResponse_5(); } - - static void OnFailureCallback_6(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_6(error); - } - - static void OnSuccessCallback_6(void * context, chip::BitFlags configStatus) - { - (static_cast(context))->OnSuccessResponse_6(configStatus); - } - - static void OnFailureCallback_7(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_7(error); - } - - static void OnSuccessCallback_7(void * context, uint8_t operationalStatus) - { - (static_cast(context))->OnSuccessResponse_7(operationalStatus); - } - - static void OnFailureCallback_8(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_8(error); - } - - static void OnSuccessCallback_8(void * context) { (static_cast(context))->OnSuccessResponse_8(); } - - static void OnFailureCallback_9(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_9(error); - } - - static void OnSuccessCallback_9(void * context, uint8_t operationalStatus) - { - (static_cast(context))->OnSuccessResponse_9(operationalStatus); - } - - static void OnFailureCallback_10(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_10(error); - } - - static void OnSuccessCallback_10(void * context, chip::app::Clusters::WindowCovering::EndProductType endProductType) - { - (static_cast(context))->OnSuccessResponse_10(endProductType); - } - - static void OnFailureCallback_11(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_11(error); - } - - static void OnSuccessCallback_11(void * context) { (static_cast(context))->OnSuccessResponse_11(); } - - static void OnFailureCallback_12(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_12(error); - } - - static void OnSuccessCallback_12(void * context, chip::app::Clusters::WindowCovering::EndProductType endProductType) - { - (static_cast(context))->OnSuccessResponse_12(endProductType); - } - - static void OnFailureCallback_13(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_13(error); - } - - static void OnSuccessCallback_13(void * context, chip::BitFlags mode) - { - (static_cast(context))->OnSuccessResponse_13(mode); - } - - static void OnFailureCallback_14(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_14(error); - } - - static void OnSuccessCallback_14(void * context) { (static_cast(context))->OnSuccessResponse_14(); } - - static void OnFailureCallback_15(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_15(error); - } - - static void OnSuccessCallback_15(void * context, chip::BitFlags mode) - { - (static_cast(context))->OnSuccessResponse_15(mode); - } - - static void OnFailureCallback_16(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_16(error); - } - - static void OnSuccessCallback_16(void * context, - const chip::app::DataModel::Nullable & targetPositionLiftPercent100ths) - { - (static_cast(context))->OnSuccessResponse_16(targetPositionLiftPercent100ths); - } - - static void OnFailureCallback_17(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_17(error); - } - - static void OnSuccessCallback_17(void * context) { (static_cast(context))->OnSuccessResponse_17(); } - - static void OnFailureCallback_18(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_18(error); - } - - static void OnSuccessCallback_18(void * context, - const chip::app::DataModel::Nullable & targetPositionLiftPercent100ths) - { - (static_cast(context))->OnSuccessResponse_18(targetPositionLiftPercent100ths); - } - - static void OnFailureCallback_19(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_19(error); - } - - static void OnSuccessCallback_19(void * context, - const chip::app::DataModel::Nullable & targetPositionTiltPercent100ths) - { - (static_cast(context))->OnSuccessResponse_19(targetPositionTiltPercent100ths); - } - - static void OnFailureCallback_20(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_20(error); - } - - static void OnSuccessCallback_20(void * context) { (static_cast(context))->OnSuccessResponse_20(); } - - static void OnFailureCallback_21(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_21(error); - } - - static void OnSuccessCallback_21(void * context, - const chip::app::DataModel::Nullable & targetPositionTiltPercent100ths) - { - (static_cast(context))->OnSuccessResponse_21(targetPositionTiltPercent100ths); - } - - static void OnFailureCallback_22(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_22(error); - } - - static void OnSuccessCallback_22(void * context, - const chip::app::DataModel::Nullable & currentPositionLiftPercent100ths) - { - (static_cast(context))->OnSuccessResponse_22(currentPositionLiftPercent100ths); - } - - static void OnFailureCallback_23(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_23(error); - } - - static void OnSuccessCallback_23(void * context) { (static_cast(context))->OnSuccessResponse_23(); } - - static void OnFailureCallback_24(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_24(error); - } - - static void OnSuccessCallback_24(void * context, - const chip::app::DataModel::Nullable & currentPositionLiftPercent100ths) - { - (static_cast(context))->OnSuccessResponse_24(currentPositionLiftPercent100ths); - } - - static void OnFailureCallback_25(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_25(error); - } - - static void OnSuccessCallback_25(void * context, - const chip::app::DataModel::Nullable & currentPositionTiltPercent100ths) - { - (static_cast(context))->OnSuccessResponse_25(currentPositionTiltPercent100ths); - } - - static void OnFailureCallback_26(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_26(error); - } - - static void OnSuccessCallback_26(void * context) { (static_cast(context))->OnSuccessResponse_26(); } - - static void OnFailureCallback_27(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_27(error); - } - - static void OnSuccessCallback_27(void * context, - const chip::app::DataModel::Nullable & currentPositionTiltPercent100ths) - { - (static_cast(context))->OnSuccessResponse_27(currentPositionTiltPercent100ths); - } - - static void OnFailureCallback_28(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_28(error); - } - - static void OnSuccessCallback_28(void * context, uint16_t installedOpenLimitLift) - { - (static_cast(context))->OnSuccessResponse_28(installedOpenLimitLift); - } - - static void OnFailureCallback_29(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_29(error); - } - - static void OnSuccessCallback_29(void * context) { (static_cast(context))->OnSuccessResponse_29(); } - - static void OnFailureCallback_30(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_30(error); - } - - static void OnSuccessCallback_30(void * context, uint16_t installedOpenLimitLift) - { - (static_cast(context))->OnSuccessResponse_30(installedOpenLimitLift); - } - - static void OnFailureCallback_31(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_31(error); - } - - static void OnSuccessCallback_31(void * context, uint16_t installedClosedLimitLift) - { - (static_cast(context))->OnSuccessResponse_31(installedClosedLimitLift); - } - - static void OnFailureCallback_32(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_32(error); - } - - static void OnSuccessCallback_32(void * context) { (static_cast(context))->OnSuccessResponse_32(); } - - static void OnFailureCallback_33(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_33(error); - } - - static void OnSuccessCallback_33(void * context, uint16_t installedClosedLimitLift) - { - (static_cast(context))->OnSuccessResponse_33(installedClosedLimitLift); - } - - static void OnFailureCallback_34(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_34(error); - } - - static void OnSuccessCallback_34(void * context, uint16_t installedOpenLimitTilt) - { - (static_cast(context))->OnSuccessResponse_34(installedOpenLimitTilt); - } - - static void OnFailureCallback_35(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_35(error); - } - - static void OnSuccessCallback_35(void * context) { (static_cast(context))->OnSuccessResponse_35(); } - - static void OnFailureCallback_36(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_36(error); - } - - static void OnSuccessCallback_36(void * context, uint16_t installedOpenLimitTilt) - { - (static_cast(context))->OnSuccessResponse_36(installedOpenLimitTilt); - } - - static void OnFailureCallback_37(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_37(error); - } - - static void OnSuccessCallback_37(void * context, uint16_t installedClosedLimitTilt) - { - (static_cast(context))->OnSuccessResponse_37(installedClosedLimitTilt); - } - - static void OnFailureCallback_38(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_38(error); - } - - static void OnSuccessCallback_38(void * context) { (static_cast(context))->OnSuccessResponse_38(); } - - static void OnFailureCallback_39(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_39(error); - } - - static void OnSuccessCallback_39(void * context, uint16_t installedClosedLimitTilt) - { - (static_cast(context))->OnSuccessResponse_39(installedClosedLimitTilt); - } - - static void OnFailureCallback_40(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_40(error); - } - - static void OnSuccessCallback_40(void * context, uint16_t safetyStatus) - { - (static_cast(context))->OnSuccessResponse_40(safetyStatus); - } - - static void OnFailureCallback_41(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_41(error); - } - - static void OnSuccessCallback_41(void * context) { (static_cast(context))->OnSuccessResponse_41(); } - - static void OnFailureCallback_42(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_42(error); - } - - static void OnSuccessCallback_42(void * context, uint16_t safetyStatus) - { - (static_cast(context))->OnSuccessResponse_42(safetyStatus); - } - - static void OnFailureCallback_43(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_43(error); - } - - static void OnSuccessCallback_43(void * context, const chip::app::DataModel::Nullable & currentPositionLift) - { - (static_cast(context))->OnSuccessResponse_43(currentPositionLift); - } - - static void OnFailureCallback_44(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_44(error); - } - - static void OnSuccessCallback_44(void * context) { (static_cast(context))->OnSuccessResponse_44(); } - - static void OnFailureCallback_45(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_45(error); - } - - static void OnSuccessCallback_45(void * context, const chip::app::DataModel::Nullable & currentPositionLift) - { - (static_cast(context))->OnSuccessResponse_45(currentPositionLift); - } - - static void OnFailureCallback_46(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_46(error); - } - - static void OnSuccessCallback_46(void * context, const chip::app::DataModel::Nullable & currentPositionTilt) - { - (static_cast(context))->OnSuccessResponse_46(currentPositionTilt); - } - - static void OnFailureCallback_47(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_47(error); - } - - static void OnSuccessCallback_47(void * context) { (static_cast(context))->OnSuccessResponse_47(); } - - static void OnFailureCallback_48(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_48(error); - } - - static void OnSuccessCallback_48(void * context, const chip::app::DataModel::Nullable & currentPositionTilt) - { - (static_cast(context))->OnSuccessResponse_48(currentPositionTilt); - } - - static void OnFailureCallback_49(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_49(error); - } - - static void OnSuccessCallback_49(void * context, - const chip::app::DataModel::Nullable & currentPositionLiftPercentage) - { - (static_cast(context))->OnSuccessResponse_49(currentPositionLiftPercentage); - } - - static void OnFailureCallback_50(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_50(error); - } - - static void OnSuccessCallback_50(void * context) { (static_cast(context))->OnSuccessResponse_50(); } - - static void OnFailureCallback_51(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_51(error); - } - - static void OnSuccessCallback_51(void * context, - const chip::app::DataModel::Nullable & currentPositionLiftPercentage) - { - (static_cast(context))->OnSuccessResponse_51(currentPositionLiftPercentage); - } - - static void OnFailureCallback_52(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_52(error); - } - - static void OnSuccessCallback_52(void * context, - const chip::app::DataModel::Nullable & currentPositionTiltPercentage) - { - (static_cast(context))->OnSuccessResponse_52(currentPositionTiltPercentage); - } - - static void OnFailureCallback_53(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_53(error); - } - - static void OnSuccessCallback_53(void * context) { (static_cast(context))->OnSuccessResponse_53(); } - - static void OnFailureCallback_54(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_54(error); - } - - static void OnSuccessCallback_54(void * context, - const chip::app::DataModel::Nullable & currentPositionTiltPercentage) - { - (static_cast(context))->OnSuccessResponse_54(currentPositionTiltPercentage); - } - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR Test2ReadTheRoMandatoryAttributeDefaultType_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::WindowCoveringClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_1, OnFailureCallback_1, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_1(chip::app::Clusters::WindowCovering::Type type) - { - VerifyOrReturn(CheckConstraintType("type", "", "enum8")); - VerifyOrReturn(CheckConstraintMinValue("type", type, 0)); - VerifyOrReturn(CheckConstraintMaxValue("type", type, 9)); - NextTest(); - } - - CHIP_ERROR Test3aWriteAValueIntoTheRoMandatoryAttributeType_2() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::WindowCoveringClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::Clusters::WindowCovering::Type typeArgument; - typeArgument = static_cast(250); - - ReturnErrorOnFailure(cluster.WriteAttribute( - typeArgument, this, OnSuccessCallback_2, OnFailureCallback_2)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_2(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - NextTest(); - } - - void OnSuccessResponse_2() { ThrowSuccessResponse(); } - - CHIP_ERROR Test3bReadsBackTheRoMandatoryAttributeType_3() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::WindowCoveringClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_3, OnFailureCallback_3, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_3(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_3(chip::app::Clusters::WindowCovering::Type type) - { - VerifyOrReturn(CheckConstraintType("type", "", "enum8")); - VerifyOrReturn(CheckConstraintNotValue("type", type, 250)); - - NextTest(); - } - - CHIP_ERROR Test2ReadTheRoMandatoryAttributeDefaultConfigStatus_4() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::WindowCoveringClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_4, OnFailureCallback_4, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_4(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_4(chip::BitFlags configStatus) - { - VerifyOrReturn(CheckConstraintType("configStatus", "", "map8")); - VerifyOrReturn(CheckConstraintMinValue("configStatus", configStatus, 0)); - VerifyOrReturn(CheckConstraintMaxValue("configStatus", configStatus, 63)); - NextTest(); - } - - CHIP_ERROR Test3aWriteAValueIntoTheRoMandatoryAttributeConfigStatus_5() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::WindowCoveringClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::BitFlags configStatusArgument; - configStatusArgument = static_cast>(128); - - ReturnErrorOnFailure(cluster.WriteAttribute( - configStatusArgument, this, OnSuccessCallback_5, OnFailureCallback_5)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_5(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - NextTest(); - } - - void OnSuccessResponse_5() { ThrowSuccessResponse(); } - - CHIP_ERROR Test3bReadsBackTheRoMandatoryAttributeConfigStatus_6() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::WindowCoveringClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_6, OnFailureCallback_6, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_6(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_6(chip::BitFlags configStatus) - { - VerifyOrReturn(CheckConstraintType("configStatus", "", "map8")); - VerifyOrReturn(CheckConstraintNotValue("configStatus", configStatus, 128)); - - NextTest(); - } - - CHIP_ERROR Test2ReadTheRoMandatoryAttributeDefaultOperationalStatus_7() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::WindowCoveringClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_7, OnFailureCallback_7, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_7(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_7(uint8_t operationalStatus) - { - VerifyOrReturn(CheckConstraintType("operationalStatus", "", "map8")); - VerifyOrReturn(CheckConstraintMinValue("operationalStatus", operationalStatus, 0)); - VerifyOrReturn(CheckConstraintMaxValue("operationalStatus", operationalStatus, 63)); - NextTest(); - } - - CHIP_ERROR Test3aWriteAValueIntoTheRoMandatoryAttributeOperationalStatus_8() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::WindowCoveringClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - uint8_t operationalStatusArgument; - operationalStatusArgument = 128; - - ReturnErrorOnFailure(cluster.WriteAttribute( - operationalStatusArgument, this, OnSuccessCallback_8, OnFailureCallback_8)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_8(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - NextTest(); - } - - void OnSuccessResponse_8() { ThrowSuccessResponse(); } - - CHIP_ERROR Test3bReadsBackTheRoMandatoryAttributeOperationalStatus_9() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::WindowCoveringClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_9, OnFailureCallback_9, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_9(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_9(uint8_t operationalStatus) - { - VerifyOrReturn(CheckConstraintType("operationalStatus", "", "map8")); - VerifyOrReturn(CheckConstraintNotValue("operationalStatus", operationalStatus, 128)); - - NextTest(); - } - - CHIP_ERROR Test2ReadTheRoMandatoryAttributeDefaultEndProductType_10() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::WindowCoveringClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_10, OnFailureCallback_10, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_10(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_10(chip::app::Clusters::WindowCovering::EndProductType endProductType) - { - VerifyOrReturn(CheckConstraintType("endProductType", "", "enum8")); - VerifyOrReturn(CheckConstraintMinValue("endProductType", endProductType, 0)); - VerifyOrReturn(CheckConstraintMaxValue("endProductType", endProductType, 23)); - NextTest(); - } - - CHIP_ERROR Test3aWriteAValueIntoTheRoMandatoryAttributeEndProductType_11() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::WindowCoveringClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::Clusters::WindowCovering::EndProductType endProductTypeArgument; - endProductTypeArgument = static_cast(250); - - ReturnErrorOnFailure(cluster.WriteAttribute( - endProductTypeArgument, this, OnSuccessCallback_11, OnFailureCallback_11)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_11(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - NextTest(); - } - - void OnSuccessResponse_11() { ThrowSuccessResponse(); } - - CHIP_ERROR Test3bReadsBackTheRoMandatoryAttributeEndProductType_12() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::WindowCoveringClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_12, OnFailureCallback_12, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_12(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_12(chip::app::Clusters::WindowCovering::EndProductType endProductType) - { - VerifyOrReturn(CheckConstraintType("endProductType", "", "enum8")); - VerifyOrReturn(CheckConstraintNotValue("endProductType", endProductType, 250)); - - NextTest(); - } - - CHIP_ERROR Test2ReadTheRwMandatoryAttributeDefaultMode_13() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::WindowCoveringClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_13, OnFailureCallback_13, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_13(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_13(chip::BitFlags mode) - { - VerifyOrReturn(CheckConstraintType("mode", "", "map8")); - VerifyOrReturn(CheckConstraintMinValue("mode", mode, 0)); - VerifyOrReturn(CheckConstraintMaxValue("mode", mode, 15)); - NextTest(); - } - - CHIP_ERROR Test3aWriteAValueIntoTheRwMandatoryAttributeMode_14() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::WindowCoveringClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::BitFlags modeArgument; - modeArgument = static_cast>(8); - - ReturnErrorOnFailure(cluster.WriteAttribute( - modeArgument, this, OnSuccessCallback_14, OnFailureCallback_14)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_14(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_14() { NextTest(); } - - CHIP_ERROR Test3bReadsBackTheRwMandatoryAttributeMode_15() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::WindowCoveringClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_15, OnFailureCallback_15, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_15(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_15(chip::BitFlags mode) - { - VerifyOrReturn(CheckValue("mode", mode, 8)); - - NextTest(); - } - - CHIP_ERROR Test2ReadTheRoOptionalAttributeDefaultTargetPositionLiftPercent100ths_16() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::WindowCoveringClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_16, OnFailureCallback_16, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_16(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_16(const chip::app::DataModel::Nullable & targetPositionLiftPercent100ths) - { - VerifyOrReturn(CheckConstraintType("targetPositionLiftPercent100ths", "", "Percent100ths")); - VerifyOrReturn(CheckConstraintMinValue("targetPositionLiftPercent100ths", targetPositionLiftPercent100ths, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("targetPositionLiftPercent100ths", targetPositionLiftPercent100ths, 10000U)); - NextTest(); - } - - CHIP_ERROR Test3aWriteAValueIntoTheRoOptionalAttributeTargetPositionLiftPercent100ths_17() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::WindowCoveringClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::DataModel::Nullable targetPositionLiftPercent100thsArgument; - targetPositionLiftPercent100thsArgument.SetNonNull(); - targetPositionLiftPercent100thsArgument.Value() = 20000U; - - ReturnErrorOnFailure( - cluster.WriteAttribute( - targetPositionLiftPercent100thsArgument, this, OnSuccessCallback_17, OnFailureCallback_17)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_17(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - NextTest(); - } - - void OnSuccessResponse_17() { ThrowSuccessResponse(); } - - CHIP_ERROR Test3bReadsBackTheRoOptionalAttributeTargetPositionLiftPercent100ths_18() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::WindowCoveringClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_18, OnFailureCallback_18, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_18(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_18(const chip::app::DataModel::Nullable & targetPositionLiftPercent100ths) - { - VerifyOrReturn(CheckConstraintType("targetPositionLiftPercent100ths", "", "Percent100ths")); - VerifyOrReturn(CheckConstraintNotValue("targetPositionLiftPercent100ths", targetPositionLiftPercent100ths, 20000U)); - - NextTest(); - } - - CHIP_ERROR Test2ReadTheRoOptionalAttributeDefaultTargetPositionTiltPercent100ths_19() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::WindowCoveringClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_19, OnFailureCallback_19, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_19(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_19(const chip::app::DataModel::Nullable & targetPositionTiltPercent100ths) - { - VerifyOrReturn(CheckConstraintType("targetPositionTiltPercent100ths", "", "Percent100ths")); - VerifyOrReturn(CheckConstraintMinValue("targetPositionTiltPercent100ths", targetPositionTiltPercent100ths, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("targetPositionTiltPercent100ths", targetPositionTiltPercent100ths, 10000U)); - NextTest(); - } - - CHIP_ERROR Test3aWriteAValueIntoTheRoOptionalAttributeTargetPositionTiltPercent100ths_20() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::WindowCoveringClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::DataModel::Nullable targetPositionTiltPercent100thsArgument; - targetPositionTiltPercent100thsArgument.SetNonNull(); - targetPositionTiltPercent100thsArgument.Value() = 20000U; - - ReturnErrorOnFailure( - cluster.WriteAttribute( - targetPositionTiltPercent100thsArgument, this, OnSuccessCallback_20, OnFailureCallback_20)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_20(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - NextTest(); - } - - void OnSuccessResponse_20() { ThrowSuccessResponse(); } - - CHIP_ERROR Test3bReadsBackTheRoOptionalAttributeTargetPositionTiltPercent100ths_21() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::WindowCoveringClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_21, OnFailureCallback_21, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_21(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_21(const chip::app::DataModel::Nullable & targetPositionTiltPercent100ths) - { - VerifyOrReturn(CheckConstraintType("targetPositionTiltPercent100ths", "", "Percent100ths")); - VerifyOrReturn(CheckConstraintNotValue("targetPositionTiltPercent100ths", targetPositionTiltPercent100ths, 20000U)); - - NextTest(); - } - - CHIP_ERROR Test2ReadTheRoOptionalAttributeDefaultCurrentPositionLiftPercent100ths_22() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::WindowCoveringClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_22, OnFailureCallback_22, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_22(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_22(const chip::app::DataModel::Nullable & currentPositionLiftPercent100ths) - { - VerifyOrReturn(CheckConstraintType("currentPositionLiftPercent100ths", "", "Percent100ths")); - VerifyOrReturn(CheckConstraintMinValue("currentPositionLiftPercent100ths", currentPositionLiftPercent100ths, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("currentPositionLiftPercent100ths", currentPositionLiftPercent100ths, 10000U)); - NextTest(); - } - - CHIP_ERROR Test3aWriteAValueIntoTheRoOptionalAttributeCurrentPositionLiftPercent100ths_23() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::WindowCoveringClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::DataModel::Nullable currentPositionLiftPercent100thsArgument; - currentPositionLiftPercent100thsArgument.SetNonNull(); - currentPositionLiftPercent100thsArgument.Value() = 20000U; - - ReturnErrorOnFailure( - cluster.WriteAttribute( - currentPositionLiftPercent100thsArgument, this, OnSuccessCallback_23, OnFailureCallback_23)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_23(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - NextTest(); - } - - void OnSuccessResponse_23() { ThrowSuccessResponse(); } - - CHIP_ERROR Test3bReadsBackTheRoOptionalAttributeCurrentPositionLiftPercent100ths_24() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::WindowCoveringClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_24, OnFailureCallback_24, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_24(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_24(const chip::app::DataModel::Nullable & currentPositionLiftPercent100ths) - { - VerifyOrReturn(CheckConstraintType("currentPositionLiftPercent100ths", "", "Percent100ths")); - VerifyOrReturn(CheckConstraintNotValue("currentPositionLiftPercent100ths", currentPositionLiftPercent100ths, 20000U)); - - NextTest(); - } - - CHIP_ERROR Test2ReadTheRoOptionalAttributeDefaultCurrentPositionTiltPercent100ths_25() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::WindowCoveringClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_25, OnFailureCallback_25, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_25(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_25(const chip::app::DataModel::Nullable & currentPositionTiltPercent100ths) - { - VerifyOrReturn(CheckConstraintType("currentPositionTiltPercent100ths", "", "Percent100ths")); - VerifyOrReturn(CheckConstraintMinValue("currentPositionTiltPercent100ths", currentPositionTiltPercent100ths, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("currentPositionTiltPercent100ths", currentPositionTiltPercent100ths, 10000U)); - NextTest(); - } - - CHIP_ERROR Test3aWriteAValueIntoTheRoOptionalAttributeCurrentPositionTiltPercent100ths_26() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::WindowCoveringClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::DataModel::Nullable currentPositionTiltPercent100thsArgument; - currentPositionTiltPercent100thsArgument.SetNonNull(); - currentPositionTiltPercent100thsArgument.Value() = 20000U; - - ReturnErrorOnFailure( - cluster.WriteAttribute( - currentPositionTiltPercent100thsArgument, this, OnSuccessCallback_26, OnFailureCallback_26)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_26(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - NextTest(); - } - - void OnSuccessResponse_26() { ThrowSuccessResponse(); } - - CHIP_ERROR Test3bReadsBackTheRoOptionalAttributeCurrentPositionTiltPercent100ths_27() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::WindowCoveringClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_27, OnFailureCallback_27, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_27(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_27(const chip::app::DataModel::Nullable & currentPositionTiltPercent100ths) - { - VerifyOrReturn(CheckConstraintType("currentPositionTiltPercent100ths", "", "Percent100ths")); - VerifyOrReturn(CheckConstraintNotValue("currentPositionTiltPercent100ths", currentPositionTiltPercent100ths, 20000U)); - - NextTest(); - } - - CHIP_ERROR Test2ReadTheRoOptionalAttributeDefaultInstalledOpenLimitLift_28() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::WindowCoveringClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_28, OnFailureCallback_28, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_28(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_28(uint16_t installedOpenLimitLift) - { - VerifyOrReturn(CheckConstraintType("installedOpenLimitLift", "", "uint16")); - VerifyOrReturn(CheckConstraintMinValue("installedOpenLimitLift", installedOpenLimitLift, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("installedOpenLimitLift", installedOpenLimitLift, 65535U)); - NextTest(); - } - - CHIP_ERROR Test3aWriteAValueIntoTheRoOptionalAttributeInstalledOpenLimitLift_29() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::WindowCoveringClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - uint16_t installedOpenLimitLiftArgument; - installedOpenLimitLiftArgument = 255U; - - ReturnErrorOnFailure( - cluster.WriteAttribute( - installedOpenLimitLiftArgument, this, OnSuccessCallback_29, OnFailureCallback_29)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_29(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - NextTest(); - } - - void OnSuccessResponse_29() { ThrowSuccessResponse(); } - - CHIP_ERROR Test3bReadsBackTheRoOptionalAttributeInstalledOpenLimitLift_30() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::WindowCoveringClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_30, OnFailureCallback_30, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_30(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_30(uint16_t installedOpenLimitLift) - { - VerifyOrReturn(CheckConstraintType("installedOpenLimitLift", "", "uint16")); - VerifyOrReturn(CheckConstraintMinValue("installedOpenLimitLift", installedOpenLimitLift, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("installedOpenLimitLift", installedOpenLimitLift, 65535U)); - NextTest(); - } - - CHIP_ERROR Test2ReadTheRoOptionalAttributeDefaultInstalledClosedLimitLift_31() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::WindowCoveringClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_31, OnFailureCallback_31, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_31(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_31(uint16_t installedClosedLimitLift) - { - VerifyOrReturn(CheckConstraintType("installedClosedLimitLift", "", "uint16")); - VerifyOrReturn(CheckConstraintMinValue("installedClosedLimitLift", installedClosedLimitLift, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("installedClosedLimitLift", installedClosedLimitLift, 65535U)); - NextTest(); - } - - CHIP_ERROR Test3aWriteAValueIntoTheRoOptionalAttributeInstalledClosedLimitLift_32() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::WindowCoveringClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - uint16_t installedClosedLimitLiftArgument; - installedClosedLimitLiftArgument = 255U; - - ReturnErrorOnFailure( - cluster.WriteAttribute( - installedClosedLimitLiftArgument, this, OnSuccessCallback_32, OnFailureCallback_32)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_32(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - NextTest(); - } - - void OnSuccessResponse_32() { ThrowSuccessResponse(); } - - CHIP_ERROR Test3bReadsBackTheRoOptionalAttributeInstalledClosedLimitLift_33() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::WindowCoveringClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_33, OnFailureCallback_33, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_33(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_33(uint16_t installedClosedLimitLift) - { - VerifyOrReturn(CheckConstraintType("installedClosedLimitLift", "", "uint16")); - VerifyOrReturn(CheckConstraintMinValue("installedClosedLimitLift", installedClosedLimitLift, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("installedClosedLimitLift", installedClosedLimitLift, 65535U)); - NextTest(); - } - - CHIP_ERROR Test2ReadTheRoOptionalAttributeDefaultInstalledOpenLimitTilt_34() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::WindowCoveringClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_34, OnFailureCallback_34, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_34(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_34(uint16_t installedOpenLimitTilt) - { - VerifyOrReturn(CheckConstraintType("installedOpenLimitTilt", "", "uint16")); - VerifyOrReturn(CheckConstraintMinValue("installedOpenLimitTilt", installedOpenLimitTilt, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("installedOpenLimitTilt", installedOpenLimitTilt, 65535U)); - NextTest(); - } - - CHIP_ERROR Test3aWriteAValueIntoTheRoOptionalAttributeInstalledOpenLimitTilt_35() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::WindowCoveringClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - uint16_t installedOpenLimitTiltArgument; - installedOpenLimitTiltArgument = 255U; - - ReturnErrorOnFailure( - cluster.WriteAttribute( - installedOpenLimitTiltArgument, this, OnSuccessCallback_35, OnFailureCallback_35)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_35(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - NextTest(); - } - - void OnSuccessResponse_35() { ThrowSuccessResponse(); } - - CHIP_ERROR Test3bReadsBackTheRoOptionalAttributeInstalledOpenLimitTilt_36() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::WindowCoveringClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_36, OnFailureCallback_36, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_36(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_36(uint16_t installedOpenLimitTilt) - { - VerifyOrReturn(CheckConstraintType("installedOpenLimitTilt", "", "uint16")); - VerifyOrReturn(CheckConstraintMinValue("installedOpenLimitTilt", installedOpenLimitTilt, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("installedOpenLimitTilt", installedOpenLimitTilt, 65535U)); - NextTest(); - } - - CHIP_ERROR Test2ReadTheRoOptionalAttributeDefaultInstalledClosedLimitTilt_37() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::WindowCoveringClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_37, OnFailureCallback_37, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_37(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_37(uint16_t installedClosedLimitTilt) - { - VerifyOrReturn(CheckConstraintType("installedClosedLimitTilt", "", "uint16")); - VerifyOrReturn(CheckConstraintMinValue("installedClosedLimitTilt", installedClosedLimitTilt, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("installedClosedLimitTilt", installedClosedLimitTilt, 65535U)); - NextTest(); - } - - CHIP_ERROR Test3aWriteAValueIntoTheRoOptionalAttributeInstalledClosedLimitTilt_38() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::WindowCoveringClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - uint16_t installedClosedLimitTiltArgument; - installedClosedLimitTiltArgument = 255U; - - ReturnErrorOnFailure( - cluster.WriteAttribute( - installedClosedLimitTiltArgument, this, OnSuccessCallback_38, OnFailureCallback_38)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_38(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - NextTest(); - } - - void OnSuccessResponse_38() { ThrowSuccessResponse(); } - - CHIP_ERROR Test3bReadsBackTheRoOptionalAttributeInstalledClosedLimitTilt_39() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::WindowCoveringClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_39, OnFailureCallback_39, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_39(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_39(uint16_t installedClosedLimitTilt) - { - VerifyOrReturn(CheckConstraintType("installedClosedLimitTilt", "", "uint16")); - VerifyOrReturn(CheckConstraintMinValue("installedClosedLimitTilt", installedClosedLimitTilt, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("installedClosedLimitTilt", installedClosedLimitTilt, 65535U)); - NextTest(); - } - - CHIP_ERROR Test4ReadTheRoMandatoryAttributeDefaultSafetyStatus_40() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::WindowCoveringClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_40, OnFailureCallback_40, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_40(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_40(uint16_t safetyStatus) - { - VerifyOrReturn(CheckConstraintType("safetyStatus", "", "map16")); - VerifyOrReturn(CheckConstraintMinValue("safetyStatus", safetyStatus, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("safetyStatus", safetyStatus, 2047U)); - NextTest(); - } - - CHIP_ERROR Test5aWriteAValueIntoTheRoMandatoryAttributeSafetyStatus_41() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::WindowCoveringClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - uint16_t safetyStatusArgument; - safetyStatusArgument = 4096U; - - ReturnErrorOnFailure(cluster.WriteAttribute( - safetyStatusArgument, this, OnSuccessCallback_41, OnFailureCallback_41)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_41(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - NextTest(); - } - - void OnSuccessResponse_41() { ThrowSuccessResponse(); } - - CHIP_ERROR Test5bReadsBackTheRoMandatoryAttributeSafetyStatus_42() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::WindowCoveringClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_42, OnFailureCallback_42, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_42(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_42(uint16_t safetyStatus) - { - VerifyOrReturn(CheckConstraintType("safetyStatus", "", "map16")); - VerifyOrReturn(CheckConstraintNotValue("safetyStatus", safetyStatus, 4096U)); - - NextTest(); - } - - CHIP_ERROR Test4ReadTheRoOptionalAttributeDefaultCurrentPositionLift_43() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::WindowCoveringClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_43, OnFailureCallback_43, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_43(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_43(const chip::app::DataModel::Nullable & currentPositionLift) - { - VerifyOrReturn(CheckConstraintType("currentPositionLift", "", "uint16")); - VerifyOrReturn(CheckConstraintMinValue("currentPositionLift", currentPositionLift, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("currentPositionLift", currentPositionLift, 65535U)); - NextTest(); - } - - CHIP_ERROR Test5aWriteAValueIntoTheRoOptionalAttributeCurrentPositionLift_44() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::WindowCoveringClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::DataModel::Nullable currentPositionLiftArgument; - currentPositionLiftArgument.SetNonNull(); - currentPositionLiftArgument.Value() = 255U; - - ReturnErrorOnFailure(cluster.WriteAttribute( - currentPositionLiftArgument, this, OnSuccessCallback_44, OnFailureCallback_44)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_44(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - NextTest(); - } - - void OnSuccessResponse_44() { ThrowSuccessResponse(); } - - CHIP_ERROR Test5bReadsBackTheRoOptionalAttributeCurrentPositionLift_45() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::WindowCoveringClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_45, OnFailureCallback_45, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_45(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_45(const chip::app::DataModel::Nullable & currentPositionLift) - { - VerifyOrReturn(CheckConstraintType("currentPositionLift", "", "uint16")); - VerifyOrReturn(CheckConstraintMinValue("currentPositionLift", currentPositionLift, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("currentPositionLift", currentPositionLift, 65535U)); - NextTest(); - } - - CHIP_ERROR Test4ReadTheRoOptionalAttributeDefaultCurrentPositionTilt_46() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::WindowCoveringClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_46, OnFailureCallback_46, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_46(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_46(const chip::app::DataModel::Nullable & currentPositionTilt) - { - VerifyOrReturn(CheckConstraintType("currentPositionTilt", "", "uint16")); - VerifyOrReturn(CheckConstraintMinValue("currentPositionTilt", currentPositionTilt, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("currentPositionTilt", currentPositionTilt, 65535U)); - NextTest(); - } - - CHIP_ERROR Test5aWriteAValueIntoTheRoOptionalAttributeCurrentPositionTilt_47() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::WindowCoveringClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::DataModel::Nullable currentPositionTiltArgument; - currentPositionTiltArgument.SetNonNull(); - currentPositionTiltArgument.Value() = 255U; - - ReturnErrorOnFailure(cluster.WriteAttribute( - currentPositionTiltArgument, this, OnSuccessCallback_47, OnFailureCallback_47)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_47(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - NextTest(); - } - - void OnSuccessResponse_47() { ThrowSuccessResponse(); } - - CHIP_ERROR Test5bReadsBackTheRoOptionalAttributeCurrentPositionTilt_48() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::WindowCoveringClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_48, OnFailureCallback_48, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_48(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_48(const chip::app::DataModel::Nullable & currentPositionTilt) - { - VerifyOrReturn(CheckConstraintType("currentPositionTilt", "", "uint16")); - VerifyOrReturn(CheckConstraintMinValue("currentPositionTilt", currentPositionTilt, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("currentPositionTilt", currentPositionTilt, 65535U)); - NextTest(); - } - - CHIP_ERROR Test4ReadTheRoOptionalAttributeDefaultCurrentPositionLiftPercentage_49() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::WindowCoveringClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_49, OnFailureCallback_49, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_49(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_49(const chip::app::DataModel::Nullable & currentPositionLiftPercentage) - { - VerifyOrReturn(CheckConstraintType("currentPositionLiftPercentage", "", "Percent")); - VerifyOrReturn(CheckConstraintMinValue("currentPositionLiftPercentage", currentPositionLiftPercentage, 0)); - VerifyOrReturn(CheckConstraintMaxValue("currentPositionLiftPercentage", currentPositionLiftPercentage, 100)); - NextTest(); - } - - CHIP_ERROR Test5aWriteAValueIntoTheRoOptionalAttributeCurrentPositionLiftPercentage_50() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::WindowCoveringClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::DataModel::Nullable currentPositionLiftPercentageArgument; - currentPositionLiftPercentageArgument.SetNonNull(); - currentPositionLiftPercentageArgument.Value() = 200; - - ReturnErrorOnFailure( - cluster.WriteAttribute( - currentPositionLiftPercentageArgument, this, OnSuccessCallback_50, OnFailureCallback_50)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_50(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - NextTest(); - } - - void OnSuccessResponse_50() { ThrowSuccessResponse(); } - - CHIP_ERROR Test5bReadsBackTheRoOptionalAttributeCurrentPositionLiftPercentage_51() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::WindowCoveringClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_51, OnFailureCallback_51, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_51(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_51(const chip::app::DataModel::Nullable & currentPositionLiftPercentage) - { - VerifyOrReturn(CheckConstraintType("currentPositionLiftPercentage", "", "Percent")); - VerifyOrReturn(CheckConstraintNotValue("currentPositionLiftPercentage", currentPositionLiftPercentage, 200)); - - NextTest(); - } - - CHIP_ERROR Test4ReadTheRoOptionalAttributeDefaultCurrentPositionTiltPercentage_52() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::WindowCoveringClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_52, OnFailureCallback_52, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_52(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_52(const chip::app::DataModel::Nullable & currentPositionTiltPercentage) - { - VerifyOrReturn(CheckConstraintType("currentPositionTiltPercentage", "", "Percent")); - VerifyOrReturn(CheckConstraintMinValue("currentPositionTiltPercentage", currentPositionTiltPercentage, 0)); - VerifyOrReturn(CheckConstraintMaxValue("currentPositionTiltPercentage", currentPositionTiltPercentage, 100)); - NextTest(); - } - - CHIP_ERROR Test5aWriteAValueIntoTheRoOptionalAttributeCurrentPositionTiltPercentage_53() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::WindowCoveringClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::DataModel::Nullable currentPositionTiltPercentageArgument; - currentPositionTiltPercentageArgument.SetNonNull(); - currentPositionTiltPercentageArgument.Value() = 200; - - ReturnErrorOnFailure( - cluster.WriteAttribute( - currentPositionTiltPercentageArgument, this, OnSuccessCallback_53, OnFailureCallback_53)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_53(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - NextTest(); - } - - void OnSuccessResponse_53() { ThrowSuccessResponse(); } - - CHIP_ERROR Test5bReadsBackTheRoOptionalAttributeCurrentPositionTiltPercentage_54() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::WindowCoveringClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_54, OnFailureCallback_54, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_54(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_54(const chip::app::DataModel::Nullable & currentPositionTiltPercentage) - { - VerifyOrReturn(CheckConstraintType("currentPositionTiltPercentage", "", "Percent")); - VerifyOrReturn(CheckConstraintNotValue("currentPositionTiltPercentage", currentPositionTiltPercentage, 200)); - - NextTest(); - } -}; - -class Test_TC_WNCV_2_2Suite : public TestCommand -{ -public: - Test_TC_WNCV_2_2Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_WNCV_2_2", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_WNCV_2_2Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_WNCV_2_2\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_WNCV_2_2\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 1; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } -}; - -class Test_TC_WNCV_2_3Suite : public TestCommand -{ -public: - Test_TC_WNCV_2_3Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_WNCV_2_3", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_WNCV_2_3Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_WNCV_2_3\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_WNCV_2_3\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : 1a: TH set the Mode Attribute bit0 of the DUT\n"); - if (ShouldSkip("WNCV_REVERSAL")) - { - NextTest(); - return; - } - err = Test1aThSetTheModeAttributeBit0OfTheDut_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : 1b: TH reads ConfigStatus attribute from DUT\n"); - if (ShouldSkip("WNCV_REVERSAL")) - { - NextTest(); - return; - } - err = Test1bThReadsConfigStatusAttributeFromDut_2(); - break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : 1c: TH clear the Mode Attribute bit0 of the DUT\n"); - if (ShouldSkip("WNCV_REVERSAL")) - { - NextTest(); - return; - } - err = Test1cThClearTheModeAttributeBit0OfTheDut_3(); - break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : 1d: TH reads ConfigStatus attribute from DUT\n"); - if (ShouldSkip("WNCV_REVERSAL")) - { - NextTest(); - return; - } - err = Test1dThReadsConfigStatusAttributeFromDut_4(); - break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : 2a: TH set the Mode Attribute bit1 of the DUT\n"); - if (ShouldSkip("WNCV_CALIBRATION")) - { - NextTest(); - return; - } - err = Test2aThSetTheModeAttributeBit1OfTheDut_5(); - break; - case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : 2b: TH reads ConfigStatus attribute from DUT\n"); - if (ShouldSkip("WNCV_CALIBRATION")) - { - NextTest(); - return; - } - err = Test2bThReadsConfigStatusAttributeFromDut_6(); - break; - case 7: - ChipLogProgress(chipTool, - " ***** Test Step 7 : 2c: If (ConfigStatus bit0 == 0) TH send DownOrClose command to the DUT\n"); - if (ShouldSkip("WNCV_CALIBRATION")) - { - NextTest(); - return; - } - err = Test2cIfConfigStatusBit00ThSendDownOrCloseCommandToTheDut_7(); - break; - case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : 2d: TH clear the Mode Attribute bit1 of the DUT\n"); - if (ShouldSkip("WNCV_CALIBRATION")) - { - NextTest(); - return; - } - err = Test2dThClearTheModeAttributeBit1OfTheDut_8(); - break; - case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : 2e: TH reads ConfigStatus attribute from DUT\n"); - if (ShouldSkip("WNCV_CALIBRATION")) - { - NextTest(); - return; - } - err = Test2eThReadsConfigStatusAttributeFromDut_9(); - break; - case 10: - ChipLogProgress(chipTool, " ***** Test Step 10 : 2f: TH reads the Mode Attribute from the DUT\n"); - if (ShouldSkip("WNCV_CALIBRATION")) - { - NextTest(); - return; - } - err = Test2fThReadsTheModeAttributeFromTheDut_10(); - break; - case 11: - ChipLogProgress(chipTool, " ***** Test Step 11 : 2g: TH send DownOrClose command to the DUT\n"); - if (ShouldSkip("WNCV_CALIBRATION")) - { - NextTest(); - return; - } - err = Test2gThSendDownOrCloseCommandToTheDut_11(); - break; - case 12: - ChipLogProgress(chipTool, " ***** Test Step 12 : 3a: TH set the Mode Attribute bit2 of the DUT\n"); - if (ShouldSkip("WNCV_MAINTENANCE")) - { - NextTest(); - return; - } - err = Test3aThSetTheModeAttributeBit2OfTheDut_12(); - break; - case 13: - ChipLogProgress(chipTool, " ***** Test Step 13 : 3c: TH reads ConfigStatus attribute from DUT\n"); - if (ShouldSkip("WNCV_MAINTENANCE")) - { - NextTest(); - return; - } - err = Test3cThReadsConfigStatusAttributeFromDut_13(); - break; - case 14: - ChipLogProgress(chipTool, " ***** Test Step 14 : 3c: TH send DownOrClose command to the DUT\n"); - if (ShouldSkip("WNCV_MAINTENANCE")) - { - NextTest(); - return; - } - err = Test3cThSendDownOrCloseCommandToTheDut_14(); - break; - case 15: - ChipLogProgress(chipTool, " ***** Test Step 15 : 3d: TH clear the Mode Attribute bit2 of the DUT\n"); - if (ShouldSkip("WNCV_MAINTENANCE")) - { - NextTest(); - return; - } - err = Test3dThClearTheModeAttributeBit2OfTheDut_15(); - break; - case 16: - ChipLogProgress(chipTool, " ***** Test Step 16 : 3e: TH reads ConfigStatus attribute from DUT\n"); - if (ShouldSkip("WNCV_MAINTENANCE")) - { - NextTest(); - return; - } - err = Test3eThReadsConfigStatusAttributeFromDut_16(); - break; - case 17: - ChipLogProgress(chipTool, " ***** Test Step 17 : 3f: TH reads the Mode Attribute from the DUT\n"); - if (ShouldSkip("WNCV_MAINTENANCE")) - { - NextTest(); - return; - } - err = Test3fThReadsTheModeAttributeFromTheDut_17(); - break; - case 18: - ChipLogProgress(chipTool, " ***** Test Step 18 : 3g: TH send DownOrClose command to the DUT\n"); - if (ShouldSkip("WNCV_MAINTENANCE")) - { - NextTest(); - return; - } - err = Test3gThSendDownOrCloseCommandToTheDut_18(); - break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 19; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - chip::BitFlags configStatusValA; - chip::BitFlags configStatusValB; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - static void OnFailureCallback_1(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_1(error); - } - - static void OnSuccessCallback_1(void * context) { (static_cast(context))->OnSuccessResponse_1(); } - - static void OnFailureCallback_2(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_2(error); - } - - static void OnSuccessCallback_2(void * context, chip::BitFlags configStatus) - { - (static_cast(context))->OnSuccessResponse_2(configStatus); - } - - static void OnFailureCallback_3(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_3(error); - } - - static void OnSuccessCallback_3(void * context) { (static_cast(context))->OnSuccessResponse_3(); } - - static void OnFailureCallback_4(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_4(error); - } - - static void OnSuccessCallback_4(void * context, chip::BitFlags configStatus) - { - (static_cast(context))->OnSuccessResponse_4(configStatus); - } - - static void OnFailureCallback_5(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_5(error); - } - - static void OnSuccessCallback_5(void * context) { (static_cast(context))->OnSuccessResponse_5(); } - - static void OnFailureCallback_6(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_6(error); - } - - static void OnSuccessCallback_6(void * context, chip::BitFlags configStatus) - { - (static_cast(context))->OnSuccessResponse_6(configStatus); - } - - static void OnFailureCallback_8(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_8(error); - } - - static void OnSuccessCallback_8(void * context) { (static_cast(context))->OnSuccessResponse_8(); } - - static void OnFailureCallback_9(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_9(error); - } - - static void OnSuccessCallback_9(void * context, chip::BitFlags configStatus) - { - (static_cast(context))->OnSuccessResponse_9(configStatus); - } - - static void OnFailureCallback_10(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_10(error); - } - - static void OnSuccessCallback_10(void * context, chip::BitFlags mode) - { - (static_cast(context))->OnSuccessResponse_10(mode); - } - - static void OnFailureCallback_12(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_12(error); - } - - static void OnSuccessCallback_12(void * context) { (static_cast(context))->OnSuccessResponse_12(); } - - static void OnFailureCallback_13(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_13(error); - } - - static void OnSuccessCallback_13(void * context, chip::BitFlags configStatus) - { - (static_cast(context))->OnSuccessResponse_13(configStatus); - } - - static void OnFailureCallback_15(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_15(error); - } - - static void OnSuccessCallback_15(void * context) { (static_cast(context))->OnSuccessResponse_15(); } - - static void OnFailureCallback_16(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_16(error); - } - - static void OnSuccessCallback_16(void * context, chip::BitFlags configStatus) - { - (static_cast(context))->OnSuccessResponse_16(configStatus); - } - - static void OnFailureCallback_17(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_17(error); - } - - static void OnSuccessCallback_17(void * context, chip::BitFlags mode) - { - (static_cast(context))->OnSuccessResponse_17(mode); - } - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR Test1aThSetTheModeAttributeBit0OfTheDut_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::WindowCoveringClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::BitFlags modeArgument; - modeArgument = static_cast>(1); - - ReturnErrorOnFailure(cluster.WriteAttribute( - modeArgument, this, OnSuccessCallback_1, OnFailureCallback_1)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_1() { NextTest(); } - - CHIP_ERROR Test1bThReadsConfigStatusAttributeFromDut_2() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::WindowCoveringClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_2, OnFailureCallback_2, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_2(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_2(chip::BitFlags configStatus) - { - VerifyOrReturn(CheckConstraintMinValue("configStatus", configStatus, 4)); - VerifyOrReturn(CheckConstraintMaxValue("configStatus", configStatus, 127)); - NextTest(); - } - - CHIP_ERROR Test1cThClearTheModeAttributeBit0OfTheDut_3() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::WindowCoveringClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::BitFlags modeArgument; - modeArgument = static_cast>(0); - - ReturnErrorOnFailure(cluster.WriteAttribute( - modeArgument, this, OnSuccessCallback_3, OnFailureCallback_3)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_3(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_3() { NextTest(); } - - CHIP_ERROR Test1dThReadsConfigStatusAttributeFromDut_4() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::WindowCoveringClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_4, OnFailureCallback_4, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_4(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_4(chip::BitFlags configStatus) - { - VerifyOrReturn(CheckConstraintMinValue("configStatus", configStatus, 0)); - VerifyOrReturn(CheckConstraintMaxValue("configStatus", configStatus, 127)); - NextTest(); - } - - CHIP_ERROR Test2aThSetTheModeAttributeBit1OfTheDut_5() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::WindowCoveringClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::BitFlags modeArgument; - modeArgument = static_cast>(2); - - ReturnErrorOnFailure(cluster.WriteAttribute( - modeArgument, this, OnSuccessCallback_5, OnFailureCallback_5)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_5(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_5() { NextTest(); } - - CHIP_ERROR Test2bThReadsConfigStatusAttributeFromDut_6() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::WindowCoveringClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_6, OnFailureCallback_6, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_6(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_6(chip::BitFlags configStatus) - { - VerifyOrReturn(CheckConstraintMinValue("configStatus", configStatus, 0)); - VerifyOrReturn(CheckConstraintMaxValue("configStatus", configStatus, 127)); - configStatusValA = configStatus; - NextTest(); - } - - CHIP_ERROR Test2cIfConfigStatusBit00ThSendDownOrCloseCommandToTheDut_7() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::WindowCovering::Commands::DownOrClose::Type; - - RequestType request; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_7(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_7(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_7(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); - NextTest(); - } - - void OnSuccessResponse_7() { ThrowSuccessResponse(); } - - CHIP_ERROR Test2dThClearTheModeAttributeBit1OfTheDut_8() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::WindowCoveringClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::BitFlags modeArgument; - modeArgument = static_cast>(0); - - ReturnErrorOnFailure(cluster.WriteAttribute( - modeArgument, this, OnSuccessCallback_8, OnFailureCallback_8)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_8(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_8() { NextTest(); } - - CHIP_ERROR Test2eThReadsConfigStatusAttributeFromDut_9() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::WindowCoveringClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_9, OnFailureCallback_9, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_9(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_9(chip::BitFlags configStatus) - { - VerifyOrReturn(CheckConstraintMinValue("configStatus", configStatus, 1)); - VerifyOrReturn(CheckConstraintMaxValue("configStatus", configStatus, 127)); - NextTest(); - } - - CHIP_ERROR Test2fThReadsTheModeAttributeFromTheDut_10() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::WindowCoveringClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_10, OnFailureCallback_10, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_10(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_10(chip::BitFlags mode) - { - VerifyOrReturn(CheckConstraintMinValue("mode", mode, 0)); - VerifyOrReturn(CheckConstraintMaxValue("mode", mode, 127)); - NextTest(); - } - - CHIP_ERROR Test2gThSendDownOrCloseCommandToTheDut_11() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::WindowCovering::Commands::DownOrClose::Type; - - RequestType request; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_11(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_11(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_11(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_11() { NextTest(); } - - CHIP_ERROR Test3aThSetTheModeAttributeBit2OfTheDut_12() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::WindowCoveringClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::BitFlags modeArgument; - modeArgument = static_cast>(4); - - ReturnErrorOnFailure(cluster.WriteAttribute( - modeArgument, this, OnSuccessCallback_12, OnFailureCallback_12)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_12(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_12() { NextTest(); } - - CHIP_ERROR Test3cThReadsConfigStatusAttributeFromDut_13() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::WindowCoveringClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_13, OnFailureCallback_13, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_13(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_13(chip::BitFlags configStatus) - { - VerifyOrReturn(CheckConstraintMinValue("configStatus", configStatus, 0)); - VerifyOrReturn(CheckConstraintMaxValue("configStatus", configStatus, 127)); - configStatusValB = configStatus; - NextTest(); - } - - CHIP_ERROR Test3cThSendDownOrCloseCommandToTheDut_14() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::WindowCovering::Commands::DownOrClose::Type; - - RequestType request; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_14(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_14(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_14(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_BUSY)); - NextTest(); - } - - void OnSuccessResponse_14() { ThrowSuccessResponse(); } - - CHIP_ERROR Test3dThClearTheModeAttributeBit2OfTheDut_15() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::WindowCoveringClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::BitFlags modeArgument; - modeArgument = static_cast>(0); - - ReturnErrorOnFailure(cluster.WriteAttribute( - modeArgument, this, OnSuccessCallback_15, OnFailureCallback_15)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_15(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_15() { NextTest(); } - - CHIP_ERROR Test3eThReadsConfigStatusAttributeFromDut_16() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::WindowCoveringClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_16, OnFailureCallback_16, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_16(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_16(chip::BitFlags configStatus) - { - VerifyOrReturn(CheckConstraintMinValue("configStatus", configStatus, 1)); - VerifyOrReturn(CheckConstraintMaxValue("configStatus", configStatus, 127)); - NextTest(); - } - - CHIP_ERROR Test3fThReadsTheModeAttributeFromTheDut_17() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::WindowCoveringClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_17, OnFailureCallback_17, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_17(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_17(chip::BitFlags mode) - { - VerifyOrReturn(CheckConstraintMinValue("mode", mode, 0)); - VerifyOrReturn(CheckConstraintMaxValue("mode", mode, 127)); - NextTest(); - } - - CHIP_ERROR Test3gThSendDownOrCloseCommandToTheDut_18() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::WindowCovering::Commands::DownOrClose::Type; - - RequestType request; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_18(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_18(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_18(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_18() { NextTest(); } -}; - -class Test_TC_WNCV_2_4Suite : public TestCommand -{ -public: - Test_TC_WNCV_2_4Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_WNCV_2_4", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_WNCV_2_4Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_WNCV_2_4\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_WNCV_2_4\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Reads Type attribute from DUT\n"); - if (ShouldSkip("A_TYPE")) - { - NextTest(); - return; - } - err = TestReadsTypeAttributeFromDut_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Reads Type attribute constraints\n"); - if (ShouldSkip("A_TYPE")) - { - NextTest(); - return; - } - err = TestReadsTypeAttributeConstraints_2(); - break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 3; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - static void OnFailureCallback_1(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_1(error); - } - - static void OnSuccessCallback_1(void * context, chip::app::Clusters::WindowCovering::Type type) - { - (static_cast(context))->OnSuccessResponse_1(type); - } - - static void OnFailureCallback_2(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_2(error); - } - - static void OnSuccessCallback_2(void * context, chip::app::Clusters::WindowCovering::Type type) - { - (static_cast(context))->OnSuccessResponse_2(type); - } - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestReadsTypeAttributeFromDut_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::WindowCoveringClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_1, OnFailureCallback_1, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_1(chip::app::Clusters::WindowCovering::Type type) - { - VerifyOrReturn(CheckValue("type", type, 0)); - - NextTest(); - } - - CHIP_ERROR TestReadsTypeAttributeConstraints_2() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::WindowCoveringClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_2, OnFailureCallback_2, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_2(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_2(chip::app::Clusters::WindowCovering::Type type) - { - VerifyOrReturn(CheckConstraintType("type", "", "enum8")); - VerifyOrReturn(CheckConstraintMinValue("type", type, 0)); - VerifyOrReturn(CheckConstraintMaxValue("type", type, 9)); - NextTest(); - } -}; - -class Test_TC_WNCV_2_5Suite : public TestCommand -{ -public: - Test_TC_WNCV_2_5Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_WNCV_2_5", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_WNCV_2_5Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_WNCV_2_5\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_WNCV_2_5\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Reads EndProductType attribute from DUT\n"); - if (ShouldSkip("A_ENDPRODUCTTYPE")) - { - NextTest(); - return; - } - err = TestReadsEndProductTypeAttributeFromDut_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Reads EndProductType attribute constraints from DUT\n"); - if (ShouldSkip("A_ENDPRODUCTTYPE")) - { - NextTest(); - return; - } - err = TestReadsEndProductTypeAttributeConstraintsFromDut_2(); - break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 3; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - static void OnFailureCallback_1(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_1(error); - } - - static void OnSuccessCallback_1(void * context, chip::app::Clusters::WindowCovering::EndProductType endProductType) - { - (static_cast(context))->OnSuccessResponse_1(endProductType); - } - - static void OnFailureCallback_2(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_2(error); - } - - static void OnSuccessCallback_2(void * context, chip::app::Clusters::WindowCovering::EndProductType endProductType) - { - (static_cast(context))->OnSuccessResponse_2(endProductType); - } - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestReadsEndProductTypeAttributeFromDut_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::WindowCoveringClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_1, OnFailureCallback_1, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_1(chip::app::Clusters::WindowCovering::EndProductType endProductType) - { - VerifyOrReturn(CheckValue("endProductType", endProductType, 0)); - - NextTest(); - } - - CHIP_ERROR TestReadsEndProductTypeAttributeConstraintsFromDut_2() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::WindowCoveringClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_2, OnFailureCallback_2, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_2(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_2(chip::app::Clusters::WindowCovering::EndProductType endProductType) - { - VerifyOrReturn(CheckConstraintType("endProductType", "", "enum8")); - VerifyOrReturn(CheckConstraintMinValue("endProductType", endProductType, 0)); - VerifyOrReturn(CheckConstraintMaxValue("endProductType", endProductType, 23)); - NextTest(); - } -}; - -class Test_TC_WNCV_3_1Suite : public TestCommand -{ -public: - Test_TC_WNCV_3_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_WNCV_3_1", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_WNCV_3_1Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_WNCV_3_1\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_WNCV_3_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : 0: Wait for the commissioned device to be retrieved\n"); - err = Test0WaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - case 1: - ChipLogProgress( - chipTool, - " ***** Test Step 1 : 1a: TH sends DownOrClose command to preposition the DUT in the opposite direction\n"); - err = Test1aThSendsDownOrCloseCommandToPrepositionTheDutInTheOppositeDirection_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : 1b: TH Waits for 10 seconds movement(s) on the device\n"); - err = Test1bThWaitsFor10SecondsMovementsOnTheDevice_2(); - break; - case 3: - ChipLogProgress(chipTool, - " ***** Test Step 3 : 1c: If (PA & LF) TH reads CurrentPositionLiftPercent100ths attribute from DUT\n"); - if (ShouldSkip("WNCV_LF && WNCV_PA_LF")) - { - NextTest(); - return; - } - err = Test1cIfPaLfThReadsCurrentPositionLiftPercent100thsAttributeFromDut_3(); - break; - case 4: - ChipLogProgress( - chipTool, - " ***** Test Step 4 : 1d: If (PA & LF) TH reads CurrentPositionLiftPercentage optional attribute from DUT\n"); - if (ShouldSkip("WNCV_LF && WNCV_PA_LF && A_CURRENTPOSITIONLIFTPERCENTAGE")) - { - NextTest(); - return; - } - err = Test1dIfPaLfThReadsCurrentPositionLiftPercentageOptionalAttributeFromDut_4(); - break; - case 5: - ChipLogProgress(chipTool, - " ***** Test Step 5 : 1e: If (PA & TL) TH reads CurrentPositionTiltPercent100ths attribute from DUT\n"); - if (ShouldSkip("WNCV_TL && WNCV_PA_TL")) - { - NextTest(); - return; - } - err = Test1eIfPaTlThReadsCurrentPositionTiltPercent100thsAttributeFromDut_5(); - break; - case 6: - ChipLogProgress( - chipTool, - " ***** Test Step 6 : 1f: If (PA & TL) TH reads CurrentPositionTiltPercentage optional attribute from DUT\n"); - if (ShouldSkip("WNCV_TL && WNCV_PA_TL && A_CURRENTPOSITIONTILTPERCENTAGE")) - { - NextTest(); - return; - } - err = Test1fIfPaTlThReadsCurrentPositionTiltPercentageOptionalAttributeFromDut_6(); - break; - case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : Report: 2: Subscribe to DUT reports on OperationalStatus attribute\n"); - err = TestReport2SubscribeToDutReportsOnOperationalStatusAttribute_7(); - break; - case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : 2: Subscribe to DUT reports on OperationalStatus attribute\n"); - err = Test2SubscribeToDutReportsOnOperationalStatusAttribute_8(); - break; - case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : 2a: TH sends UpOrOpen command to DUT\n"); - err = Test2aThSendsUpOrOpenCommandToDut_9(); - break; - case 10: - ChipLogProgress(chipTool, " ***** Test Step 10 : 2b: DUT updates its attributes\n"); - err = Test2bDutUpdatesItsAttributes_10(); - break; - case 11: - ChipLogProgress(chipTool, - " ***** Test Step 11 : 2c: If (PA & LF) TH reads TargetPositionLiftPercent100ths attribute from DUT\n"); - if (ShouldSkip("WNCV_LF && WNCV_PA_LF")) - { - NextTest(); - return; - } - err = Test2cIfPaLfThReadsTargetPositionLiftPercent100thsAttributeFromDut_11(); - break; - case 12: - ChipLogProgress(chipTool, " ***** Test Step 12 : 2e: TH leave the device moving for 2 seconds\n"); - err = Test2eThLeaveTheDeviceMovingFor2Seconds_12(); - break; - case 13: - ChipLogProgress(chipTool, - " ***** Test Step 13 : 3a1: Verify DUT reports OperationalStatus attribute to TH after a UpOrOpen\n"); - err = Test3a1VerifyDutReportsOperationalStatusAttributeToThAfterAUpOrOpen_13(); - break; - case 14: - ChipLogProgress(chipTool, " ***** Test Step 14 : 3a2: DUT updates its attributes\n"); - err = Test3a2DutUpdatesItsAttributes_14(); - break; - case 15: - ChipLogProgress( - chipTool, " ***** Test Step 15 : 3b: If (PA & LF) TH reads CurrentPositionLiftPercent100ths attribute from DUT\n"); - if (ShouldSkip("WNCV_LF && WNCV_PA_LF")) - { - NextTest(); - return; - } - err = Test3bIfPaLfThReadsCurrentPositionLiftPercent100thsAttributeFromDut_15(); - break; - case 16: - ChipLogProgress( - chipTool, - " ***** Test Step 16 : 3c: If (PA & LF) TH reads CurrentPositionLiftPercentage optional attribute from DUT\n"); - if (ShouldSkip("WNCV_LF && WNCV_PA_LF && A_CURRENTPOSITIONLIFTPERCENTAGE")) - { - NextTest(); - return; - } - err = Test3cIfPaLfThReadsCurrentPositionLiftPercentageOptionalAttributeFromDut_16(); - break; - case 17: - ChipLogProgress( - chipTool, " ***** Test Step 17 : 3d: If (PA & TL) TH reads CurrentPositionTiltPercent100ths attribute from DUT\n"); - if (ShouldSkip("WNCV_TL && WNCV_PA_TL")) - { - NextTest(); - return; - } - err = Test3dIfPaTlThReadsCurrentPositionTiltPercent100thsAttributeFromDut_17(); - break; - case 18: - ChipLogProgress( - chipTool, - " ***** Test Step 18 : 3e: If (PA & LF) TH reads CurrentPositionTiltPercentage optional attribute from DUT\n"); - if (ShouldSkip("WNCV_TL && WNCV_PA_TL && A_CURRENTPOSITIONTILTPERCENTAGE")) - { - NextTest(); - return; - } - err = Test3eIfPaLfThReadsCurrentPositionTiltPercentageOptionalAttributeFromDut_18(); - break; - case 19: - ChipLogProgress(chipTool, " ***** Test Step 19 : 4a: TH sends a StopMotion command to DUT\n"); - err = Test4aThSendsAStopMotionCommandToDut_19(); - break; - case 20: - ChipLogProgress(chipTool, - " ***** Test Step 20 : 4b: TH waits for 3 seconds the end of inertial movement(s) on the device\n"); - err = Test4bThWaitsFor3SecondsTheEndOfInertialMovementsOnTheDevice_20(); - break; - case 21: - ChipLogProgress(chipTool, - " ***** Test Step 21 : 4c: Verify DUT update OperationalStatus attribute to TH after a StopMotion\n"); - err = Test4cVerifyDutUpdateOperationalStatusAttributeToThAfterAStopMotion_21(); - break; - case 22: - ChipLogProgress(chipTool, " ***** Test Step 22 : 5a: TH waits for x seconds attributes update on the device\n"); - err = Test5aThWaitsForXSecondsAttributesUpdateOnTheDevice_22(); - break; - case 23: - ChipLogProgress(chipTool, - " ***** Test Step 23 : 5b: If (PA & LF) TH reads TargetPositionLiftPercent100ths attribute from DUT\n"); - if (ShouldSkip("WNCV_LF && WNCV_PA_LF")) - { - NextTest(); - return; - } - err = Test5bIfPaLfThReadsTargetPositionLiftPercent100thsAttributeFromDut_23(); - break; - case 24: - ChipLogProgress(chipTool, - " ***** Test Step 24 : 5c: If (PA & TL) TH reads TargetPositionTiltPercent100ths attribute from DUT\n"); - if (ShouldSkip("WNCV_TL && WNCV_PA_TL")) - { - NextTest(); - return; - } - err = Test5cIfPaTlThReadsTargetPositionTiltPercent100thsAttributeFromDut_24(); - break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 25; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 2: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 10: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 12: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 14: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 20: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 22: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - typedef void (*Test_Test_TC_WNCV_3_1_OperationalStatus_ReportCallback)(void * context, uint8_t value); - Test_Test_TC_WNCV_3_1_OperationalStatus_ReportCallback mTest_Test_TC_WNCV_3_1_OperationalStatus_Reported = nullptr; - - static void OnFailureCallback_3(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_3(error); - } - - static void OnSuccessCallback_3(void * context, - const chip::app::DataModel::Nullable & currentPositionLiftPercent100ths) - { - (static_cast(context))->OnSuccessResponse_3(currentPositionLiftPercent100ths); - } - - static void OnFailureCallback_4(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_4(error); - } - - static void OnSuccessCallback_4(void * context, - const chip::app::DataModel::Nullable & currentPositionLiftPercentage) - { - (static_cast(context))->OnSuccessResponse_4(currentPositionLiftPercentage); - } - - static void OnFailureCallback_5(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_5(error); - } - - static void OnSuccessCallback_5(void * context, - const chip::app::DataModel::Nullable & currentPositionTiltPercent100ths) - { - (static_cast(context))->OnSuccessResponse_5(currentPositionTiltPercent100ths); - } - - static void OnFailureCallback_6(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_6(error); - } - - static void OnSuccessCallback_6(void * context, - const chip::app::DataModel::Nullable & currentPositionTiltPercentage) - { - (static_cast(context))->OnSuccessResponse_6(currentPositionTiltPercentage); - } - - static void OnFailureCallback_7(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_7(error); - } - - static void OnSuccessCallback_7(void * context, uint8_t operationalStatus) - { - (static_cast(context))->OnSuccessResponse_7(operationalStatus); - } - - bool mReceivedReport_7 = false; - - static void OnFailureCallback_8(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_8(error); - } - - static void OnSuccessCallback_8(void * context, uint8_t operationalStatus) - { - (static_cast(context))->OnSuccessResponse_8(operationalStatus); - } - - static void OnSubscriptionEstablished_8(void * context) - { - (static_cast(context))->OnSubscriptionEstablishedResponse_8(); - } - - static void OnFailureCallback_11(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_11(error); - } - - static void OnSuccessCallback_11(void * context, - const chip::app::DataModel::Nullable & targetPositionLiftPercent100ths) - { - (static_cast(context))->OnSuccessResponse_11(targetPositionLiftPercent100ths); - } - - static void OnFailureCallback_13(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_13(error); - } - - static void OnSuccessCallback_13(void * context, uint8_t operationalStatus) - { - (static_cast(context))->OnSuccessResponse_13(operationalStatus); - } - - bool mReceivedReport_13 = false; - - static void OnFailureCallback_15(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_15(error); - } - - static void OnSuccessCallback_15(void * context, - const chip::app::DataModel::Nullable & currentPositionLiftPercent100ths) - { - (static_cast(context))->OnSuccessResponse_15(currentPositionLiftPercent100ths); - } - - static void OnFailureCallback_16(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_16(error); - } - - static void OnSuccessCallback_16(void * context, - const chip::app::DataModel::Nullable & currentPositionLiftPercentage) - { - (static_cast(context))->OnSuccessResponse_16(currentPositionLiftPercentage); - } - - static void OnFailureCallback_17(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_17(error); - } - - static void OnSuccessCallback_17(void * context, - const chip::app::DataModel::Nullable & currentPositionTiltPercent100ths) - { - (static_cast(context))->OnSuccessResponse_17(currentPositionTiltPercent100ths); - } - - static void OnFailureCallback_18(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_18(error); - } - - static void OnSuccessCallback_18(void * context, - const chip::app::DataModel::Nullable & currentPositionTiltPercentage) - { - (static_cast(context))->OnSuccessResponse_18(currentPositionTiltPercentage); - } - - static void OnFailureCallback_21(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_21(error); - } - - static void OnSuccessCallback_21(void * context, uint8_t operationalStatus) - { - (static_cast(context))->OnSuccessResponse_21(operationalStatus); - } - - static void OnFailureCallback_23(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_23(error); - } - - static void OnSuccessCallback_23(void * context, - const chip::app::DataModel::Nullable & targetPositionLiftPercent100ths) - { - (static_cast(context))->OnSuccessResponse_23(targetPositionLiftPercent100ths); - } - - static void OnFailureCallback_24(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_24(error); - } - - static void OnSuccessCallback_24(void * context, - const chip::app::DataModel::Nullable & targetPositionTiltPercent100ths) - { - (static_cast(context))->OnSuccessResponse_24(targetPositionTiltPercent100ths); - } - - // - // Tests methods - // - - CHIP_ERROR Test0WaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR Test1aThSendsDownOrCloseCommandToPrepositionTheDutInTheOppositeDirection_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::WindowCovering::Commands::DownOrClose::Type; - - RequestType request; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_1(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_1(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_1() { NextTest(); } - - CHIP_ERROR Test1bThWaitsFor10SecondsMovementsOnTheDevice_2() - { - SetIdentity(kIdentityAlpha); - return WaitForMs(10000); - } - - CHIP_ERROR Test1cIfPaLfThReadsCurrentPositionLiftPercent100thsAttributeFromDut_3() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::WindowCoveringClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_3, OnFailureCallback_3, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_3(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_3(const chip::app::DataModel::Nullable & currentPositionLiftPercent100ths) - { - VerifyOrReturn(CheckConstraintType("currentPositionLiftPercent100ths", "", "uint16")); - VerifyOrReturn(CheckConstraintMinValue("currentPositionLiftPercent100ths", currentPositionLiftPercent100ths, 1U)); - VerifyOrReturn(CheckConstraintMaxValue("currentPositionLiftPercent100ths", currentPositionLiftPercent100ths, 10000U)); - NextTest(); - } - - CHIP_ERROR Test1dIfPaLfThReadsCurrentPositionLiftPercentageOptionalAttributeFromDut_4() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::WindowCoveringClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_4, OnFailureCallback_4, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_4(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_4(const chip::app::DataModel::Nullable & currentPositionLiftPercentage) - { - VerifyOrReturn(CheckConstraintType("currentPositionLiftPercentage", "", "uint8")); - VerifyOrReturn(CheckConstraintMinValue("currentPositionLiftPercentage", currentPositionLiftPercentage, 1)); - VerifyOrReturn(CheckConstraintMaxValue("currentPositionLiftPercentage", currentPositionLiftPercentage, 100)); - NextTest(); - } - - CHIP_ERROR Test1eIfPaTlThReadsCurrentPositionTiltPercent100thsAttributeFromDut_5() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::WindowCoveringClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_5, OnFailureCallback_5, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_5(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_5(const chip::app::DataModel::Nullable & currentPositionTiltPercent100ths) - { - VerifyOrReturn(CheckConstraintType("currentPositionTiltPercent100ths", "", "uint16")); - VerifyOrReturn(CheckConstraintMinValue("currentPositionTiltPercent100ths", currentPositionTiltPercent100ths, 1U)); - VerifyOrReturn(CheckConstraintMaxValue("currentPositionTiltPercent100ths", currentPositionTiltPercent100ths, 10000U)); - NextTest(); - } - - CHIP_ERROR Test1fIfPaTlThReadsCurrentPositionTiltPercentageOptionalAttributeFromDut_6() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::WindowCoveringClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_6, OnFailureCallback_6, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_6(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_6(const chip::app::DataModel::Nullable & currentPositionTiltPercentage) - { - VerifyOrReturn(CheckConstraintType("currentPositionTiltPercentage", "", "uint8")); - VerifyOrReturn(CheckConstraintMinValue("currentPositionTiltPercentage", currentPositionTiltPercentage, 1)); - VerifyOrReturn(CheckConstraintMaxValue("currentPositionTiltPercentage", currentPositionTiltPercentage, 100)); - NextTest(); - } - - CHIP_ERROR TestReport2SubscribeToDutReportsOnOperationalStatusAttribute_7() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::WindowCoveringClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - mTest_Test_TC_WNCV_3_1_OperationalStatus_Reported = OnSuccessCallback_7; - return WaitForMs(0); - } - - void OnFailureResponse_7(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_7(uint8_t operationalStatus) - { - mReceivedReport_7 = true; - VerifyOrReturn(CheckConstraintType("operationalStatus", "", "map8")); - } - - CHIP_ERROR Test2SubscribeToDutReportsOnOperationalStatusAttribute_8() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::WindowCoveringClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - uint16_t minIntervalArgument; - minIntervalArgument = 4U; - uint16_t maxIntervalArgument; - maxIntervalArgument = 5U; - - ReturnErrorOnFailure( - cluster.SubscribeAttribute( - this, OnSuccessCallback_8, OnFailureCallback_8, minIntervalArgument, maxIntervalArgument, - OnSubscriptionEstablished_8, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_8(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_8(uint8_t value) - { - if (mTest_Test_TC_WNCV_3_1_OperationalStatus_Reported) - { - auto callback = mTest_Test_TC_WNCV_3_1_OperationalStatus_Reported; - mTest_Test_TC_WNCV_3_1_OperationalStatus_Reported = nullptr; - callback(this, value); - } - } - - void OnSubscriptionEstablishedResponse_8() - { - VerifyOrReturn(mReceivedReport_7, Exit("Initial report not received!")); - NextTest(); - } - - CHIP_ERROR Test2aThSendsUpOrOpenCommandToDut_9() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::WindowCovering::Commands::UpOrOpen::Type; - - RequestType request; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_9(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_9(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_9(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_9() { NextTest(); } - - CHIP_ERROR Test2bDutUpdatesItsAttributes_10() - { - SetIdentity(kIdentityAlpha); - return WaitForMs(100); - } - - CHIP_ERROR Test2cIfPaLfThReadsTargetPositionLiftPercent100thsAttributeFromDut_11() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::WindowCoveringClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_11, OnFailureCallback_11, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_11(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_11(const chip::app::DataModel::Nullable & targetPositionLiftPercent100ths) - { - VerifyOrReturn(CheckValueNonNull("targetPositionLiftPercent100ths", targetPositionLiftPercent100ths)); - VerifyOrReturn(CheckValue("targetPositionLiftPercent100ths.Value()", targetPositionLiftPercent100ths.Value(), 0U)); - - NextTest(); - } - - CHIP_ERROR Test2eThLeaveTheDeviceMovingFor2Seconds_12() - { - SetIdentity(kIdentityAlpha); - return WaitForMs(2000); - } - - CHIP_ERROR Test3a1VerifyDutReportsOperationalStatusAttributeToThAfterAUpOrOpen_13() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::WindowCoveringClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - mTest_Test_TC_WNCV_3_1_OperationalStatus_Reported = OnSuccessCallback_13; - return CHIP_NO_ERROR; - } - - void OnFailureResponse_13(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_13(uint8_t operationalStatus) - { - mReceivedReport_13 = true; - VerifyOrReturn(CheckConstraintType("operationalStatus", "", "map8")); - VerifyOrReturn(CheckConstraintMinValue("operationalStatus", operationalStatus, 5)); - VerifyOrReturn(CheckConstraintMaxValue("operationalStatus", operationalStatus, 21)); - NextTest(); - } - - CHIP_ERROR Test3a2DutUpdatesItsAttributes_14() - { - SetIdentity(kIdentityAlpha); - return WaitForMs(2000); - } - - CHIP_ERROR Test3bIfPaLfThReadsCurrentPositionLiftPercent100thsAttributeFromDut_15() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::WindowCoveringClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_15, OnFailureCallback_15, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_15(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_15(const chip::app::DataModel::Nullable & currentPositionLiftPercent100ths) - { - VerifyOrReturn(CheckConstraintType("currentPositionLiftPercent100ths", "", "uint16")); - VerifyOrReturn(CheckConstraintMinValue("currentPositionLiftPercent100ths", currentPositionLiftPercent100ths, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("currentPositionLiftPercent100ths", currentPositionLiftPercent100ths, 9999U)); - NextTest(); - } - - CHIP_ERROR Test3cIfPaLfThReadsCurrentPositionLiftPercentageOptionalAttributeFromDut_16() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::WindowCoveringClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_16, OnFailureCallback_16, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_16(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_16(const chip::app::DataModel::Nullable & currentPositionLiftPercentage) - { - VerifyOrReturn(CheckConstraintType("currentPositionLiftPercentage", "", "uint8")); - VerifyOrReturn(CheckConstraintMinValue("currentPositionLiftPercentage", currentPositionLiftPercentage, 0)); - VerifyOrReturn(CheckConstraintMaxValue("currentPositionLiftPercentage", currentPositionLiftPercentage, 99)); - NextTest(); - } - - CHIP_ERROR Test3dIfPaTlThReadsCurrentPositionTiltPercent100thsAttributeFromDut_17() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::WindowCoveringClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_17, OnFailureCallback_17, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_17(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_17(const chip::app::DataModel::Nullable & currentPositionTiltPercent100ths) - { - VerifyOrReturn(CheckConstraintType("currentPositionTiltPercent100ths", "", "uint16")); - VerifyOrReturn(CheckConstraintMinValue("currentPositionTiltPercent100ths", currentPositionTiltPercent100ths, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("currentPositionTiltPercent100ths", currentPositionTiltPercent100ths, 9999U)); - NextTest(); - } - - CHIP_ERROR Test3eIfPaLfThReadsCurrentPositionTiltPercentageOptionalAttributeFromDut_18() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::WindowCoveringClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_18, OnFailureCallback_18, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_18(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_18(const chip::app::DataModel::Nullable & currentPositionTiltPercentage) - { - VerifyOrReturn(CheckConstraintType("currentPositionTiltPercentage", "", "uint8")); - VerifyOrReturn(CheckConstraintMinValue("currentPositionTiltPercentage", currentPositionTiltPercentage, 0)); - VerifyOrReturn(CheckConstraintMaxValue("currentPositionTiltPercentage", currentPositionTiltPercentage, 99)); - NextTest(); - } - - CHIP_ERROR Test4aThSendsAStopMotionCommandToDut_19() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::WindowCovering::Commands::StopMotion::Type; - - RequestType request; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_19(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_19(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_19(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_19() { NextTest(); } - - CHIP_ERROR Test4bThWaitsFor3SecondsTheEndOfInertialMovementsOnTheDevice_20() - { - SetIdentity(kIdentityAlpha); - return WaitForMs(3000); - } - - CHIP_ERROR Test4cVerifyDutUpdateOperationalStatusAttributeToThAfterAStopMotion_21() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::WindowCoveringClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_21, OnFailureCallback_21, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_21(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_21(uint8_t operationalStatus) - { - VerifyOrReturn(CheckValue("operationalStatus", operationalStatus, 0)); - - NextTest(); - } - - CHIP_ERROR Test5aThWaitsForXSecondsAttributesUpdateOnTheDevice_22() - { - SetIdentity(kIdentityAlpha); - return WaitForMs(1000); - } - - CHIP_ERROR Test5bIfPaLfThReadsTargetPositionLiftPercent100thsAttributeFromDut_23() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::WindowCoveringClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_23, OnFailureCallback_23, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_23(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_23(const chip::app::DataModel::Nullable & targetPositionLiftPercent100ths) - { - VerifyOrReturn(CheckConstraintType("targetPositionLiftPercent100ths", "", "uint16")); - VerifyOrReturn(CheckConstraintMinValue("targetPositionLiftPercent100ths", targetPositionLiftPercent100ths, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("targetPositionLiftPercent100ths", targetPositionLiftPercent100ths, 9999U)); - NextTest(); - } - - CHIP_ERROR Test5cIfPaTlThReadsTargetPositionTiltPercent100thsAttributeFromDut_24() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::WindowCoveringClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_24, OnFailureCallback_24, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_24(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_24(const chip::app::DataModel::Nullable & targetPositionTiltPercent100ths) - { - VerifyOrReturn(CheckConstraintType("targetPositionTiltPercent100ths", "", "uint16")); - VerifyOrReturn(CheckConstraintMinValue("targetPositionTiltPercent100ths", targetPositionTiltPercent100ths, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("targetPositionTiltPercent100ths", targetPositionTiltPercent100ths, 9999U)); - NextTest(); - } -}; - -class Test_TC_WNCV_3_2Suite : public TestCommand -{ -public: - Test_TC_WNCV_3_2Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_WNCV_3_2", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_WNCV_3_2Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_WNCV_3_2\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_WNCV_3_2\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : 0: Wait for the commissioned device to be retrieved\n"); - err = Test0WaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - case 1: - ChipLogProgress( - chipTool, " ***** Test Step 1 : 1a: TH sends UpOrOpen command to preposition the DUT in the opposite direction\n"); - err = Test1aThSendsUpOrOpenCommandToPrepositionTheDutInTheOppositeDirection_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : 1b: TH Waits for 10 seconds movement(s) on the device\n"); - err = Test1bThWaitsFor10SecondsMovementsOnTheDevice_2(); - break; - case 3: - ChipLogProgress(chipTool, - " ***** Test Step 3 : 1c: If (PA & LF) TH reads CurrentPositionLiftPercent100ths attribute from DUT\n"); - if (ShouldSkip("WNCV_LF && WNCV_PA_LF")) - { - NextTest(); - return; - } - err = Test1cIfPaLfThReadsCurrentPositionLiftPercent100thsAttributeFromDut_3(); - break; - case 4: - ChipLogProgress( - chipTool, - " ***** Test Step 4 : 1d: If (PA & LF) TH reads CurrentPositionLiftPercentage optional attribute from DUT\n"); - if (ShouldSkip("WNCV_LF && WNCV_PA_LF && A_CURRENTPOSITIONLIFTPERCENTAGE")) - { - NextTest(); - return; - } - err = Test1dIfPaLfThReadsCurrentPositionLiftPercentageOptionalAttributeFromDut_4(); - break; - case 5: - ChipLogProgress(chipTool, - " ***** Test Step 5 : 1e: If (PA & TL) TH reads CurrentPositionTiltPercent100ths attribute from DUT\n"); - if (ShouldSkip("WNCV_TL && WNCV_PA_TL")) - { - NextTest(); - return; - } - err = Test1eIfPaTlThReadsCurrentPositionTiltPercent100thsAttributeFromDut_5(); - break; - case 6: - ChipLogProgress( - chipTool, - " ***** Test Step 6 : 1f: If (PA & TL) TH reads CurrentPositionTiltPercentage optional attribute from DUT\n"); - if (ShouldSkip("WNCV_TL && WNCV_PA_TL && A_CURRENTPOSITIONTILTPERCENTAGE")) - { - NextTest(); - return; - } - err = Test1fIfPaTlThReadsCurrentPositionTiltPercentageOptionalAttributeFromDut_6(); - break; - case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : Report: 2: Subscribe to DUT reports on OperationalStatus attribute\n"); - err = TestReport2SubscribeToDutReportsOnOperationalStatusAttribute_7(); - break; - case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : 2: Subscribe to DUT reports on OperationalStatus attribute\n"); - err = Test2SubscribeToDutReportsOnOperationalStatusAttribute_8(); - break; - case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : 2a: TH sends DownOrClose command to DUT\n"); - err = Test2aThSendsDownOrCloseCommandToDut_9(); - break; - case 10: - ChipLogProgress(chipTool, " ***** Test Step 10 : 2b: DUT updates its attributes\n"); - err = Test2bDutUpdatesItsAttributes_10(); - break; - case 11: - ChipLogProgress(chipTool, - " ***** Test Step 11 : 2c: If (PA & LF) TH reads TargetPositionLiftPercent100ths attribute from DUT\n"); - if (ShouldSkip("WNCV_LF && WNCV_PA_LF")) - { - NextTest(); - return; - } - err = Test2cIfPaLfThReadsTargetPositionLiftPercent100thsAttributeFromDut_11(); - break; - case 12: - ChipLogProgress(chipTool, " ***** Test Step 12 : 2e: TH leave the device moving for 2 seconds\n"); - err = Test2eThLeaveTheDeviceMovingFor2Seconds_12(); - break; - case 13: - ChipLogProgress(chipTool, - " ***** Test Step 13 : 3a: Verify DUT reports OperationalStatus attribute to TH after a DownOrClose\n"); - err = Test3aVerifyDutReportsOperationalStatusAttributeToThAfterADownOrClose_13(); - break; - case 14: - ChipLogProgress(chipTool, " ***** Test Step 14 : 3a2: DUT updates its attributes\n"); - err = Test3a2DutUpdatesItsAttributes_14(); - break; - case 15: - ChipLogProgress( - chipTool, " ***** Test Step 15 : 3b: If (PA & LF) TH reads CurrentPositionLiftPercent100ths attribute from DUT\n"); - if (ShouldSkip("WNCV_LF && WNCV_PA_LF")) - { - NextTest(); - return; - } - err = Test3bIfPaLfThReadsCurrentPositionLiftPercent100thsAttributeFromDut_15(); - break; - case 16: - ChipLogProgress( - chipTool, - " ***** Test Step 16 : 3c: If (PA & LF) TH reads CurrentPositionLiftPercentage optional attribute from DUT\n"); - if (ShouldSkip("WNCV_LF && WNCV_PA_LF && A_CURRENTPOSITIONLIFTPERCENTAGE")) - { - NextTest(); - return; - } - err = Test3cIfPaLfThReadsCurrentPositionLiftPercentageOptionalAttributeFromDut_16(); - break; - case 17: - ChipLogProgress( - chipTool, " ***** Test Step 17 : 3d: If (PA & TL) TH reads CurrentPositionTiltPercent100ths attribute from DUT\n"); - if (ShouldSkip("WNCV_TL && WNCV_PA_TL")) - { - NextTest(); - return; - } - err = Test3dIfPaTlThReadsCurrentPositionTiltPercent100thsAttributeFromDut_17(); - break; - case 18: - ChipLogProgress( - chipTool, - " ***** Test Step 18 : 3e: If (PA & LF) TH reads CurrentPositionTiltPercentage optional attribute from DUT\n"); - if (ShouldSkip("WNCV_TL && WNCV_PA_TL && A_CURRENTPOSITIONTILTPERCENTAGE")) - { - NextTest(); - return; - } - err = Test3eIfPaLfThReadsCurrentPositionTiltPercentageOptionalAttributeFromDut_18(); - break; - case 19: - ChipLogProgress(chipTool, " ***** Test Step 19 : 4a: TH sends a StopMotion command to DUT\n"); - err = Test4aThSendsAStopMotionCommandToDut_19(); - break; - case 20: - ChipLogProgress(chipTool, - " ***** Test Step 20 : 4b: TH waits for 3 seconds the end of inertial movement(s) on the device\n"); - err = Test4bThWaitsFor3SecondsTheEndOfInertialMovementsOnTheDevice_20(); - break; - case 21: - ChipLogProgress(chipTool, - " ***** Test Step 21 : 4c: Verify DUT update OperationalStatus attribute to TH after a StopMotion\n"); - err = Test4cVerifyDutUpdateOperationalStatusAttributeToThAfterAStopMotion_21(); - break; - case 22: - ChipLogProgress(chipTool, " ***** Test Step 22 : 5a: TH waits for x seconds attributes update on the device\n"); - err = Test5aThWaitsForXSecondsAttributesUpdateOnTheDevice_22(); - break; - case 23: - ChipLogProgress(chipTool, - " ***** Test Step 23 : 5b: If (PA & LF) TH reads TargetPositionLiftPercent100ths attribute from DUT\n"); - if (ShouldSkip("WNCV_LF && WNCV_PA_LF")) - { - NextTest(); - return; - } - err = Test5bIfPaLfThReadsTargetPositionLiftPercent100thsAttributeFromDut_23(); - break; - case 24: - ChipLogProgress(chipTool, - " ***** Test Step 24 : 5c: If (PA & TL) TH reads TargetPositionTiltPercent100ths attribute from DUT\n"); - if (ShouldSkip("WNCV_TL && WNCV_PA_TL")) - { - NextTest(); - return; - } - err = Test5cIfPaTlThReadsTargetPositionTiltPercent100thsAttributeFromDut_24(); - break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 25; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 2: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 10: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 12: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 14: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 20: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 22: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - typedef void (*Test_Test_TC_WNCV_3_2_OperationalStatus_ReportCallback)(void * context, uint8_t value); - Test_Test_TC_WNCV_3_2_OperationalStatus_ReportCallback mTest_Test_TC_WNCV_3_2_OperationalStatus_Reported = nullptr; - - static void OnFailureCallback_3(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_3(error); - } - - static void OnSuccessCallback_3(void * context, - const chip::app::DataModel::Nullable & currentPositionLiftPercent100ths) - { - (static_cast(context))->OnSuccessResponse_3(currentPositionLiftPercent100ths); - } - - static void OnFailureCallback_4(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_4(error); - } - - static void OnSuccessCallback_4(void * context, - const chip::app::DataModel::Nullable & currentPositionLiftPercentage) - { - (static_cast(context))->OnSuccessResponse_4(currentPositionLiftPercentage); - } - - static void OnFailureCallback_5(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_5(error); - } - - static void OnSuccessCallback_5(void * context, - const chip::app::DataModel::Nullable & currentPositionTiltPercent100ths) - { - (static_cast(context))->OnSuccessResponse_5(currentPositionTiltPercent100ths); - } - - static void OnFailureCallback_6(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_6(error); - } - - static void OnSuccessCallback_6(void * context, - const chip::app::DataModel::Nullable & currentPositionTiltPercentage) - { - (static_cast(context))->OnSuccessResponse_6(currentPositionTiltPercentage); - } - - static void OnFailureCallback_7(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_7(error); - } - - static void OnSuccessCallback_7(void * context, uint8_t operationalStatus) - { - (static_cast(context))->OnSuccessResponse_7(operationalStatus); - } - - bool mReceivedReport_7 = false; - - static void OnFailureCallback_8(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_8(error); - } - - static void OnSuccessCallback_8(void * context, uint8_t operationalStatus) - { - (static_cast(context))->OnSuccessResponse_8(operationalStatus); - } - - static void OnSubscriptionEstablished_8(void * context) - { - (static_cast(context))->OnSubscriptionEstablishedResponse_8(); - } - - static void OnFailureCallback_11(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_11(error); - } - - static void OnSuccessCallback_11(void * context, - const chip::app::DataModel::Nullable & targetPositionLiftPercent100ths) - { - (static_cast(context))->OnSuccessResponse_11(targetPositionLiftPercent100ths); - } - - static void OnFailureCallback_13(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_13(error); - } - - static void OnSuccessCallback_13(void * context, uint8_t operationalStatus) - { - (static_cast(context))->OnSuccessResponse_13(operationalStatus); - } - - bool mReceivedReport_13 = false; - - static void OnFailureCallback_15(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_15(error); - } - - static void OnSuccessCallback_15(void * context, - const chip::app::DataModel::Nullable & currentPositionLiftPercent100ths) - { - (static_cast(context))->OnSuccessResponse_15(currentPositionLiftPercent100ths); - } - - static void OnFailureCallback_16(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_16(error); - } - - static void OnSuccessCallback_16(void * context, - const chip::app::DataModel::Nullable & currentPositionLiftPercentage) - { - (static_cast(context))->OnSuccessResponse_16(currentPositionLiftPercentage); - } - - static void OnFailureCallback_17(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_17(error); - } - - static void OnSuccessCallback_17(void * context, - const chip::app::DataModel::Nullable & currentPositionTiltPercent100ths) - { - (static_cast(context))->OnSuccessResponse_17(currentPositionTiltPercent100ths); - } - - static void OnFailureCallback_18(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_18(error); - } - - static void OnSuccessCallback_18(void * context, - const chip::app::DataModel::Nullable & currentPositionTiltPercentage) - { - (static_cast(context))->OnSuccessResponse_18(currentPositionTiltPercentage); - } - - static void OnFailureCallback_21(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_21(error); - } - - static void OnSuccessCallback_21(void * context, uint8_t operationalStatus) - { - (static_cast(context))->OnSuccessResponse_21(operationalStatus); - } - - static void OnFailureCallback_23(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_23(error); - } - - static void OnSuccessCallback_23(void * context, - const chip::app::DataModel::Nullable & targetPositionLiftPercent100ths) - { - (static_cast(context))->OnSuccessResponse_23(targetPositionLiftPercent100ths); - } - - static void OnFailureCallback_24(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_24(error); - } - - static void OnSuccessCallback_24(void * context, - const chip::app::DataModel::Nullable & targetPositionTiltPercent100ths) - { - (static_cast(context))->OnSuccessResponse_24(targetPositionTiltPercent100ths); - } - - // - // Tests methods - // - - CHIP_ERROR Test0WaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR Test1aThSendsUpOrOpenCommandToPrepositionTheDutInTheOppositeDirection_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::WindowCovering::Commands::UpOrOpen::Type; - - RequestType request; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_1(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_1(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_1() { NextTest(); } - - CHIP_ERROR Test1bThWaitsFor10SecondsMovementsOnTheDevice_2() - { - SetIdentity(kIdentityAlpha); - return WaitForMs(10000); - } - - CHIP_ERROR Test1cIfPaLfThReadsCurrentPositionLiftPercent100thsAttributeFromDut_3() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::WindowCoveringClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_3, OnFailureCallback_3, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_3(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_3(const chip::app::DataModel::Nullable & currentPositionLiftPercent100ths) - { - VerifyOrReturn(CheckConstraintType("currentPositionLiftPercent100ths", "", "uint16")); - VerifyOrReturn(CheckConstraintMinValue("currentPositionLiftPercent100ths", currentPositionLiftPercent100ths, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("currentPositionLiftPercent100ths", currentPositionLiftPercent100ths, 9999U)); - NextTest(); - } - - CHIP_ERROR Test1dIfPaLfThReadsCurrentPositionLiftPercentageOptionalAttributeFromDut_4() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::WindowCoveringClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_4, OnFailureCallback_4, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_4(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_4(const chip::app::DataModel::Nullable & currentPositionLiftPercentage) - { - VerifyOrReturn(CheckConstraintType("currentPositionLiftPercentage", "", "uint8")); - VerifyOrReturn(CheckConstraintMinValue("currentPositionLiftPercentage", currentPositionLiftPercentage, 0)); - VerifyOrReturn(CheckConstraintMaxValue("currentPositionLiftPercentage", currentPositionLiftPercentage, 99)); - NextTest(); - } - - CHIP_ERROR Test1eIfPaTlThReadsCurrentPositionTiltPercent100thsAttributeFromDut_5() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::WindowCoveringClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_5, OnFailureCallback_5, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_5(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_5(const chip::app::DataModel::Nullable & currentPositionTiltPercent100ths) - { - VerifyOrReturn(CheckConstraintType("currentPositionTiltPercent100ths", "", "uint16")); - VerifyOrReturn(CheckConstraintMinValue("currentPositionTiltPercent100ths", currentPositionTiltPercent100ths, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("currentPositionTiltPercent100ths", currentPositionTiltPercent100ths, 9999U)); - NextTest(); - } - - CHIP_ERROR Test1fIfPaTlThReadsCurrentPositionTiltPercentageOptionalAttributeFromDut_6() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::WindowCoveringClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_6, OnFailureCallback_6, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_6(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_6(const chip::app::DataModel::Nullable & currentPositionTiltPercentage) - { - VerifyOrReturn(CheckConstraintType("currentPositionTiltPercentage", "", "uint8")); - VerifyOrReturn(CheckConstraintMinValue("currentPositionTiltPercentage", currentPositionTiltPercentage, 0)); - VerifyOrReturn(CheckConstraintMaxValue("currentPositionTiltPercentage", currentPositionTiltPercentage, 99)); - NextTest(); - } - - CHIP_ERROR TestReport2SubscribeToDutReportsOnOperationalStatusAttribute_7() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::WindowCoveringClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - mTest_Test_TC_WNCV_3_2_OperationalStatus_Reported = OnSuccessCallback_7; - return WaitForMs(0); - } - - void OnFailureResponse_7(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_7(uint8_t operationalStatus) - { - mReceivedReport_7 = true; - VerifyOrReturn(CheckConstraintType("operationalStatus", "", "map8")); - } - - CHIP_ERROR Test2SubscribeToDutReportsOnOperationalStatusAttribute_8() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::WindowCoveringClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - uint16_t minIntervalArgument; - minIntervalArgument = 4U; - uint16_t maxIntervalArgument; - maxIntervalArgument = 5U; - - ReturnErrorOnFailure( - cluster.SubscribeAttribute( - this, OnSuccessCallback_8, OnFailureCallback_8, minIntervalArgument, maxIntervalArgument, - OnSubscriptionEstablished_8, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_8(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_8(uint8_t value) - { - if (mTest_Test_TC_WNCV_3_2_OperationalStatus_Reported) - { - auto callback = mTest_Test_TC_WNCV_3_2_OperationalStatus_Reported; - mTest_Test_TC_WNCV_3_2_OperationalStatus_Reported = nullptr; - callback(this, value); - } - } - - void OnSubscriptionEstablishedResponse_8() - { - VerifyOrReturn(mReceivedReport_7, Exit("Initial report not received!")); - NextTest(); - } - - CHIP_ERROR Test2aThSendsDownOrCloseCommandToDut_9() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::WindowCovering::Commands::DownOrClose::Type; - - RequestType request; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_9(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_9(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_9(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_9() { NextTest(); } - - CHIP_ERROR Test2bDutUpdatesItsAttributes_10() - { - SetIdentity(kIdentityAlpha); - return WaitForMs(100); - } - - CHIP_ERROR Test2cIfPaLfThReadsTargetPositionLiftPercent100thsAttributeFromDut_11() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::WindowCoveringClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_11, OnFailureCallback_11, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_11(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_11(const chip::app::DataModel::Nullable & targetPositionLiftPercent100ths) - { - VerifyOrReturn(CheckValueNonNull("targetPositionLiftPercent100ths", targetPositionLiftPercent100ths)); - VerifyOrReturn(CheckValue("targetPositionLiftPercent100ths.Value()", targetPositionLiftPercent100ths.Value(), 10000U)); - - NextTest(); - } - - CHIP_ERROR Test2eThLeaveTheDeviceMovingFor2Seconds_12() - { - SetIdentity(kIdentityAlpha); - return WaitForMs(2000); - } - - CHIP_ERROR Test3aVerifyDutReportsOperationalStatusAttributeToThAfterADownOrClose_13() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::WindowCoveringClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - mTest_Test_TC_WNCV_3_2_OperationalStatus_Reported = OnSuccessCallback_13; - return CHIP_NO_ERROR; - } - - void OnFailureResponse_13(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_13(uint8_t operationalStatus) - { - mReceivedReport_13 = true; - VerifyOrReturn(CheckConstraintType("operationalStatus", "", "map8")); - VerifyOrReturn(CheckConstraintMinValue("operationalStatus", operationalStatus, 10)); - VerifyOrReturn(CheckConstraintMaxValue("operationalStatus", operationalStatus, 42)); - NextTest(); - } - - CHIP_ERROR Test3a2DutUpdatesItsAttributes_14() - { - SetIdentity(kIdentityAlpha); - return WaitForMs(2000); - } - - CHIP_ERROR Test3bIfPaLfThReadsCurrentPositionLiftPercent100thsAttributeFromDut_15() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::WindowCoveringClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_15, OnFailureCallback_15, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_15(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_15(const chip::app::DataModel::Nullable & currentPositionLiftPercent100ths) - { - VerifyOrReturn(CheckConstraintType("currentPositionLiftPercent100ths", "", "uint16")); - VerifyOrReturn(CheckConstraintMinValue("currentPositionLiftPercent100ths", currentPositionLiftPercent100ths, 1U)); - VerifyOrReturn(CheckConstraintMaxValue("currentPositionLiftPercent100ths", currentPositionLiftPercent100ths, 10000U)); - NextTest(); - } - - CHIP_ERROR Test3cIfPaLfThReadsCurrentPositionLiftPercentageOptionalAttributeFromDut_16() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::WindowCoveringClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_16, OnFailureCallback_16, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_16(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_16(const chip::app::DataModel::Nullable & currentPositionLiftPercentage) - { - VerifyOrReturn(CheckConstraintType("currentPositionLiftPercentage", "", "uint8")); - VerifyOrReturn(CheckConstraintMinValue("currentPositionLiftPercentage", currentPositionLiftPercentage, 1)); - VerifyOrReturn(CheckConstraintMaxValue("currentPositionLiftPercentage", currentPositionLiftPercentage, 100)); - NextTest(); - } - - CHIP_ERROR Test3dIfPaTlThReadsCurrentPositionTiltPercent100thsAttributeFromDut_17() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::WindowCoveringClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_17, OnFailureCallback_17, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_17(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_17(const chip::app::DataModel::Nullable & currentPositionTiltPercent100ths) - { - VerifyOrReturn(CheckConstraintType("currentPositionTiltPercent100ths", "", "uint16")); - VerifyOrReturn(CheckConstraintMinValue("currentPositionTiltPercent100ths", currentPositionTiltPercent100ths, 1U)); - VerifyOrReturn(CheckConstraintMaxValue("currentPositionTiltPercent100ths", currentPositionTiltPercent100ths, 10000U)); - NextTest(); - } - - CHIP_ERROR Test3eIfPaLfThReadsCurrentPositionTiltPercentageOptionalAttributeFromDut_18() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::WindowCoveringClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_18, OnFailureCallback_18, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_18(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_18(const chip::app::DataModel::Nullable & currentPositionTiltPercentage) - { - VerifyOrReturn(CheckConstraintType("currentPositionTiltPercentage", "", "uint8")); - VerifyOrReturn(CheckConstraintMinValue("currentPositionTiltPercentage", currentPositionTiltPercentage, 1)); - VerifyOrReturn(CheckConstraintMaxValue("currentPositionTiltPercentage", currentPositionTiltPercentage, 100)); - NextTest(); - } - - CHIP_ERROR Test4aThSendsAStopMotionCommandToDut_19() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::WindowCovering::Commands::StopMotion::Type; - - RequestType request; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_19(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_19(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_19(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_19() { NextTest(); } - - CHIP_ERROR Test4bThWaitsFor3SecondsTheEndOfInertialMovementsOnTheDevice_20() - { - SetIdentity(kIdentityAlpha); - return WaitForMs(3000); - } - - CHIP_ERROR Test4cVerifyDutUpdateOperationalStatusAttributeToThAfterAStopMotion_21() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::WindowCoveringClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_21, OnFailureCallback_21, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_21(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_21(uint8_t operationalStatus) - { - VerifyOrReturn(CheckValue("operationalStatus", operationalStatus, 0)); - - NextTest(); - } - - CHIP_ERROR Test5aThWaitsForXSecondsAttributesUpdateOnTheDevice_22() - { - SetIdentity(kIdentityAlpha); - return WaitForMs(1000); - } - - CHIP_ERROR Test5bIfPaLfThReadsTargetPositionLiftPercent100thsAttributeFromDut_23() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::WindowCoveringClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_23, OnFailureCallback_23, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_23(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_23(const chip::app::DataModel::Nullable & targetPositionLiftPercent100ths) - { - VerifyOrReturn(CheckConstraintType("targetPositionLiftPercent100ths", "", "uint16")); - VerifyOrReturn(CheckConstraintMinValue("targetPositionLiftPercent100ths", targetPositionLiftPercent100ths, 1U)); - VerifyOrReturn(CheckConstraintMaxValue("targetPositionLiftPercent100ths", targetPositionLiftPercent100ths, 10000U)); - NextTest(); - } - - CHIP_ERROR Test5cIfPaTlThReadsTargetPositionTiltPercent100thsAttributeFromDut_24() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::WindowCoveringClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_24, OnFailureCallback_24, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_24(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_24(const chip::app::DataModel::Nullable & targetPositionTiltPercent100ths) - { - VerifyOrReturn(CheckConstraintType("targetPositionTiltPercent100ths", "", "uint16")); - VerifyOrReturn(CheckConstraintMinValue("targetPositionTiltPercent100ths", targetPositionTiltPercent100ths, 1U)); - VerifyOrReturn(CheckConstraintMaxValue("targetPositionTiltPercent100ths", targetPositionTiltPercent100ths, 10000U)); - NextTest(); - } -}; - -class Test_TC_WNCV_3_3Suite : public TestCommand -{ -public: - Test_TC_WNCV_3_3Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_WNCV_3_3", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_WNCV_3_3Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_WNCV_3_3\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_WNCV_3_3\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : 0: Wait for the commissioned device to be retrieved\n"); - err = Test0WaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - case 1: - ChipLogProgress( - chipTool, - " ***** Test Step 1 : 1a: TH sends DownOrClose command to preposition the DUT in the opposite direction\n"); - err = Test1aThSendsDownOrCloseCommandToPrepositionTheDutInTheOppositeDirection_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : 1b: TH Waits for 6-8 seconds movement(s) on the device\n"); - err = Test1bThWaitsFor68SecondsMovementsOnTheDevice_2(); - break; - case 3: - ChipLogProgress( - chipTool, " ***** Test Step 3 : 1c: TH sends UpOrOpen command to preposition the DUT in the opposite direction\n"); - err = Test1cThSendsUpOrOpenCommandToPrepositionTheDutInTheOppositeDirection_3(); - break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : 1d: TH Waits for 2 seconds movement(s) on the device\n"); - err = Test1dThWaitsFor2SecondsMovementsOnTheDevice_4(); - break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Report: 2: Subscribe to DUT reports on OperationalStatus attribute\n"); - err = TestReport2SubscribeToDutReportsOnOperationalStatusAttribute_5(); - break; - case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : 2: Subscribe to DUT reports on OperationalStatus attribute\n"); - err = Test2SubscribeToDutReportsOnOperationalStatusAttribute_6(); - break; - case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : 2a: TH sends a StopMotion command to DUT\n"); - err = Test2aThSendsAStopMotionCommandToDut_7(); - break; - case 8: - ChipLogProgress(chipTool, - " ***** Test Step 8 : 2b: TH waits for 3 seconds the end of inertial movement(s) on the device\n"); - err = Test2bThWaitsFor3SecondsTheEndOfInertialMovementsOnTheDevice_8(); - break; - case 9: - ChipLogProgress(chipTool, - " ***** Test Step 9 : 2c: Verify DUT reports OperationalStatus attribute to TH after a StopMotion\n"); - err = Test2cVerifyDutReportsOperationalStatusAttributeToThAfterAStopMotion_9(); - break; - case 10: - ChipLogProgress(chipTool, " ***** Test Step 10 : 2d: TH waits for 100ms - 3s attributes update on the device\n"); - err = Test2dThWaitsFor100ms3sAttributesUpdateOnTheDevice_10(); - break; - case 11: - ChipLogProgress(chipTool, " ***** Test Step 11 : 2e: TH reads OperationalStatus attribute from DUT\n"); - err = Test2eThReadsOperationalStatusAttributeFromDut_11(); - break; - case 12: - ChipLogProgress( - chipTool, " ***** Test Step 12 : 3a: If (PA & LF) TH reads CurrentPositionLiftPercent100ths attribute from DUT\n"); - if (ShouldSkip("WNCV_LF && WNCV_PA_LF")) - { - NextTest(); - return; - } - err = Test3aIfPaLfThReadsCurrentPositionLiftPercent100thsAttributeFromDut_12(); - break; - case 13: - ChipLogProgress(chipTool, - " ***** Test Step 13 : 3b: If (PA & LF) TH reads TargetPositionLiftPercent100ths attribute 3c: it Must " - "be equal with CurrentPositionLiftPercent100ths from DUT\n"); - if (ShouldSkip("WNCV_LF && WNCV_PA_LF")) - { - NextTest(); - return; - } - err = - Test3bIfPaLfThReadsTargetPositionLiftPercent100thsAttribute3cItMustBeEqualWithCurrentPositionLiftPercent100thsFromDut_13(); - break; - case 14: - ChipLogProgress( - chipTool, " ***** Test Step 14 : 4a: If (PA & TL) TH reads CurrentPositionTiltPercent100ths attribute from DUT\n"); - if (ShouldSkip("WNCV_TL && WNCV_PA_TL")) - { - NextTest(); - return; - } - err = Test4aIfPaTlThReadsCurrentPositionTiltPercent100thsAttributeFromDut_14(); - break; - case 15: - ChipLogProgress(chipTool, - " ***** Test Step 15 : 4b: If (PA & TL) TH reads TargetPositionTiltPercent100ths attribute 4c: it Must " - "be equal with CurrentPositionTiltPercent100ths from DUT\n"); - if (ShouldSkip("WNCV_TL && WNCV_PA_TL")) - { - NextTest(); - return; - } - err = - Test4bIfPaTlThReadsTargetPositionTiltPercent100thsAttribute4cItMustBeEqualWithCurrentPositionTiltPercent100thsFromDut_15(); - break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 16; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - chip::app::DataModel::Nullable attrCurrentPositionLift; - chip::app::DataModel::Nullable attrCurrentPositionTilt; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 2: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 4: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 8: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 10: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - typedef void (*Test_Test_TC_WNCV_3_3_OperationalStatus_ReportCallback)(void * context, uint8_t value); - Test_Test_TC_WNCV_3_3_OperationalStatus_ReportCallback mTest_Test_TC_WNCV_3_3_OperationalStatus_Reported = nullptr; - - static void OnFailureCallback_5(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_5(error); - } - - static void OnSuccessCallback_5(void * context, uint8_t operationalStatus) - { - (static_cast(context))->OnSuccessResponse_5(operationalStatus); - } - - bool mReceivedReport_5 = false; - - static void OnFailureCallback_6(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_6(error); - } - - static void OnSuccessCallback_6(void * context, uint8_t operationalStatus) - { - (static_cast(context))->OnSuccessResponse_6(operationalStatus); - } - - static void OnSubscriptionEstablished_6(void * context) - { - (static_cast(context))->OnSubscriptionEstablishedResponse_6(); - } - - static void OnFailureCallback_9(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_9(error); - } - - static void OnSuccessCallback_9(void * context, uint8_t operationalStatus) - { - (static_cast(context))->OnSuccessResponse_9(operationalStatus); - } - - bool mReceivedReport_9 = false; - - static void OnFailureCallback_11(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_11(error); - } - - static void OnSuccessCallback_11(void * context, uint8_t operationalStatus) - { - (static_cast(context))->OnSuccessResponse_11(operationalStatus); - } - - static void OnFailureCallback_12(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_12(error); - } - - static void OnSuccessCallback_12(void * context, - const chip::app::DataModel::Nullable & currentPositionLiftPercent100ths) - { - (static_cast(context))->OnSuccessResponse_12(currentPositionLiftPercent100ths); - } - - static void OnFailureCallback_13(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_13(error); - } - - static void OnSuccessCallback_13(void * context, - const chip::app::DataModel::Nullable & targetPositionLiftPercent100ths) - { - (static_cast(context))->OnSuccessResponse_13(targetPositionLiftPercent100ths); - } - - static void OnFailureCallback_14(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_14(error); - } - - static void OnSuccessCallback_14(void * context, - const chip::app::DataModel::Nullable & currentPositionTiltPercent100ths) - { - (static_cast(context))->OnSuccessResponse_14(currentPositionTiltPercent100ths); - } - - static void OnFailureCallback_15(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_15(error); - } - - static void OnSuccessCallback_15(void * context, - const chip::app::DataModel::Nullable & targetPositionTiltPercent100ths) - { - (static_cast(context))->OnSuccessResponse_15(targetPositionTiltPercent100ths); - } - - // - // Tests methods - // - - CHIP_ERROR Test0WaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR Test1aThSendsDownOrCloseCommandToPrepositionTheDutInTheOppositeDirection_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::WindowCovering::Commands::DownOrClose::Type; - - RequestType request; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_1(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_1(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_1() { NextTest(); } - - CHIP_ERROR Test1bThWaitsFor68SecondsMovementsOnTheDevice_2() - { - SetIdentity(kIdentityAlpha); - return WaitForMs(6000); - } - - CHIP_ERROR Test1cThSendsUpOrOpenCommandToPrepositionTheDutInTheOppositeDirection_3() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::WindowCovering::Commands::UpOrOpen::Type; - - RequestType request; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_3(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_3(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_3(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_3() { NextTest(); } - - CHIP_ERROR Test1dThWaitsFor2SecondsMovementsOnTheDevice_4() - { - SetIdentity(kIdentityAlpha); - return WaitForMs(2000); - } - - CHIP_ERROR TestReport2SubscribeToDutReportsOnOperationalStatusAttribute_5() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::WindowCoveringClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - mTest_Test_TC_WNCV_3_3_OperationalStatus_Reported = OnSuccessCallback_5; - return WaitForMs(0); - } - - void OnFailureResponse_5(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_5(uint8_t operationalStatus) - { - mReceivedReport_5 = true; - VerifyOrReturn(CheckConstraintType("operationalStatus", "", "map8")); - } - - CHIP_ERROR Test2SubscribeToDutReportsOnOperationalStatusAttribute_6() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::WindowCoveringClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - uint16_t minIntervalArgument; - minIntervalArgument = 4U; - uint16_t maxIntervalArgument; - maxIntervalArgument = 5U; - - ReturnErrorOnFailure( - cluster.SubscribeAttribute( - this, OnSuccessCallback_6, OnFailureCallback_6, minIntervalArgument, maxIntervalArgument, - OnSubscriptionEstablished_6, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_6(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_6(uint8_t value) - { - if (mTest_Test_TC_WNCV_3_3_OperationalStatus_Reported) - { - auto callback = mTest_Test_TC_WNCV_3_3_OperationalStatus_Reported; - mTest_Test_TC_WNCV_3_3_OperationalStatus_Reported = nullptr; - callback(this, value); - } - } - - void OnSubscriptionEstablishedResponse_6() - { - VerifyOrReturn(mReceivedReport_5, Exit("Initial report not received!")); - NextTest(); - } - - CHIP_ERROR Test2aThSendsAStopMotionCommandToDut_7() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::WindowCovering::Commands::StopMotion::Type; - - RequestType request; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_7(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_7(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_7(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_7() { NextTest(); } - - CHIP_ERROR Test2bThWaitsFor3SecondsTheEndOfInertialMovementsOnTheDevice_8() - { - SetIdentity(kIdentityAlpha); - return WaitForMs(3000); - } - - CHIP_ERROR Test2cVerifyDutReportsOperationalStatusAttributeToThAfterAStopMotion_9() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::WindowCoveringClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - mTest_Test_TC_WNCV_3_3_OperationalStatus_Reported = OnSuccessCallback_9; - return CHIP_NO_ERROR; - } - - void OnFailureResponse_9(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_9(uint8_t operationalStatus) - { - mReceivedReport_9 = true; - VerifyOrReturn(CheckValue("operationalStatus", operationalStatus, 0)); - - NextTest(); - } - - CHIP_ERROR Test2dThWaitsFor100ms3sAttributesUpdateOnTheDevice_10() - { - SetIdentity(kIdentityAlpha); - return WaitForMs(2000); - } - - CHIP_ERROR Test2eThReadsOperationalStatusAttributeFromDut_11() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::WindowCoveringClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_11, OnFailureCallback_11, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_11(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_11(uint8_t operationalStatus) - { - VerifyOrReturn(CheckValue("operationalStatus", operationalStatus, 0)); - - NextTest(); - } - - CHIP_ERROR Test3aIfPaLfThReadsCurrentPositionLiftPercent100thsAttributeFromDut_12() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::WindowCoveringClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_12, OnFailureCallback_12, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_12(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_12(const chip::app::DataModel::Nullable & currentPositionLiftPercent100ths) - { - VerifyOrReturn(CheckConstraintMinValue("currentPositionLiftPercent100ths", currentPositionLiftPercent100ths, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("currentPositionLiftPercent100ths", currentPositionLiftPercent100ths, 10000U)); - attrCurrentPositionLift = currentPositionLiftPercent100ths; - NextTest(); - } - - CHIP_ERROR - Test3bIfPaLfThReadsTargetPositionLiftPercent100thsAttribute3cItMustBeEqualWithCurrentPositionLiftPercent100thsFromDut_13() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::WindowCoveringClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_13, OnFailureCallback_13, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_13(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_13(const chip::app::DataModel::Nullable & targetPositionLiftPercent100ths) - { - if (attrCurrentPositionLift.IsNull()) - { - VerifyOrReturn(CheckValueNull("targetPositionLiftPercent100ths", targetPositionLiftPercent100ths)); - } - else - { - VerifyOrReturn(CheckValueNonNull("targetPositionLiftPercent100ths", targetPositionLiftPercent100ths)); - VerifyOrReturn(CheckValue("targetPositionLiftPercent100ths.Value()", targetPositionLiftPercent100ths.Value(), - attrCurrentPositionLift.Value())); - } - - NextTest(); - } - - CHIP_ERROR Test4aIfPaTlThReadsCurrentPositionTiltPercent100thsAttributeFromDut_14() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::WindowCoveringClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_14, OnFailureCallback_14, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_14(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_14(const chip::app::DataModel::Nullable & currentPositionTiltPercent100ths) - { - VerifyOrReturn(CheckConstraintMinValue("currentPositionTiltPercent100ths", currentPositionTiltPercent100ths, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("currentPositionTiltPercent100ths", currentPositionTiltPercent100ths, 10000U)); - attrCurrentPositionTilt = currentPositionTiltPercent100ths; - NextTest(); - } - - CHIP_ERROR - Test4bIfPaTlThReadsTargetPositionTiltPercent100thsAttribute4cItMustBeEqualWithCurrentPositionTiltPercent100thsFromDut_15() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::WindowCoveringClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_15, OnFailureCallback_15, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_15(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_15(const chip::app::DataModel::Nullable & targetPositionTiltPercent100ths) - { - if (attrCurrentPositionTilt.IsNull()) - { - VerifyOrReturn(CheckValueNull("targetPositionTiltPercent100ths", targetPositionTiltPercent100ths)); - } - else - { - VerifyOrReturn(CheckValueNonNull("targetPositionTiltPercent100ths", targetPositionTiltPercent100ths)); - VerifyOrReturn(CheckValue("targetPositionTiltPercent100ths.Value()", targetPositionTiltPercent100ths.Value(), - attrCurrentPositionTilt.Value())); - } - - NextTest(); - } -}; - -class Test_TC_WNCV_3_4Suite : public TestCommand -{ -public: - Test_TC_WNCV_3_4Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_WNCV_3_4", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("fastMotionDuration", 0, UINT16_MAX, &mFastMotionDuration); - AddArgument("fullMotionDuration", 0, UINT16_MAX, &mFullMotionDuration); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_WNCV_3_4Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_WNCV_3_4\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_WNCV_3_4\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : 0: Wait for the commissioned device to be retrieved\n"); - err = Test0WaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - case 1: - ChipLogProgress( - chipTool, - " ***** Test Step 1 : 1a: TH sends DownOrClose command to preposition the DUT in the opposite direction\n"); - err = Test1aThSendsDownOrCloseCommandToPrepositionTheDutInTheOppositeDirection_1(); - break; - case 2: - ChipLogProgress(chipTool, - " ***** Test Step 2 : 1b: TH Waits for fastMotionDuration seconds movement(s) on the device\n"); - err = Test1bThWaitsForFastMotionDurationSecondsMovementsOnTheDevice_2(); - break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : 2a: TH sends UpOrOpen command to DUT\n"); - err = Test2aThSendsUpOrOpenCommandToDut_3(); - break; - case 4: - ChipLogProgress(chipTool, - " ***** Test Step 4 : 2b: TH Waits for fullMotionDuration seconds movement(s) on the device\n"); - err = Test2bThWaitsForFullMotionDurationSecondsMovementsOnTheDevice_4(); - break; - case 5: - ChipLogProgress(chipTool, - " ***** Test Step 5 : 3a: If (PA & LF) TH reads CurrentPositionLiftPercent100ths attribute from DUT\n"); - if (ShouldSkip("WNCV_LF && WNCV_PA_LF")) - { - NextTest(); - return; - } - err = Test3aIfPaLfThReadsCurrentPositionLiftPercent100thsAttributeFromDut_5(); - break; - case 6: - ChipLogProgress( - chipTool, - " ***** Test Step 6 : 3b: If (PA & LF) TH reads CurrentPositionLiftPercentage optional attribute from DUT\n"); - if (ShouldSkip("WNCV_LF && WNCV_PA_LF && A_CURRENTPOSITIONLIFTPERCENTAGE")) - { - NextTest(); - return; - } - err = Test3bIfPaLfThReadsCurrentPositionLiftPercentageOptionalAttributeFromDut_6(); - break; - case 7: - ChipLogProgress(chipTool, - " ***** Test Step 7 : 3c: If (PA & TL) TH reads CurrentPositionTiltPercent100ths attribute from DUT\n"); - if (ShouldSkip("WNCV_TL && WNCV_PA_TL")) - { - NextTest(); - return; - } - err = Test3cIfPaTlThReadsCurrentPositionTiltPercent100thsAttributeFromDut_7(); - break; - case 8: - ChipLogProgress( - chipTool, - " ***** Test Step 8 : 3d: If (PA & TL) TH reads CurrentPositionTiltPercentage optional attribute from DUT\n"); - if (ShouldSkip("WNCV_TL && WNCV_PA_TL && A_CURRENTPOSITIONLIFTPERCENTAGE")) - { - NextTest(); - return; - } - err = Test3dIfPaTlThReadsCurrentPositionTiltPercentageOptionalAttributeFromDut_8(); - break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 9; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mFastMotionDuration; - chip::Optional mFullMotionDuration; - chip::Optional mTimeout; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 2: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 4: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - static void OnFailureCallback_5(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_5(error); - } - - static void OnSuccessCallback_5(void * context, - const chip::app::DataModel::Nullable & currentPositionLiftPercent100ths) - { - (static_cast(context))->OnSuccessResponse_5(currentPositionLiftPercent100ths); - } - - static void OnFailureCallback_6(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_6(error); - } - - static void OnSuccessCallback_6(void * context, - const chip::app::DataModel::Nullable & currentPositionLiftPercentage) - { - (static_cast(context))->OnSuccessResponse_6(currentPositionLiftPercentage); - } - - static void OnFailureCallback_7(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_7(error); - } - - static void OnSuccessCallback_7(void * context, - const chip::app::DataModel::Nullable & currentPositionTiltPercent100ths) - { - (static_cast(context))->OnSuccessResponse_7(currentPositionTiltPercent100ths); - } - - static void OnFailureCallback_8(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_8(error); - } - - static void OnSuccessCallback_8(void * context, - const chip::app::DataModel::Nullable & currentPositionTiltPercentage) - { - (static_cast(context))->OnSuccessResponse_8(currentPositionTiltPercentage); - } - - // - // Tests methods - // - - CHIP_ERROR Test0WaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR Test1aThSendsDownOrCloseCommandToPrepositionTheDutInTheOppositeDirection_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::WindowCovering::Commands::DownOrClose::Type; - - RequestType request; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_1(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_1(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_1() { NextTest(); } - - CHIP_ERROR Test1bThWaitsForFastMotionDurationSecondsMovementsOnTheDevice_2() - { - SetIdentity(kIdentityAlpha); - return WaitForMs(mFastMotionDuration.HasValue() ? mFastMotionDuration.Value() : 3000U); - } - - CHIP_ERROR Test2aThSendsUpOrOpenCommandToDut_3() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::WindowCovering::Commands::UpOrOpen::Type; - - RequestType request; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_3(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_3(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_3(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_3() { NextTest(); } - - CHIP_ERROR Test2bThWaitsForFullMotionDurationSecondsMovementsOnTheDevice_4() - { - SetIdentity(kIdentityAlpha); - return WaitForMs(mFullMotionDuration.HasValue() ? mFullMotionDuration.Value() : 6000U); - } - - CHIP_ERROR Test3aIfPaLfThReadsCurrentPositionLiftPercent100thsAttributeFromDut_5() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::WindowCoveringClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_5, OnFailureCallback_5, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_5(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_5(const chip::app::DataModel::Nullable & currentPositionLiftPercent100ths) - { - VerifyOrReturn(CheckValueNonNull("currentPositionLiftPercent100ths", currentPositionLiftPercent100ths)); - VerifyOrReturn(CheckValue("currentPositionLiftPercent100ths.Value()", currentPositionLiftPercent100ths.Value(), 0U)); - - NextTest(); - } - - CHIP_ERROR Test3bIfPaLfThReadsCurrentPositionLiftPercentageOptionalAttributeFromDut_6() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::WindowCoveringClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_6, OnFailureCallback_6, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_6(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_6(const chip::app::DataModel::Nullable & currentPositionLiftPercentage) - { - VerifyOrReturn(CheckValueNonNull("currentPositionLiftPercentage", currentPositionLiftPercentage)); - VerifyOrReturn(CheckValue("currentPositionLiftPercentage.Value()", currentPositionLiftPercentage.Value(), 0)); - - NextTest(); - } - - CHIP_ERROR Test3cIfPaTlThReadsCurrentPositionTiltPercent100thsAttributeFromDut_7() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::WindowCoveringClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_7, OnFailureCallback_7, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_7(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_7(const chip::app::DataModel::Nullable & currentPositionTiltPercent100ths) - { - VerifyOrReturn(CheckValueNonNull("currentPositionTiltPercent100ths", currentPositionTiltPercent100ths)); - VerifyOrReturn(CheckValue("currentPositionTiltPercent100ths.Value()", currentPositionTiltPercent100ths.Value(), 0U)); - - NextTest(); - } - - CHIP_ERROR Test3dIfPaTlThReadsCurrentPositionTiltPercentageOptionalAttributeFromDut_8() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::WindowCoveringClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_8, OnFailureCallback_8, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_8(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_8(const chip::app::DataModel::Nullable & currentPositionTiltPercentage) - { - VerifyOrReturn(CheckValueNonNull("currentPositionTiltPercentage", currentPositionTiltPercentage)); - VerifyOrReturn(CheckValue("currentPositionTiltPercentage.Value()", currentPositionTiltPercentage.Value(), 0)); - - NextTest(); - } -}; - -class Test_TC_WNCV_3_5Suite : public TestCommand -{ -public: - Test_TC_WNCV_3_5Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_WNCV_3_5", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("fastMotionDuration", 0, UINT16_MAX, &mFastMotionDuration); - AddArgument("fullMotionDuration", 0, UINT16_MAX, &mFullMotionDuration); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_WNCV_3_5Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_WNCV_3_5\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_WNCV_3_5\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : 0: Wait for the commissioned device to be retrieved\n"); - err = Test0WaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - case 1: - ChipLogProgress( - chipTool, " ***** Test Step 1 : 1a: TH sends UpOrOpen command to preposition the DUT in the opposite direction\n"); - err = Test1aThSendsUpOrOpenCommandToPrepositionTheDutInTheOppositeDirection_1(); - break; - case 2: - ChipLogProgress(chipTool, - " ***** Test Step 2 : 1b: TH Waits for fastMotionDuration seconds movement(s) on the device\n"); - err = Test1bThWaitsForFastMotionDurationSecondsMovementsOnTheDevice_2(); - break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : 2a: TH sends DownOrClose command to DUT\n"); - err = Test2aThSendsDownOrCloseCommandToDut_3(); - break; - case 4: - ChipLogProgress(chipTool, - " ***** Test Step 4 : 2b: TH Waits for fullMotionDuration seconds movement(s) on the device\n"); - err = Test2bThWaitsForFullMotionDurationSecondsMovementsOnTheDevice_4(); - break; - case 5: - ChipLogProgress(chipTool, - " ***** Test Step 5 : 3a: If (PA & LF) TH reads CurrentPositionLiftPercent100ths attribute from DUT\n"); - if (ShouldSkip("WNCV_LF && WNCV_PA_LF")) - { - NextTest(); - return; - } - err = Test3aIfPaLfThReadsCurrentPositionLiftPercent100thsAttributeFromDut_5(); - break; - case 6: - ChipLogProgress( - chipTool, - " ***** Test Step 6 : 3b: If (PA & LF) TH reads CurrentPositionLiftPercentage optional attribute from DUT\n"); - if (ShouldSkip("WNCV_LF && WNCV_PA_LF && A_CURRENTPOSITIONLIFTPERCENTAGE")) - { - NextTest(); - return; - } - err = Test3bIfPaLfThReadsCurrentPositionLiftPercentageOptionalAttributeFromDut_6(); - break; - case 7: - ChipLogProgress(chipTool, - " ***** Test Step 7 : 3c: If (PA & TL) TH reads CurrentPositionTiltPercent100ths attribute from DUT\n"); - if (ShouldSkip("WNCV_TL && WNCV_PA_TL")) - { - NextTest(); - return; - } - err = Test3cIfPaTlThReadsCurrentPositionTiltPercent100thsAttributeFromDut_7(); - break; - case 8: - ChipLogProgress( - chipTool, - " ***** Test Step 8 : 3d: If (PA & TL) TH reads CurrentPositionTiltPercentage optional attribute from DUT\n"); - if (ShouldSkip("WNCV_TL && WNCV_PA_TL && A_CURRENTPOSITIONLIFTPERCENTAGE")) - { - NextTest(); - return; - } - err = Test3dIfPaTlThReadsCurrentPositionTiltPercentageOptionalAttributeFromDut_8(); - break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 9; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mFastMotionDuration; - chip::Optional mFullMotionDuration; - chip::Optional mTimeout; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 2: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 4: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - static void OnFailureCallback_5(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_5(error); - } - - static void OnSuccessCallback_5(void * context, - const chip::app::DataModel::Nullable & currentPositionLiftPercent100ths) - { - (static_cast(context))->OnSuccessResponse_5(currentPositionLiftPercent100ths); - } - - static void OnFailureCallback_6(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_6(error); - } - - static void OnSuccessCallback_6(void * context, - const chip::app::DataModel::Nullable & currentPositionLiftPercentage) - { - (static_cast(context))->OnSuccessResponse_6(currentPositionLiftPercentage); - } - - static void OnFailureCallback_7(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_7(error); - } - - static void OnSuccessCallback_7(void * context, - const chip::app::DataModel::Nullable & currentPositionTiltPercent100ths) - { - (static_cast(context))->OnSuccessResponse_7(currentPositionTiltPercent100ths); - } - - static void OnFailureCallback_8(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_8(error); - } - - static void OnSuccessCallback_8(void * context, - const chip::app::DataModel::Nullable & currentPositionTiltPercentage) - { - (static_cast(context))->OnSuccessResponse_8(currentPositionTiltPercentage); - } - - // - // Tests methods - // - - CHIP_ERROR Test0WaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR Test1aThSendsUpOrOpenCommandToPrepositionTheDutInTheOppositeDirection_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::WindowCovering::Commands::UpOrOpen::Type; - - RequestType request; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_1(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_1(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_1() { NextTest(); } - - CHIP_ERROR Test1bThWaitsForFastMotionDurationSecondsMovementsOnTheDevice_2() - { - SetIdentity(kIdentityAlpha); - return WaitForMs(mFastMotionDuration.HasValue() ? mFastMotionDuration.Value() : 3000U); - } - - CHIP_ERROR Test2aThSendsDownOrCloseCommandToDut_3() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::WindowCovering::Commands::DownOrClose::Type; - - RequestType request; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_3(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_3(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_3(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_3() { NextTest(); } - - CHIP_ERROR Test2bThWaitsForFullMotionDurationSecondsMovementsOnTheDevice_4() - { - SetIdentity(kIdentityAlpha); - return WaitForMs(mFullMotionDuration.HasValue() ? mFullMotionDuration.Value() : 6000U); - } - - CHIP_ERROR Test3aIfPaLfThReadsCurrentPositionLiftPercent100thsAttributeFromDut_5() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::WindowCoveringClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_5, OnFailureCallback_5, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_5(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_5(const chip::app::DataModel::Nullable & currentPositionLiftPercent100ths) - { - VerifyOrReturn(CheckValueNonNull("currentPositionLiftPercent100ths", currentPositionLiftPercent100ths)); - VerifyOrReturn(CheckValue("currentPositionLiftPercent100ths.Value()", currentPositionLiftPercent100ths.Value(), 10000U)); - - NextTest(); - } - - CHIP_ERROR Test3bIfPaLfThReadsCurrentPositionLiftPercentageOptionalAttributeFromDut_6() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::WindowCoveringClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_6, OnFailureCallback_6, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_6(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_6(const chip::app::DataModel::Nullable & currentPositionLiftPercentage) - { - VerifyOrReturn(CheckValueNonNull("currentPositionLiftPercentage", currentPositionLiftPercentage)); - VerifyOrReturn(CheckValue("currentPositionLiftPercentage.Value()", currentPositionLiftPercentage.Value(), 100)); - - NextTest(); - } - - CHIP_ERROR Test3cIfPaTlThReadsCurrentPositionTiltPercent100thsAttributeFromDut_7() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::WindowCoveringClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_7, OnFailureCallback_7, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_7(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_7(const chip::app::DataModel::Nullable & currentPositionTiltPercent100ths) - { - VerifyOrReturn(CheckValueNonNull("currentPositionTiltPercent100ths", currentPositionTiltPercent100ths)); - VerifyOrReturn(CheckValue("currentPositionTiltPercent100ths.Value()", currentPositionTiltPercent100ths.Value(), 10000U)); - - NextTest(); - } - - CHIP_ERROR Test3dIfPaTlThReadsCurrentPositionTiltPercentageOptionalAttributeFromDut_8() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::WindowCoveringClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_8, OnFailureCallback_8, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_8(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_8(const chip::app::DataModel::Nullable & currentPositionTiltPercentage) - { - VerifyOrReturn(CheckValueNonNull("currentPositionTiltPercentage", currentPositionTiltPercentage)); - VerifyOrReturn(CheckValue("currentPositionTiltPercentage.Value()", currentPositionTiltPercentage.Value(), 100)); - - NextTest(); - } -}; - -class Test_TC_WNCV_4_1Suite : public TestCommand -{ -public: - Test_TC_WNCV_4_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_WNCV_4_1", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("fullMotionDuration", 0, UINT16_MAX, &mFullMotionDuration); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_WNCV_4_1Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_WNCV_4_1\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_WNCV_4_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : 0: Wait for the commissioned device to be retrieved\n"); - err = Test0WaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - case 1: - ChipLogProgress( - chipTool, - " ***** Test Step 1 : 1a: TH sends DownOrClose command to preposition the DUT in the opposite direction\n"); - err = Test1aThSendsDownOrCloseCommandToPrepositionTheDutInTheOppositeDirection_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : 1b: TH waits for x seconds movement(s) on the DUT\n"); - err = Test1bThWaitsForXSecondsMovementsOnTheDut_2(); - break; - case 3: - ChipLogProgress(chipTool, - " ***** Test Step 3 : 1c: If (PA & LF) TH reads CurrentPositionLiftPercent100ths attribute from DUT\n"); - if (ShouldSkip("WNCV_PA_LF && WNCV_LF")) - { - NextTest(); - return; - } - err = Test1cIfPaLfThReadsCurrentPositionLiftPercent100thsAttributeFromDut_3(); - break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : 2a: TH sends GoToLiftPercentage command with 25 percent to DUT\n"); - if (ShouldSkip("WNCV_LF && CR_GOTOLIFTPERCENTAGE")) - { - NextTest(); - return; - } - err = Test2aThSendsGoToLiftPercentageCommandWith25PercentToDut_4(); - break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : 2b: DUT updates its attributes\n"); - err = Test2bDutUpdatesItsAttributes_5(); - break; - case 6: - ChipLogProgress(chipTool, - " ***** Test Step 6 : 2c: If (PA & LF) TH reads TargetPositionLiftPercent100ths attribute from DUT\n"); - if (ShouldSkip("WNCV_PA_LF && WNCV_LF")) - { - NextTest(); - return; - } - err = Test2cIfPaLfThReadsTargetPositionLiftPercent100thsAttributeFromDut_6(); - break; - case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : 3a: TH set a timeout of X minutes for failure\n"); - err = Test3aThSetATimeoutOfXMinutesForFailure_7(); - break; - case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : 3b: TH reads OperationalStatus attribute from DUT\n"); - err = Test3bThReadsOperationalStatusAttributeFromDut_8(); - break; - case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : 4a: TH sends GoToLiftPercentage command with 75.20 percent to DUT\n"); - if (ShouldSkip("WNCV_LF && CR_GOTOLIFTPERCENTAGE")) - { - NextTest(); - return; - } - err = Test4aThSendsGoToLiftPercentageCommandWith7520PercentToDut_9(); - break; - case 10: - ChipLogProgress(chipTool, " ***** Test Step 10 : 4b: DUT updates its attributes\n"); - err = Test4bDutUpdatesItsAttributes_10(); - break; - case 11: - ChipLogProgress(chipTool, " ***** Test Step 11 : 5a: TH waits for x seconds movement(s) on the DUT\n"); - err = Test5aThWaitsForXSecondsMovementsOnTheDut_11(); - break; - case 12: - ChipLogProgress(chipTool, " ***** Test Step 12 : 5b: TH reads OperationalStatus attribute from DUT\n"); - err = Test5bThReadsOperationalStatusAttributeFromDut_12(); - break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 13; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mFullMotionDuration; - chip::Optional mTimeout; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 2: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 5: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 7: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 10: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 11: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - static void OnFailureCallback_3(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_3(error); - } - - static void OnSuccessCallback_3(void * context, - const chip::app::DataModel::Nullable & currentPositionLiftPercent100ths) - { - (static_cast(context))->OnSuccessResponse_3(currentPositionLiftPercent100ths); - } - - static void OnFailureCallback_6(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_6(error); - } - - static void OnSuccessCallback_6(void * context, - const chip::app::DataModel::Nullable & targetPositionLiftPercent100ths) - { - (static_cast(context))->OnSuccessResponse_6(targetPositionLiftPercent100ths); - } - - static void OnFailureCallback_8(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_8(error); - } - - static void OnSuccessCallback_8(void * context, uint8_t operationalStatus) - { - (static_cast(context))->OnSuccessResponse_8(operationalStatus); - } - - static void OnFailureCallback_12(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_12(error); - } - - static void OnSuccessCallback_12(void * context, uint8_t operationalStatus) - { - (static_cast(context))->OnSuccessResponse_12(operationalStatus); - } - - // - // Tests methods - // - - CHIP_ERROR Test0WaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR Test1aThSendsDownOrCloseCommandToPrepositionTheDutInTheOppositeDirection_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::WindowCovering::Commands::DownOrClose::Type; - - RequestType request; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_1(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_1(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_1() { NextTest(); } - - CHIP_ERROR Test1bThWaitsForXSecondsMovementsOnTheDut_2() - { - SetIdentity(kIdentityAlpha); - return WaitForMs(mFullMotionDuration.HasValue() ? mFullMotionDuration.Value() : 6000U); - } - - CHIP_ERROR Test1cIfPaLfThReadsCurrentPositionLiftPercent100thsAttributeFromDut_3() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::WindowCoveringClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_3, OnFailureCallback_3, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_3(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_3(const chip::app::DataModel::Nullable & currentPositionLiftPercent100ths) - { - VerifyOrReturn(CheckConstraintNotValue("currentPositionLiftPercent100ths", currentPositionLiftPercent100ths, 0U)); - - NextTest(); - } - - CHIP_ERROR Test2aThSendsGoToLiftPercentageCommandWith25PercentToDut_4() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::WindowCovering::Commands::GoToLiftPercentage::Type; - - RequestType request; - request.liftPercentageValue = 25; - request.liftPercent100thsValue.Emplace(); - request.liftPercent100thsValue.Value() = 2500U; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_4(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_4(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_4(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_4() { NextTest(); } - - CHIP_ERROR Test2bDutUpdatesItsAttributes_5() - { - SetIdentity(kIdentityAlpha); - return WaitForMs(100); - } - - CHIP_ERROR Test2cIfPaLfThReadsTargetPositionLiftPercent100thsAttributeFromDut_6() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::WindowCoveringClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_6, OnFailureCallback_6, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_6(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_6(const chip::app::DataModel::Nullable & targetPositionLiftPercent100ths) - { - VerifyOrReturn(CheckValueNonNull("targetPositionLiftPercent100ths", targetPositionLiftPercent100ths)); - VerifyOrReturn(CheckValue("targetPositionLiftPercent100ths.Value()", targetPositionLiftPercent100ths.Value(), 2500U)); - - NextTest(); - } - - CHIP_ERROR Test3aThSetATimeoutOfXMinutesForFailure_7() - { - SetIdentity(kIdentityAlpha); - return WaitForMs(mFullMotionDuration.HasValue() ? mFullMotionDuration.Value() : 6000U); - } - - CHIP_ERROR Test3bThReadsOperationalStatusAttributeFromDut_8() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::WindowCoveringClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_8, OnFailureCallback_8, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_8(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_8(uint8_t operationalStatus) - { - VerifyOrReturn(CheckValue("operationalStatus", operationalStatus, 0)); - - NextTest(); - } - - CHIP_ERROR Test4aThSendsGoToLiftPercentageCommandWith7520PercentToDut_9() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::WindowCovering::Commands::GoToLiftPercentage::Type; - - RequestType request; - request.liftPercentageValue = 75; - request.liftPercent100thsValue.Emplace(); - request.liftPercent100thsValue.Value() = 7520U; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_9(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_9(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_9(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_9() { NextTest(); } - - CHIP_ERROR Test4bDutUpdatesItsAttributes_10() - { - SetIdentity(kIdentityAlpha); - return WaitForMs(100); - } - - CHIP_ERROR Test5aThWaitsForXSecondsMovementsOnTheDut_11() - { - SetIdentity(kIdentityAlpha); - return WaitForMs(mFullMotionDuration.HasValue() ? mFullMotionDuration.Value() : 6000U); - } - - CHIP_ERROR Test5bThReadsOperationalStatusAttributeFromDut_12() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::WindowCoveringClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_12, OnFailureCallback_12, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_12(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_12(uint8_t operationalStatus) - { - VerifyOrReturn(CheckValue("operationalStatus", operationalStatus, 0)); - - NextTest(); - } -}; - -class Test_TC_WNCV_4_2Suite : public TestCommand -{ -public: - Test_TC_WNCV_4_2Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_WNCV_4_2", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("fullMotionDuration", 0, UINT16_MAX, &mFullMotionDuration); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_WNCV_4_2Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_WNCV_4_2\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_WNCV_4_2\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : 0: Wait for the commissioned device to be retrieved\n"); - err = Test0WaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - case 1: - ChipLogProgress( - chipTool, - " ***** Test Step 1 : 1a: TH sends DownOrClose command to preposition the DUT in the opposite direction\n"); - err = Test1aThSendsDownOrCloseCommandToPrepositionTheDutInTheOppositeDirection_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : 1b: TH waits for x seconds movement(s) on the DUT\n"); - err = Test1bThWaitsForXSecondsMovementsOnTheDut_2(); - break; - case 3: - ChipLogProgress(chipTool, - " ***** Test Step 3 : 1c: If (PA & TL) TH reads CurrentPositionTiltPercent100ths attribute from DUT\n"); - if (ShouldSkip("WNCV_PA_TL && WNCV_TL")) - { - NextTest(); - return; - } - err = Test1cIfPaTlThReadsCurrentPositionTiltPercent100thsAttributeFromDut_3(); - break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : 2a: TH sends GoToTiltPercentage command with 30 percent to DUT\n"); - if (ShouldSkip("WNCV_TL && CR_GOTOTILTPERCENTAGE")) - { - NextTest(); - return; - } - err = Test2aThSendsGoToTiltPercentageCommandWith30PercentToDut_4(); - break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : 2b: DUT updates its attributes\n"); - err = Test2bDutUpdatesItsAttributes_5(); - break; - case 6: - ChipLogProgress(chipTool, - " ***** Test Step 6 : 2c: If (PA & TL) TH reads TargetPositionTiltPercent100ths attribute from DUT\n"); - if (ShouldSkip("WNCV_PA_TL && WNCV_TL")) - { - NextTest(); - return; - } - err = Test2cIfPaTlThReadsTargetPositionTiltPercent100thsAttributeFromDut_6(); - break; - case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : 3a: TH set a timeout of X minutes for failure\n"); - err = Test3aThSetATimeoutOfXMinutesForFailure_7(); - break; - case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : 3b: TH reads OperationalStatus attribute from DUT\n"); - err = Test3bThReadsOperationalStatusAttributeFromDut_8(); - break; - case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : 4a: TH sends GoToTiltPercentage command with 60.20 percent to DUT\n"); - if (ShouldSkip("WNCV_TL && CR_GOTOTILTPERCENTAGE")) - { - NextTest(); - return; - } - err = Test4aThSendsGoToTiltPercentageCommandWith6020PercentToDut_9(); - break; - case 10: - ChipLogProgress(chipTool, " ***** Test Step 10 : 4b: DUT updates its attributes\n"); - err = Test4bDutUpdatesItsAttributes_10(); - break; - case 11: - ChipLogProgress(chipTool, " ***** Test Step 11 : 5a: TH waits for x seconds movement(s) on the DUT\n"); - err = Test5aThWaitsForXSecondsMovementsOnTheDut_11(); - break; - case 12: - ChipLogProgress(chipTool, " ***** Test Step 12 : 5b: TH reads OperationalStatus attribute from DUT\n"); - err = Test5bThReadsOperationalStatusAttributeFromDut_12(); - break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 13; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mFullMotionDuration; - chip::Optional mTimeout; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 2: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 5: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 7: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 10: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 11: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - static void OnFailureCallback_3(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_3(error); - } - - static void OnSuccessCallback_3(void * context, - const chip::app::DataModel::Nullable & currentPositionTiltPercent100ths) - { - (static_cast(context))->OnSuccessResponse_3(currentPositionTiltPercent100ths); - } - - static void OnFailureCallback_6(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_6(error); - } - - static void OnSuccessCallback_6(void * context, - const chip::app::DataModel::Nullable & targetPositionTiltPercent100ths) - { - (static_cast(context))->OnSuccessResponse_6(targetPositionTiltPercent100ths); - } - - static void OnFailureCallback_8(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_8(error); - } - - static void OnSuccessCallback_8(void * context, uint8_t operationalStatus) - { - (static_cast(context))->OnSuccessResponse_8(operationalStatus); - } - - static void OnFailureCallback_12(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_12(error); - } - - static void OnSuccessCallback_12(void * context, uint8_t operationalStatus) - { - (static_cast(context))->OnSuccessResponse_12(operationalStatus); - } - - // - // Tests methods - // - - CHIP_ERROR Test0WaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR Test1aThSendsDownOrCloseCommandToPrepositionTheDutInTheOppositeDirection_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::WindowCovering::Commands::DownOrClose::Type; - - RequestType request; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_1(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_1(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_1() { NextTest(); } - - CHIP_ERROR Test1bThWaitsForXSecondsMovementsOnTheDut_2() - { - SetIdentity(kIdentityAlpha); - return WaitForMs(mFullMotionDuration.HasValue() ? mFullMotionDuration.Value() : 6000U); - } - - CHIP_ERROR Test1cIfPaTlThReadsCurrentPositionTiltPercent100thsAttributeFromDut_3() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::WindowCoveringClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_3, OnFailureCallback_3, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_3(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_3(const chip::app::DataModel::Nullable & currentPositionTiltPercent100ths) - { - VerifyOrReturn(CheckConstraintNotValue("currentPositionTiltPercent100ths", currentPositionTiltPercent100ths, 0U)); - - NextTest(); - } - - CHIP_ERROR Test2aThSendsGoToTiltPercentageCommandWith30PercentToDut_4() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::WindowCovering::Commands::GoToTiltPercentage::Type; - - RequestType request; - request.tiltPercentageValue = 30; - request.tiltPercent100thsValue.Emplace(); - request.tiltPercent100thsValue.Value() = 3000U; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_4(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_4(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_4(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_4() { NextTest(); } - - CHIP_ERROR Test2bDutUpdatesItsAttributes_5() - { - SetIdentity(kIdentityAlpha); - return WaitForMs(100); - } - - CHIP_ERROR Test2cIfPaTlThReadsTargetPositionTiltPercent100thsAttributeFromDut_6() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::WindowCoveringClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_6, OnFailureCallback_6, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_6(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_6(const chip::app::DataModel::Nullable & targetPositionTiltPercent100ths) - { - VerifyOrReturn(CheckValueNonNull("targetPositionTiltPercent100ths", targetPositionTiltPercent100ths)); - VerifyOrReturn(CheckValue("targetPositionTiltPercent100ths.Value()", targetPositionTiltPercent100ths.Value(), 3000U)); - - NextTest(); - } - - CHIP_ERROR Test3aThSetATimeoutOfXMinutesForFailure_7() - { - SetIdentity(kIdentityAlpha); - return WaitForMs(mFullMotionDuration.HasValue() ? mFullMotionDuration.Value() : 6000U); - } - - CHIP_ERROR Test3bThReadsOperationalStatusAttributeFromDut_8() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::WindowCoveringClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_8, OnFailureCallback_8, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_8(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_8(uint8_t operationalStatus) - { - VerifyOrReturn(CheckValue("operationalStatus", operationalStatus, 0)); - - NextTest(); - } - - CHIP_ERROR Test4aThSendsGoToTiltPercentageCommandWith6020PercentToDut_9() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::WindowCovering::Commands::GoToTiltPercentage::Type; - - RequestType request; - request.tiltPercentageValue = 60; - request.tiltPercent100thsValue.Emplace(); - request.tiltPercent100thsValue.Value() = 6005U; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_9(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_9(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_9(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_9() { NextTest(); } - - CHIP_ERROR Test4bDutUpdatesItsAttributes_10() - { - SetIdentity(kIdentityAlpha); - return WaitForMs(100); - } - - CHIP_ERROR Test5aThWaitsForXSecondsMovementsOnTheDut_11() - { - SetIdentity(kIdentityAlpha); - return WaitForMs(mFullMotionDuration.HasValue() ? mFullMotionDuration.Value() : 6000U); - } - - CHIP_ERROR Test5bThReadsOperationalStatusAttributeFromDut_12() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::WindowCoveringClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_12, OnFailureCallback_12, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_12(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_12(uint8_t operationalStatus) - { - VerifyOrReturn(CheckValue("operationalStatus", operationalStatus, 0)); - - NextTest(); - } -}; - -class Test_TC_WNCV_4_3Suite : public TestCommand -{ -public: - Test_TC_WNCV_4_3Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_WNCV_4_3", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_WNCV_4_3Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_WNCV_4_3\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_WNCV_4_3\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : 0: Wait for the commissioned device to be retrieved\n"); - err = Test0WaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - case 1: - ChipLogProgress(chipTool, - " ***** Test Step 1 : 1a: If (PA_LF & LF) TH reads CurrentPositionLiftPercent100ths from DUT\n"); - if (ShouldSkip("WNCV_LF && WNCV_PA_LF")) - { - NextTest(); - return; - } - err = Test1aIfPaLfLfThReadsCurrentPositionLiftPercent100thsFromDut_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : 1b: If (PA_LF & LF) TH reads CurrentPositionLiftPercentage from DUT\n"); - if (ShouldSkip("WNCV_LF && WNCV_PA_LF && A_CURRENTPOSITIONLIFTPERCENTAGE")) - { - NextTest(); - return; - } - err = Test1bIfPaLfLfThReadsCurrentPositionLiftPercentageFromDut_2(); - break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : 2b: TH sends GoToLiftPercentage command with BadParam to DUT\n"); - if (ShouldSkip("WNCV_LF && WNCV_PA_LF || WNCV_LF && CR_GOTOLIFTPERCENTAGE")) - { - NextTest(); - return; - } - err = Test2bThSendsGoToLiftPercentageCommandWithBadParamToDut_3(); - break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : 3a: TH sends GoToLiftPercentage command with 10001 to DUT\n"); - if (ShouldSkip("WNCV_LF && WNCV_PA_LF || WNCV_LF && CR_GOTOLIFTPERCENTAGE")) - { - NextTest(); - return; - } - err = Test3aThSendsGoToLiftPercentageCommandWith10001ToDut_4(); - break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : 4a: TH sends GoToLiftPercentage command with 0xFFFF to DUT\n"); - if (ShouldSkip("WNCV_LF && WNCV_PA_LF || WNCV_LF && CR_GOTOLIFTPERCENTAGE")) - { - NextTest(); - return; - } - err = Test4aThSendsGoToLiftPercentageCommandWith0xFFFFToDut_5(); - break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 6; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - chip::app::DataModel::Nullable attrCurrentPositionLiftPercent100ths; - chip::app::DataModel::Nullable attrCurrentPositionLiftPercentage; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - static void OnFailureCallback_1(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_1(error); - } - - static void OnSuccessCallback_1(void * context, - const chip::app::DataModel::Nullable & currentPositionLiftPercent100ths) - { - (static_cast(context))->OnSuccessResponse_1(currentPositionLiftPercent100ths); - } - - static void OnFailureCallback_2(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_2(error); - } - - static void OnSuccessCallback_2(void * context, - const chip::app::DataModel::Nullable & currentPositionLiftPercentage) - { - (static_cast(context))->OnSuccessResponse_2(currentPositionLiftPercentage); - } - - // - // Tests methods - // - - CHIP_ERROR Test0WaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR Test1aIfPaLfLfThReadsCurrentPositionLiftPercent100thsFromDut_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::WindowCoveringClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_1, OnFailureCallback_1, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_1(const chip::app::DataModel::Nullable & currentPositionLiftPercent100ths) - { - VerifyOrReturn(CheckConstraintMinValue("currentPositionLiftPercent100ths", currentPositionLiftPercent100ths, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("currentPositionLiftPercent100ths", currentPositionLiftPercent100ths, 10000U)); - attrCurrentPositionLiftPercent100ths = currentPositionLiftPercent100ths; - NextTest(); - } - - CHIP_ERROR Test1bIfPaLfLfThReadsCurrentPositionLiftPercentageFromDut_2() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::WindowCoveringClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_2, OnFailureCallback_2, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_2(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_2(const chip::app::DataModel::Nullable & currentPositionLiftPercentage) - { - VerifyOrReturn(CheckConstraintMinValue("currentPositionLiftPercentage", currentPositionLiftPercentage, 0)); - VerifyOrReturn(CheckConstraintMaxValue("currentPositionLiftPercentage", currentPositionLiftPercentage, 100)); - attrCurrentPositionLiftPercentage = currentPositionLiftPercentage; - NextTest(); - } - - CHIP_ERROR Test2bThSendsGoToLiftPercentageCommandWithBadParamToDut_3() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::WindowCovering::Commands::GoToLiftPercentage::Type; - - RequestType request; - request.liftPercentageValue = 63; - request.liftPercent100thsValue.Emplace(); - request.liftPercent100thsValue.Value() = 12288U; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_3(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_3(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_3(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - NextTest(); - } - - void OnSuccessResponse_3() { ThrowSuccessResponse(); } - - CHIP_ERROR Test3aThSendsGoToLiftPercentageCommandWith10001ToDut_4() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::WindowCovering::Commands::GoToLiftPercentage::Type; - - RequestType request; - request.liftPercentageValue = 100; - request.liftPercent100thsValue.Emplace(); - request.liftPercent100thsValue.Value() = 10001U; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_4(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_4(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_4(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - NextTest(); - } - - void OnSuccessResponse_4() { ThrowSuccessResponse(); } - - CHIP_ERROR Test4aThSendsGoToLiftPercentageCommandWith0xFFFFToDut_5() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::WindowCovering::Commands::GoToLiftPercentage::Type; - - RequestType request; - request.liftPercentageValue = 255; - request.liftPercent100thsValue.Emplace(); - request.liftPercent100thsValue.Value() = 65535U; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_5(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_5(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_5(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - NextTest(); - } - - void OnSuccessResponse_5() { ThrowSuccessResponse(); } -}; - -class Test_TC_WNCV_4_4Suite : public TestCommand -{ -public: - Test_TC_WNCV_4_4Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_WNCV_4_4", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_WNCV_4_4Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_WNCV_4_4\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_WNCV_4_4\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : 0: Wait for the commissioned device to be retrieved\n"); - err = Test0WaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - case 1: - ChipLogProgress(chipTool, - " ***** Test Step 1 : 1a: If (PA_TL & TL) TH reads CurrentPositionTiltPercent100ths from DUT\n"); - if (ShouldSkip("WNCV_TL && WNCV_PA_TL")) - { - NextTest(); - return; - } - err = Test1aIfPaTlTlThReadsCurrentPositionTiltPercent100thsFromDut_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : 1b: If (PA_TL & TL) TH reads CurrentPositionTiltPercentage from DUT\n"); - if (ShouldSkip("WNCV_TL && WNCV_PA_TL && A_CURRENTPOSITIONTILTPERCENTAGE")) - { - NextTest(); - return; - } - err = Test1bIfPaTlTlThReadsCurrentPositionTiltPercentageFromDut_2(); - break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : 2b: TH sends GoToTiltPercentage command with BadParam to DUT\n"); - if (ShouldSkip("WNCV_TL && WNCV_PA_TL || WNCV_TL && CR_GOTOTILTPERCENTAGE")) - { - NextTest(); - return; - } - err = Test2bThSendsGoToTiltPercentageCommandWithBadParamToDut_3(); - break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : 3a: TH sends GoToTiltPercentage command with 10001 to DUT\n"); - if (ShouldSkip("WNCV_TL && WNCV_PA_TL || WNCV_TL && CR_GOTOTILTPERCENTAGE")) - { - NextTest(); - return; - } - err = Test3aThSendsGoToTiltPercentageCommandWith10001ToDut_4(); - break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : 4a: TH sends GoToTiltPercentage command with 0xFFFF to DUT\n"); - if (ShouldSkip("WNCV_TL && WNCV_PA_TL || WNCV_TL && CR_GOTOTILTPERCENTAGE")) - { - NextTest(); - return; - } - err = Test4aThSendsGoToTiltPercentageCommandWith0xFFFFToDut_5(); - break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 6; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - chip::app::DataModel::Nullable attrCurrentPositionTiltPercent100ths; - chip::app::DataModel::Nullable attrCurrentPositionTiltPercentage; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - static void OnFailureCallback_1(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_1(error); - } - - static void OnSuccessCallback_1(void * context, - const chip::app::DataModel::Nullable & currentPositionTiltPercent100ths) - { - (static_cast(context))->OnSuccessResponse_1(currentPositionTiltPercent100ths); - } - - static void OnFailureCallback_2(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_2(error); - } - - static void OnSuccessCallback_2(void * context, - const chip::app::DataModel::Nullable & currentPositionTiltPercentage) - { - (static_cast(context))->OnSuccessResponse_2(currentPositionTiltPercentage); - } - - // - // Tests methods - // - - CHIP_ERROR Test0WaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR Test1aIfPaTlTlThReadsCurrentPositionTiltPercent100thsFromDut_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::WindowCoveringClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_1, OnFailureCallback_1, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_1(const chip::app::DataModel::Nullable & currentPositionTiltPercent100ths) - { - VerifyOrReturn(CheckConstraintMinValue("currentPositionTiltPercent100ths", currentPositionTiltPercent100ths, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("currentPositionTiltPercent100ths", currentPositionTiltPercent100ths, 10000U)); - attrCurrentPositionTiltPercent100ths = currentPositionTiltPercent100ths; - NextTest(); - } - - CHIP_ERROR Test1bIfPaTlTlThReadsCurrentPositionTiltPercentageFromDut_2() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::WindowCoveringClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_2, OnFailureCallback_2, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_2(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_2(const chip::app::DataModel::Nullable & currentPositionTiltPercentage) - { - VerifyOrReturn(CheckConstraintMinValue("currentPositionTiltPercentage", currentPositionTiltPercentage, 0)); - VerifyOrReturn(CheckConstraintMaxValue("currentPositionTiltPercentage", currentPositionTiltPercentage, 100)); - attrCurrentPositionTiltPercentage = currentPositionTiltPercentage; - NextTest(); - } - - CHIP_ERROR Test2bThSendsGoToTiltPercentageCommandWithBadParamToDut_3() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::WindowCovering::Commands::GoToTiltPercentage::Type; - - RequestType request; - request.tiltPercentageValue = 63; - request.tiltPercent100thsValue.Emplace(); - request.tiltPercent100thsValue.Value() = 12288U; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_3(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_3(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_3(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - NextTest(); - } - - void OnSuccessResponse_3() { ThrowSuccessResponse(); } - - CHIP_ERROR Test3aThSendsGoToTiltPercentageCommandWith10001ToDut_4() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::WindowCovering::Commands::GoToTiltPercentage::Type; - - RequestType request; - request.tiltPercentageValue = 100; - request.tiltPercent100thsValue.Emplace(); - request.tiltPercent100thsValue.Value() = 10001U; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_4(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_4(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_4(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - NextTest(); - } - - void OnSuccessResponse_4() { ThrowSuccessResponse(); } - - CHIP_ERROR Test4aThSendsGoToTiltPercentageCommandWith0xFFFFToDut_5() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::WindowCovering::Commands::GoToTiltPercentage::Type; - - RequestType request; - request.tiltPercentageValue = 255; - request.tiltPercent100thsValue.Emplace(); - request.tiltPercent100thsValue.Value() = 65535U; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_5(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_5(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_5(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - NextTest(); - } - - void OnSuccessResponse_5() { ThrowSuccessResponse(); } -}; - -class Test_TC_WNCV_4_5Suite : public TestCommand -{ -public: - Test_TC_WNCV_4_5Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_WNCV_4_5", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("discriminator", 0, UINT16_MAX, &mDiscriminator); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_WNCV_4_5Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_WNCV_4_5\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_WNCV_4_5\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : 0a: Wait for the commissioned device to be retrieved\n"); - err = Test0aWaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : 0b: TH sends UpOrOpen command to preposition the DUT\n"); - err = Test0bThSendsUpOrOpenCommandToPrepositionTheDut_1(); - break; - case 2: - ChipLogProgress(chipTool, - " ***** Test Step 2 : 1a: If (PA_LF & LF) TH sends GoToLiftPercentage command with 90%% to DUT\n"); - if (ShouldSkip("WNCV_LF && WNCV_PA_LF")) - { - NextTest(); - return; - } - err = Test1aIfPaLfLfThSendsGoToLiftPercentageCommandWith90ToDut_2(); - break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : 1b: TH Waits for 100ms-1s\n"); - err = Test1bThWaitsFor100ms1s_3(); - break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : 1c: TH sends StopMotion command to DUT\n"); - err = Test1cThSendsStopMotionCommandToDut_4(); - break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : 1d: TH Waits for 100ms-1s\n"); - err = Test1dThWaitsFor100ms1s_5(); - break; - case 6: - ChipLogProgress(chipTool, - " ***** Test Step 6 : 2a: If (PA_TL & TL) TH sends GoToTiltPercentage command with 90%% to DUT\n"); - if (ShouldSkip("WNCV_TL && WNCV_PA_TL")) - { - NextTest(); - return; - } - err = Test2aIfPaTlTlThSendsGoToTiltPercentageCommandWith90ToDut_6(); - break; - case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : 2b: TH Waits for 100ms-1s\n"); - err = Test2bThWaitsFor100ms1s_7(); - break; - case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : 2c: TH sends StopMotion command to DUT\n"); - err = Test2cThSendsStopMotionCommandToDut_8(); - break; - case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : 2d: TH Waits for 100ms-1s\n"); - err = Test2dThWaitsFor100ms1s_9(); - break; - case 10: - ChipLogProgress(chipTool, " ***** Test Step 10 : 3a: TH reads CurrentPositionLiftPercent100ths from DUT\n"); - if (ShouldSkip("WNCV_LF && WNCV_PA_LF")) - { - NextTest(); - return; - } - err = Test3aThReadsCurrentPositionLiftPercent100thsFromDut_10(); - break; - case 11: - ChipLogProgress(chipTool, " ***** Test Step 11 : 3b: TH reads CurrentPositionTiltPercent100ths from DUT\n"); - if (ShouldSkip("WNCV_TL && WNCV_PA_TL")) - { - NextTest(); - return; - } - err = Test3bThReadsCurrentPositionTiltPercent100thsFromDut_11(); - break; - case 12: - ChipLogProgress(chipTool, " ***** Test Step 12 : 3c: reboot/restart the DUT\n"); - err = Test3cRebootRestartTheDut_12(); - break; - case 13: - ChipLogProgress(chipTool, " ***** Test Step 13 : 3d: Wait for the commissioned device to be retrieved\n"); - err = Test3dWaitForTheCommissionedDeviceToBeRetrieved_13(); - break; - case 14: - ChipLogProgress(chipTool, " ***** Test Step 14 : 3e: TH reads CurrentPositionLiftPercent100ths from DUT\n"); - if (ShouldSkip("WNCV_LF && WNCV_PA_LF")) - { - NextTest(); - return; - } - err = Test3eThReadsCurrentPositionLiftPercent100thsFromDut_14(); - break; - case 15: - ChipLogProgress(chipTool, " ***** Test Step 15 : 3f: TH reads CurrentPositionTiltPercent100ths from DUT\n"); - if (ShouldSkip("WNCV_TL && WNCV_PA_TL")) - { - NextTest(); - return; - } - err = Test3fThReadsCurrentPositionTiltPercent100thsFromDut_15(); - break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 16; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mDiscriminator; - chip::Optional mTimeout; - - chip::app::DataModel::Nullable attrCurrentPositionLiftPercent100ths; - chip::app::DataModel::Nullable attrCurrentPositionTiltPercent100ths; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 3: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 5: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 7: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 9: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 12: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 13: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - static void OnFailureCallback_10(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_10(error); - } - - static void OnSuccessCallback_10(void * context, - const chip::app::DataModel::Nullable & currentPositionLiftPercent100ths) - { - (static_cast(context))->OnSuccessResponse_10(currentPositionLiftPercent100ths); - } - - static void OnFailureCallback_11(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_11(error); - } - - static void OnSuccessCallback_11(void * context, - const chip::app::DataModel::Nullable & currentPositionTiltPercent100ths) - { - (static_cast(context))->OnSuccessResponse_11(currentPositionTiltPercent100ths); - } - - static void OnFailureCallback_14(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_14(error); - } - - static void OnSuccessCallback_14(void * context, - const chip::app::DataModel::Nullable & currentPositionLiftPercent100ths) - { - (static_cast(context))->OnSuccessResponse_14(currentPositionLiftPercent100ths); - } - - static void OnFailureCallback_15(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_15(error); - } - - static void OnSuccessCallback_15(void * context, - const chip::app::DataModel::Nullable & currentPositionTiltPercent100ths) - { - (static_cast(context))->OnSuccessResponse_15(currentPositionTiltPercent100ths); - } - - // - // Tests methods - // - - CHIP_ERROR Test0aWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR Test0bThSendsUpOrOpenCommandToPrepositionTheDut_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::WindowCovering::Commands::UpOrOpen::Type; - - RequestType request; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_1(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_1(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_1() { NextTest(); } - - CHIP_ERROR Test1aIfPaLfLfThSendsGoToLiftPercentageCommandWith90ToDut_2() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::WindowCovering::Commands::GoToLiftPercentage::Type; - - RequestType request; - request.liftPercentageValue = 90; - request.liftPercent100thsValue.Emplace(); - request.liftPercent100thsValue.Value() = 9000U; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_2(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_2(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_2(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_2() { NextTest(); } - - CHIP_ERROR Test1bThWaitsFor100ms1s_3() - { - SetIdentity(kIdentityAlpha); - return WaitForMs(500); - } - - CHIP_ERROR Test1cThSendsStopMotionCommandToDut_4() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::WindowCovering::Commands::StopMotion::Type; - - RequestType request; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_4(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_4(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_4(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_4() { NextTest(); } - - CHIP_ERROR Test1dThWaitsFor100ms1s_5() - { - SetIdentity(kIdentityAlpha); - return WaitForMs(500); - } - - CHIP_ERROR Test2aIfPaTlTlThSendsGoToTiltPercentageCommandWith90ToDut_6() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::WindowCovering::Commands::GoToTiltPercentage::Type; - - RequestType request; - request.tiltPercentageValue = 90; - request.tiltPercent100thsValue.Emplace(); - request.tiltPercent100thsValue.Value() = 9000U; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_6(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_6(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_6(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_6() { NextTest(); } - - CHIP_ERROR Test2bThWaitsFor100ms1s_7() - { - SetIdentity(kIdentityAlpha); - return WaitForMs(500); - } - - CHIP_ERROR Test2cThSendsStopMotionCommandToDut_8() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::WindowCovering::Commands::StopMotion::Type; - - RequestType request; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_8(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_8(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_8(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_8() { NextTest(); } - - CHIP_ERROR Test2dThWaitsFor100ms1s_9() - { - SetIdentity(kIdentityAlpha); - return WaitForMs(500); - } - - CHIP_ERROR Test3aThReadsCurrentPositionLiftPercent100thsFromDut_10() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::WindowCoveringClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_10, OnFailureCallback_10, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_10(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_10(const chip::app::DataModel::Nullable & currentPositionLiftPercent100ths) - { - VerifyOrReturn(CheckConstraintNotValue("currentPositionLiftPercent100ths", currentPositionLiftPercent100ths, 0U)); - - attrCurrentPositionLiftPercent100ths = currentPositionLiftPercent100ths; - NextTest(); - } - - CHIP_ERROR Test3bThReadsCurrentPositionTiltPercent100thsFromDut_11() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::WindowCoveringClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_11, OnFailureCallback_11, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_11(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_11(const chip::app::DataModel::Nullable & currentPositionTiltPercent100ths) - { - VerifyOrReturn(CheckConstraintNotValue("currentPositionTiltPercent100ths", currentPositionTiltPercent100ths, 0U)); - - attrCurrentPositionTiltPercent100ths = currentPositionTiltPercent100ths; - NextTest(); - } - - CHIP_ERROR Test3cRebootRestartTheDut_12() - { - SetIdentity(kIdentityAlpha); - return Reboot(mDiscriminator.HasValue() ? mDiscriminator.Value() : 3840U); - } - - CHIP_ERROR Test3dWaitForTheCommissionedDeviceToBeRetrieved_13() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR Test3eThReadsCurrentPositionLiftPercent100thsFromDut_14() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::WindowCoveringClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_14, OnFailureCallback_14, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_14(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_14(const chip::app::DataModel::Nullable & currentPositionLiftPercent100ths) - { - if (attrCurrentPositionLiftPercent100ths.IsNull()) - { - VerifyOrReturn(CheckValueNull("currentPositionLiftPercent100ths", currentPositionLiftPercent100ths)); - } - else - { - VerifyOrReturn(CheckValueNonNull("currentPositionLiftPercent100ths", currentPositionLiftPercent100ths)); - VerifyOrReturn(CheckValue("currentPositionLiftPercent100ths.Value()", currentPositionLiftPercent100ths.Value(), - attrCurrentPositionLiftPercent100ths.Value())); - } - - NextTest(); - } - - CHIP_ERROR Test3fThReadsCurrentPositionTiltPercent100thsFromDut_15() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::WindowCoveringClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_15, OnFailureCallback_15, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_15(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_15(const chip::app::DataModel::Nullable & currentPositionTiltPercent100ths) - { - if (attrCurrentPositionTiltPercent100ths.IsNull()) - { - VerifyOrReturn(CheckValueNull("currentPositionTiltPercent100ths", currentPositionTiltPercent100ths)); - } - else - { - VerifyOrReturn(CheckValueNonNull("currentPositionTiltPercent100ths", currentPositionTiltPercent100ths)); - VerifyOrReturn(CheckValue("currentPositionTiltPercent100ths.Value()", currentPositionTiltPercent100ths.Value(), - attrCurrentPositionTiltPercent100ths.Value())); - } - - NextTest(); - } -}; - -class TV_TargetNavigatorClusterSuite : public TestCommand -{ -public: - TV_TargetNavigatorClusterSuite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("TV_TargetNavigatorCluster", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~TV_TargetNavigatorClusterSuite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: TV_TargetNavigatorCluster\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: TV_TargetNavigatorCluster\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Read attribute Target Navigator list\n"); - err = TestReadAttributeTargetNavigatorList_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Read attribute current navigator target\n"); - err = TestReadAttributeCurrentNavigatorTarget_2(); - break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Navigate Target Request Command\n"); - err = TestNavigateTargetRequestCommand_3(); - break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 4; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - static void OnFailureCallback_1(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_1(error); - } - - static void OnSuccessCallback_1( - void * context, - const chip::app::DataModel::DecodableList & - targetList) - { - (static_cast(context))->OnSuccessResponse_1(targetList); - } - - static void OnFailureCallback_2(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_2(error); - } - - static void OnSuccessCallback_2(void * context, uint8_t currentTarget) - { - (static_cast(context))->OnSuccessResponse_2(currentTarget); - } - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestReadAttributeTargetNavigatorList_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TargetNavigatorClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_1, OnFailureCallback_1, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_1( - const chip::app::DataModel::DecodableList & - targetList) - { - { - auto iter_0 = targetList.begin(); - VerifyOrReturn(CheckNextListItemDecodes("targetList", iter_0, 0)); - VerifyOrReturn(CheckValue("targetList[0].identifier", iter_0.GetValue().identifier, 1)); - VerifyOrReturn(CheckValueAsString("targetList[0].name", iter_0.GetValue().name, chip::CharSpan("exampleName", 11))); - VerifyOrReturn(CheckNextListItemDecodes("targetList", iter_0, 1)); - VerifyOrReturn(CheckValue("targetList[1].identifier", iter_0.GetValue().identifier, 2)); - VerifyOrReturn(CheckValueAsString("targetList[1].name", iter_0.GetValue().name, chip::CharSpan("exampleName", 11))); - VerifyOrReturn(CheckNoMoreListItems("targetList", iter_0, 2)); - } - - NextTest(); - } - - CHIP_ERROR TestReadAttributeCurrentNavigatorTarget_2() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TargetNavigatorClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_2, OnFailureCallback_2, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_2(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_2(uint8_t currentTarget) - { - VerifyOrReturn(CheckValue("currentTarget", currentTarget, 0)); - - NextTest(); - } - - CHIP_ERROR TestNavigateTargetRequestCommand_3() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::TargetNavigator::Commands::NavigateTarget::Type; - - RequestType request; - request.target = 1; - request.data.Emplace(); - request.data.Value() = chip::Span("1garbage: not in length on purpose", 1); - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_3(data.status, data.data); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_3(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_3(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_3(chip::app::Clusters::TargetNavigator::StatusEnum status, const chip::Optional & data) - { - VerifyOrReturn(CheckValue("status", status, 0)); - - VerifyOrReturn(CheckValuePresent("data", data)); - VerifyOrReturn(CheckValueAsString("data.Value()", data.Value(), chip::CharSpan("data response", 13))); - - NextTest(); - } -}; - -class TV_AudioOutputClusterSuite : public TestCommand -{ -public: - TV_AudioOutputClusterSuite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("TV_AudioOutputCluster", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~TV_AudioOutputClusterSuite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: TV_AudioOutputCluster\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: TV_AudioOutputCluster\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Read attribute Audio Output list\n"); - err = TestReadAttributeAudioOutputList_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Read attribute current audio output\n"); - err = TestReadAttributeCurrentAudioOutput_2(); - break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Select Output Command\n"); - err = TestSelectOutputCommand_3(); - break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Rename Output Command\n"); - err = TestRenameOutputCommand_4(); - break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Read attribute Audio Output list\n"); - err = TestReadAttributeAudioOutputList_5(); - break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 6; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - static void OnFailureCallback_1(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_1(error); - } - - static void OnSuccessCallback_1( - void * context, - const chip::app::DataModel::DecodableList & - outputList) - { - (static_cast(context))->OnSuccessResponse_1(outputList); - } - - static void OnFailureCallback_2(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_2(error); - } - - static void OnSuccessCallback_2(void * context, uint8_t currentOutput) - { - (static_cast(context))->OnSuccessResponse_2(currentOutput); - } - - static void OnFailureCallback_5(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_5(error); - } - - static void OnSuccessCallback_5( - void * context, - const chip::app::DataModel::DecodableList & - outputList) - { - (static_cast(context))->OnSuccessResponse_5(outputList); - } - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestReadAttributeAudioOutputList_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 2; - chip::Controller::AudioOutputClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_1, OnFailureCallback_1, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_1( - const chip::app::DataModel::DecodableList & - outputList) - { - { - auto iter_0 = outputList.begin(); - VerifyOrReturn(CheckNextListItemDecodes("outputList", iter_0, 0)); - VerifyOrReturn(CheckValue("outputList[0].index", iter_0.GetValue().index, 1)); - VerifyOrReturn(CheckValue("outputList[0].outputType", iter_0.GetValue().outputType, 0)); - VerifyOrReturn(CheckValueAsString("outputList[0].name", iter_0.GetValue().name, chip::CharSpan("HDMI", 4))); - VerifyOrReturn(CheckNextListItemDecodes("outputList", iter_0, 1)); - VerifyOrReturn(CheckValue("outputList[1].index", iter_0.GetValue().index, 2)); - VerifyOrReturn(CheckValue("outputList[1].outputType", iter_0.GetValue().outputType, 0)); - VerifyOrReturn(CheckValueAsString("outputList[1].name", iter_0.GetValue().name, chip::CharSpan("HDMI", 4))); - VerifyOrReturn(CheckNextListItemDecodes("outputList", iter_0, 2)); - VerifyOrReturn(CheckValue("outputList[2].index", iter_0.GetValue().index, 3)); - VerifyOrReturn(CheckValue("outputList[2].outputType", iter_0.GetValue().outputType, 0)); - VerifyOrReturn(CheckValueAsString("outputList[2].name", iter_0.GetValue().name, chip::CharSpan("HDMI", 4))); - VerifyOrReturn(CheckNoMoreListItems("outputList", iter_0, 3)); - } - - NextTest(); - } - - CHIP_ERROR TestReadAttributeCurrentAudioOutput_2() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 2; - chip::Controller::AudioOutputClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_2, OnFailureCallback_2, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_2(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_2(uint8_t currentOutput) - { - VerifyOrReturn(CheckValue("currentOutput", currentOutput, 1)); - - NextTest(); - } - - CHIP_ERROR TestSelectOutputCommand_3() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 2; - using RequestType = chip::app::Clusters::AudioOutput::Commands::SelectOutput::Type; - - RequestType request; - request.index = 1; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_3(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_3(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_3(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_3() { NextTest(); } - - CHIP_ERROR TestRenameOutputCommand_4() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 2; - using RequestType = chip::app::Clusters::AudioOutput::Commands::RenameOutput::Type; - - RequestType request; - request.index = 1; - request.name = chip::Span("HDMI Testgarbage: not in length on purpose", 9); - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_4(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_4(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_4(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_4() { NextTest(); } - - CHIP_ERROR TestReadAttributeAudioOutputList_5() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 2; - chip::Controller::AudioOutputClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_5, OnFailureCallback_5, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_5(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_5( - const chip::app::DataModel::DecodableList & - outputList) - { - { - auto iter_0 = outputList.begin(); - VerifyOrReturn(CheckNextListItemDecodes("outputList", iter_0, 0)); - VerifyOrReturn(CheckValue("outputList[0].index", iter_0.GetValue().index, 1)); - VerifyOrReturn(CheckValue("outputList[0].outputType", iter_0.GetValue().outputType, 0)); - VerifyOrReturn(CheckValueAsString("outputList[0].name", iter_0.GetValue().name, chip::CharSpan("HDMI Test", 9))); - VerifyOrReturn(CheckNextListItemDecodes("outputList", iter_0, 1)); - VerifyOrReturn(CheckValue("outputList[1].index", iter_0.GetValue().index, 2)); - VerifyOrReturn(CheckValue("outputList[1].outputType", iter_0.GetValue().outputType, 0)); - VerifyOrReturn(CheckValueAsString("outputList[1].name", iter_0.GetValue().name, chip::CharSpan("HDMI", 4))); - VerifyOrReturn(CheckNextListItemDecodes("outputList", iter_0, 2)); - VerifyOrReturn(CheckValue("outputList[2].index", iter_0.GetValue().index, 3)); - VerifyOrReturn(CheckValue("outputList[2].outputType", iter_0.GetValue().outputType, 0)); - VerifyOrReturn(CheckValueAsString("outputList[2].name", iter_0.GetValue().name, chip::CharSpan("HDMI", 4))); - VerifyOrReturn(CheckNoMoreListItems("outputList", iter_0, 3)); - } - - NextTest(); - } -}; - -class TV_ApplicationLauncherClusterSuite : public TestCommand -{ -public: - TV_ApplicationLauncherClusterSuite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("TV_ApplicationLauncherCluster", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~TV_ApplicationLauncherClusterSuite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: TV_ApplicationLauncherCluster\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: TV_ApplicationLauncherCluster\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Read attribute Application Launcher list\n"); - err = TestReadAttributeApplicationLauncherList_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Read attribute application launcher app\n"); - err = TestReadAttributeApplicationLauncherApp_2(); - break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Launch App Command\n"); - err = TestLaunchAppCommand_3(); - break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Stop App Command\n"); - err = TestStopAppCommand_4(); - break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Hide App Command\n"); - err = TestHideAppCommand_5(); - break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 6; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - static void OnFailureCallback_1(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_1(error); - } - - static void OnSuccessCallback_1(void * context, const chip::app::DataModel::DecodableList & catalogList) - { - (static_cast(context))->OnSuccessResponse_1(catalogList); - } - - static void OnFailureCallback_2(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_2(error); - } - - static void OnSuccessCallback_2( - void * context, - const chip::app::DataModel::Nullable & - currentApp) - { - (static_cast(context))->OnSuccessResponse_2(currentApp); - } - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestReadAttributeApplicationLauncherList_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ApplicationLauncherClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_1, OnFailureCallback_1, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_1(const chip::app::DataModel::DecodableList & catalogList) - { - { - auto iter_0 = catalogList.begin(); - VerifyOrReturn(CheckNextListItemDecodes("catalogList", iter_0, 0)); - VerifyOrReturn(CheckValue("catalogList[0]", iter_0.GetValue(), 123U)); - VerifyOrReturn(CheckNextListItemDecodes("catalogList", iter_0, 1)); - VerifyOrReturn(CheckValue("catalogList[1]", iter_0.GetValue(), 456U)); - VerifyOrReturn(CheckNoMoreListItems("catalogList", iter_0, 2)); - } - - NextTest(); - } - - CHIP_ERROR TestReadAttributeApplicationLauncherApp_2() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ApplicationLauncherClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_2, OnFailureCallback_2, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_2(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_2( - const chip::app::DataModel::Nullable & - currentApp) - { - VerifyOrReturn(CheckValueNull("currentApp", currentApp)); - - NextTest(); - } - - CHIP_ERROR TestLaunchAppCommand_3() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::ApplicationLauncher::Commands::LaunchApp::Type; - - RequestType request; - - request.application.catalogVendorId = 123U; - request.application.applicationId = chip::Span("applicationIdgarbage: not in length on purpose", 13); - - request.data.Emplace(); - request.data.Value() = chip::ByteSpan(chip::Uint8::from_const_char("datagarbage: not in length on purpose"), 4); - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_3(data.status, data.data); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_3(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_3(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_3(chip::app::Clusters::ApplicationLauncher::StatusEnum status, chip::ByteSpan data) - { - VerifyOrReturn(CheckValue("status", status, 0)); - - VerifyOrReturn(CheckValueAsString("data", data, chip::ByteSpan(chip::Uint8::from_const_char("data"), 4))); - - NextTest(); - } - - CHIP_ERROR TestStopAppCommand_4() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::ApplicationLauncher::Commands::StopApp::Type; - - RequestType request; - - request.application.catalogVendorId = 123U; - request.application.applicationId = chip::Span("applicationIdgarbage: not in length on purpose", 13); - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_4(data.status, data.data); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_4(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_4(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_4(chip::app::Clusters::ApplicationLauncher::StatusEnum status, chip::ByteSpan data) - { - VerifyOrReturn(CheckValue("status", status, 0)); - - VerifyOrReturn(CheckValueAsString("data", data, chip::ByteSpan(chip::Uint8::from_const_char("data"), 4))); - - NextTest(); - } - - CHIP_ERROR TestHideAppCommand_5() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::ApplicationLauncher::Commands::HideApp::Type; - - RequestType request; - - request.application.catalogVendorId = 123U; - request.application.applicationId = chip::Span("applicationIdgarbage: not in length on purpose", 13); - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_5(data.status, data.data); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_5(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_5(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_5(chip::app::Clusters::ApplicationLauncher::StatusEnum status, chip::ByteSpan data) - { - VerifyOrReturn(CheckValue("status", status, 0)); - - VerifyOrReturn(CheckValueAsString("data", data, chip::ByteSpan(chip::Uint8::from_const_char("data"), 4))); - - NextTest(); - } -}; - -class TV_KeypadInputClusterSuite : public TestCommand -{ -public: - TV_KeypadInputClusterSuite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("TV_KeypadInputCluster", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~TV_KeypadInputClusterSuite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: TV_KeypadInputCluster\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: TV_KeypadInputCluster\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Send Key Command\n"); - err = TestSendKeyCommand_1(); - break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 2; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestSendKeyCommand_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::KeypadInput::Commands::SendKey::Type; - - RequestType request; - request.keyCode = static_cast(3); - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_1(data.status); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_1(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_1(chip::app::Clusters::KeypadInput::StatusEnum status) - { - VerifyOrReturn(CheckValue("status", status, 0)); - - NextTest(); - } -}; - -class TV_AccountLoginClusterSuite : public TestCommand -{ -public: - TV_AccountLoginClusterSuite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("TV_AccountLoginCluster", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~TV_AccountLoginClusterSuite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: TV_AccountLoginCluster\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: TV_AccountLoginCluster\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Get Setup PIN Command\n"); - err = TestGetSetupPinCommand_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Login Command\n"); - err = TestLoginCommand_2(); - break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Logout Command\n"); - err = TestLogoutCommand_3(); - break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 4; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestGetSetupPinCommand_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 3; - using RequestType = chip::app::Clusters::AccountLogin::Commands::GetSetupPIN::Type; - - RequestType request; - request.tempAccountIdentifier = chip::Span("asdfgarbage: not in length on purpose", 4); - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_1(data.setupPIN); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_1(error); - }; - - ReturnErrorOnFailure( - chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request, 10000)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_1(chip::CharSpan setupPIN) - { - VerifyOrReturn(CheckValueAsString("setupPIN", setupPIN, chip::CharSpan("tempPin123", 10))); - - NextTest(); - } - - CHIP_ERROR TestLoginCommand_2() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 3; - using RequestType = chip::app::Clusters::AccountLogin::Commands::Login::Type; - - RequestType request; - request.tempAccountIdentifier = chip::Span("asdfgarbage: not in length on purpose", 4); - request.setupPIN = chip::Span("tempPin123garbage: not in length on purpose", 10); - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_2(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_2(error); - }; - - ReturnErrorOnFailure( - chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request, 10000)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_2(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_2() { NextTest(); } - - CHIP_ERROR TestLogoutCommand_3() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 3; - using RequestType = chip::app::Clusters::AccountLogin::Commands::Logout::Type; - - RequestType request; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_3(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_3(error); - }; - - ReturnErrorOnFailure( - chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request, 10000)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_3(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_3() { NextTest(); } -}; - -class TV_WakeOnLanClusterSuite : public TestCommand -{ -public: - TV_WakeOnLanClusterSuite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("TV_WakeOnLanCluster", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~TV_WakeOnLanClusterSuite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: TV_WakeOnLanCluster\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: TV_WakeOnLanCluster\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Read mac address\n"); - err = TestReadMacAddress_1(); - break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 2; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - static void OnFailureCallback_1(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_1(error); - } - - static void OnSuccessCallback_1(void * context, chip::CharSpan MACAddress) - { - (static_cast(context))->OnSuccessResponse_1(MACAddress); - } - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestReadMacAddress_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::WakeOnLanClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_1, OnFailureCallback_1, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_1(chip::CharSpan MACAddress) - { - VerifyOrReturn(CheckValueAsString("MACAddress", MACAddress, chip::CharSpan("00:00:00:00:00", 14))); - - NextTest(); - } -}; - -class TV_ApplicationBasicClusterSuite : public TestCommand -{ -public: - TV_ApplicationBasicClusterSuite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("TV_ApplicationBasicCluster", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~TV_ApplicationBasicClusterSuite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: TV_ApplicationBasicCluster\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: TV_ApplicationBasicCluster\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Read attribute vendor name\n"); - err = TestReadAttributeVendorName_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Read attribute vendor id\n"); - err = TestReadAttributeVendorId_2(); - break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Read attribute application name\n"); - err = TestReadAttributeApplicationName_3(); - break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Read attribute product id\n"); - err = TestReadAttributeProductId_4(); - break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Read attribute application status\n"); - err = TestReadAttributeApplicationStatus_5(); - break; - case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : Read attribute application status\n"); - err = TestReadAttributeApplicationStatus_6(); - break; - case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : Read attribute application version\n"); - err = TestReadAttributeApplicationVersion_7(); - break; - case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : Read attribute application allowed vendor list\n"); - err = TestReadAttributeApplicationAllowedVendorList_8(); - break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 9; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - static void OnFailureCallback_1(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_1(error); - } - - static void OnSuccessCallback_1(void * context, chip::CharSpan vendorName) - { - (static_cast(context))->OnSuccessResponse_1(vendorName); - } - - static void OnFailureCallback_2(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_2(error); - } - - static void OnSuccessCallback_2(void * context, uint16_t vendorID) - { - (static_cast(context))->OnSuccessResponse_2(vendorID); - } - - static void OnFailureCallback_3(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_3(error); - } - - static void OnSuccessCallback_3(void * context, chip::CharSpan applicationName) - { - (static_cast(context))->OnSuccessResponse_3(applicationName); - } - - static void OnFailureCallback_4(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_4(error); - } - - static void OnSuccessCallback_4(void * context, uint16_t productID) - { - (static_cast(context))->OnSuccessResponse_4(productID); - } - - static void OnFailureCallback_5(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_5(error); - } - - static void OnSuccessCallback_5(void * context, chip::app::Clusters::ApplicationBasic::ApplicationStatusEnum status) - { - (static_cast(context))->OnSuccessResponse_5(status); - } - - static void OnFailureCallback_6(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_6(error); - } - - static void OnSuccessCallback_6( - void * context, - const chip::app::Clusters::ApplicationBasic::Structs::ApplicationBasicApplication::DecodableType & application) - { - (static_cast(context))->OnSuccessResponse_6(application); - } - - static void OnFailureCallback_7(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_7(error); - } - - static void OnSuccessCallback_7(void * context, chip::CharSpan applicationVersion) - { - (static_cast(context))->OnSuccessResponse_7(applicationVersion); - } - - static void OnFailureCallback_8(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_8(error); - } - - static void OnSuccessCallback_8(void * context, const chip::app::DataModel::DecodableList & allowedVendorList) - { - (static_cast(context))->OnSuccessResponse_8(allowedVendorList); - } - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestReadAttributeVendorName_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 3; - chip::Controller::ApplicationBasicClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_1, OnFailureCallback_1, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_1(chip::CharSpan vendorName) - { - VerifyOrReturn(CheckValueAsString("vendorName", vendorName, chip::CharSpan("exampleVendorName1", 18))); - - NextTest(); - } - - CHIP_ERROR TestReadAttributeVendorId_2() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 3; - chip::Controller::ApplicationBasicClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_2, OnFailureCallback_2, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_2(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_2(uint16_t vendorID) - { - VerifyOrReturn(CheckValue("vendorID", vendorID, 1U)); - - NextTest(); - } - - CHIP_ERROR TestReadAttributeApplicationName_3() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 3; - chip::Controller::ApplicationBasicClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_3, OnFailureCallback_3, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_3(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_3(chip::CharSpan applicationName) - { - VerifyOrReturn(CheckValueAsString("applicationName", applicationName, chip::CharSpan("exampleName1", 12))); - - NextTest(); - } - - CHIP_ERROR TestReadAttributeProductId_4() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 3; - chip::Controller::ApplicationBasicClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_4, OnFailureCallback_4, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_4(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_4(uint16_t productID) - { - VerifyOrReturn(CheckValue("productID", productID, 1U)); - - NextTest(); - } - - CHIP_ERROR TestReadAttributeApplicationStatus_5() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 3; - chip::Controller::ApplicationBasicClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_5, OnFailureCallback_5, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_5(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_5(chip::app::Clusters::ApplicationBasic::ApplicationStatusEnum status) - { - VerifyOrReturn(CheckValue("status", status, 0)); - - NextTest(); - } - - CHIP_ERROR TestReadAttributeApplicationStatus_6() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 3; - chip::Controller::ApplicationBasicClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_6, OnFailureCallback_6, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_6(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_6( - const chip::app::Clusters::ApplicationBasic::Structs::ApplicationBasicApplication::DecodableType & application) - { - VerifyOrReturn(CheckValue("application.catalogVendorId", application.catalogVendorId, 123U)); - VerifyOrReturn( - CheckValueAsString("application.applicationId", application.applicationId, chip::CharSpan("applicationId", 13))); - - NextTest(); - } - - CHIP_ERROR TestReadAttributeApplicationVersion_7() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 3; - chip::Controller::ApplicationBasicClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_7, OnFailureCallback_7, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_7(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_7(chip::CharSpan applicationVersion) - { - VerifyOrReturn(CheckValueAsString("applicationVersion", applicationVersion, chip::CharSpan("exampleVersion", 14))); - - NextTest(); - } - - CHIP_ERROR TestReadAttributeApplicationAllowedVendorList_8() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 3; - chip::Controller::ApplicationBasicClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_8, OnFailureCallback_8, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_8(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_8(const chip::app::DataModel::DecodableList & allowedVendorList) - { - { - auto iter_0 = allowedVendorList.begin(); - VerifyOrReturn(CheckNextListItemDecodes("allowedVendorList", iter_0, 0)); - VerifyOrReturn(CheckValue("allowedVendorList[0]", iter_0.GetValue(), 1U)); - VerifyOrReturn(CheckNextListItemDecodes("allowedVendorList", iter_0, 1)); - VerifyOrReturn(CheckValue("allowedVendorList[1]", iter_0.GetValue(), 456U)); - VerifyOrReturn(CheckNoMoreListItems("allowedVendorList", iter_0, 2)); - } - - NextTest(); - } -}; - -class TV_MediaPlaybackClusterSuite : public TestCommand -{ -public: - TV_MediaPlaybackClusterSuite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("TV_MediaPlaybackCluster", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~TV_MediaPlaybackClusterSuite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: TV_MediaPlaybackCluster\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: TV_MediaPlaybackCluster\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Read attribute playback state\n"); - err = TestReadAttributePlaybackState_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Read attribute start time\n"); - err = TestReadAttributeStartTime_2(); - break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Read attribute duration\n"); - err = TestReadAttributeDuration_3(); - break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Read attribute position\n"); - err = TestReadAttributePosition_4(); - break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Read attribute playback speed\n"); - err = TestReadAttributePlaybackSpeed_5(); - break; - case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : Read attribute seek range end\n"); - err = TestReadAttributeSeekRangeEnd_6(); - break; - case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : Read attribute seek range start\n"); - err = TestReadAttributeSeekRangeStart_7(); - break; - case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : Media Playback Play Command\n"); - err = TestMediaPlaybackPlayCommand_8(); - break; - case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : Media Playback Pause Command\n"); - err = TestMediaPlaybackPauseCommand_9(); - break; - case 10: - ChipLogProgress(chipTool, " ***** Test Step 10 : Media Playback Stop Command\n"); - err = TestMediaPlaybackStopCommand_10(); - break; - case 11: - ChipLogProgress(chipTool, " ***** Test Step 11 : Media Playback Start Over Command\n"); - err = TestMediaPlaybackStartOverCommand_11(); - break; - case 12: - ChipLogProgress(chipTool, " ***** Test Step 12 : Media Playback Previous Command\n"); - err = TestMediaPlaybackPreviousCommand_12(); - break; - case 13: - ChipLogProgress(chipTool, " ***** Test Step 13 : Media Playback Next Command\n"); - err = TestMediaPlaybackNextCommand_13(); - break; - case 14: - ChipLogProgress(chipTool, " ***** Test Step 14 : Media Playback Rewind Command\n"); - err = TestMediaPlaybackRewindCommand_14(); - break; - case 15: - ChipLogProgress(chipTool, " ***** Test Step 15 : Media Playback Fast Forward Command\n"); - err = TestMediaPlaybackFastForwardCommand_15(); - break; - case 16: - ChipLogProgress(chipTool, " ***** Test Step 16 : Media Playback Skip Forward Command\n"); - err = TestMediaPlaybackSkipForwardCommand_16(); - break; - case 17: - ChipLogProgress(chipTool, " ***** Test Step 17 : Read attribute position after skip forward\n"); - err = TestReadAttributePositionAfterSkipForward_17(); - break; - case 18: - ChipLogProgress(chipTool, " ***** Test Step 18 : Media Playback Skip Backward Command\n"); - err = TestMediaPlaybackSkipBackwardCommand_18(); - break; - case 19: - ChipLogProgress(chipTool, " ***** Test Step 19 : Read attribute position after skip backward\n"); - err = TestReadAttributePositionAfterSkipBackward_19(); - break; - case 20: - ChipLogProgress(chipTool, " ***** Test Step 20 : Media Playback Seek Command\n"); - err = TestMediaPlaybackSeekCommand_20(); - break; - case 21: - ChipLogProgress(chipTool, " ***** Test Step 21 : Read attribute position after seek\n"); - err = TestReadAttributePositionAfterSeek_21(); - break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 22; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - static void OnFailureCallback_1(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_1(error); - } - - static void OnSuccessCallback_1(void * context, chip::app::Clusters::MediaPlayback::PlaybackStateEnum currentState) - { - (static_cast(context))->OnSuccessResponse_1(currentState); - } - - static void OnFailureCallback_2(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_2(error); - } - - static void OnSuccessCallback_2(void * context, const chip::app::DataModel::Nullable & startTime) - { - (static_cast(context))->OnSuccessResponse_2(startTime); - } - - static void OnFailureCallback_3(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_3(error); - } - - static void OnSuccessCallback_3(void * context, const chip::app::DataModel::Nullable & duration) - { - (static_cast(context))->OnSuccessResponse_3(duration); - } - - static void OnFailureCallback_4(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_4(error); - } - - static void OnSuccessCallback_4( - void * context, - const chip::app::DataModel::Nullable & - sampledPosition) - { - (static_cast(context))->OnSuccessResponse_4(sampledPosition); - } - - static void OnFailureCallback_5(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_5(error); - } - - static void OnSuccessCallback_5(void * context, float playbackSpeed) - { - (static_cast(context))->OnSuccessResponse_5(playbackSpeed); - } - - static void OnFailureCallback_6(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_6(error); - } - - static void OnSuccessCallback_6(void * context, const chip::app::DataModel::Nullable & seekRangeEnd) - { - (static_cast(context))->OnSuccessResponse_6(seekRangeEnd); - } - - static void OnFailureCallback_7(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_7(error); - } - - static void OnSuccessCallback_7(void * context, const chip::app::DataModel::Nullable & seekRangeStart) - { - (static_cast(context))->OnSuccessResponse_7(seekRangeStart); - } - - static void OnFailureCallback_17(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_17(error); - } - - static void OnSuccessCallback_17( - void * context, - const chip::app::DataModel::Nullable & - sampledPosition) - { - (static_cast(context))->OnSuccessResponse_17(sampledPosition); - } - - static void OnFailureCallback_19(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_19(error); - } - - static void OnSuccessCallback_19( - void * context, - const chip::app::DataModel::Nullable & - sampledPosition) - { - (static_cast(context))->OnSuccessResponse_19(sampledPosition); - } - - static void OnFailureCallback_21(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_21(error); - } - - static void OnSuccessCallback_21( - void * context, - const chip::app::DataModel::Nullable & - sampledPosition) - { - (static_cast(context))->OnSuccessResponse_21(sampledPosition); - } - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestReadAttributePlaybackState_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 3; - chip::Controller::MediaPlaybackClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_1, OnFailureCallback_1, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_1(chip::app::Clusters::MediaPlayback::PlaybackStateEnum currentState) - { - VerifyOrReturn(CheckValue("currentState", currentState, 0)); - - NextTest(); - } - - CHIP_ERROR TestReadAttributeStartTime_2() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 3; - chip::Controller::MediaPlaybackClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_2, OnFailureCallback_2, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_2(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_2(const chip::app::DataModel::Nullable & startTime) - { - VerifyOrReturn(CheckValueNonNull("startTime", startTime)); - VerifyOrReturn(CheckValue("startTime.Value()", startTime.Value(), 0ULL)); - - NextTest(); - } - - CHIP_ERROR TestReadAttributeDuration_3() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 3; - chip::Controller::MediaPlaybackClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_3, OnFailureCallback_3, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_3(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_3(const chip::app::DataModel::Nullable & duration) - { - VerifyOrReturn(CheckValueNonNull("duration", duration)); - VerifyOrReturn(CheckValue("duration.Value()", duration.Value(), 80000ULL)); - - NextTest(); - } - - CHIP_ERROR TestReadAttributePosition_4() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 3; - chip::Controller::MediaPlaybackClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_4, OnFailureCallback_4, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_4(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_4( - const chip::app::DataModel::Nullable & - sampledPosition) - { - VerifyOrReturn(CheckValueNonNull("sampledPosition", sampledPosition)); - VerifyOrReturn(CheckValue("sampledPosition.Value().updatedAt", sampledPosition.Value().updatedAt, 0ULL)); - VerifyOrReturn(CheckValueNonNull("sampledPosition.Value().position", sampledPosition.Value().position)); - VerifyOrReturn(CheckValue("sampledPosition.Value().position.Value()", sampledPosition.Value().position.Value(), 0ULL)); - - NextTest(); - } - - CHIP_ERROR TestReadAttributePlaybackSpeed_5() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 3; - chip::Controller::MediaPlaybackClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_5, OnFailureCallback_5, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_5(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_5(float playbackSpeed) - { - VerifyOrReturn(CheckValue("playbackSpeed", playbackSpeed, 0.0f)); - - NextTest(); - } - - CHIP_ERROR TestReadAttributeSeekRangeEnd_6() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 3; - chip::Controller::MediaPlaybackClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_6, OnFailureCallback_6, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_6(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_6(const chip::app::DataModel::Nullable & seekRangeEnd) - { - VerifyOrReturn(CheckValueNonNull("seekRangeEnd", seekRangeEnd)); - VerifyOrReturn(CheckValue("seekRangeEnd.Value()", seekRangeEnd.Value(), 80000ULL)); - - NextTest(); - } - - CHIP_ERROR TestReadAttributeSeekRangeStart_7() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 3; - chip::Controller::MediaPlaybackClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_7, OnFailureCallback_7, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_7(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_7(const chip::app::DataModel::Nullable & seekRangeStart) - { - VerifyOrReturn(CheckValueNonNull("seekRangeStart", seekRangeStart)); - VerifyOrReturn(CheckValue("seekRangeStart.Value()", seekRangeStart.Value(), 0ULL)); - - NextTest(); - } - - CHIP_ERROR TestMediaPlaybackPlayCommand_8() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 3; - using RequestType = chip::app::Clusters::MediaPlayback::Commands::Play::Type; - - RequestType request; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_8(data.status, data.data); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_8(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_8(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_8(chip::app::Clusters::MediaPlayback::StatusEnum status, const chip::Optional & data) - { - VerifyOrReturn(CheckValue("status", status, 0)); - - VerifyOrReturn(CheckValuePresent("data", data)); - VerifyOrReturn(CheckValueAsString("data.Value()", data.Value(), chip::CharSpan("data response", 13))); - - NextTest(); - } - - CHIP_ERROR TestMediaPlaybackPauseCommand_9() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 3; - using RequestType = chip::app::Clusters::MediaPlayback::Commands::Pause::Type; - - RequestType request; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_9(data.status, data.data); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_9(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_9(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_9(chip::app::Clusters::MediaPlayback::StatusEnum status, const chip::Optional & data) - { - VerifyOrReturn(CheckValue("status", status, 0)); - - VerifyOrReturn(CheckValuePresent("data", data)); - VerifyOrReturn(CheckValueAsString("data.Value()", data.Value(), chip::CharSpan("data response", 13))); - - NextTest(); - } - - CHIP_ERROR TestMediaPlaybackStopCommand_10() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 3; - using RequestType = chip::app::Clusters::MediaPlayback::Commands::StopPlayback::Type; - - RequestType request; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_10(data.status, data.data); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_10(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_10(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_10(chip::app::Clusters::MediaPlayback::StatusEnum status, const chip::Optional & data) - { - VerifyOrReturn(CheckValue("status", status, 0)); - - VerifyOrReturn(CheckValuePresent("data", data)); - VerifyOrReturn(CheckValueAsString("data.Value()", data.Value(), chip::CharSpan("data response", 13))); - - NextTest(); - } - - CHIP_ERROR TestMediaPlaybackStartOverCommand_11() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 3; - using RequestType = chip::app::Clusters::MediaPlayback::Commands::StartOver::Type; - - RequestType request; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_11(data.status, data.data); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_11(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_11(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_11(chip::app::Clusters::MediaPlayback::StatusEnum status, const chip::Optional & data) - { - VerifyOrReturn(CheckValue("status", status, 0)); - - VerifyOrReturn(CheckValuePresent("data", data)); - VerifyOrReturn(CheckValueAsString("data.Value()", data.Value(), chip::CharSpan("data response", 13))); - - NextTest(); - } - - CHIP_ERROR TestMediaPlaybackPreviousCommand_12() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 3; - using RequestType = chip::app::Clusters::MediaPlayback::Commands::Previous::Type; - - RequestType request; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_12(data.status, data.data); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_12(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_12(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_12(chip::app::Clusters::MediaPlayback::StatusEnum status, const chip::Optional & data) - { - VerifyOrReturn(CheckValue("status", status, 0)); - - VerifyOrReturn(CheckValuePresent("data", data)); - VerifyOrReturn(CheckValueAsString("data.Value()", data.Value(), chip::CharSpan("data response", 13))); - - NextTest(); - } - - CHIP_ERROR TestMediaPlaybackNextCommand_13() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 3; - using RequestType = chip::app::Clusters::MediaPlayback::Commands::Next::Type; - - RequestType request; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_13(data.status, data.data); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_13(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_13(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_13(chip::app::Clusters::MediaPlayback::StatusEnum status, const chip::Optional & data) - { - VerifyOrReturn(CheckValue("status", status, 0)); - - VerifyOrReturn(CheckValuePresent("data", data)); - VerifyOrReturn(CheckValueAsString("data.Value()", data.Value(), chip::CharSpan("data response", 13))); - - NextTest(); - } - - CHIP_ERROR TestMediaPlaybackRewindCommand_14() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 3; - using RequestType = chip::app::Clusters::MediaPlayback::Commands::Rewind::Type; - - RequestType request; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_14(data.status, data.data); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_14(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_14(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_14(chip::app::Clusters::MediaPlayback::StatusEnum status, const chip::Optional & data) - { - VerifyOrReturn(CheckValue("status", status, 0)); - - VerifyOrReturn(CheckValuePresent("data", data)); - VerifyOrReturn(CheckValueAsString("data.Value()", data.Value(), chip::CharSpan("data response", 13))); - - NextTest(); - } - - CHIP_ERROR TestMediaPlaybackFastForwardCommand_15() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 3; - using RequestType = chip::app::Clusters::MediaPlayback::Commands::FastForward::Type; - - RequestType request; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_15(data.status, data.data); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_15(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_15(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_15(chip::app::Clusters::MediaPlayback::StatusEnum status, const chip::Optional & data) - { - VerifyOrReturn(CheckValue("status", status, 0)); - - VerifyOrReturn(CheckValuePresent("data", data)); - VerifyOrReturn(CheckValueAsString("data.Value()", data.Value(), chip::CharSpan("data response", 13))); - - NextTest(); - } - - CHIP_ERROR TestMediaPlaybackSkipForwardCommand_16() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 3; - using RequestType = chip::app::Clusters::MediaPlayback::Commands::SkipForward::Type; - - RequestType request; - request.deltaPositionMilliseconds = 500ULL; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_16(data.status, data.data); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_16(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_16(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_16(chip::app::Clusters::MediaPlayback::StatusEnum status, const chip::Optional & data) - { - VerifyOrReturn(CheckValue("status", status, 0)); - - VerifyOrReturn(CheckValuePresent("data", data)); - VerifyOrReturn(CheckValueAsString("data.Value()", data.Value(), chip::CharSpan("data response", 13))); - - NextTest(); - } - - CHIP_ERROR TestReadAttributePositionAfterSkipForward_17() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 3; - chip::Controller::MediaPlaybackClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_17, OnFailureCallback_17, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_17(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_17( - const chip::app::DataModel::Nullable & - sampledPosition) - { - VerifyOrReturn(CheckValueNonNull("sampledPosition", sampledPosition)); - VerifyOrReturn(CheckValue("sampledPosition.Value().updatedAt", sampledPosition.Value().updatedAt, 0ULL)); - VerifyOrReturn(CheckValueNonNull("sampledPosition.Value().position", sampledPosition.Value().position)); - VerifyOrReturn(CheckValue("sampledPosition.Value().position.Value()", sampledPosition.Value().position.Value(), 500ULL)); - - NextTest(); - } - - CHIP_ERROR TestMediaPlaybackSkipBackwardCommand_18() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 3; - using RequestType = chip::app::Clusters::MediaPlayback::Commands::SkipBackward::Type; - - RequestType request; - request.deltaPositionMilliseconds = 100ULL; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_18(data.status, data.data); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_18(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_18(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_18(chip::app::Clusters::MediaPlayback::StatusEnum status, const chip::Optional & data) - { - VerifyOrReturn(CheckValue("status", status, 0)); - - VerifyOrReturn(CheckValuePresent("data", data)); - VerifyOrReturn(CheckValueAsString("data.Value()", data.Value(), chip::CharSpan("data response", 13))); - - NextTest(); - } - - CHIP_ERROR TestReadAttributePositionAfterSkipBackward_19() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 3; - chip::Controller::MediaPlaybackClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_19, OnFailureCallback_19, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_19(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_19( - const chip::app::DataModel::Nullable & - sampledPosition) - { - VerifyOrReturn(CheckValueNonNull("sampledPosition", sampledPosition)); - VerifyOrReturn(CheckValue("sampledPosition.Value().updatedAt", sampledPosition.Value().updatedAt, 0ULL)); - VerifyOrReturn(CheckValueNonNull("sampledPosition.Value().position", sampledPosition.Value().position)); - VerifyOrReturn(CheckValue("sampledPosition.Value().position.Value()", sampledPosition.Value().position.Value(), 400ULL)); - - NextTest(); - } - - CHIP_ERROR TestMediaPlaybackSeekCommand_20() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 3; - using RequestType = chip::app::Clusters::MediaPlayback::Commands::Seek::Type; - - RequestType request; - request.position = 1000ULL; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_20(data.status, data.data); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_20(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_20(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_20(chip::app::Clusters::MediaPlayback::StatusEnum status, const chip::Optional & data) - { - VerifyOrReturn(CheckValue("status", status, 0)); - - VerifyOrReturn(CheckValuePresent("data", data)); - VerifyOrReturn(CheckValueAsString("data.Value()", data.Value(), chip::CharSpan("data response", 13))); - - NextTest(); - } - - CHIP_ERROR TestReadAttributePositionAfterSeek_21() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 3; - chip::Controller::MediaPlaybackClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_21, OnFailureCallback_21, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_21(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_21( - const chip::app::DataModel::Nullable & - sampledPosition) - { - VerifyOrReturn(CheckValueNonNull("sampledPosition", sampledPosition)); - VerifyOrReturn(CheckValue("sampledPosition.Value().updatedAt", sampledPosition.Value().updatedAt, 0ULL)); - VerifyOrReturn(CheckValueNonNull("sampledPosition.Value().position", sampledPosition.Value().position)); - VerifyOrReturn(CheckValue("sampledPosition.Value().position.Value()", sampledPosition.Value().position.Value(), 1000ULL)); - - NextTest(); - } -}; - -class TV_ChannelClusterSuite : public TestCommand -{ -public: - TV_ChannelClusterSuite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("TV_ChannelCluster", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~TV_ChannelClusterSuite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: TV_ChannelCluster\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: TV_ChannelCluster\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Read attribute Channel list\n"); - err = TestReadAttributeChannelList_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Read attribute channel lineup\n"); - err = TestReadAttributeChannelLineup_2(); - break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Read attribute current channel\n"); - err = TestReadAttributeCurrentChannel_3(); - break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Change Channel Command\n"); - err = TestChangeChannelCommand_4(); - break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Change Channel By Number Command\n"); - err = TestChangeChannelByNumberCommand_5(); - break; - case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : Skip Channel Command\n"); - err = TestSkipChannelCommand_6(); - break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 7; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - static void OnFailureCallback_1(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_1(error); - } - - static void OnSuccessCallback_1( - void * context, - const chip::app::DataModel::DecodableList & channelList) - { - (static_cast(context))->OnSuccessResponse_1(channelList); - } - - static void OnFailureCallback_2(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_2(error); - } - - static void OnSuccessCallback_2( - void * context, - const chip::app::DataModel::Nullable & lineup) - { - (static_cast(context))->OnSuccessResponse_2(lineup); - } - - static void OnFailureCallback_3(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_3(error); - } - - static void OnSuccessCallback_3( - void * context, - const chip::app::DataModel::Nullable & currentChannel) - { - (static_cast(context))->OnSuccessResponse_3(currentChannel); - } - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestReadAttributeChannelList_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ChannelClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_1, OnFailureCallback_1, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_1( - const chip::app::DataModel::DecodableList & channelList) - { - { - auto iter_0 = channelList.begin(); - VerifyOrReturn(CheckNextListItemDecodes("channelList", iter_0, 0)); - VerifyOrReturn(CheckValue("channelList[0].majorNumber", iter_0.GetValue().majorNumber, 6U)); - VerifyOrReturn(CheckValue("channelList[0].minorNumber", iter_0.GetValue().minorNumber, 0U)); - VerifyOrReturn(CheckValuePresent("channelList[0].name", iter_0.GetValue().name)); - VerifyOrReturn( - CheckValueAsString("channelList[0].name.Value()", iter_0.GetValue().name.Value(), chip::CharSpan("ABC", 3))); - VerifyOrReturn(CheckValuePresent("channelList[0].callSign", iter_0.GetValue().callSign)); - VerifyOrReturn(CheckValueAsString("channelList[0].callSign.Value()", iter_0.GetValue().callSign.Value(), - chip::CharSpan("KAAL-TV", 7))); - VerifyOrReturn(CheckValuePresent("channelList[0].affiliateCallSign", iter_0.GetValue().affiliateCallSign)); - VerifyOrReturn(CheckValueAsString("channelList[0].affiliateCallSign.Value()", - iter_0.GetValue().affiliateCallSign.Value(), chip::CharSpan("KAAL", 4))); - VerifyOrReturn(CheckNextListItemDecodes("channelList", iter_0, 1)); - VerifyOrReturn(CheckValue("channelList[1].majorNumber", iter_0.GetValue().majorNumber, 9U)); - VerifyOrReturn(CheckValue("channelList[1].minorNumber", iter_0.GetValue().minorNumber, 1U)); - VerifyOrReturn(CheckValuePresent("channelList[1].name", iter_0.GetValue().name)); - VerifyOrReturn( - CheckValueAsString("channelList[1].name.Value()", iter_0.GetValue().name.Value(), chip::CharSpan("PBS", 3))); - VerifyOrReturn(CheckValuePresent("channelList[1].callSign", iter_0.GetValue().callSign)); - VerifyOrReturn(CheckValueAsString("channelList[1].callSign.Value()", iter_0.GetValue().callSign.Value(), - chip::CharSpan("KCTS-TV", 7))); - VerifyOrReturn(CheckValuePresent("channelList[1].affiliateCallSign", iter_0.GetValue().affiliateCallSign)); - VerifyOrReturn(CheckValueAsString("channelList[1].affiliateCallSign.Value()", - iter_0.GetValue().affiliateCallSign.Value(), chip::CharSpan("KCTS", 4))); - VerifyOrReturn(CheckNextListItemDecodes("channelList", iter_0, 2)); - VerifyOrReturn(CheckValue("channelList[2].majorNumber", iter_0.GetValue().majorNumber, 9U)); - VerifyOrReturn(CheckValue("channelList[2].minorNumber", iter_0.GetValue().minorNumber, 2U)); - VerifyOrReturn(CheckValuePresent("channelList[2].name", iter_0.GetValue().name)); - VerifyOrReturn( - CheckValueAsString("channelList[2].name.Value()", iter_0.GetValue().name.Value(), chip::CharSpan("PBS Kids", 8))); - VerifyOrReturn(CheckValuePresent("channelList[2].callSign", iter_0.GetValue().callSign)); - VerifyOrReturn(CheckValueAsString("channelList[2].callSign.Value()", iter_0.GetValue().callSign.Value(), - chip::CharSpan("KCTS-TV", 7))); - VerifyOrReturn(CheckValuePresent("channelList[2].affiliateCallSign", iter_0.GetValue().affiliateCallSign)); - VerifyOrReturn(CheckValueAsString("channelList[2].affiliateCallSign.Value()", - iter_0.GetValue().affiliateCallSign.Value(), chip::CharSpan("KCTS", 4))); - VerifyOrReturn(CheckNextListItemDecodes("channelList", iter_0, 3)); - VerifyOrReturn(CheckValue("channelList[3].majorNumber", iter_0.GetValue().majorNumber, 9U)); - VerifyOrReturn(CheckValue("channelList[3].minorNumber", iter_0.GetValue().minorNumber, 3U)); - VerifyOrReturn(CheckValuePresent("channelList[3].name", iter_0.GetValue().name)); - VerifyOrReturn(CheckValueAsString("channelList[3].name.Value()", iter_0.GetValue().name.Value(), - chip::CharSpan("World Channel", 13))); - VerifyOrReturn(CheckValuePresent("channelList[3].callSign", iter_0.GetValue().callSign)); - VerifyOrReturn(CheckValueAsString("channelList[3].callSign.Value()", iter_0.GetValue().callSign.Value(), - chip::CharSpan("KCTS-TV", 7))); - VerifyOrReturn(CheckValuePresent("channelList[3].affiliateCallSign", iter_0.GetValue().affiliateCallSign)); - VerifyOrReturn(CheckValueAsString("channelList[3].affiliateCallSign.Value()", - iter_0.GetValue().affiliateCallSign.Value(), chip::CharSpan("KCTS", 4))); - VerifyOrReturn(CheckNoMoreListItems("channelList", iter_0, 4)); - } - - NextTest(); - } - - CHIP_ERROR TestReadAttributeChannelLineup_2() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ChannelClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_2, OnFailureCallback_2, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_2(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_2( - const chip::app::DataModel::Nullable & lineup) - { - VerifyOrReturn(CheckValueNonNull("lineup", lineup)); - VerifyOrReturn( - CheckValueAsString("lineup.Value().operatorName", lineup.Value().operatorName, chip::CharSpan("Comcast", 7))); - VerifyOrReturn(CheckValuePresent("lineup.Value().lineupName", lineup.Value().lineupName)); - VerifyOrReturn(CheckValueAsString("lineup.Value().lineupName.Value()", lineup.Value().lineupName.Value(), - chip::CharSpan("Comcast King County", 19))); - VerifyOrReturn(CheckValuePresent("lineup.Value().postalCode", lineup.Value().postalCode)); - VerifyOrReturn( - CheckValueAsString("lineup.Value().postalCode.Value()", lineup.Value().postalCode.Value(), chip::CharSpan("98052", 5))); - VerifyOrReturn(CheckValue("lineup.Value().lineupInfoType", lineup.Value().lineupInfoType, 0)); - - NextTest(); - } - - CHIP_ERROR TestReadAttributeCurrentChannel_3() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ChannelClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_3, OnFailureCallback_3, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_3(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_3( - const chip::app::DataModel::Nullable & currentChannel) - { - VerifyOrReturn(CheckValueNonNull("currentChannel", currentChannel)); - VerifyOrReturn(CheckValue("currentChannel.Value().majorNumber", currentChannel.Value().majorNumber, 6U)); - VerifyOrReturn(CheckValue("currentChannel.Value().minorNumber", currentChannel.Value().minorNumber, 0U)); - VerifyOrReturn(CheckValuePresent("currentChannel.Value().name", currentChannel.Value().name)); - VerifyOrReturn(CheckValueAsString("currentChannel.Value().name.Value()", currentChannel.Value().name.Value(), - chip::CharSpan("ABC", 3))); - VerifyOrReturn(CheckValuePresent("currentChannel.Value().callSign", currentChannel.Value().callSign)); - VerifyOrReturn(CheckValueAsString("currentChannel.Value().callSign.Value()", currentChannel.Value().callSign.Value(), - chip::CharSpan("KAAL-TV", 7))); - VerifyOrReturn(CheckValuePresent("currentChannel.Value().affiliateCallSign", currentChannel.Value().affiliateCallSign)); - VerifyOrReturn(CheckValueAsString("currentChannel.Value().affiliateCallSign.Value()", - currentChannel.Value().affiliateCallSign.Value(), chip::CharSpan("KAAL", 4))); - - NextTest(); - } - - CHIP_ERROR TestChangeChannelCommand_4() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::Channel::Commands::ChangeChannel::Type; - - RequestType request; - request.match = chip::Span("PBSgarbage: not in length on purpose", 3); - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_4(data.status, data.data); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_4(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_4(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_4(chip::app::Clusters::Channel::StatusEnum status, const chip::Optional & data) - { - VerifyOrReturn(CheckValue("status", status, 0)); - - VerifyOrReturn(CheckValuePresent("data", data)); - VerifyOrReturn(CheckValueAsString("data.Value()", data.Value(), chip::CharSpan("data response", 13))); - - NextTest(); - } - - CHIP_ERROR TestChangeChannelByNumberCommand_5() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::Channel::Commands::ChangeChannelByNumber::Type; - - RequestType request; - request.majorNumber = 6U; - request.minorNumber = 0U; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_5(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_5(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_5(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_5() { NextTest(); } - - CHIP_ERROR TestSkipChannelCommand_6() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::Channel::Commands::SkipChannel::Type; - - RequestType request; - request.count = 1U; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_6(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_6(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_6(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_6() { NextTest(); } -}; - -class TV_LowPowerClusterSuite : public TestCommand -{ -public: - TV_LowPowerClusterSuite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("TV_LowPowerCluster", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~TV_LowPowerClusterSuite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: TV_LowPowerCluster\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: TV_LowPowerCluster\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Sleep Input Status Command\n"); - err = TestSleepInputStatusCommand_1(); - break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 2; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestSleepInputStatusCommand_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::LowPower::Commands::Sleep::Type; - - RequestType request; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_1(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_1(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_1() { NextTest(); } -}; - -class TV_ContentLauncherClusterSuite : public TestCommand -{ -public: - TV_ContentLauncherClusterSuite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("TV_ContentLauncherCluster", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~TV_ContentLauncherClusterSuite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: TV_ContentLauncherCluster\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: TV_ContentLauncherCluster\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Read attribute accept header list\n"); - err = TestReadAttributeAcceptHeaderList_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Read attribute supported streaming protocols\n"); - err = TestReadAttributeSupportedStreamingProtocols_2(); - break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Launch Content Command\n"); - err = TestLaunchContentCommand_3(); - break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Launch URL Command\n"); - err = TestLaunchUrlCommand_4(); - break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 5; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - static void OnFailureCallback_1(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_1(error); - } - - static void OnSuccessCallback_1(void * context, const chip::app::DataModel::DecodableList & acceptHeader) - { - (static_cast(context))->OnSuccessResponse_1(acceptHeader); - } - - static void OnFailureCallback_2(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_2(error); - } - - static void OnSuccessCallback_2(void * context, uint32_t supportedStreamingProtocols) - { - (static_cast(context))->OnSuccessResponse_2(supportedStreamingProtocols); - } - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestReadAttributeAcceptHeaderList_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ContentLauncherClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_1, OnFailureCallback_1, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_1(const chip::app::DataModel::DecodableList & acceptHeader) - { - { - auto iter_0 = acceptHeader.begin(); - VerifyOrReturn(CheckNextListItemDecodes("acceptHeader", iter_0, 0)); - VerifyOrReturn(CheckValueAsString("acceptHeader[0]", iter_0.GetValue(), chip::CharSpan("example", 7))); - VerifyOrReturn(CheckNextListItemDecodes("acceptHeader", iter_0, 1)); - VerifyOrReturn(CheckValueAsString("acceptHeader[1]", iter_0.GetValue(), chip::CharSpan("example", 7))); - VerifyOrReturn(CheckNoMoreListItems("acceptHeader", iter_0, 2)); - } - - NextTest(); - } - - CHIP_ERROR TestReadAttributeSupportedStreamingProtocols_2() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ContentLauncherClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_2, OnFailureCallback_2, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_2(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_2(uint32_t supportedStreamingProtocols) - { - VerifyOrReturn(CheckValue("supportedStreamingProtocols", supportedStreamingProtocols, 0UL)); - - NextTest(); - } - - CHIP_ERROR TestLaunchContentCommand_3() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::ContentLauncher::Commands::LaunchContent::Type; - - ListFreer listFreer; - RequestType request; - - { - auto * listHolder_1 = new ListHolder(1); - listFreer.add(listHolder_1); - - listHolder_1->mList[0].type = static_cast(1); - listHolder_1->mList[0].value = chip::Span("exampleValuegarbage: not in length on purpose", 12); - listHolder_1->mList[0].externalIDList.Emplace(); - - { - auto * listHolder_4 = new ListHolder(1); - listFreer.add(listHolder_4); - - listHolder_4->mList[0].name = chip::Span("namegarbage: not in length on purpose", 4); - listHolder_4->mList[0].value = chip::Span("valuegarbage: not in length on purpose", 5); - - listHolder_1->mList[0].externalIDList.Value() = - chip::app::DataModel::List( - listHolder_4->mList, 1); - } - - request.search.parameterList = - chip::app::DataModel::List(listHolder_1->mList, 1); - } - - request.autoPlay = true; - request.data.Emplace(); - request.data.Value() = chip::Span("exampleDatagarbage: not in length on purpose", 11); - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_3(data.status, data.data); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_3(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_3(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_3(chip::app::Clusters::ContentLauncher::StatusEnum status, const chip::Optional & data) - { - VerifyOrReturn(CheckValue("status", status, 0)); - - VerifyOrReturn(CheckValuePresent("data", data)); - VerifyOrReturn(CheckValueAsString("data.Value()", data.Value(), chip::CharSpan("exampleData", 11))); - - NextTest(); - } - - CHIP_ERROR TestLaunchUrlCommand_4() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::ContentLauncher::Commands::LaunchURL::Type; - - RequestType request; - request.contentURL = chip::Span("exampleUrlgarbage: not in length on purpose", 10); - request.displayString.Emplace(); - request.displayString.Value() = chip::Span("exampleDisplayStringgarbage: not in length on purpose", 20); - request.brandingInformation.Emplace(); - - request.brandingInformation.Value().providerName = - chip::Span("exampleNamegarbage: not in length on purpose", 11); - request.brandingInformation.Value().background.Emplace(); - - request.brandingInformation.Value().background.Value().imageUrl.Emplace(); - request.brandingInformation.Value().background.Value().imageUrl.Value() = - chip::Span("exampleUrlgarbage: not in length on purpose", 10); - request.brandingInformation.Value().background.Value().color.Emplace(); - request.brandingInformation.Value().background.Value().color.Value() = - chip::Span("exampleColorgarbage: not in length on purpose", 12); - request.brandingInformation.Value().background.Value().size.Emplace(); - - request.brandingInformation.Value().background.Value().size.Value().width = 0; - request.brandingInformation.Value().background.Value().size.Value().height = 0; - request.brandingInformation.Value().background.Value().size.Value().metric = - static_cast(0); - - request.brandingInformation.Value().logo.Emplace(); - - request.brandingInformation.Value().logo.Value().imageUrl.Emplace(); - request.brandingInformation.Value().logo.Value().imageUrl.Value() = - chip::Span("exampleUrlgarbage: not in length on purpose", 10); - request.brandingInformation.Value().logo.Value().color.Emplace(); - request.brandingInformation.Value().logo.Value().color.Value() = - chip::Span("exampleColorgarbage: not in length on purpose", 12); - request.brandingInformation.Value().logo.Value().size.Emplace(); - - request.brandingInformation.Value().logo.Value().size.Value().width = 0; - request.brandingInformation.Value().logo.Value().size.Value().height = 0; - request.brandingInformation.Value().logo.Value().size.Value().metric = - static_cast(0); - - request.brandingInformation.Value().progressBar.Emplace(); - - request.brandingInformation.Value().progressBar.Value().imageUrl.Emplace(); - request.brandingInformation.Value().progressBar.Value().imageUrl.Value() = - chip::Span("exampleUrlgarbage: not in length on purpose", 10); - request.brandingInformation.Value().progressBar.Value().color.Emplace(); - request.brandingInformation.Value().progressBar.Value().color.Value() = - chip::Span("exampleColorgarbage: not in length on purpose", 12); - request.brandingInformation.Value().progressBar.Value().size.Emplace(); - - request.brandingInformation.Value().progressBar.Value().size.Value().width = 0; - request.brandingInformation.Value().progressBar.Value().size.Value().height = 0; - request.brandingInformation.Value().progressBar.Value().size.Value().metric = - static_cast(0); - - request.brandingInformation.Value().splash.Emplace(); - - request.brandingInformation.Value().splash.Value().imageUrl.Emplace(); - request.brandingInformation.Value().splash.Value().imageUrl.Value() = - chip::Span("exampleUrlgarbage: not in length on purpose", 10); - request.brandingInformation.Value().splash.Value().color.Emplace(); - request.brandingInformation.Value().splash.Value().color.Value() = - chip::Span("exampleColorgarbage: not in length on purpose", 12); - request.brandingInformation.Value().splash.Value().size.Emplace(); - - request.brandingInformation.Value().splash.Value().size.Value().width = 0; - request.brandingInformation.Value().splash.Value().size.Value().height = 0; - request.brandingInformation.Value().splash.Value().size.Value().metric = - static_cast(0); - - request.brandingInformation.Value().waterMark.Emplace(); - - request.brandingInformation.Value().waterMark.Value().imageUrl.Emplace(); - request.brandingInformation.Value().waterMark.Value().imageUrl.Value() = - chip::Span("exampleUrlgarbage: not in length on purpose", 10); - request.brandingInformation.Value().waterMark.Value().color.Emplace(); - request.brandingInformation.Value().waterMark.Value().color.Value() = - chip::Span("exampleColorgarbage: not in length on purpose", 12); - request.brandingInformation.Value().waterMark.Value().size.Emplace(); - - request.brandingInformation.Value().waterMark.Value().size.Value().width = 0; - request.brandingInformation.Value().waterMark.Value().size.Value().height = 0; - request.brandingInformation.Value().waterMark.Value().size.Value().metric = - static_cast(0); - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_4(data.status, data.data); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_4(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_4(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_4(chip::app::Clusters::ContentLauncher::StatusEnum status, const chip::Optional & data) - { - VerifyOrReturn(CheckValue("status", status, 0)); - - VerifyOrReturn(CheckValuePresent("data", data)); - VerifyOrReturn(CheckValueAsString("data.Value()", data.Value(), chip::CharSpan("exampleData", 11))); - - NextTest(); - } -}; - -class TV_MediaInputClusterSuite : public TestCommand -{ -public: - TV_MediaInputClusterSuite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("TV_MediaInputCluster", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~TV_MediaInputClusterSuite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: TV_MediaInputCluster\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: TV_MediaInputCluster\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Read attribute media input list\n"); - err = TestReadAttributeMediaInputList_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Read current media input\n"); - err = TestReadCurrentMediaInput_2(); - break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Select Input Command\n"); - err = TestSelectInputCommand_3(); - break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Hide Input Status Command\n"); - err = TestHideInputStatusCommand_4(); - break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Show Input Status Command\n"); - err = TestShowInputStatusCommand_5(); - break; - case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : Rename Input Command\n"); - err = TestRenameInputCommand_6(); - break; - case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : Read attribute media input list\n"); - err = TestReadAttributeMediaInputList_7(); - break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 8; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - static void OnFailureCallback_1(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_1(error); - } - - static void OnSuccessCallback_1( - void * context, - const chip::app::DataModel::DecodableList & inputList) - { - (static_cast(context))->OnSuccessResponse_1(inputList); - } - - static void OnFailureCallback_2(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_2(error); - } - - static void OnSuccessCallback_2(void * context, uint8_t currentInput) - { - (static_cast(context))->OnSuccessResponse_2(currentInput); - } - - static void OnFailureCallback_7(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_7(error); - } - - static void OnSuccessCallback_7( - void * context, - const chip::app::DataModel::DecodableList & inputList) - { - (static_cast(context))->OnSuccessResponse_7(inputList); - } - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestReadAttributeMediaInputList_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::MediaInputClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_1, OnFailureCallback_1, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_1( - const chip::app::DataModel::DecodableList & inputList) - { - { - auto iter_0 = inputList.begin(); - VerifyOrReturn(CheckNextListItemDecodes("inputList", iter_0, 0)); - VerifyOrReturn(CheckValue("inputList[0].index", iter_0.GetValue().index, 1)); - VerifyOrReturn(CheckValue("inputList[0].inputType", iter_0.GetValue().inputType, 4)); - VerifyOrReturn(CheckValueAsString("inputList[0].name", iter_0.GetValue().name, chip::CharSpan("HDMI", 4))); - VerifyOrReturn(CheckValueAsString("inputList[0].description", iter_0.GetValue().description, - chip::CharSpan("High-Definition Multimedia Interface", 36))); - VerifyOrReturn(CheckNextListItemDecodes("inputList", iter_0, 1)); - VerifyOrReturn(CheckValue("inputList[1].index", iter_0.GetValue().index, 2)); - VerifyOrReturn(CheckValue("inputList[1].inputType", iter_0.GetValue().inputType, 4)); - VerifyOrReturn(CheckValueAsString("inputList[1].name", iter_0.GetValue().name, chip::CharSpan("HDMI", 4))); - VerifyOrReturn(CheckValueAsString("inputList[1].description", iter_0.GetValue().description, - chip::CharSpan("High-Definition Multimedia Interface", 36))); - VerifyOrReturn(CheckNoMoreListItems("inputList", iter_0, 2)); - } - - NextTest(); - } - - CHIP_ERROR TestReadCurrentMediaInput_2() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::MediaInputClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_2, OnFailureCallback_2, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_2(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_2(uint8_t currentInput) - { - VerifyOrReturn(CheckValue("currentInput", currentInput, 1)); - - NextTest(); - } - - CHIP_ERROR TestSelectInputCommand_3() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::MediaInput::Commands::SelectInput::Type; - - RequestType request; - request.index = 1; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_3(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_3(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_3(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_3() { NextTest(); } - - CHIP_ERROR TestHideInputStatusCommand_4() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::MediaInput::Commands::HideInputStatus::Type; - - RequestType request; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_4(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_4(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_4(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_4() { NextTest(); } - - CHIP_ERROR TestShowInputStatusCommand_5() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::MediaInput::Commands::ShowInputStatus::Type; - - RequestType request; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_5(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_5(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_5(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_5() { NextTest(); } - - CHIP_ERROR TestRenameInputCommand_6() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::MediaInput::Commands::RenameInput::Type; - - RequestType request; - request.index = 1; - request.name = chip::Span("HDMI Testgarbage: not in length on purpose", 9); - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_6(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_6(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_6(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_6() { NextTest(); } - - CHIP_ERROR TestReadAttributeMediaInputList_7() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::MediaInputClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_7, OnFailureCallback_7, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_7(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_7( - const chip::app::DataModel::DecodableList & inputList) - { - { - auto iter_0 = inputList.begin(); - VerifyOrReturn(CheckNextListItemDecodes("inputList", iter_0, 0)); - VerifyOrReturn(CheckValue("inputList[0].index", iter_0.GetValue().index, 1)); - VerifyOrReturn(CheckValue("inputList[0].inputType", iter_0.GetValue().inputType, 4)); - VerifyOrReturn(CheckValueAsString("inputList[0].name", iter_0.GetValue().name, chip::CharSpan("HDMI Test", 9))); - VerifyOrReturn(CheckValueAsString("inputList[0].description", iter_0.GetValue().description, - chip::CharSpan("High-Definition Multimedia Interface", 36))); - VerifyOrReturn(CheckNextListItemDecodes("inputList", iter_0, 1)); - VerifyOrReturn(CheckValue("inputList[1].index", iter_0.GetValue().index, 2)); - VerifyOrReturn(CheckValue("inputList[1].inputType", iter_0.GetValue().inputType, 4)); - VerifyOrReturn(CheckValueAsString("inputList[1].name", iter_0.GetValue().name, chip::CharSpan("HDMI", 4))); - VerifyOrReturn(CheckValueAsString("inputList[1].description", iter_0.GetValue().description, - chip::CharSpan("High-Definition Multimedia Interface", 36))); - VerifyOrReturn(CheckNoMoreListItems("inputList", iter_0, 2)); - } - - NextTest(); - } -}; - -class TestClusterSuite : public TestCommand -{ -public: - TestClusterSuite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("TestCluster", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~TestClusterSuite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: TestCluster\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: TestCluster\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Send Test Command\n"); - err = TestSendTestCommand_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Send Test Not Handled Command\n"); - err = TestSendTestNotHandledCommand_2(); - break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Send Test Specific Command\n"); - err = TestSendTestSpecificCommand_3(); - break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Send Test Add Arguments Command\n"); - err = TestSendTestAddArgumentsCommand_4(); - break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Send failing Test Add Arguments Command\n"); - err = TestSendFailingTestAddArgumentsCommand_5(); - break; - case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : Read attribute BOOLEAN Default Value\n"); - err = TestReadAttributeBooleanDefaultValue_6(); - break; - case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : Write attribute BOOLEAN True\n"); - err = TestWriteAttributeBooleanTrue_7(); - break; - case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : Read attribute BOOLEAN True\n"); - err = TestReadAttributeBooleanTrue_8(); - break; - case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : Write attribute BOOLEAN False\n"); - err = TestWriteAttributeBooleanFalse_9(); - break; - case 10: - ChipLogProgress(chipTool, " ***** Test Step 10 : Read attribute BOOLEAN False\n"); - err = TestReadAttributeBooleanFalse_10(); - break; - case 11: - ChipLogProgress(chipTool, " ***** Test Step 11 : Read attribute BITMAP8 Default Value\n"); - err = TestReadAttributeBitmap8DefaultValue_11(); - break; - case 12: - ChipLogProgress(chipTool, " ***** Test Step 12 : Write attribute BITMAP8 Max Value\n"); - err = TestWriteAttributeBitmap8MaxValue_12(); - break; - case 13: - ChipLogProgress(chipTool, " ***** Test Step 13 : Read attribute BITMAP8 Max Value\n"); - err = TestReadAttributeBitmap8MaxValue_13(); - break; - case 14: - ChipLogProgress(chipTool, " ***** Test Step 14 : Write attribute BITMAP8 Min Value\n"); - err = TestWriteAttributeBitmap8MinValue_14(); - break; - case 15: - ChipLogProgress(chipTool, " ***** Test Step 15 : Read attribute BITMAP8 Min Value\n"); - err = TestReadAttributeBitmap8MinValue_15(); - break; - case 16: - ChipLogProgress(chipTool, " ***** Test Step 16 : Read attribute BITMAP16 Default Value\n"); - err = TestReadAttributeBitmap16DefaultValue_16(); - break; - case 17: - ChipLogProgress(chipTool, " ***** Test Step 17 : Write attribute BITMAP16 Max Value\n"); - err = TestWriteAttributeBitmap16MaxValue_17(); - break; - case 18: - ChipLogProgress(chipTool, " ***** Test Step 18 : Read attribute BITMAP16 Max Value\n"); - err = TestReadAttributeBitmap16MaxValue_18(); - break; - case 19: - ChipLogProgress(chipTool, " ***** Test Step 19 : Write attribute BITMAP16 Min Value\n"); - err = TestWriteAttributeBitmap16MinValue_19(); - break; - case 20: - ChipLogProgress(chipTool, " ***** Test Step 20 : Read attribute BITMAP16 Min Value\n"); - err = TestReadAttributeBitmap16MinValue_20(); - break; - case 21: - ChipLogProgress(chipTool, " ***** Test Step 21 : Read attribute BITMAP32 Default Value\n"); - err = TestReadAttributeBitmap32DefaultValue_21(); - break; - case 22: - ChipLogProgress(chipTool, " ***** Test Step 22 : Write attribute BITMAP32 Max Value\n"); - err = TestWriteAttributeBitmap32MaxValue_22(); - break; - case 23: - ChipLogProgress(chipTool, " ***** Test Step 23 : Read attribute BITMAP32 Max Value\n"); - err = TestReadAttributeBitmap32MaxValue_23(); - break; - case 24: - ChipLogProgress(chipTool, " ***** Test Step 24 : Write attribute BITMAP32 Min Value\n"); - err = TestWriteAttributeBitmap32MinValue_24(); - break; - case 25: - ChipLogProgress(chipTool, " ***** Test Step 25 : Read attribute BITMAP32 Min Value\n"); - err = TestReadAttributeBitmap32MinValue_25(); - break; - case 26: - ChipLogProgress(chipTool, " ***** Test Step 26 : Read attribute BITMAP64 Default Value\n"); - err = TestReadAttributeBitmap64DefaultValue_26(); - break; - case 27: - ChipLogProgress(chipTool, " ***** Test Step 27 : Write attribute BITMAP64 Max Value\n"); - err = TestWriteAttributeBitmap64MaxValue_27(); - break; - case 28: - ChipLogProgress(chipTool, " ***** Test Step 28 : Read attribute BITMAP64 Max Value\n"); - err = TestReadAttributeBitmap64MaxValue_28(); - break; - case 29: - ChipLogProgress(chipTool, " ***** Test Step 29 : Write attribute BITMAP64 Min Value\n"); - err = TestWriteAttributeBitmap64MinValue_29(); - break; - case 30: - ChipLogProgress(chipTool, " ***** Test Step 30 : Read attribute BITMAP64 Min Value\n"); - err = TestReadAttributeBitmap64MinValue_30(); - break; - case 31: - ChipLogProgress(chipTool, " ***** Test Step 31 : Read attribute INT8U Default Value\n"); - err = TestReadAttributeInt8uDefaultValue_31(); - break; - case 32: - ChipLogProgress(chipTool, " ***** Test Step 32 : Write attribute INT8U Max Value\n"); - err = TestWriteAttributeInt8uMaxValue_32(); - break; - case 33: - ChipLogProgress(chipTool, " ***** Test Step 33 : Read attribute INT8U Max Value\n"); - err = TestReadAttributeInt8uMaxValue_33(); - break; - case 34: - ChipLogProgress(chipTool, " ***** Test Step 34 : Write attribute INT8U Min Value\n"); - err = TestWriteAttributeInt8uMinValue_34(); - break; - case 35: - ChipLogProgress(chipTool, " ***** Test Step 35 : Read attribute INT8U Min Value\n"); - err = TestReadAttributeInt8uMinValue_35(); - break; - case 36: - ChipLogProgress(chipTool, " ***** Test Step 36 : Read attribute INT16U Default Value\n"); - err = TestReadAttributeInt16uDefaultValue_36(); - break; - case 37: - ChipLogProgress(chipTool, " ***** Test Step 37 : Write attribute INT16U Max Value\n"); - err = TestWriteAttributeInt16uMaxValue_37(); - break; - case 38: - ChipLogProgress(chipTool, " ***** Test Step 38 : Read attribute INT16U Max Value\n"); - err = TestReadAttributeInt16uMaxValue_38(); - break; - case 39: - ChipLogProgress(chipTool, " ***** Test Step 39 : Write attribute INT16U Min Value\n"); - err = TestWriteAttributeInt16uMinValue_39(); - break; - case 40: - ChipLogProgress(chipTool, " ***** Test Step 40 : Read attribute INT16U Min Value\n"); - err = TestReadAttributeInt16uMinValue_40(); - break; - case 41: - ChipLogProgress(chipTool, " ***** Test Step 41 : Read attribute INT32U Default Value\n"); - err = TestReadAttributeInt32uDefaultValue_41(); - break; - case 42: - ChipLogProgress(chipTool, " ***** Test Step 42 : Write attribute INT32U Max Value\n"); - err = TestWriteAttributeInt32uMaxValue_42(); - break; - case 43: - ChipLogProgress(chipTool, " ***** Test Step 43 : Read attribute INT32U Max Value\n"); - err = TestReadAttributeInt32uMaxValue_43(); - break; - case 44: - ChipLogProgress(chipTool, " ***** Test Step 44 : Write attribute INT32U Min Value\n"); - err = TestWriteAttributeInt32uMinValue_44(); - break; - case 45: - ChipLogProgress(chipTool, " ***** Test Step 45 : Read attribute INT32U Min Value\n"); - err = TestReadAttributeInt32uMinValue_45(); - break; - case 46: - ChipLogProgress(chipTool, " ***** Test Step 46 : Read attribute INT64U Default Value\n"); - err = TestReadAttributeInt64uDefaultValue_46(); - break; - case 47: - ChipLogProgress(chipTool, " ***** Test Step 47 : Write attribute INT64U Max Value\n"); - err = TestWriteAttributeInt64uMaxValue_47(); - break; - case 48: - ChipLogProgress(chipTool, " ***** Test Step 48 : Read attribute INT64U Max Value\n"); - err = TestReadAttributeInt64uMaxValue_48(); - break; - case 49: - ChipLogProgress(chipTool, " ***** Test Step 49 : Write attribute INT64U Min Value\n"); - err = TestWriteAttributeInt64uMinValue_49(); - break; - case 50: - ChipLogProgress(chipTool, " ***** Test Step 50 : Read attribute INT64U Min Value\n"); - err = TestReadAttributeInt64uMinValue_50(); - break; - case 51: - ChipLogProgress(chipTool, " ***** Test Step 51 : Read attribute INT8S Default Value\n"); - err = TestReadAttributeInt8sDefaultValue_51(); - break; - case 52: - ChipLogProgress(chipTool, " ***** Test Step 52 : Write attribute INT8S Max Value\n"); - err = TestWriteAttributeInt8sMaxValue_52(); - break; - case 53: - ChipLogProgress(chipTool, " ***** Test Step 53 : Read attribute INT8S Max Value\n"); - err = TestReadAttributeInt8sMaxValue_53(); - break; - case 54: - ChipLogProgress(chipTool, " ***** Test Step 54 : Write attribute INT8S Min Value\n"); - err = TestWriteAttributeInt8sMinValue_54(); - break; - case 55: - ChipLogProgress(chipTool, " ***** Test Step 55 : Read attribute INT8S Min Value\n"); - err = TestReadAttributeInt8sMinValue_55(); - break; - case 56: - ChipLogProgress(chipTool, " ***** Test Step 56 : Write attribute INT8S Default Value\n"); - err = TestWriteAttributeInt8sDefaultValue_56(); - break; - case 57: - ChipLogProgress(chipTool, " ***** Test Step 57 : Read attribute INT8S Default Value\n"); - err = TestReadAttributeInt8sDefaultValue_57(); - break; - case 58: - ChipLogProgress(chipTool, " ***** Test Step 58 : Read attribute INT16S Default Value\n"); - err = TestReadAttributeInt16sDefaultValue_58(); - break; - case 59: - ChipLogProgress(chipTool, " ***** Test Step 59 : Write attribute INT16S Max Value\n"); - err = TestWriteAttributeInt16sMaxValue_59(); - break; - case 60: - ChipLogProgress(chipTool, " ***** Test Step 60 : Read attribute INT16S Max Value\n"); - err = TestReadAttributeInt16sMaxValue_60(); - break; - case 61: - ChipLogProgress(chipTool, " ***** Test Step 61 : Write attribute INT16S Min Value\n"); - err = TestWriteAttributeInt16sMinValue_61(); - break; - case 62: - ChipLogProgress(chipTool, " ***** Test Step 62 : Read attribute INT16S Min Value\n"); - err = TestReadAttributeInt16sMinValue_62(); - break; - case 63: - ChipLogProgress(chipTool, " ***** Test Step 63 : Write attribute INT16S Default Value\n"); - err = TestWriteAttributeInt16sDefaultValue_63(); - break; - case 64: - ChipLogProgress(chipTool, " ***** Test Step 64 : Read attribute INT16S Default Value\n"); - err = TestReadAttributeInt16sDefaultValue_64(); - break; - case 65: - ChipLogProgress(chipTool, " ***** Test Step 65 : Read attribute INT32S Default Value\n"); - err = TestReadAttributeInt32sDefaultValue_65(); - break; - case 66: - ChipLogProgress(chipTool, " ***** Test Step 66 : Write attribute INT32S Max Value\n"); - err = TestWriteAttributeInt32sMaxValue_66(); - break; - case 67: - ChipLogProgress(chipTool, " ***** Test Step 67 : Read attribute INT32S Max Value\n"); - err = TestReadAttributeInt32sMaxValue_67(); - break; - case 68: - ChipLogProgress(chipTool, " ***** Test Step 68 : Write attribute INT32S Min Value\n"); - err = TestWriteAttributeInt32sMinValue_68(); - break; - case 69: - ChipLogProgress(chipTool, " ***** Test Step 69 : Read attribute INT32S Min Value\n"); - err = TestReadAttributeInt32sMinValue_69(); - break; - case 70: - ChipLogProgress(chipTool, " ***** Test Step 70 : Write attribute INT32S Default Value\n"); - err = TestWriteAttributeInt32sDefaultValue_70(); - break; - case 71: - ChipLogProgress(chipTool, " ***** Test Step 71 : Read attribute INT32S Default Value\n"); - err = TestReadAttributeInt32sDefaultValue_71(); - break; - case 72: - ChipLogProgress(chipTool, " ***** Test Step 72 : Read attribute INT64S Default Value\n"); - err = TestReadAttributeInt64sDefaultValue_72(); - break; - case 73: - ChipLogProgress(chipTool, " ***** Test Step 73 : Write attribute INT64S Max Value\n"); - err = TestWriteAttributeInt64sMaxValue_73(); - break; - case 74: - ChipLogProgress(chipTool, " ***** Test Step 74 : Read attribute INT64S Max Value\n"); - err = TestReadAttributeInt64sMaxValue_74(); - break; - case 75: - ChipLogProgress(chipTool, " ***** Test Step 75 : Write attribute INT64S Min Value\n"); - err = TestWriteAttributeInt64sMinValue_75(); - break; - case 76: - ChipLogProgress(chipTool, " ***** Test Step 76 : Read attribute INT64S Min Value\n"); - err = TestReadAttributeInt64sMinValue_76(); - break; - case 77: - ChipLogProgress(chipTool, " ***** Test Step 77 : Write attribute INT64S Default Value\n"); - err = TestWriteAttributeInt64sDefaultValue_77(); - break; - case 78: - ChipLogProgress(chipTool, " ***** Test Step 78 : Read attribute INT64S Default Value\n"); - err = TestReadAttributeInt64sDefaultValue_78(); - break; - case 79: - ChipLogProgress(chipTool, " ***** Test Step 79 : Read attribute SINGLE Default Value\n"); - err = TestReadAttributeSingleDefaultValue_79(); - break; - case 80: - ChipLogProgress(chipTool, " ***** Test Step 80 : Write attribute SINGLE medium Value\n"); - err = TestWriteAttributeSingleMediumValue_80(); - break; - case 81: - ChipLogProgress(chipTool, " ***** Test Step 81 : Read attribute SINGLE medium Value\n"); - err = TestReadAttributeSingleMediumValue_81(); - break; - case 82: - ChipLogProgress(chipTool, " ***** Test Step 82 : Write attribute SINGLE large Value\n"); - err = TestWriteAttributeSingleLargeValue_82(); - break; - case 83: - ChipLogProgress(chipTool, " ***** Test Step 83 : Read attribute SINGLE large Value\n"); - err = TestReadAttributeSingleLargeValue_83(); - break; - case 84: - ChipLogProgress(chipTool, " ***** Test Step 84 : Write attribute SINGLE small Value\n"); - err = TestWriteAttributeSingleSmallValue_84(); - break; - case 85: - ChipLogProgress(chipTool, " ***** Test Step 85 : Read attribute SINGLE small Value\n"); - err = TestReadAttributeSingleSmallValue_85(); - break; - case 86: - ChipLogProgress(chipTool, " ***** Test Step 86 : Write attribute SINGLE Default Value\n"); - err = TestWriteAttributeSingleDefaultValue_86(); - break; - case 87: - ChipLogProgress(chipTool, " ***** Test Step 87 : Read attribute SINGLE Default Value\n"); - err = TestReadAttributeSingleDefaultValue_87(); - break; - case 88: - ChipLogProgress(chipTool, " ***** Test Step 88 : Read attribute DOUBLE Default Value\n"); - err = TestReadAttributeDoubleDefaultValue_88(); - break; - case 89: - ChipLogProgress(chipTool, " ***** Test Step 89 : Write attribute DOUBLE medium Value\n"); - err = TestWriteAttributeDoubleMediumValue_89(); - break; - case 90: - ChipLogProgress(chipTool, " ***** Test Step 90 : Read attribute DOUBLE medium Value\n"); - err = TestReadAttributeDoubleMediumValue_90(); - break; - case 91: - ChipLogProgress(chipTool, " ***** Test Step 91 : Write attribute DOUBLE large Value\n"); - err = TestWriteAttributeDoubleLargeValue_91(); - break; - case 92: - ChipLogProgress(chipTool, " ***** Test Step 92 : Read attribute DOUBLE large Value\n"); - err = TestReadAttributeDoubleLargeValue_92(); - break; - case 93: - ChipLogProgress(chipTool, " ***** Test Step 93 : Write attribute DOUBLE small Value\n"); - err = TestWriteAttributeDoubleSmallValue_93(); - break; - case 94: - ChipLogProgress(chipTool, " ***** Test Step 94 : Read attribute DOUBLE small Value\n"); - err = TestReadAttributeDoubleSmallValue_94(); - break; - case 95: - ChipLogProgress(chipTool, " ***** Test Step 95 : Write attribute DOUBLE Default Value\n"); - err = TestWriteAttributeDoubleDefaultValue_95(); - break; - case 96: - ChipLogProgress(chipTool, " ***** Test Step 96 : Read attribute DOUBLE Default Value\n"); - err = TestReadAttributeDoubleDefaultValue_96(); - break; - case 97: - ChipLogProgress(chipTool, " ***** Test Step 97 : Read attribute ENUM8 Default Value\n"); - err = TestReadAttributeEnum8DefaultValue_97(); - break; - case 98: - ChipLogProgress(chipTool, " ***** Test Step 98 : Write attribute ENUM8 Max Value\n"); - err = TestWriteAttributeEnum8MaxValue_98(); - break; - case 99: - ChipLogProgress(chipTool, " ***** Test Step 99 : Read attribute ENUM8 Max Value\n"); - err = TestReadAttributeEnum8MaxValue_99(); - break; - case 100: - ChipLogProgress(chipTool, " ***** Test Step 100 : Write attribute ENUM8 Min Value\n"); - err = TestWriteAttributeEnum8MinValue_100(); - break; - case 101: - ChipLogProgress(chipTool, " ***** Test Step 101 : Read attribute ENUM8 Min Value\n"); - err = TestReadAttributeEnum8MinValue_101(); - break; - case 102: - ChipLogProgress(chipTool, " ***** Test Step 102 : Read attribute ENUM16 Default Value\n"); - err = TestReadAttributeEnum16DefaultValue_102(); - break; - case 103: - ChipLogProgress(chipTool, " ***** Test Step 103 : Write attribute ENUM16 Max Value\n"); - err = TestWriteAttributeEnum16MaxValue_103(); - break; - case 104: - ChipLogProgress(chipTool, " ***** Test Step 104 : Read attribute ENUM16 Max Value\n"); - err = TestReadAttributeEnum16MaxValue_104(); - break; - case 105: - ChipLogProgress(chipTool, " ***** Test Step 105 : Write attribute ENUM16 Min Value\n"); - err = TestWriteAttributeEnum16MinValue_105(); - break; - case 106: - ChipLogProgress(chipTool, " ***** Test Step 106 : Read attribute ENUM16 Min Value\n"); - err = TestReadAttributeEnum16MinValue_106(); - break; - case 107: - ChipLogProgress(chipTool, " ***** Test Step 107 : Read attribute OCTET_STRING Default Value\n"); - err = TestReadAttributeOctetStringDefaultValue_107(); - break; - case 108: - ChipLogProgress(chipTool, " ***** Test Step 108 : Write attribute OCTET_STRING with embedded null\n"); - err = TestWriteAttributeOctetStringWithEmbeddedNull_108(); - break; - case 109: - ChipLogProgress(chipTool, " ***** Test Step 109 : Read attribute OCTET_STRING with embedded null\n"); - err = TestReadAttributeOctetStringWithEmbeddedNull_109(); - break; - case 110: - ChipLogProgress(chipTool, " ***** Test Step 110 : Write attribute OCTET_STRING with weird chars\n"); - err = TestWriteAttributeOctetStringWithWeirdChars_110(); - break; - case 111: - ChipLogProgress(chipTool, " ***** Test Step 111 : Read attribute OCTET_STRING with weird chars\n"); - err = TestReadAttributeOctetStringWithWeirdChars_111(); - break; - case 112: - ChipLogProgress(chipTool, " ***** Test Step 112 : Write attribute OCTET_STRING\n"); - err = TestWriteAttributeOctetString_112(); - break; - case 113: - ChipLogProgress(chipTool, " ***** Test Step 113 : Read attribute OCTET_STRING\n"); - err = TestReadAttributeOctetString_113(); - break; - case 114: - ChipLogProgress(chipTool, " ***** Test Step 114 : Write attribute OCTET_STRING\n"); - err = TestWriteAttributeOctetString_114(); - break; - case 115: - ChipLogProgress(chipTool, " ***** Test Step 115 : Read attribute OCTET_STRING\n"); - err = TestReadAttributeOctetString_115(); - break; - case 116: - ChipLogProgress(chipTool, " ***** Test Step 116 : Write attribute OCTET_STRING\n"); - err = TestWriteAttributeOctetString_116(); - break; - case 117: - ChipLogProgress(chipTool, " ***** Test Step 117 : Read attribute LONG_OCTET_STRING Default Value\n"); - err = TestReadAttributeLongOctetStringDefaultValue_117(); - break; - case 118: - ChipLogProgress(chipTool, " ***** Test Step 118 : Write attribute LONG_OCTET_STRING\n"); - err = TestWriteAttributeLongOctetString_118(); - break; - case 119: - ChipLogProgress(chipTool, " ***** Test Step 119 : Read attribute LONG_OCTET_STRING\n"); - err = TestReadAttributeLongOctetString_119(); - break; - case 120: - ChipLogProgress(chipTool, " ***** Test Step 120 : Write attribute LONG_OCTET_STRING\n"); - err = TestWriteAttributeLongOctetString_120(); - break; - case 121: - ChipLogProgress(chipTool, " ***** Test Step 121 : Read attribute CHAR_STRING Default Value\n"); - err = TestReadAttributeCharStringDefaultValue_121(); - break; - case 122: - ChipLogProgress(chipTool, " ***** Test Step 122 : Write attribute CHAR_STRING\n"); - err = TestWriteAttributeCharString_122(); - break; - case 123: - ChipLogProgress(chipTool, " ***** Test Step 123 : Read attribute CHAR_STRING\n"); - err = TestReadAttributeCharString_123(); - break; - case 124: - ChipLogProgress(chipTool, " ***** Test Step 124 : Write attribute CHAR_STRING - Value too long\n"); - err = TestWriteAttributeCharStringValueTooLong_124(); - break; - case 125: - ChipLogProgress(chipTool, " ***** Test Step 125 : Read attribute CHAR_STRING\n"); - err = TestReadAttributeCharString_125(); - break; - case 126: - ChipLogProgress(chipTool, " ***** Test Step 126 : Write attribute CHAR_STRING - Empty\n"); - err = TestWriteAttributeCharStringEmpty_126(); - break; - case 127: - ChipLogProgress(chipTool, " ***** Test Step 127 : Read attribute LONG_CHAR_STRING Default Value\n"); - err = TestReadAttributeLongCharStringDefaultValue_127(); - break; - case 128: - ChipLogProgress(chipTool, " ***** Test Step 128 : Write attribute LONG_CHAR_STRING\n"); - err = TestWriteAttributeLongCharString_128(); - break; - case 129: - ChipLogProgress(chipTool, " ***** Test Step 129 : Read attribute LONG_CHAR_STRING\n"); - err = TestReadAttributeLongCharString_129(); - break; - case 130: - ChipLogProgress(chipTool, " ***** Test Step 130 : Write attribute LONG_CHAR_STRING\n"); - err = TestWriteAttributeLongCharString_130(); - break; - case 131: - ChipLogProgress(chipTool, " ***** Test Step 131 : Read attribute LIST_LONG_OCTET_STRING (for chunked read)\n"); - err = TestReadAttributeListLongOctetStringForChunkedRead_131(); - break; - case 132: - ChipLogProgress(chipTool, " ***** Test Step 132 : Write attribute LIST_LONG_OCTET_STRING (for chunked write)\n"); - err = TestWriteAttributeListLongOctetStringForChunkedWrite_132(); - break; - case 133: - ChipLogProgress(chipTool, " ***** Test Step 133 : Read attribute LIST_LONG_OCTET_STRING (for chunked read)\n"); - err = TestReadAttributeListLongOctetStringForChunkedRead_133(); - break; - case 134: - ChipLogProgress(chipTool, " ***** Test Step 134 : Read attribute EPOCH_US Default Value\n"); - err = TestReadAttributeEpochUsDefaultValue_134(); - break; - case 135: - ChipLogProgress(chipTool, " ***** Test Step 135 : Write attribute EPOCH_US Max Value\n"); - err = TestWriteAttributeEpochUsMaxValue_135(); - break; - case 136: - ChipLogProgress(chipTool, " ***** Test Step 136 : Read attribute EPOCH_US Max Value\n"); - err = TestReadAttributeEpochUsMaxValue_136(); - break; - case 137: - ChipLogProgress(chipTool, " ***** Test Step 137 : Write attribute EPOCH_US Min Value\n"); - err = TestWriteAttributeEpochUsMinValue_137(); - break; - case 138: - ChipLogProgress(chipTool, " ***** Test Step 138 : Read attribute EPOCH_US Min Value\n"); - err = TestReadAttributeEpochUsMinValue_138(); - break; - case 139: - ChipLogProgress(chipTool, " ***** Test Step 139 : Read attribute EPOCH_S Default Value\n"); - err = TestReadAttributeEpochSDefaultValue_139(); - break; - case 140: - ChipLogProgress(chipTool, " ***** Test Step 140 : Write attribute EPOCH_S Max Value\n"); - err = TestWriteAttributeEpochSMaxValue_140(); - break; - case 141: - ChipLogProgress(chipTool, " ***** Test Step 141 : Read attribute EPOCH_S Max Value\n"); - err = TestReadAttributeEpochSMaxValue_141(); - break; - case 142: - ChipLogProgress(chipTool, " ***** Test Step 142 : Write attribute EPOCH_S Min Value\n"); - err = TestWriteAttributeEpochSMinValue_142(); - break; - case 143: - ChipLogProgress(chipTool, " ***** Test Step 143 : Read attribute EPOCH_S Min Value\n"); - err = TestReadAttributeEpochSMinValue_143(); - break; - case 144: - ChipLogProgress(chipTool, " ***** Test Step 144 : Read attribute UNSUPPORTED\n"); - err = TestReadAttributeUnsupported_144(); - break; - case 145: - ChipLogProgress(chipTool, " ***** Test Step 145 : Writeattribute UNSUPPORTED\n"); - err = TestWriteattributeUnsupported_145(); - break; - case 146: - ChipLogProgress(chipTool, " ***** Test Step 146 : Send Test Command to unsupported endpoint\n"); - err = TestSendTestCommandToUnsupportedEndpoint_146(); - break; - case 147: - ChipLogProgress(chipTool, " ***** Test Step 147 : Send Test Command to unsupported cluster\n"); - err = TestSendTestCommandToUnsupportedCluster_147(); - break; - case 148: - ChipLogProgress(chipTool, " ***** Test Step 148 : Read attribute vendor_id Default Value\n"); - err = TestReadAttributeVendorIdDefaultValue_148(); - break; - case 149: - ChipLogProgress(chipTool, " ***** Test Step 149 : Write attribute vendor_id\n"); - err = TestWriteAttributeVendorId_149(); - break; - case 150: - ChipLogProgress(chipTool, " ***** Test Step 150 : Read attribute vendor_id\n"); - err = TestReadAttributeVendorId_150(); - break; - case 151: - ChipLogProgress(chipTool, " ***** Test Step 151 : Restore attribute vendor_id\n"); - err = TestRestoreAttributeVendorId_151(); - break; - case 152: - ChipLogProgress(chipTool, " ***** Test Step 152 : Send a command with a vendor_id and enum\n"); - err = TestSendACommandWithAVendorIdAndEnum_152(); - break; - case 153: - ChipLogProgress(chipTool, " ***** Test Step 153 : Send Test Command With Struct Argument and arg1.b is true\n"); - err = TestSendTestCommandWithStructArgumentAndArg1bIsTrue_153(); - break; - case 154: - ChipLogProgress(chipTool, " ***** Test Step 154 : Send Test Command With Struct Argument and arg1.b is false\n"); - err = TestSendTestCommandWithStructArgumentAndArg1bIsFalse_154(); - break; - case 155: - ChipLogProgress(chipTool, - " ***** Test Step 155 : Send Test Command With Nested Struct Argument and arg1.c.b is true\n"); - err = TestSendTestCommandWithNestedStructArgumentAndArg1cbIsTrue_155(); - break; - case 156: - ChipLogProgress(chipTool, " ***** Test Step 156 : Send Test Command With Nested Struct Argument arg1.c.b is false\n"); - err = TestSendTestCommandWithNestedStructArgumentArg1cbIsFalse_156(); - break; - case 157: - ChipLogProgress( - chipTool, - " ***** Test Step 157 : Send Test Command With Nested Struct List Argument and all fields b of arg1.d are true\n"); - err = TestSendTestCommandWithNestedStructListArgumentAndAllFieldsBOfArg1dAreTrue_157(); - break; - case 158: - ChipLogProgress(chipTool, - " ***** Test Step 158 : Send Test Command With Nested Struct List Argument and some fields b of arg1.d " - "are false\n"); - err = TestSendTestCommandWithNestedStructListArgumentAndSomeFieldsBOfArg1dAreFalse_158(); - break; - case 159: - ChipLogProgress(chipTool, " ***** Test Step 159 : Send Test Command With Struct Argument and see what we get back\n"); - err = TestSendTestCommandWithStructArgumentAndSeeWhatWeGetBack_159(); - break; - case 160: - ChipLogProgress(chipTool, " ***** Test Step 160 : Send Test Command With List of INT8U and none of them is set to 0\n"); - err = TestSendTestCommandWithListOfInt8uAndNoneOfThemIsSetTo0_160(); - break; - case 161: - ChipLogProgress(chipTool, " ***** Test Step 161 : Send Test Command With List of INT8U and one of them is set to 0\n"); - err = TestSendTestCommandWithListOfInt8uAndOneOfThemIsSetTo0_161(); - break; - case 162: - ChipLogProgress(chipTool, " ***** Test Step 162 : Send Test Command With List of INT8U and get it reversed\n"); - err = TestSendTestCommandWithListOfInt8uAndGetItReversed_162(); - break; - case 163: - ChipLogProgress(chipTool, - " ***** Test Step 163 : Send Test Command With empty List of INT8U and get an empty list back\n"); - err = TestSendTestCommandWithEmptyListOfInt8uAndGetAnEmptyListBack_163(); - break; - case 164: - ChipLogProgress( - chipTool, - " ***** Test Step 164 : Send Test Command With List of Struct Argument and arg1.b of first item is true\n"); - err = TestSendTestCommandWithListOfStructArgumentAndArg1bOfFirstItemIsTrue_164(); - break; - case 165: - ChipLogProgress( - chipTool, - " ***** Test Step 165 : Send Test Command With List of Struct Argument and arg1.b of first item is false\n"); - err = TestSendTestCommandWithListOfStructArgumentAndArg1bOfFirstItemIsFalse_165(); - break; - case 166: - ChipLogProgress(chipTool, - " ***** Test Step 166 : Send Test Command With List of Nested Struct List Argument and all fields b of " - "elements of arg1.d are true\n"); - err = TestSendTestCommandWithListOfNestedStructListArgumentAndAllFieldsBOfElementsOfArg1dAreTrue_166(); - break; - case 167: - ChipLogProgress(chipTool, - " ***** Test Step 167 : Send Test Command With Nested Struct List Argument and some fields b of " - "elements of arg1.d are false\n"); - err = TestSendTestCommandWithNestedStructListArgumentAndSomeFieldsBOfElementsOfArg1dAreFalse_167(); - break; - case 168: - ChipLogProgress(chipTool, - " ***** Test Step 168 : Write attribute LIST With List of INT8U and none of them is set to 0\n"); - err = TestWriteAttributeListWithListOfInt8uAndNoneOfThemIsSetTo0_168(); - break; - case 169: - ChipLogProgress(chipTool, " ***** Test Step 169 : Read attribute LIST With List of INT8U\n"); - err = TestReadAttributeListWithListOfInt8u_169(); - break; - case 170: - ChipLogProgress(chipTool, " ***** Test Step 170 : Write attribute LIST With List of OCTET_STRING\n"); - err = TestWriteAttributeListWithListOfOctetString_170(); - break; - case 171: - ChipLogProgress(chipTool, " ***** Test Step 171 : Read attribute LIST With List of OCTET_STRING\n"); - err = TestReadAttributeListWithListOfOctetString_171(); - break; - case 172: - ChipLogProgress(chipTool, " ***** Test Step 172 : Write attribute LIST With List of LIST_STRUCT_OCTET_STRING\n"); - err = TestWriteAttributeListWithListOfListStructOctetString_172(); - break; - case 173: - ChipLogProgress(chipTool, " ***** Test Step 173 : Read attribute LIST With List of LIST_STRUCT_OCTET_STRING\n"); - err = TestReadAttributeListWithListOfListStructOctetString_173(); - break; - case 174: - ChipLogProgress(chipTool, " ***** Test Step 174 : Send Test Command with optional arg set.\n"); - err = TestSendTestCommandWithOptionalArgSet_174(); - break; - case 175: - ChipLogProgress(chipTool, " ***** Test Step 175 : Send Test Command without its optional arg.\n"); - err = TestSendTestCommandWithoutItsOptionalArg_175(); - break; - case 176: - ChipLogProgress(chipTool, " ***** Test Step 176 : Read list of structs containing nullables and optionals\n"); - err = TestReadListOfStructsContainingNullablesAndOptionals_176(); - break; - case 177: - ChipLogProgress(chipTool, " ***** Test Step 177 : Write list of structs containing nullables and optionals\n"); - err = TestWriteListOfStructsContainingNullablesAndOptionals_177(); - break; - case 178: - ChipLogProgress(chipTool, - " ***** Test Step 178 : Read list of structs containing nullables and optionals after writing\n"); - err = TestReadListOfStructsContainingNullablesAndOptionalsAfterWriting_178(); - break; - case 179: - ChipLogProgress(chipTool, " ***** Test Step 179 : Write attribute NULLABLE_BOOLEAN null\n"); - err = TestWriteAttributeNullableBooleanNull_179(); - break; - case 180: - ChipLogProgress(chipTool, " ***** Test Step 180 : Read attribute NULLABLE_BOOLEAN null\n"); - err = TestReadAttributeNullableBooleanNull_180(); - break; - case 181: - ChipLogProgress(chipTool, " ***** Test Step 181 : Write attribute NULLABLE_BOOLEAN True\n"); - err = TestWriteAttributeNullableBooleanTrue_181(); - break; - case 182: - ChipLogProgress(chipTool, " ***** Test Step 182 : Read attribute NULLABLE_BOOLEAN True\n"); - err = TestReadAttributeNullableBooleanTrue_182(); - break; - case 183: - ChipLogProgress(chipTool, " ***** Test Step 183 : Write attribute NULLABLE_BITMAP8 Max Value\n"); - err = TestWriteAttributeNullableBitmap8MaxValue_183(); - break; - case 184: - ChipLogProgress(chipTool, " ***** Test Step 184 : Read attribute NULLABLE_BITMAP8 Max Value\n"); - err = TestReadAttributeNullableBitmap8MaxValue_184(); - break; - case 185: - ChipLogProgress(chipTool, " ***** Test Step 185 : Write attribute NULLABLE_BITMAP8 Invalid Value\n"); - err = TestWriteAttributeNullableBitmap8InvalidValue_185(); - break; - case 186: - ChipLogProgress(chipTool, " ***** Test Step 186 : Read attribute NULLABLE_BITMAP8 unchanged Value\n"); - err = TestReadAttributeNullableBitmap8UnchangedValue_186(); - break; - case 187: - ChipLogProgress(chipTool, " ***** Test Step 187 : Write attribute NULLABLE_BITMAP8 null Value\n"); - err = TestWriteAttributeNullableBitmap8NullValue_187(); - break; - case 188: - ChipLogProgress(chipTool, " ***** Test Step 188 : Read attribute NULLABLE_BITMAP8 null Value\n"); - err = TestReadAttributeNullableBitmap8NullValue_188(); - break; - case 189: - ChipLogProgress(chipTool, " ***** Test Step 189 : Write attribute NULLABLE_BITMAP16 Max Value\n"); - err = TestWriteAttributeNullableBitmap16MaxValue_189(); - break; - case 190: - ChipLogProgress(chipTool, " ***** Test Step 190 : Read attribute NULLABLE_BITMAP16 Max Value\n"); - err = TestReadAttributeNullableBitmap16MaxValue_190(); - break; - case 191: - ChipLogProgress(chipTool, " ***** Test Step 191 : Write attribute NULLABLE_BITMAP16 Invalid Value\n"); - err = TestWriteAttributeNullableBitmap16InvalidValue_191(); - break; - case 192: - ChipLogProgress(chipTool, " ***** Test Step 192 : Read attribute NULLABLE_BITMAP16 unchanged Value\n"); - err = TestReadAttributeNullableBitmap16UnchangedValue_192(); - break; - case 193: - ChipLogProgress(chipTool, " ***** Test Step 193 : Write attribute NULLABLE_BITMAP16 null Value\n"); - err = TestWriteAttributeNullableBitmap16NullValue_193(); - break; - case 194: - ChipLogProgress(chipTool, " ***** Test Step 194 : Read attribute NULLABLE_BITMAP16 null Value\n"); - err = TestReadAttributeNullableBitmap16NullValue_194(); - break; - case 195: - ChipLogProgress(chipTool, " ***** Test Step 195 : Write attribute NULLABLE_BITMAP32 Max Value\n"); - err = TestWriteAttributeNullableBitmap32MaxValue_195(); - break; - case 196: - ChipLogProgress(chipTool, " ***** Test Step 196 : Read attribute NULLABLE_BITMAP32 Max Value\n"); - err = TestReadAttributeNullableBitmap32MaxValue_196(); - break; - case 197: - ChipLogProgress(chipTool, " ***** Test Step 197 : Write attribute NULLABLE_BITMAP32 Invalid Value\n"); - err = TestWriteAttributeNullableBitmap32InvalidValue_197(); - break; - case 198: - ChipLogProgress(chipTool, " ***** Test Step 198 : Read attribute NULLABLE_BITMAP32 unchanged Value\n"); - err = TestReadAttributeNullableBitmap32UnchangedValue_198(); - break; - case 199: - ChipLogProgress(chipTool, " ***** Test Step 199 : Write attribute NULLABLE_BITMAP32 null Value\n"); - err = TestWriteAttributeNullableBitmap32NullValue_199(); - break; - case 200: - ChipLogProgress(chipTool, " ***** Test Step 200 : Read attribute NULLABLE_BITMAP32 null Value\n"); - err = TestReadAttributeNullableBitmap32NullValue_200(); - break; - case 201: - ChipLogProgress(chipTool, " ***** Test Step 201 : Write attribute NULLABLE_BITMAP64 Max Value\n"); - err = TestWriteAttributeNullableBitmap64MaxValue_201(); - break; - case 202: - ChipLogProgress(chipTool, " ***** Test Step 202 : Read attribute NULLABLE_BITMAP64 Max Value\n"); - err = TestReadAttributeNullableBitmap64MaxValue_202(); - break; - case 203: - ChipLogProgress(chipTool, " ***** Test Step 203 : Write attribute NULLABLE_BITMAP64 Invalid Value\n"); - err = TestWriteAttributeNullableBitmap64InvalidValue_203(); - break; - case 204: - ChipLogProgress(chipTool, " ***** Test Step 204 : Read attribute NULLABLE_BITMAP64 unchanged Value\n"); - err = TestReadAttributeNullableBitmap64UnchangedValue_204(); - break; - case 205: - ChipLogProgress(chipTool, " ***** Test Step 205 : Write attribute NULLABLE_BITMAP64 null Value\n"); - err = TestWriteAttributeNullableBitmap64NullValue_205(); - break; - case 206: - ChipLogProgress(chipTool, " ***** Test Step 206 : Read attribute NULLABLE_BITMAP64 null Value\n"); - err = TestReadAttributeNullableBitmap64NullValue_206(); - break; - case 207: - ChipLogProgress(chipTool, " ***** Test Step 207 : Write attribute NULLABLE_INT8U Min Value\n"); - err = TestWriteAttributeNullableInt8uMinValue_207(); - break; - case 208: - ChipLogProgress(chipTool, " ***** Test Step 208 : Read attribute NULLABLE_INT8U Min Value\n"); - err = TestReadAttributeNullableInt8uMinValue_208(); - break; - case 209: - ChipLogProgress(chipTool, " ***** Test Step 209 : Write attribute NULLABLE_INT8U Max Value\n"); - err = TestWriteAttributeNullableInt8uMaxValue_209(); - break; - case 210: - ChipLogProgress(chipTool, " ***** Test Step 210 : Read attribute NULLABLE_INT8U Max Value\n"); - err = TestReadAttributeNullableInt8uMaxValue_210(); - break; - case 211: - ChipLogProgress(chipTool, " ***** Test Step 211 : Write attribute NULLABLE_INT8U Invalid Value\n"); - err = TestWriteAttributeNullableInt8uInvalidValue_211(); - break; - case 212: - ChipLogProgress(chipTool, " ***** Test Step 212 : Read attribute NULLABLE_INT8U unchanged Value\n"); - err = TestReadAttributeNullableInt8uUnchangedValue_212(); - break; - case 213: - ChipLogProgress(chipTool, " ***** Test Step 213 : Read attribute NULLABLE_INT8U unchanged Value with constraint\n"); - err = TestReadAttributeNullableInt8uUnchangedValueWithConstraint_213(); - break; - case 214: - ChipLogProgress(chipTool, " ***** Test Step 214 : Write attribute NULLABLE_INT8U null Value\n"); - err = TestWriteAttributeNullableInt8uNullValue_214(); - break; - case 215: - ChipLogProgress(chipTool, " ***** Test Step 215 : Read attribute NULLABLE_INT8U null Value\n"); - err = TestReadAttributeNullableInt8uNullValue_215(); - break; - case 216: - ChipLogProgress(chipTool, " ***** Test Step 216 : Read attribute NULLABLE_INT8U null Value & range\n"); - err = TestReadAttributeNullableInt8uNullValueRange_216(); - break; - case 217: - ChipLogProgress(chipTool, " ***** Test Step 217 : Read attribute NULLABLE_INT8U null Value & not\n"); - err = TestReadAttributeNullableInt8uNullValueNot_217(); - break; - case 218: - ChipLogProgress(chipTool, " ***** Test Step 218 : Write attribute NULLABLE_INT8U Value\n"); - err = TestWriteAttributeNullableInt8uValue_218(); - break; - case 219: - ChipLogProgress(chipTool, " ***** Test Step 219 : Read attribute NULLABLE_INT8U Value in range\n"); - err = TestReadAttributeNullableInt8uValueInRange_219(); - break; - case 220: - ChipLogProgress(chipTool, " ***** Test Step 220 : Read attribute NULLABLE_INT8U notValue OK\n"); - err = TestReadAttributeNullableInt8uNotValueOk_220(); - break; - case 221: - ChipLogProgress(chipTool, " ***** Test Step 221 : Write attribute NULLABLE_INT16U Min Value\n"); - err = TestWriteAttributeNullableInt16uMinValue_221(); - break; - case 222: - ChipLogProgress(chipTool, " ***** Test Step 222 : Read attribute NULLABLE_INT16U Min Value\n"); - err = TestReadAttributeNullableInt16uMinValue_222(); - break; - case 223: - ChipLogProgress(chipTool, " ***** Test Step 223 : Write attribute NULLABLE_INT16U Max Value\n"); - err = TestWriteAttributeNullableInt16uMaxValue_223(); - break; - case 224: - ChipLogProgress(chipTool, " ***** Test Step 224 : Read attribute NULLABLE_INT16U Max Value\n"); - err = TestReadAttributeNullableInt16uMaxValue_224(); - break; - case 225: - ChipLogProgress(chipTool, " ***** Test Step 225 : Write attribute NULLABLE_INT16U Invalid Value\n"); - err = TestWriteAttributeNullableInt16uInvalidValue_225(); - break; - case 226: - ChipLogProgress(chipTool, " ***** Test Step 226 : Read attribute NULLABLE_INT16U unchanged Value\n"); - err = TestReadAttributeNullableInt16uUnchangedValue_226(); - break; - case 227: - ChipLogProgress(chipTool, " ***** Test Step 227 : Write attribute NULLABLE_INT16U null Value\n"); - err = TestWriteAttributeNullableInt16uNullValue_227(); - break; - case 228: - ChipLogProgress(chipTool, " ***** Test Step 228 : Read attribute NULLABLE_INT16U null Value\n"); - err = TestReadAttributeNullableInt16uNullValue_228(); - break; - case 229: - ChipLogProgress(chipTool, " ***** Test Step 229 : Read attribute NULLABLE_INT16U null Value & range\n"); - err = TestReadAttributeNullableInt16uNullValueRange_229(); - break; - case 230: - ChipLogProgress(chipTool, " ***** Test Step 230 : Read attribute NULLABLE_INT16U null Value & not\n"); - err = TestReadAttributeNullableInt16uNullValueNot_230(); - break; - case 231: - ChipLogProgress(chipTool, " ***** Test Step 231 : Write attribute NULLABLE_INT16U Value\n"); - err = TestWriteAttributeNullableInt16uValue_231(); - break; - case 232: - ChipLogProgress(chipTool, " ***** Test Step 232 : Read attribute NULLABLE_INT16U Value in range\n"); - err = TestReadAttributeNullableInt16uValueInRange_232(); - break; - case 233: - ChipLogProgress(chipTool, " ***** Test Step 233 : Read attribute NULLABLE_INT16U notValue OK\n"); - err = TestReadAttributeNullableInt16uNotValueOk_233(); - break; - case 234: - ChipLogProgress(chipTool, " ***** Test Step 234 : Write attribute NULLABLE_INT32U Min Value\n"); - err = TestWriteAttributeNullableInt32uMinValue_234(); - break; - case 235: - ChipLogProgress(chipTool, " ***** Test Step 235 : Read attribute NULLABLE_INT32U Min Value\n"); - err = TestReadAttributeNullableInt32uMinValue_235(); - break; - case 236: - ChipLogProgress(chipTool, " ***** Test Step 236 : Write attribute NULLABLE_INT32U Max Value\n"); - err = TestWriteAttributeNullableInt32uMaxValue_236(); - break; - case 237: - ChipLogProgress(chipTool, " ***** Test Step 237 : Read attribute NULLABLE_INT32U Max Value\n"); - err = TestReadAttributeNullableInt32uMaxValue_237(); - break; - case 238: - ChipLogProgress(chipTool, " ***** Test Step 238 : Write attribute NULLABLE_INT32U Invalid Value\n"); - err = TestWriteAttributeNullableInt32uInvalidValue_238(); - break; - case 239: - ChipLogProgress(chipTool, " ***** Test Step 239 : Read attribute NULLABLE_INT32U unchanged Value\n"); - err = TestReadAttributeNullableInt32uUnchangedValue_239(); - break; - case 240: - ChipLogProgress(chipTool, " ***** Test Step 240 : Write attribute NULLABLE_INT32U null Value\n"); - err = TestWriteAttributeNullableInt32uNullValue_240(); - break; - case 241: - ChipLogProgress(chipTool, " ***** Test Step 241 : Read attribute NULLABLE_INT32U null Value\n"); - err = TestReadAttributeNullableInt32uNullValue_241(); - break; - case 242: - ChipLogProgress(chipTool, " ***** Test Step 242 : Read attribute NULLABLE_INT32U null Value & range\n"); - err = TestReadAttributeNullableInt32uNullValueRange_242(); - break; - case 243: - ChipLogProgress(chipTool, " ***** Test Step 243 : Read attribute NULLABLE_INT32U null Value & not\n"); - err = TestReadAttributeNullableInt32uNullValueNot_243(); - break; - case 244: - ChipLogProgress(chipTool, " ***** Test Step 244 : Write attribute NULLABLE_INT32U Value\n"); - err = TestWriteAttributeNullableInt32uValue_244(); - break; - case 245: - ChipLogProgress(chipTool, " ***** Test Step 245 : Read attribute NULLABLE_INT32U Value in range\n"); - err = TestReadAttributeNullableInt32uValueInRange_245(); - break; - case 246: - ChipLogProgress(chipTool, " ***** Test Step 246 : Read attribute NULLABLE_INT32U notValue OK\n"); - err = TestReadAttributeNullableInt32uNotValueOk_246(); - break; - case 247: - ChipLogProgress(chipTool, " ***** Test Step 247 : Write attribute NULLABLE_INT64U Min Value\n"); - err = TestWriteAttributeNullableInt64uMinValue_247(); - break; - case 248: - ChipLogProgress(chipTool, " ***** Test Step 248 : Read attribute NULLABLE_INT64U Min Value\n"); - err = TestReadAttributeNullableInt64uMinValue_248(); - break; - case 249: - ChipLogProgress(chipTool, " ***** Test Step 249 : Write attribute NULLABLE_INT64U Max Value\n"); - err = TestWriteAttributeNullableInt64uMaxValue_249(); - break; - case 250: - ChipLogProgress(chipTool, " ***** Test Step 250 : Read attribute NULLABLE_INT64U Max Value\n"); - err = TestReadAttributeNullableInt64uMaxValue_250(); - break; - case 251: - ChipLogProgress(chipTool, " ***** Test Step 251 : Write attribute NULLABLE_INT64U Invalid Value\n"); - err = TestWriteAttributeNullableInt64uInvalidValue_251(); - break; - case 252: - ChipLogProgress(chipTool, " ***** Test Step 252 : Read attribute NULLABLE_INT64U unchanged Value\n"); - err = TestReadAttributeNullableInt64uUnchangedValue_252(); - break; - case 253: - ChipLogProgress(chipTool, " ***** Test Step 253 : Write attribute NULLABLE_INT64U null Value\n"); - err = TestWriteAttributeNullableInt64uNullValue_253(); - break; - case 254: - ChipLogProgress(chipTool, " ***** Test Step 254 : Read attribute NULLABLE_INT64U null Value\n"); - err = TestReadAttributeNullableInt64uNullValue_254(); - break; - case 255: - ChipLogProgress(chipTool, " ***** Test Step 255 : Read attribute NULLABLE_INT64U null Value & range\n"); - err = TestReadAttributeNullableInt64uNullValueRange_255(); - break; - case 256: - ChipLogProgress(chipTool, " ***** Test Step 256 : Read attribute NULLABLE_INT64U null Value & not\n"); - err = TestReadAttributeNullableInt64uNullValueNot_256(); - break; - case 257: - ChipLogProgress(chipTool, " ***** Test Step 257 : Write attribute NULLABLE_INT64U Value\n"); - err = TestWriteAttributeNullableInt64uValue_257(); - break; - case 258: - ChipLogProgress(chipTool, " ***** Test Step 258 : Read attribute NULLABLE_INT64U Value in range\n"); - err = TestReadAttributeNullableInt64uValueInRange_258(); - break; - case 259: - ChipLogProgress(chipTool, " ***** Test Step 259 : Read attribute NULLABLE_INT64U notValue OK\n"); - err = TestReadAttributeNullableInt64uNotValueOk_259(); - break; - case 260: - ChipLogProgress(chipTool, " ***** Test Step 260 : Write attribute NULLABLE_INT8S Min Value\n"); - err = TestWriteAttributeNullableInt8sMinValue_260(); - break; - case 261: - ChipLogProgress(chipTool, " ***** Test Step 261 : Read attribute NULLABLE_INT8S Min Value\n"); - err = TestReadAttributeNullableInt8sMinValue_261(); - break; - case 262: - ChipLogProgress(chipTool, " ***** Test Step 262 : Write attribute NULLABLE_INT8S Invalid Value\n"); - err = TestWriteAttributeNullableInt8sInvalidValue_262(); - break; - case 263: - ChipLogProgress(chipTool, " ***** Test Step 263 : Read attribute NULLABLE_INT8S unchanged Value\n"); - err = TestReadAttributeNullableInt8sUnchangedValue_263(); - break; - case 264: - ChipLogProgress(chipTool, " ***** Test Step 264 : Write attribute NULLABLE_INT8S null Value\n"); - err = TestWriteAttributeNullableInt8sNullValue_264(); - break; - case 265: - ChipLogProgress(chipTool, " ***** Test Step 265 : Read attribute NULLABLE_INT8S null Value\n"); - err = TestReadAttributeNullableInt8sNullValue_265(); - break; - case 266: - ChipLogProgress(chipTool, " ***** Test Step 266 : Read attribute NULLABLE_INT8S null Value & range\n"); - err = TestReadAttributeNullableInt8sNullValueRange_266(); - break; - case 267: - ChipLogProgress(chipTool, " ***** Test Step 267 : Read attribute NULLABLE_INT8S null Value & not\n"); - err = TestReadAttributeNullableInt8sNullValueNot_267(); - break; - case 268: - ChipLogProgress(chipTool, " ***** Test Step 268 : Write attribute NULLABLE_INT8S Value\n"); - err = TestWriteAttributeNullableInt8sValue_268(); - break; - case 269: - ChipLogProgress(chipTool, " ***** Test Step 269 : Read attribute NULLABLE_INT8S Value in range\n"); - err = TestReadAttributeNullableInt8sValueInRange_269(); - break; - case 270: - ChipLogProgress(chipTool, " ***** Test Step 270 : Read attribute NULLABLE_INT8S notValue OK\n"); - err = TestReadAttributeNullableInt8sNotValueOk_270(); - break; - case 271: - ChipLogProgress(chipTool, " ***** Test Step 271 : Write attribute NULLABLE_INT16S Min Value\n"); - err = TestWriteAttributeNullableInt16sMinValue_271(); - break; - case 272: - ChipLogProgress(chipTool, " ***** Test Step 272 : Read attribute NULLABLE_INT16S Min Value\n"); - err = TestReadAttributeNullableInt16sMinValue_272(); - break; - case 273: - ChipLogProgress(chipTool, " ***** Test Step 273 : Write attribute NULLABLE_INT16S Invalid Value\n"); - err = TestWriteAttributeNullableInt16sInvalidValue_273(); - break; - case 274: - ChipLogProgress(chipTool, " ***** Test Step 274 : Read attribute NULLABLE_INT16S unchanged Value\n"); - err = TestReadAttributeNullableInt16sUnchangedValue_274(); - break; - case 275: - ChipLogProgress(chipTool, " ***** Test Step 275 : Write attribute NULLABLE_INT16S null Value\n"); - err = TestWriteAttributeNullableInt16sNullValue_275(); - break; - case 276: - ChipLogProgress(chipTool, " ***** Test Step 276 : Read attribute NULLABLE_INT16S null Value\n"); - err = TestReadAttributeNullableInt16sNullValue_276(); - break; - case 277: - ChipLogProgress(chipTool, " ***** Test Step 277 : Read attribute NULLABLE_INT16S null Value & range\n"); - err = TestReadAttributeNullableInt16sNullValueRange_277(); - break; - case 278: - ChipLogProgress(chipTool, " ***** Test Step 278 : Read attribute NULLABLE_INT16S null Value & not\n"); - err = TestReadAttributeNullableInt16sNullValueNot_278(); - break; - case 279: - ChipLogProgress(chipTool, " ***** Test Step 279 : Write attribute NULLABLE_INT16S Value\n"); - err = TestWriteAttributeNullableInt16sValue_279(); - break; - case 280: - ChipLogProgress(chipTool, " ***** Test Step 280 : Read attribute NULLABLE_INT16S Value in range\n"); - err = TestReadAttributeNullableInt16sValueInRange_280(); - break; - case 281: - ChipLogProgress(chipTool, " ***** Test Step 281 : Read attribute NULLABLE_INT16S notValue OK\n"); - err = TestReadAttributeNullableInt16sNotValueOk_281(); - break; - case 282: - ChipLogProgress(chipTool, " ***** Test Step 282 : Write attribute NULLABLE_INT32S Min Value\n"); - err = TestWriteAttributeNullableInt32sMinValue_282(); - break; - case 283: - ChipLogProgress(chipTool, " ***** Test Step 283 : Read attribute NULLABLE_INT32S Min Value\n"); - err = TestReadAttributeNullableInt32sMinValue_283(); - break; - case 284: - ChipLogProgress(chipTool, " ***** Test Step 284 : Write attribute NULLABLE_INT32S Invalid Value\n"); - err = TestWriteAttributeNullableInt32sInvalidValue_284(); - break; - case 285: - ChipLogProgress(chipTool, " ***** Test Step 285 : Read attribute NULLABLE_INT32S unchanged Value\n"); - err = TestReadAttributeNullableInt32sUnchangedValue_285(); - break; - case 286: - ChipLogProgress(chipTool, " ***** Test Step 286 : Write attribute NULLABLE_INT32S null Value\n"); - err = TestWriteAttributeNullableInt32sNullValue_286(); - break; - case 287: - ChipLogProgress(chipTool, " ***** Test Step 287 : Read attribute NULLABLE_INT32S null Value\n"); - err = TestReadAttributeNullableInt32sNullValue_287(); - break; - case 288: - ChipLogProgress(chipTool, " ***** Test Step 288 : Read attribute NULLABLE_INT32S null Value & range\n"); - err = TestReadAttributeNullableInt32sNullValueRange_288(); - break; - case 289: - ChipLogProgress(chipTool, " ***** Test Step 289 : Read attribute NULLABLE_INT32S null Value & not\n"); - err = TestReadAttributeNullableInt32sNullValueNot_289(); - break; - case 290: - ChipLogProgress(chipTool, " ***** Test Step 290 : Write attribute NULLABLE_INT32S Value\n"); - err = TestWriteAttributeNullableInt32sValue_290(); - break; - case 291: - ChipLogProgress(chipTool, " ***** Test Step 291 : Read attribute NULLABLE_INT32S Value in range\n"); - err = TestReadAttributeNullableInt32sValueInRange_291(); - break; - case 292: - ChipLogProgress(chipTool, " ***** Test Step 292 : Read attribute NULLABLE_INT32S notValue OK\n"); - err = TestReadAttributeNullableInt32sNotValueOk_292(); - break; - case 293: - ChipLogProgress(chipTool, " ***** Test Step 293 : Write attribute NULLABLE_INT64S Min Value\n"); - err = TestWriteAttributeNullableInt64sMinValue_293(); - break; - case 294: - ChipLogProgress(chipTool, " ***** Test Step 294 : Read attribute NULLABLE_INT64S Min Value\n"); - err = TestReadAttributeNullableInt64sMinValue_294(); - break; - case 295: - ChipLogProgress(chipTool, " ***** Test Step 295 : Write attribute NULLABLE_INT64S Invalid Value\n"); - err = TestWriteAttributeNullableInt64sInvalidValue_295(); - break; - case 296: - ChipLogProgress(chipTool, " ***** Test Step 296 : Read attribute NULLABLE_INT64S unchanged Value\n"); - err = TestReadAttributeNullableInt64sUnchangedValue_296(); - break; - case 297: - ChipLogProgress(chipTool, " ***** Test Step 297 : Write attribute NULLABLE_INT64S null Value\n"); - err = TestWriteAttributeNullableInt64sNullValue_297(); - break; - case 298: - ChipLogProgress(chipTool, " ***** Test Step 298 : Read attribute NULLABLE_INT64S null Value\n"); - err = TestReadAttributeNullableInt64sNullValue_298(); - break; - case 299: - ChipLogProgress(chipTool, " ***** Test Step 299 : Read attribute NULLABLE_INT64S null Value & range\n"); - err = TestReadAttributeNullableInt64sNullValueRange_299(); - break; - case 300: - ChipLogProgress(chipTool, " ***** Test Step 300 : Read attribute NULLABLE_INT64S null Value & not\n"); - err = TestReadAttributeNullableInt64sNullValueNot_300(); - break; - case 301: - ChipLogProgress(chipTool, " ***** Test Step 301 : Write attribute NULLABLE_INT64S Value\n"); - err = TestWriteAttributeNullableInt64sValue_301(); - break; - case 302: - ChipLogProgress(chipTool, " ***** Test Step 302 : Read attribute NULLABLE_INT64S Value in range\n"); - err = TestReadAttributeNullableInt64sValueInRange_302(); - break; - case 303: - ChipLogProgress(chipTool, " ***** Test Step 303 : Read attribute NULLABLE_INT64S notValue OK\n"); - err = TestReadAttributeNullableInt64sNotValueOk_303(); - break; - case 304: - ChipLogProgress(chipTool, " ***** Test Step 304 : Write attribute NULLABLE_SINGLE medium Value\n"); - err = TestWriteAttributeNullableSingleMediumValue_304(); - break; - case 305: - ChipLogProgress(chipTool, " ***** Test Step 305 : Read attribute NULLABLE_SINGLE medium Value\n"); - err = TestReadAttributeNullableSingleMediumValue_305(); - break; - case 306: - ChipLogProgress(chipTool, " ***** Test Step 306 : Write attribute NULLABLE_SINGLE largest Value\n"); - err = TestWriteAttributeNullableSingleLargestValue_306(); - break; - case 307: - ChipLogProgress(chipTool, " ***** Test Step 307 : Read attribute NULLABLE_SINGLE largest Value\n"); - err = TestReadAttributeNullableSingleLargestValue_307(); - break; - case 308: - ChipLogProgress(chipTool, " ***** Test Step 308 : Write attribute NULLABLE_SINGLE smallest Value\n"); - err = TestWriteAttributeNullableSingleSmallestValue_308(); - break; - case 309: - ChipLogProgress(chipTool, " ***** Test Step 309 : Read attribute NULLABLE_SINGLE smallest Value\n"); - err = TestReadAttributeNullableSingleSmallestValue_309(); - break; - case 310: - ChipLogProgress(chipTool, " ***** Test Step 310 : Write attribute NULLABLE_SINGLE null Value\n"); - err = TestWriteAttributeNullableSingleNullValue_310(); - break; - case 311: - ChipLogProgress(chipTool, " ***** Test Step 311 : Read attribute NULLABLE_SINGLE null Value\n"); - err = TestReadAttributeNullableSingleNullValue_311(); - break; - case 312: - ChipLogProgress(chipTool, " ***** Test Step 312 : Write attribute NULLABLE_SINGLE 0 Value\n"); - err = TestWriteAttributeNullableSingle0Value_312(); - break; - case 313: - ChipLogProgress(chipTool, " ***** Test Step 313 : Read attribute NULLABLE_SINGLE 0 Value\n"); - err = TestReadAttributeNullableSingle0Value_313(); - break; - case 314: - ChipLogProgress(chipTool, " ***** Test Step 314 : Write attribute NULLABLE_DOUBLE medium Value\n"); - err = TestWriteAttributeNullableDoubleMediumValue_314(); - break; - case 315: - ChipLogProgress(chipTool, " ***** Test Step 315 : Read attribute NULLABLE_DOUBLE medium Value\n"); - err = TestReadAttributeNullableDoubleMediumValue_315(); - break; - case 316: - ChipLogProgress(chipTool, " ***** Test Step 316 : Write attribute NULLABLE_DOUBLE largest Value\n"); - err = TestWriteAttributeNullableDoubleLargestValue_316(); - break; - case 317: - ChipLogProgress(chipTool, " ***** Test Step 317 : Read attribute NULLABLE_DOUBLE largest Value\n"); - err = TestReadAttributeNullableDoubleLargestValue_317(); - break; - case 318: - ChipLogProgress(chipTool, " ***** Test Step 318 : Write attribute NULLABLE_DOUBLE smallest Value\n"); - err = TestWriteAttributeNullableDoubleSmallestValue_318(); - break; - case 319: - ChipLogProgress(chipTool, " ***** Test Step 319 : Read attribute NULLABLE_DOUBLE smallest Value\n"); - err = TestReadAttributeNullableDoubleSmallestValue_319(); - break; - case 320: - ChipLogProgress(chipTool, " ***** Test Step 320 : Write attribute NULLABLE_DOUBLE null Value\n"); - err = TestWriteAttributeNullableDoubleNullValue_320(); - break; - case 321: - ChipLogProgress(chipTool, " ***** Test Step 321 : Read attribute NULLABLE_DOUBLE null Value\n"); - err = TestReadAttributeNullableDoubleNullValue_321(); - break; - case 322: - ChipLogProgress(chipTool, " ***** Test Step 322 : Write attribute NULLABLE_DOUBLE 0 Value\n"); - err = TestWriteAttributeNullableDouble0Value_322(); - break; - case 323: - ChipLogProgress(chipTool, " ***** Test Step 323 : Read attribute NULLABLE_DOUBLE 0 Value\n"); - err = TestReadAttributeNullableDouble0Value_323(); - break; - case 324: - ChipLogProgress(chipTool, " ***** Test Step 324 : Write attribute NULLABLE_ENUM8 Min Value\n"); - err = TestWriteAttributeNullableEnum8MinValue_324(); - break; - case 325: - ChipLogProgress(chipTool, " ***** Test Step 325 : Read attribute NULLABLE_ENUM8 Min Value\n"); - err = TestReadAttributeNullableEnum8MinValue_325(); - break; - case 326: - ChipLogProgress(chipTool, " ***** Test Step 326 : Write attribute NULLABLE_ENUM8 Max Value\n"); - err = TestWriteAttributeNullableEnum8MaxValue_326(); - break; - case 327: - ChipLogProgress(chipTool, " ***** Test Step 327 : Read attribute NULLABLE_ENUM8 Max Value\n"); - err = TestReadAttributeNullableEnum8MaxValue_327(); - break; - case 328: - ChipLogProgress(chipTool, " ***** Test Step 328 : Write attribute NULLABLE_ENUM8 Invalid Value\n"); - err = TestWriteAttributeNullableEnum8InvalidValue_328(); - break; - case 329: - ChipLogProgress(chipTool, " ***** Test Step 329 : Read attribute NULLABLE_ENUM8 unchanged Value\n"); - err = TestReadAttributeNullableEnum8UnchangedValue_329(); - break; - case 330: - ChipLogProgress(chipTool, " ***** Test Step 330 : Write attribute NULLABLE_ENUM8 null Value\n"); - err = TestWriteAttributeNullableEnum8NullValue_330(); - break; - case 331: - ChipLogProgress(chipTool, " ***** Test Step 331 : Read attribute NULLABLE_ENUM8 null Value\n"); - err = TestReadAttributeNullableEnum8NullValue_331(); - break; - case 332: - ChipLogProgress(chipTool, " ***** Test Step 332 : Write attribute NULLABLE_ENUM16 Min Value\n"); - err = TestWriteAttributeNullableEnum16MinValue_332(); - break; - case 333: - ChipLogProgress(chipTool, " ***** Test Step 333 : Read attribute NULLABLE_ENUM16 Min Value\n"); - err = TestReadAttributeNullableEnum16MinValue_333(); - break; - case 334: - ChipLogProgress(chipTool, " ***** Test Step 334 : Write attribute NULLABLE_ENUM16 Max Value\n"); - err = TestWriteAttributeNullableEnum16MaxValue_334(); - break; - case 335: - ChipLogProgress(chipTool, " ***** Test Step 335 : Read attribute NULLABLE_ENUM16 Max Value\n"); - err = TestReadAttributeNullableEnum16MaxValue_335(); - break; - case 336: - ChipLogProgress(chipTool, " ***** Test Step 336 : Write attribute NULLABLE_ENUM16 Invalid Value\n"); - err = TestWriteAttributeNullableEnum16InvalidValue_336(); - break; - case 337: - ChipLogProgress(chipTool, " ***** Test Step 337 : Read attribute NULLABLE_ENUM16 unchanged Value\n"); - err = TestReadAttributeNullableEnum16UnchangedValue_337(); - break; - case 338: - ChipLogProgress(chipTool, " ***** Test Step 338 : Write attribute NULLABLE_ENUM16 null Value\n"); - err = TestWriteAttributeNullableEnum16NullValue_338(); - break; - case 339: - ChipLogProgress(chipTool, " ***** Test Step 339 : Read attribute NULLABLE_ENUM16 null Value\n"); - err = TestReadAttributeNullableEnum16NullValue_339(); - break; - case 340: - ChipLogProgress(chipTool, " ***** Test Step 340 : Write attribute NULLABLE_SIMPLE_ENUM Min Value\n"); - err = TestWriteAttributeNullableSimpleEnumMinValue_340(); - break; - case 341: - ChipLogProgress(chipTool, " ***** Test Step 341 : Read attribute NULLABLE_SIMPLE_ENUM Min Value\n"); - err = TestReadAttributeNullableSimpleEnumMinValue_341(); - break; - case 342: - ChipLogProgress(chipTool, " ***** Test Step 342 : Write attribute NULLABLE_SIMPLE_ENUM Max Value\n"); - err = TestWriteAttributeNullableSimpleEnumMaxValue_342(); - break; - case 343: - ChipLogProgress(chipTool, " ***** Test Step 343 : Read attribute NULLABLE_SIMPLE_ENUM Max Value\n"); - err = TestReadAttributeNullableSimpleEnumMaxValue_343(); - break; - case 344: - ChipLogProgress(chipTool, " ***** Test Step 344 : Write attribute NULLABLE_SIMPLE_ENUM Invalid Value\n"); - err = TestWriteAttributeNullableSimpleEnumInvalidValue_344(); - break; - case 345: - ChipLogProgress(chipTool, " ***** Test Step 345 : Read attribute NULLABLE_SIMPLE_ENUM unchanged Value\n"); - err = TestReadAttributeNullableSimpleEnumUnchangedValue_345(); - break; - case 346: - ChipLogProgress(chipTool, " ***** Test Step 346 : Write attribute NULLABLE_SIMPLE_ENUM null Value\n"); - err = TestWriteAttributeNullableSimpleEnumNullValue_346(); - break; - case 347: - ChipLogProgress(chipTool, " ***** Test Step 347 : Read attribute NULLABLE_SIMPLE_ENUM null Value\n"); - err = TestReadAttributeNullableSimpleEnumNullValue_347(); - break; - case 348: - ChipLogProgress(chipTool, " ***** Test Step 348 : Read attribute NULLABLE_OCTET_STRING Default Value\n"); - err = TestReadAttributeNullableOctetStringDefaultValue_348(); - break; - case 349: - ChipLogProgress(chipTool, " ***** Test Step 349 : Write attribute NULLABLE_OCTET_STRING\n"); - err = TestWriteAttributeNullableOctetString_349(); - break; - case 350: - ChipLogProgress(chipTool, " ***** Test Step 350 : Read attribute NULLABLE_OCTET_STRING\n"); - err = TestReadAttributeNullableOctetString_350(); - break; - case 351: - ChipLogProgress(chipTool, " ***** Test Step 351 : Write attribute NULLABLE_OCTET_STRING\n"); - err = TestWriteAttributeNullableOctetString_351(); - break; - case 352: - ChipLogProgress(chipTool, " ***** Test Step 352 : Read attribute NULLABLE_OCTET_STRING\n"); - err = TestReadAttributeNullableOctetString_352(); - break; - case 353: - ChipLogProgress(chipTool, " ***** Test Step 353 : Write attribute NULLABLE_OCTET_STRING\n"); - err = TestWriteAttributeNullableOctetString_353(); - break; - case 354: - ChipLogProgress(chipTool, " ***** Test Step 354 : Read attribute NULLABLE_OCTET_STRING\n"); - err = TestReadAttributeNullableOctetString_354(); - break; - case 355: - ChipLogProgress(chipTool, " ***** Test Step 355 : Read attribute NULLABLE_CHAR_STRING Default Value\n"); - err = TestReadAttributeNullableCharStringDefaultValue_355(); - break; - case 356: - ChipLogProgress(chipTool, " ***** Test Step 356 : Write attribute NULLABLE_CHAR_STRING\n"); - err = TestWriteAttributeNullableCharString_356(); - break; - case 357: - ChipLogProgress(chipTool, " ***** Test Step 357 : Read attribute NULLABLE_CHAR_STRING\n"); - err = TestReadAttributeNullableCharString_357(); - break; - case 358: - ChipLogProgress(chipTool, " ***** Test Step 358 : Write attribute NULLABLE_CHAR_STRING - Value too long\n"); - err = TestWriteAttributeNullableCharStringValueTooLong_358(); - break; - case 359: - ChipLogProgress(chipTool, " ***** Test Step 359 : Read attribute NULLABLE_CHAR_STRING\n"); - err = TestReadAttributeNullableCharString_359(); - break; - case 360: - ChipLogProgress(chipTool, " ***** Test Step 360 : Write attribute NULLABLE_CHAR_STRING - Empty\n"); - err = TestWriteAttributeNullableCharStringEmpty_360(); - break; - case 361: - ChipLogProgress(chipTool, " ***** Test Step 361 : Read attribute NULLABLE_CHAR_STRING\n"); - err = TestReadAttributeNullableCharString_361(); - break; - case 362: - ChipLogProgress(chipTool, " ***** Test Step 362 : Read attribute from nonexistent endpoint.\n"); - err = TestReadAttributeFromNonexistentEndpoint_362(); - break; - case 363: - ChipLogProgress(chipTool, " ***** Test Step 363 : Read attribute from nonexistent cluster.\n"); - err = TestReadAttributeFromNonexistentCluster_363(); - break; - case 364: - ChipLogProgress(chipTool, - " ***** Test Step 364 : Send a command that takes an optional parameter but do not set it.\n"); - err = TestSendACommandThatTakesAnOptionalParameterButDoNotSetIt_364(); - break; - case 365: - ChipLogProgress(chipTool, - " ***** Test Step 365 : Send a command that takes an optional parameter but do not set it.\n"); - err = TestSendACommandThatTakesAnOptionalParameterButDoNotSetIt_365(); - break; - case 366: - ChipLogProgress(chipTool, " ***** Test Step 366 : Report: Subscribe to list attribute\n"); - err = TestReportSubscribeToListAttribute_366(); - break; - case 367: - ChipLogProgress(chipTool, " ***** Test Step 367 : Subscribe to list attribute\n"); - err = TestSubscribeToListAttribute_367(); - break; - case 368: - ChipLogProgress(chipTool, " ***** Test Step 368 : Write subscribed-to list attribute\n"); - err = TestWriteSubscribedToListAttribute_368(); - break; - case 369: - ChipLogProgress(chipTool, " ***** Test Step 369 : Check for list attribute report\n"); - err = TestCheckForListAttributeReport_369(); - break; - case 370: - ChipLogProgress(chipTool, " ***** Test Step 370 : Read range-restricted unsigned 8-bit integer\n"); - err = TestReadRangeRestrictedUnsigned8BitInteger_370(); - break; - case 371: - ChipLogProgress(chipTool, " ***** Test Step 371 : Write min value to a range-restricted unsigned 8-bit integer\n"); - err = TestWriteMinValueToARangeRestrictedUnsigned8BitInteger_371(); - break; - case 372: - ChipLogProgress(chipTool, - " ***** Test Step 372 : Write just-below-range value to a range-restricted unsigned 8-bit integer\n"); - err = TestWriteJustBelowRangeValueToARangeRestrictedUnsigned8BitInteger_372(); - break; - case 373: - ChipLogProgress(chipTool, - " ***** Test Step 373 : Write just-above-range value to a range-restricted unsigned 8-bit integer\n"); - err = TestWriteJustAboveRangeValueToARangeRestrictedUnsigned8BitInteger_373(); - break; - case 374: - ChipLogProgress(chipTool, " ***** Test Step 374 : Write max value to a range-restricted unsigned 8-bit integer\n"); - err = TestWriteMaxValueToARangeRestrictedUnsigned8BitInteger_374(); - break; - case 375: - ChipLogProgress(chipTool, - " ***** Test Step 375 : Verify range-restricted unsigned 8-bit integer value has not changed\n"); - err = TestVerifyRangeRestrictedUnsigned8BitIntegerValueHasNotChanged_375(); - break; - case 376: - ChipLogProgress(chipTool, - " ***** Test Step 376 : Write min valid value to a range-restricted unsigned 8-bit integer\n"); - err = TestWriteMinValidValueToARangeRestrictedUnsigned8BitInteger_376(); - break; - case 377: - ChipLogProgress(chipTool, - " ***** Test Step 377 : Verify range-restricted unsigned 8-bit integer value is at min valid\n"); - err = TestVerifyRangeRestrictedUnsigned8BitIntegerValueIsAtMinValid_377(); - break; - case 378: - ChipLogProgress(chipTool, - " ***** Test Step 378 : Write max valid value to a range-restricted unsigned 8-bit integer\n"); - err = TestWriteMaxValidValueToARangeRestrictedUnsigned8BitInteger_378(); - break; - case 379: - ChipLogProgress(chipTool, - " ***** Test Step 379 : Verify range-restricted unsigned 8-bit integer value is at max valid\n"); - err = TestVerifyRangeRestrictedUnsigned8BitIntegerValueIsAtMaxValid_379(); - break; - case 380: - ChipLogProgress(chipTool, - " ***** Test Step 380 : Write middle valid value to a range-restricted unsigned 8-bit integer\n"); - err = TestWriteMiddleValidValueToARangeRestrictedUnsigned8BitInteger_380(); - break; - case 381: - ChipLogProgress(chipTool, - " ***** Test Step 381 : Verify range-restricted unsigned 8-bit integer value is at mid valid\n"); - err = TestVerifyRangeRestrictedUnsigned8BitIntegerValueIsAtMidValid_381(); - break; - case 382: - ChipLogProgress(chipTool, " ***** Test Step 382 : Read range-restricted unsigned 16-bit integer\n"); - err = TestReadRangeRestrictedUnsigned16BitInteger_382(); - break; - case 383: - ChipLogProgress(chipTool, " ***** Test Step 383 : Write min value to a range-restricted unsigned 16-bit integer\n"); - err = TestWriteMinValueToARangeRestrictedUnsigned16BitInteger_383(); - break; - case 384: - ChipLogProgress(chipTool, - " ***** Test Step 384 : Write just-below-range value to a range-restricted unsigned 16-bit integer\n"); - err = TestWriteJustBelowRangeValueToARangeRestrictedUnsigned16BitInteger_384(); - break; - case 385: - ChipLogProgress(chipTool, - " ***** Test Step 385 : Write just-above-range value to a range-restricted unsigned 16-bit integer\n"); - err = TestWriteJustAboveRangeValueToARangeRestrictedUnsigned16BitInteger_385(); - break; - case 386: - ChipLogProgress(chipTool, " ***** Test Step 386 : Write max value to a range-restricted unsigned 16-bit integer\n"); - err = TestWriteMaxValueToARangeRestrictedUnsigned16BitInteger_386(); - break; - case 387: - ChipLogProgress(chipTool, - " ***** Test Step 387 : Verify range-restricted unsigned 16-bit integer value has not changed\n"); - err = TestVerifyRangeRestrictedUnsigned16BitIntegerValueHasNotChanged_387(); - break; - case 388: - ChipLogProgress(chipTool, - " ***** Test Step 388 : Write min valid value to a range-restricted unsigned 16-bit integer\n"); - err = TestWriteMinValidValueToARangeRestrictedUnsigned16BitInteger_388(); - break; - case 389: - ChipLogProgress(chipTool, - " ***** Test Step 389 : Verify range-restricted unsigned 16-bit integer value is at min valid\n"); - err = TestVerifyRangeRestrictedUnsigned16BitIntegerValueIsAtMinValid_389(); - break; - case 390: - ChipLogProgress(chipTool, - " ***** Test Step 390 : Write max valid value to a range-restricted unsigned 16-bit integer\n"); - err = TestWriteMaxValidValueToARangeRestrictedUnsigned16BitInteger_390(); - break; - case 391: - ChipLogProgress(chipTool, - " ***** Test Step 391 : Verify range-restricted unsigned 16-bit integer value is at max valid\n"); - err = TestVerifyRangeRestrictedUnsigned16BitIntegerValueIsAtMaxValid_391(); - break; - case 392: - ChipLogProgress(chipTool, - " ***** Test Step 392 : Write middle valid value to a range-restricted unsigned 16-bit integer\n"); - err = TestWriteMiddleValidValueToARangeRestrictedUnsigned16BitInteger_392(); - break; - case 393: - ChipLogProgress(chipTool, - " ***** Test Step 393 : Verify range-restricted unsigned 16-bit integer value is at mid valid\n"); - err = TestVerifyRangeRestrictedUnsigned16BitIntegerValueIsAtMidValid_393(); - break; - case 394: - ChipLogProgress(chipTool, " ***** Test Step 394 : Read range-restricted signed 8-bit integer\n"); - err = TestReadRangeRestrictedSigned8BitInteger_394(); - break; - case 395: - ChipLogProgress(chipTool, " ***** Test Step 395 : Write min value to a range-restricted signed 8-bit integer\n"); - err = TestWriteMinValueToARangeRestrictedSigned8BitInteger_395(); - break; - case 396: - ChipLogProgress(chipTool, - " ***** Test Step 396 : Write just-below-range value to a range-restricted signed 8-bit integer\n"); - err = TestWriteJustBelowRangeValueToARangeRestrictedSigned8BitInteger_396(); - break; - case 397: - ChipLogProgress(chipTool, - " ***** Test Step 397 : Write just-above-range value to a range-restricted signed 8-bit integer\n"); - err = TestWriteJustAboveRangeValueToARangeRestrictedSigned8BitInteger_397(); - break; - case 398: - ChipLogProgress(chipTool, " ***** Test Step 398 : Write max value to a range-restricted signed 8-bit integer\n"); - err = TestWriteMaxValueToARangeRestrictedSigned8BitInteger_398(); - break; - case 399: - ChipLogProgress(chipTool, - " ***** Test Step 399 : Verify range-restricted signed 8-bit integer value has not changed\n"); - err = TestVerifyRangeRestrictedSigned8BitIntegerValueHasNotChanged_399(); - break; - case 400: - ChipLogProgress(chipTool, " ***** Test Step 400 : Write min valid value to a range-restricted signed 8-bit integer\n"); - err = TestWriteMinValidValueToARangeRestrictedSigned8BitInteger_400(); - break; - case 401: - ChipLogProgress(chipTool, - " ***** Test Step 401 : Verify range-restricted signed 8-bit integer value is at min valid\n"); - err = TestVerifyRangeRestrictedSigned8BitIntegerValueIsAtMinValid_401(); - break; - case 402: - ChipLogProgress(chipTool, " ***** Test Step 402 : Write max valid value to a range-restricted signed 8-bit integer\n"); - err = TestWriteMaxValidValueToARangeRestrictedSigned8BitInteger_402(); - break; - case 403: - ChipLogProgress(chipTool, - " ***** Test Step 403 : Verify range-restricted signed 8-bit integer value is at max valid\n"); - err = TestVerifyRangeRestrictedSigned8BitIntegerValueIsAtMaxValid_403(); - break; - case 404: - ChipLogProgress(chipTool, - " ***** Test Step 404 : Write middle valid value to a range-restricted signed 8-bit integer\n"); - err = TestWriteMiddleValidValueToARangeRestrictedSigned8BitInteger_404(); - break; - case 405: - ChipLogProgress(chipTool, - " ***** Test Step 405 : Verify range-restricted signed 8-bit integer value is at mid valid\n"); - err = TestVerifyRangeRestrictedSigned8BitIntegerValueIsAtMidValid_405(); - break; - case 406: - ChipLogProgress(chipTool, " ***** Test Step 406 : Read range-restricted signed 16-bit integer\n"); - err = TestReadRangeRestrictedSigned16BitInteger_406(); - break; - case 407: - ChipLogProgress(chipTool, " ***** Test Step 407 : Write min value to a range-restricted signed 16-bit integer\n"); - err = TestWriteMinValueToARangeRestrictedSigned16BitInteger_407(); - break; - case 408: - ChipLogProgress(chipTool, - " ***** Test Step 408 : Write just-below-range value to a range-restricted signed 16-bit integer\n"); - err = TestWriteJustBelowRangeValueToARangeRestrictedSigned16BitInteger_408(); - break; - case 409: - ChipLogProgress(chipTool, - " ***** Test Step 409 : Write just-above-range value to a range-restricted signed 16-bit integer\n"); - err = TestWriteJustAboveRangeValueToARangeRestrictedSigned16BitInteger_409(); - break; - case 410: - ChipLogProgress(chipTool, " ***** Test Step 410 : Write max value to a range-restricted signed 16-bit integer\n"); - err = TestWriteMaxValueToARangeRestrictedSigned16BitInteger_410(); - break; - case 411: - ChipLogProgress(chipTool, - " ***** Test Step 411 : Verify range-restricted signed 16-bit integer value has not changed\n"); - err = TestVerifyRangeRestrictedSigned16BitIntegerValueHasNotChanged_411(); - break; - case 412: - ChipLogProgress(chipTool, " ***** Test Step 412 : Write min valid value to a range-restricted signed 16-bit integer\n"); - err = TestWriteMinValidValueToARangeRestrictedSigned16BitInteger_412(); - break; - case 413: - ChipLogProgress(chipTool, - " ***** Test Step 413 : Verify range-restricted signed 16-bit integer value is at min valid\n"); - err = TestVerifyRangeRestrictedSigned16BitIntegerValueIsAtMinValid_413(); - break; - case 414: - ChipLogProgress(chipTool, " ***** Test Step 414 : Write max valid value to a range-restricted signed 16-bit integer\n"); - err = TestWriteMaxValidValueToARangeRestrictedSigned16BitInteger_414(); - break; - case 415: - ChipLogProgress(chipTool, - " ***** Test Step 415 : Verify range-restricted signed 16-bit integer value is at max valid\n"); - err = TestVerifyRangeRestrictedSigned16BitIntegerValueIsAtMaxValid_415(); - break; - case 416: - ChipLogProgress(chipTool, - " ***** Test Step 416 : Write middle valid value to a range-restricted signed 16-bit integer\n"); - err = TestWriteMiddleValidValueToARangeRestrictedSigned16BitInteger_416(); - break; - case 417: - ChipLogProgress(chipTool, - " ***** Test Step 417 : Verify range-restricted signed 16-bit integer value is at mid valid\n"); - err = TestVerifyRangeRestrictedSigned16BitIntegerValueIsAtMidValid_417(); - break; - case 418: - ChipLogProgress(chipTool, " ***** Test Step 418 : Read nullable range-restricted unsigned 8-bit integer\n"); - err = TestReadNullableRangeRestrictedUnsigned8BitInteger_418(); - break; - case 419: - ChipLogProgress(chipTool, - " ***** Test Step 419 : Write min value to a nullable range-restricted unsigned 8-bit integer\n"); - err = TestWriteMinValueToANullableRangeRestrictedUnsigned8BitInteger_419(); - break; - case 420: - ChipLogProgress( - chipTool, - " ***** Test Step 420 : Write just-below-range value to a nullable range-restricted unsigned 8-bit integer\n"); - err = TestWriteJustBelowRangeValueToANullableRangeRestrictedUnsigned8BitInteger_420(); - break; - case 421: - ChipLogProgress( - chipTool, - " ***** Test Step 421 : Write just-above-range value to a nullable range-restricted unsigned 8-bit integer\n"); - err = TestWriteJustAboveRangeValueToANullableRangeRestrictedUnsigned8BitInteger_421(); - break; - case 422: - ChipLogProgress(chipTool, - " ***** Test Step 422 : Write max value to a nullable range-restricted unsigned 8-bit integer\n"); - err = TestWriteMaxValueToANullableRangeRestrictedUnsigned8BitInteger_422(); - break; - case 423: - ChipLogProgress( - chipTool, " ***** Test Step 423 : Verify nullable range-restricted unsigned 8-bit integer value has not changed\n"); - err = TestVerifyNullableRangeRestrictedUnsigned8BitIntegerValueHasNotChanged_423(); - break; - case 424: - ChipLogProgress(chipTool, - " ***** Test Step 424 : Write min valid value to a nullable range-restricted unsigned 8-bit integer\n"); - err = TestWriteMinValidValueToANullableRangeRestrictedUnsigned8BitInteger_424(); - break; - case 425: - ChipLogProgress( - chipTool, " ***** Test Step 425 : Verify nullable range-restricted unsigned 8-bit integer value is at min valid\n"); - err = TestVerifyNullableRangeRestrictedUnsigned8BitIntegerValueIsAtMinValid_425(); - break; - case 426: - ChipLogProgress(chipTool, - " ***** Test Step 426 : Write max valid value to a nullable range-restricted unsigned 8-bit integer\n"); - err = TestWriteMaxValidValueToANullableRangeRestrictedUnsigned8BitInteger_426(); - break; - case 427: - ChipLogProgress( - chipTool, " ***** Test Step 427 : Verify nullable range-restricted unsigned 8-bit integer value is at max valid\n"); - err = TestVerifyNullableRangeRestrictedUnsigned8BitIntegerValueIsAtMaxValid_427(); - break; - case 428: - ChipLogProgress( - chipTool, - " ***** Test Step 428 : Write middle valid value to a nullable range-restricted unsigned 8-bit integer\n"); - err = TestWriteMiddleValidValueToANullableRangeRestrictedUnsigned8BitInteger_428(); - break; - case 429: - ChipLogProgress( - chipTool, " ***** Test Step 429 : Verify nullable range-restricted unsigned 8-bit integer value is at mid valid\n"); - err = TestVerifyNullableRangeRestrictedUnsigned8BitIntegerValueIsAtMidValid_429(); - break; - case 430: - ChipLogProgress(chipTool, - " ***** Test Step 430 : Write null value to a nullable range-restricted unsigned 8-bit integer\n"); - err = TestWriteNullValueToANullableRangeRestrictedUnsigned8BitInteger_430(); - break; - case 431: - ChipLogProgress(chipTool, - " ***** Test Step 431 : Verify nullable range-restricted unsigned 8-bit integer value is null\n"); - err = TestVerifyNullableRangeRestrictedUnsigned8BitIntegerValueIsNull_431(); - break; - case 432: - ChipLogProgress(chipTool, " ***** Test Step 432 : Read nullable range-restricted unsigned 16-bit integer\n"); - err = TestReadNullableRangeRestrictedUnsigned16BitInteger_432(); - break; - case 433: - ChipLogProgress(chipTool, - " ***** Test Step 433 : Write min value to a nullable range-restricted unsigned 16-bit integer\n"); - err = TestWriteMinValueToANullableRangeRestrictedUnsigned16BitInteger_433(); - break; - case 434: - ChipLogProgress( - chipTool, - " ***** Test Step 434 : Write just-below-range value to a nullable range-restricted unsigned 16-bit integer\n"); - err = TestWriteJustBelowRangeValueToANullableRangeRestrictedUnsigned16BitInteger_434(); - break; - case 435: - ChipLogProgress( - chipTool, - " ***** Test Step 435 : Write just-above-range value to a nullable range-restricted unsigned 16-bit integer\n"); - err = TestWriteJustAboveRangeValueToANullableRangeRestrictedUnsigned16BitInteger_435(); - break; - case 436: - ChipLogProgress(chipTool, - " ***** Test Step 436 : Write max value to a nullable range-restricted unsigned 16-bit integer\n"); - err = TestWriteMaxValueToANullableRangeRestrictedUnsigned16BitInteger_436(); - break; - case 437: - ChipLogProgress( - chipTool, - " ***** Test Step 437 : Verify nullable range-restricted unsigned 16-bit integer value has not changed\n"); - err = TestVerifyNullableRangeRestrictedUnsigned16BitIntegerValueHasNotChanged_437(); - break; - case 438: - ChipLogProgress( - chipTool, " ***** Test Step 438 : Write min valid value to a nullable range-restricted unsigned 16-bit integer\n"); - err = TestWriteMinValidValueToANullableRangeRestrictedUnsigned16BitInteger_438(); - break; - case 439: - ChipLogProgress( - chipTool, - " ***** Test Step 439 : Verify nullable range-restricted unsigned 16-bit integer value is at min valid\n"); - err = TestVerifyNullableRangeRestrictedUnsigned16BitIntegerValueIsAtMinValid_439(); - break; - case 440: - ChipLogProgress( - chipTool, " ***** Test Step 440 : Write max valid value to a nullable range-restricted unsigned 16-bit integer\n"); - err = TestWriteMaxValidValueToANullableRangeRestrictedUnsigned16BitInteger_440(); - break; - case 441: - ChipLogProgress( - chipTool, - " ***** Test Step 441 : Verify nullable range-restricted unsigned 16-bit integer value is at max valid\n"); - err = TestVerifyNullableRangeRestrictedUnsigned16BitIntegerValueIsAtMaxValid_441(); - break; - case 442: - ChipLogProgress( - chipTool, - " ***** Test Step 442 : Write middle valid value to a nullable range-restricted unsigned 16-bit integer\n"); - err = TestWriteMiddleValidValueToANullableRangeRestrictedUnsigned16BitInteger_442(); - break; - case 443: - ChipLogProgress( - chipTool, - " ***** Test Step 443 : Verify nullable range-restricted unsigned 16-bit integer value is at mid valid\n"); - err = TestVerifyNullableRangeRestrictedUnsigned16BitIntegerValueIsAtMidValid_443(); - break; - case 444: - ChipLogProgress(chipTool, - " ***** Test Step 444 : Write null value to a nullable range-restricted unsigned 16-bit integer\n"); - err = TestWriteNullValueToANullableRangeRestrictedUnsigned16BitInteger_444(); - break; - case 445: - ChipLogProgress(chipTool, - " ***** Test Step 445 : Verify nullable range-restricted unsigned 16-bit integer value is null\n"); - err = TestVerifyNullableRangeRestrictedUnsigned16BitIntegerValueIsNull_445(); - break; - case 446: - ChipLogProgress(chipTool, " ***** Test Step 446 : Read nullable range-restricted signed 8-bit integer\n"); - err = TestReadNullableRangeRestrictedSigned8BitInteger_446(); - break; - case 447: - ChipLogProgress(chipTool, - " ***** Test Step 447 : Write min value to a nullable range-restricted signed 8-bit integer\n"); - err = TestWriteMinValueToANullableRangeRestrictedSigned8BitInteger_447(); - break; - case 448: - ChipLogProgress( - chipTool, - " ***** Test Step 448 : Write just-below-range value to a nullable range-restricted signed 8-bit integer\n"); - err = TestWriteJustBelowRangeValueToANullableRangeRestrictedSigned8BitInteger_448(); - break; - case 449: - ChipLogProgress( - chipTool, - " ***** Test Step 449 : Write just-above-range value to a nullable range-restricted signed 8-bit integer\n"); - err = TestWriteJustAboveRangeValueToANullableRangeRestrictedSigned8BitInteger_449(); - break; - case 450: - ChipLogProgress(chipTool, - " ***** Test Step 450 : Write max value to a nullable range-restricted signed 8-bit integer\n"); - err = TestWriteMaxValueToANullableRangeRestrictedSigned8BitInteger_450(); - break; - case 451: - ChipLogProgress(chipTool, - " ***** Test Step 451 : Verify nullable range-restricted signed 8-bit integer value has not changed\n"); - err = TestVerifyNullableRangeRestrictedSigned8BitIntegerValueHasNotChanged_451(); - break; - case 452: - ChipLogProgress(chipTool, - " ***** Test Step 452 : Write min valid value to a nullable range-restricted signed 8-bit integer\n"); - err = TestWriteMinValidValueToANullableRangeRestrictedSigned8BitInteger_452(); - break; - case 453: - ChipLogProgress(chipTool, - " ***** Test Step 453 : Verify nullable range-restricted signed 8-bit integer value is at min valid\n"); - err = TestVerifyNullableRangeRestrictedSigned8BitIntegerValueIsAtMinValid_453(); - break; - case 454: - ChipLogProgress(chipTool, - " ***** Test Step 454 : Write max valid value to a nullable range-restricted signed 8-bit integer\n"); - err = TestWriteMaxValidValueToANullableRangeRestrictedSigned8BitInteger_454(); - break; - case 455: - ChipLogProgress(chipTool, - " ***** Test Step 455 : Verify nullable range-restricted signed 8-bit integer value is at max valid\n"); - err = TestVerifyNullableRangeRestrictedSigned8BitIntegerValueIsAtMaxValid_455(); - break; - case 456: - ChipLogProgress( - chipTool, " ***** Test Step 456 : Write middle valid value to a nullable range-restricted signed 8-bit integer\n"); - err = TestWriteMiddleValidValueToANullableRangeRestrictedSigned8BitInteger_456(); - break; - case 457: - ChipLogProgress(chipTool, - " ***** Test Step 457 : Verify nullable range-restricted signed 8-bit integer value is at mid valid\n"); - err = TestVerifyNullableRangeRestrictedSigned8BitIntegerValueIsAtMidValid_457(); - break; - case 458: - ChipLogProgress(chipTool, - " ***** Test Step 458 : Write null value to a nullable range-restricted signed 8-bit integer\n"); - err = TestWriteNullValueToANullableRangeRestrictedSigned8BitInteger_458(); - break; - case 459: - ChipLogProgress(chipTool, - " ***** Test Step 459 : Verify nullable range-restricted signed 8-bit integer value is at null\n"); - err = TestVerifyNullableRangeRestrictedSigned8BitIntegerValueIsAtNull_459(); - break; - case 460: - ChipLogProgress(chipTool, " ***** Test Step 460 : Read nullable range-restricted signed 16-bit integer\n"); - err = TestReadNullableRangeRestrictedSigned16BitInteger_460(); - break; - case 461: - ChipLogProgress(chipTool, - " ***** Test Step 461 : Write min value to a nullable range-restricted signed 16-bit integer\n"); - err = TestWriteMinValueToANullableRangeRestrictedSigned16BitInteger_461(); - break; - case 462: - ChipLogProgress( - chipTool, - " ***** Test Step 462 : Write just-below-range value to a nullable range-restricted signed 16-bit integer\n"); - err = TestWriteJustBelowRangeValueToANullableRangeRestrictedSigned16BitInteger_462(); - break; - case 463: - ChipLogProgress( - chipTool, - " ***** Test Step 463 : Write just-above-range value to a nullable range-restricted signed 16-bit integer\n"); - err = TestWriteJustAboveRangeValueToANullableRangeRestrictedSigned16BitInteger_463(); - break; - case 464: - ChipLogProgress(chipTool, - " ***** Test Step 464 : Write max value to a nullable range-restricted signed 16-bit integer\n"); - err = TestWriteMaxValueToANullableRangeRestrictedSigned16BitInteger_464(); - break; - case 465: - ChipLogProgress( - chipTool, " ***** Test Step 465 : Verify nullable range-restricted signed 16-bit integer value has not changed\n"); - err = TestVerifyNullableRangeRestrictedSigned16BitIntegerValueHasNotChanged_465(); - break; - case 466: - ChipLogProgress(chipTool, - " ***** Test Step 466 : Write min valid value to a nullable range-restricted signed 16-bit integer\n"); - err = TestWriteMinValidValueToANullableRangeRestrictedSigned16BitInteger_466(); - break; - case 467: - ChipLogProgress( - chipTool, " ***** Test Step 467 : Verify nullable range-restricted signed 16-bit integer value is at min valid\n"); - err = TestVerifyNullableRangeRestrictedSigned16BitIntegerValueIsAtMinValid_467(); - break; - case 468: - ChipLogProgress(chipTool, - " ***** Test Step 468 : Write max valid value to a nullable range-restricted signed 16-bit integer\n"); - err = TestWriteMaxValidValueToANullableRangeRestrictedSigned16BitInteger_468(); - break; - case 469: - ChipLogProgress( - chipTool, " ***** Test Step 469 : Verify nullable range-restricted signed 16-bit integer value is at max valid\n"); - err = TestVerifyNullableRangeRestrictedSigned16BitIntegerValueIsAtMaxValid_469(); - break; - case 470: - ChipLogProgress( - chipTool, " ***** Test Step 470 : Write middle valid value to a nullable range-restricted signed 16-bit integer\n"); - err = TestWriteMiddleValidValueToANullableRangeRestrictedSigned16BitInteger_470(); - break; - case 471: - ChipLogProgress( - chipTool, " ***** Test Step 471 : Verify nullable range-restricted signed 16-bit integer value is at mid valid\n"); - err = TestVerifyNullableRangeRestrictedSigned16BitIntegerValueIsAtMidValid_471(); - break; - case 472: - ChipLogProgress(chipTool, - " ***** Test Step 472 : Write null value to a nullable range-restricted signed 16-bit integer\n"); - err = TestWriteNullValueToANullableRangeRestrictedSigned16BitInteger_472(); - break; - case 473: - ChipLogProgress(chipTool, - " ***** Test Step 473 : Verify nullable range-restricted signed 16-bit integer value is null\n"); - err = TestVerifyNullableRangeRestrictedSigned16BitIntegerValueIsNull_473(); - break; - case 474: - ChipLogProgress(chipTool, " ***** Test Step 474 : Write attribute that returns general status on write\n"); - err = TestWriteAttributeThatReturnsGeneralStatusOnWrite_474(); - break; - case 475: - ChipLogProgress(chipTool, " ***** Test Step 475 : Write attribute that returns cluster-specific status on write\n"); - err = TestWriteAttributeThatReturnsClusterSpecificStatusOnWrite_475(); - break; - case 476: - ChipLogProgress(chipTool, " ***** Test Step 476 : Read attribute that returns general status on read\n"); - err = TestReadAttributeThatReturnsGeneralStatusOnRead_476(); - break; - case 477: - ChipLogProgress(chipTool, " ***** Test Step 477 : read attribute that returns cluster-specific status on read\n"); - err = TestReadAttributeThatReturnsClusterSpecificStatusOnRead_477(); - break; - case 478: - ChipLogProgress(chipTool, " ***** Test Step 478 : read AcceptedCommandList attribute\n"); - err = TestReadAcceptedCommandListAttribute_478(); - break; - case 479: - ChipLogProgress(chipTool, " ***** Test Step 479 : read GeneratedCommandList attribute\n"); - err = TestReadGeneratedCommandListAttribute_479(); - break; - case 480: - ChipLogProgress(chipTool, " ***** Test Step 480 : Write struct-typed attribute\n"); - err = TestWriteStructTypedAttribute_480(); - break; - case 481: - ChipLogProgress(chipTool, " ***** Test Step 481 : Read struct-typed attribute\n"); - err = TestReadStructTypedAttribute_481(); - break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 482; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - typedef void (*Test_TestCluster_list_int8u_ReportCallback)(void * context, - const chip::app::DataModel::DecodableList & value); - Test_TestCluster_list_int8u_ReportCallback mTest_TestCluster_list_int8u_Reported = nullptr; - - static void OnFailureCallback_6(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_6(error); - } - - static void OnSuccessCallback_6(void * context, bool boolean) - { - (static_cast(context))->OnSuccessResponse_6(boolean); - } - - static void OnFailureCallback_7(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_7(error); - } - - static void OnSuccessCallback_7(void * context) { (static_cast(context))->OnSuccessResponse_7(); } - - static void OnFailureCallback_8(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_8(error); - } - - static void OnSuccessCallback_8(void * context, bool boolean) - { - (static_cast(context))->OnSuccessResponse_8(boolean); - } - - static void OnFailureCallback_9(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_9(error); - } - - static void OnSuccessCallback_9(void * context) { (static_cast(context))->OnSuccessResponse_9(); } - - static void OnFailureCallback_10(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_10(error); - } - - static void OnSuccessCallback_10(void * context, bool boolean) - { - (static_cast(context))->OnSuccessResponse_10(boolean); - } - - static void OnFailureCallback_11(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_11(error); - } - - static void OnSuccessCallback_11(void * context, chip::BitFlags bitmap8) - { - (static_cast(context))->OnSuccessResponse_11(bitmap8); - } - - static void OnFailureCallback_12(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_12(error); - } - - static void OnSuccessCallback_12(void * context) { (static_cast(context))->OnSuccessResponse_12(); } - - static void OnFailureCallback_13(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_13(error); - } - - static void OnSuccessCallback_13(void * context, chip::BitFlags bitmap8) - { - (static_cast(context))->OnSuccessResponse_13(bitmap8); - } - - static void OnFailureCallback_14(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_14(error); - } - - static void OnSuccessCallback_14(void * context) { (static_cast(context))->OnSuccessResponse_14(); } - - static void OnFailureCallback_15(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_15(error); - } - - static void OnSuccessCallback_15(void * context, chip::BitFlags bitmap8) - { - (static_cast(context))->OnSuccessResponse_15(bitmap8); - } - - static void OnFailureCallback_16(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_16(error); - } - - static void OnSuccessCallback_16(void * context, chip::BitFlags bitmap16) - { - (static_cast(context))->OnSuccessResponse_16(bitmap16); - } - - static void OnFailureCallback_17(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_17(error); - } - - static void OnSuccessCallback_17(void * context) { (static_cast(context))->OnSuccessResponse_17(); } - - static void OnFailureCallback_18(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_18(error); - } - - static void OnSuccessCallback_18(void * context, chip::BitFlags bitmap16) - { - (static_cast(context))->OnSuccessResponse_18(bitmap16); - } - - static void OnFailureCallback_19(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_19(error); - } - - static void OnSuccessCallback_19(void * context) { (static_cast(context))->OnSuccessResponse_19(); } - - static void OnFailureCallback_20(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_20(error); - } - - static void OnSuccessCallback_20(void * context, chip::BitFlags bitmap16) - { - (static_cast(context))->OnSuccessResponse_20(bitmap16); - } - - static void OnFailureCallback_21(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_21(error); - } - - static void OnSuccessCallback_21(void * context, chip::BitFlags bitmap32) - { - (static_cast(context))->OnSuccessResponse_21(bitmap32); - } - - static void OnFailureCallback_22(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_22(error); - } - - static void OnSuccessCallback_22(void * context) { (static_cast(context))->OnSuccessResponse_22(); } - - static void OnFailureCallback_23(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_23(error); - } - - static void OnSuccessCallback_23(void * context, chip::BitFlags bitmap32) - { - (static_cast(context))->OnSuccessResponse_23(bitmap32); - } - - static void OnFailureCallback_24(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_24(error); - } - - static void OnSuccessCallback_24(void * context) { (static_cast(context))->OnSuccessResponse_24(); } - - static void OnFailureCallback_25(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_25(error); - } - - static void OnSuccessCallback_25(void * context, chip::BitFlags bitmap32) - { - (static_cast(context))->OnSuccessResponse_25(bitmap32); - } - - static void OnFailureCallback_26(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_26(error); - } - - static void OnSuccessCallback_26(void * context, chip::BitFlags bitmap64) - { - (static_cast(context))->OnSuccessResponse_26(bitmap64); - } - - static void OnFailureCallback_27(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_27(error); - } - - static void OnSuccessCallback_27(void * context) { (static_cast(context))->OnSuccessResponse_27(); } - - static void OnFailureCallback_28(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_28(error); - } - - static void OnSuccessCallback_28(void * context, chip::BitFlags bitmap64) - { - (static_cast(context))->OnSuccessResponse_28(bitmap64); - } - - static void OnFailureCallback_29(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_29(error); - } - - static void OnSuccessCallback_29(void * context) { (static_cast(context))->OnSuccessResponse_29(); } - - static void OnFailureCallback_30(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_30(error); - } - - static void OnSuccessCallback_30(void * context, chip::BitFlags bitmap64) - { - (static_cast(context))->OnSuccessResponse_30(bitmap64); - } - - static void OnFailureCallback_31(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_31(error); - } - - static void OnSuccessCallback_31(void * context, uint8_t int8u) - { - (static_cast(context))->OnSuccessResponse_31(int8u); - } - - static void OnFailureCallback_32(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_32(error); - } - - static void OnSuccessCallback_32(void * context) { (static_cast(context))->OnSuccessResponse_32(); } - - static void OnFailureCallback_33(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_33(error); - } - - static void OnSuccessCallback_33(void * context, uint8_t int8u) - { - (static_cast(context))->OnSuccessResponse_33(int8u); - } - - static void OnFailureCallback_34(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_34(error); - } - - static void OnSuccessCallback_34(void * context) { (static_cast(context))->OnSuccessResponse_34(); } - - static void OnFailureCallback_35(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_35(error); - } - - static void OnSuccessCallback_35(void * context, uint8_t int8u) - { - (static_cast(context))->OnSuccessResponse_35(int8u); - } - - static void OnFailureCallback_36(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_36(error); - } - - static void OnSuccessCallback_36(void * context, uint16_t int16u) - { - (static_cast(context))->OnSuccessResponse_36(int16u); - } - - static void OnFailureCallback_37(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_37(error); - } - - static void OnSuccessCallback_37(void * context) { (static_cast(context))->OnSuccessResponse_37(); } - - static void OnFailureCallback_38(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_38(error); - } - - static void OnSuccessCallback_38(void * context, uint16_t int16u) - { - (static_cast(context))->OnSuccessResponse_38(int16u); - } - - static void OnFailureCallback_39(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_39(error); - } - - static void OnSuccessCallback_39(void * context) { (static_cast(context))->OnSuccessResponse_39(); } - - static void OnFailureCallback_40(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_40(error); - } - - static void OnSuccessCallback_40(void * context, uint16_t int16u) - { - (static_cast(context))->OnSuccessResponse_40(int16u); - } - - static void OnFailureCallback_41(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_41(error); - } - - static void OnSuccessCallback_41(void * context, uint32_t int32u) - { - (static_cast(context))->OnSuccessResponse_41(int32u); - } - - static void OnFailureCallback_42(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_42(error); - } - - static void OnSuccessCallback_42(void * context) { (static_cast(context))->OnSuccessResponse_42(); } - - static void OnFailureCallback_43(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_43(error); - } - - static void OnSuccessCallback_43(void * context, uint32_t int32u) - { - (static_cast(context))->OnSuccessResponse_43(int32u); - } - - static void OnFailureCallback_44(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_44(error); - } - - static void OnSuccessCallback_44(void * context) { (static_cast(context))->OnSuccessResponse_44(); } - - static void OnFailureCallback_45(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_45(error); - } - - static void OnSuccessCallback_45(void * context, uint32_t int32u) - { - (static_cast(context))->OnSuccessResponse_45(int32u); - } - - static void OnFailureCallback_46(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_46(error); - } - - static void OnSuccessCallback_46(void * context, uint64_t int64u) - { - (static_cast(context))->OnSuccessResponse_46(int64u); - } - - static void OnFailureCallback_47(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_47(error); - } - - static void OnSuccessCallback_47(void * context) { (static_cast(context))->OnSuccessResponse_47(); } - - static void OnFailureCallback_48(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_48(error); - } - - static void OnSuccessCallback_48(void * context, uint64_t int64u) - { - (static_cast(context))->OnSuccessResponse_48(int64u); - } - - static void OnFailureCallback_49(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_49(error); - } - - static void OnSuccessCallback_49(void * context) { (static_cast(context))->OnSuccessResponse_49(); } - - static void OnFailureCallback_50(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_50(error); - } - - static void OnSuccessCallback_50(void * context, uint64_t int64u) - { - (static_cast(context))->OnSuccessResponse_50(int64u); - } - - static void OnFailureCallback_51(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_51(error); - } - - static void OnSuccessCallback_51(void * context, int8_t int8s) - { - (static_cast(context))->OnSuccessResponse_51(int8s); - } - - static void OnFailureCallback_52(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_52(error); - } - - static void OnSuccessCallback_52(void * context) { (static_cast(context))->OnSuccessResponse_52(); } - - static void OnFailureCallback_53(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_53(error); - } - - static void OnSuccessCallback_53(void * context, int8_t int8s) - { - (static_cast(context))->OnSuccessResponse_53(int8s); - } - - static void OnFailureCallback_54(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_54(error); - } - - static void OnSuccessCallback_54(void * context) { (static_cast(context))->OnSuccessResponse_54(); } - - static void OnFailureCallback_55(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_55(error); - } - - static void OnSuccessCallback_55(void * context, int8_t int8s) - { - (static_cast(context))->OnSuccessResponse_55(int8s); - } - - static void OnFailureCallback_56(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_56(error); - } - - static void OnSuccessCallback_56(void * context) { (static_cast(context))->OnSuccessResponse_56(); } - - static void OnFailureCallback_57(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_57(error); - } - - static void OnSuccessCallback_57(void * context, int8_t int8s) - { - (static_cast(context))->OnSuccessResponse_57(int8s); - } - - static void OnFailureCallback_58(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_58(error); - } - - static void OnSuccessCallback_58(void * context, int16_t int16s) - { - (static_cast(context))->OnSuccessResponse_58(int16s); - } - - static void OnFailureCallback_59(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_59(error); - } - - static void OnSuccessCallback_59(void * context) { (static_cast(context))->OnSuccessResponse_59(); } - - static void OnFailureCallback_60(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_60(error); - } - - static void OnSuccessCallback_60(void * context, int16_t int16s) - { - (static_cast(context))->OnSuccessResponse_60(int16s); - } - - static void OnFailureCallback_61(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_61(error); - } - - static void OnSuccessCallback_61(void * context) { (static_cast(context))->OnSuccessResponse_61(); } - - static void OnFailureCallback_62(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_62(error); - } - - static void OnSuccessCallback_62(void * context, int16_t int16s) - { - (static_cast(context))->OnSuccessResponse_62(int16s); - } - - static void OnFailureCallback_63(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_63(error); - } - - static void OnSuccessCallback_63(void * context) { (static_cast(context))->OnSuccessResponse_63(); } - - static void OnFailureCallback_64(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_64(error); - } - - static void OnSuccessCallback_64(void * context, int16_t int16s) - { - (static_cast(context))->OnSuccessResponse_64(int16s); - } - - static void OnFailureCallback_65(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_65(error); - } - - static void OnSuccessCallback_65(void * context, int32_t int32s) - { - (static_cast(context))->OnSuccessResponse_65(int32s); - } - - static void OnFailureCallback_66(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_66(error); - } - - static void OnSuccessCallback_66(void * context) { (static_cast(context))->OnSuccessResponse_66(); } - - static void OnFailureCallback_67(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_67(error); - } - - static void OnSuccessCallback_67(void * context, int32_t int32s) - { - (static_cast(context))->OnSuccessResponse_67(int32s); - } - - static void OnFailureCallback_68(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_68(error); - } - - static void OnSuccessCallback_68(void * context) { (static_cast(context))->OnSuccessResponse_68(); } - - static void OnFailureCallback_69(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_69(error); - } - - static void OnSuccessCallback_69(void * context, int32_t int32s) - { - (static_cast(context))->OnSuccessResponse_69(int32s); - } - - static void OnFailureCallback_70(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_70(error); - } - - static void OnSuccessCallback_70(void * context) { (static_cast(context))->OnSuccessResponse_70(); } - - static void OnFailureCallback_71(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_71(error); - } - - static void OnSuccessCallback_71(void * context, int32_t int32s) - { - (static_cast(context))->OnSuccessResponse_71(int32s); - } - - static void OnFailureCallback_72(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_72(error); - } - - static void OnSuccessCallback_72(void * context, int64_t int64s) - { - (static_cast(context))->OnSuccessResponse_72(int64s); - } - - static void OnFailureCallback_73(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_73(error); - } - - static void OnSuccessCallback_73(void * context) { (static_cast(context))->OnSuccessResponse_73(); } - - static void OnFailureCallback_74(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_74(error); - } - - static void OnSuccessCallback_74(void * context, int64_t int64s) - { - (static_cast(context))->OnSuccessResponse_74(int64s); - } - - static void OnFailureCallback_75(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_75(error); - } - - static void OnSuccessCallback_75(void * context) { (static_cast(context))->OnSuccessResponse_75(); } - - static void OnFailureCallback_76(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_76(error); - } - - static void OnSuccessCallback_76(void * context, int64_t int64s) - { - (static_cast(context))->OnSuccessResponse_76(int64s); - } - - static void OnFailureCallback_77(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_77(error); - } - - static void OnSuccessCallback_77(void * context) { (static_cast(context))->OnSuccessResponse_77(); } - - static void OnFailureCallback_78(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_78(error); - } - - static void OnSuccessCallback_78(void * context, int64_t int64s) - { - (static_cast(context))->OnSuccessResponse_78(int64s); - } - - static void OnFailureCallback_79(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_79(error); - } - - static void OnSuccessCallback_79(void * context, float floatSingle) - { - (static_cast(context))->OnSuccessResponse_79(floatSingle); - } - - static void OnFailureCallback_80(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_80(error); - } - - static void OnSuccessCallback_80(void * context) { (static_cast(context))->OnSuccessResponse_80(); } - - static void OnFailureCallback_81(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_81(error); - } - - static void OnSuccessCallback_81(void * context, float floatSingle) - { - (static_cast(context))->OnSuccessResponse_81(floatSingle); - } - - static void OnFailureCallback_82(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_82(error); - } - - static void OnSuccessCallback_82(void * context) { (static_cast(context))->OnSuccessResponse_82(); } - - static void OnFailureCallback_83(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_83(error); - } - - static void OnSuccessCallback_83(void * context, float floatSingle) - { - (static_cast(context))->OnSuccessResponse_83(floatSingle); - } - - static void OnFailureCallback_84(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_84(error); - } - - static void OnSuccessCallback_84(void * context) { (static_cast(context))->OnSuccessResponse_84(); } - - static void OnFailureCallback_85(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_85(error); - } - - static void OnSuccessCallback_85(void * context, float floatSingle) - { - (static_cast(context))->OnSuccessResponse_85(floatSingle); - } - - static void OnFailureCallback_86(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_86(error); - } - - static void OnSuccessCallback_86(void * context) { (static_cast(context))->OnSuccessResponse_86(); } - - static void OnFailureCallback_87(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_87(error); - } - - static void OnSuccessCallback_87(void * context, float floatSingle) - { - (static_cast(context))->OnSuccessResponse_87(floatSingle); - } - - static void OnFailureCallback_88(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_88(error); - } - - static void OnSuccessCallback_88(void * context, double floatDouble) - { - (static_cast(context))->OnSuccessResponse_88(floatDouble); - } - - static void OnFailureCallback_89(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_89(error); - } - - static void OnSuccessCallback_89(void * context) { (static_cast(context))->OnSuccessResponse_89(); } - - static void OnFailureCallback_90(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_90(error); - } - - static void OnSuccessCallback_90(void * context, double floatDouble) - { - (static_cast(context))->OnSuccessResponse_90(floatDouble); - } - - static void OnFailureCallback_91(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_91(error); - } - - static void OnSuccessCallback_91(void * context) { (static_cast(context))->OnSuccessResponse_91(); } - - static void OnFailureCallback_92(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_92(error); - } - - static void OnSuccessCallback_92(void * context, double floatDouble) - { - (static_cast(context))->OnSuccessResponse_92(floatDouble); - } - - static void OnFailureCallback_93(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_93(error); - } - - static void OnSuccessCallback_93(void * context) { (static_cast(context))->OnSuccessResponse_93(); } - - static void OnFailureCallback_94(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_94(error); - } - - static void OnSuccessCallback_94(void * context, double floatDouble) - { - (static_cast(context))->OnSuccessResponse_94(floatDouble); - } - - static void OnFailureCallback_95(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_95(error); - } - - static void OnSuccessCallback_95(void * context) { (static_cast(context))->OnSuccessResponse_95(); } - - static void OnFailureCallback_96(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_96(error); - } - - static void OnSuccessCallback_96(void * context, double floatDouble) - { - (static_cast(context))->OnSuccessResponse_96(floatDouble); - } - - static void OnFailureCallback_97(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_97(error); - } - - static void OnSuccessCallback_97(void * context, uint8_t enum8) - { - (static_cast(context))->OnSuccessResponse_97(enum8); - } - - static void OnFailureCallback_98(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_98(error); - } - - static void OnSuccessCallback_98(void * context) { (static_cast(context))->OnSuccessResponse_98(); } - - static void OnFailureCallback_99(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_99(error); - } - - static void OnSuccessCallback_99(void * context, uint8_t enum8) - { - (static_cast(context))->OnSuccessResponse_99(enum8); - } - - static void OnFailureCallback_100(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_100(error); - } - - static void OnSuccessCallback_100(void * context) { (static_cast(context))->OnSuccessResponse_100(); } - - static void OnFailureCallback_101(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_101(error); - } - - static void OnSuccessCallback_101(void * context, uint8_t enum8) - { - (static_cast(context))->OnSuccessResponse_101(enum8); - } - - static void OnFailureCallback_102(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_102(error); - } - - static void OnSuccessCallback_102(void * context, uint16_t enum16) - { - (static_cast(context))->OnSuccessResponse_102(enum16); - } - - static void OnFailureCallback_103(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_103(error); - } - - static void OnSuccessCallback_103(void * context) { (static_cast(context))->OnSuccessResponse_103(); } - - static void OnFailureCallback_104(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_104(error); - } - - static void OnSuccessCallback_104(void * context, uint16_t enum16) - { - (static_cast(context))->OnSuccessResponse_104(enum16); - } - - static void OnFailureCallback_105(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_105(error); - } - - static void OnSuccessCallback_105(void * context) { (static_cast(context))->OnSuccessResponse_105(); } - - static void OnFailureCallback_106(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_106(error); - } - - static void OnSuccessCallback_106(void * context, uint16_t enum16) - { - (static_cast(context))->OnSuccessResponse_106(enum16); - } - - static void OnFailureCallback_107(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_107(error); - } - - static void OnSuccessCallback_107(void * context, chip::ByteSpan octetString) - { - (static_cast(context))->OnSuccessResponse_107(octetString); - } - - static void OnFailureCallback_108(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_108(error); - } - - static void OnSuccessCallback_108(void * context) { (static_cast(context))->OnSuccessResponse_108(); } - - static void OnFailureCallback_109(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_109(error); - } - - static void OnSuccessCallback_109(void * context, chip::ByteSpan octetString) - { - (static_cast(context))->OnSuccessResponse_109(octetString); - } - - static void OnFailureCallback_110(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_110(error); - } - - static void OnSuccessCallback_110(void * context) { (static_cast(context))->OnSuccessResponse_110(); } - - static void OnFailureCallback_111(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_111(error); - } - - static void OnSuccessCallback_111(void * context, chip::ByteSpan octetString) - { - (static_cast(context))->OnSuccessResponse_111(octetString); - } - - static void OnFailureCallback_112(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_112(error); - } - - static void OnSuccessCallback_112(void * context) { (static_cast(context))->OnSuccessResponse_112(); } - - static void OnFailureCallback_113(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_113(error); - } - - static void OnSuccessCallback_113(void * context, chip::ByteSpan octetString) - { - (static_cast(context))->OnSuccessResponse_113(octetString); - } - - static void OnFailureCallback_114(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_114(error); - } - - static void OnSuccessCallback_114(void * context) { (static_cast(context))->OnSuccessResponse_114(); } - - static void OnFailureCallback_115(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_115(error); - } - - static void OnSuccessCallback_115(void * context, chip::ByteSpan octetString) - { - (static_cast(context))->OnSuccessResponse_115(octetString); - } - - static void OnFailureCallback_116(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_116(error); - } - - static void OnSuccessCallback_116(void * context) { (static_cast(context))->OnSuccessResponse_116(); } - - static void OnFailureCallback_117(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_117(error); - } - - static void OnSuccessCallback_117(void * context, chip::ByteSpan longOctetString) - { - (static_cast(context))->OnSuccessResponse_117(longOctetString); - } - - static void OnFailureCallback_118(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_118(error); - } - - static void OnSuccessCallback_118(void * context) { (static_cast(context))->OnSuccessResponse_118(); } - - static void OnFailureCallback_119(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_119(error); - } - - static void OnSuccessCallback_119(void * context, chip::ByteSpan longOctetString) - { - (static_cast(context))->OnSuccessResponse_119(longOctetString); - } - - static void OnFailureCallback_120(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_120(error); - } - - static void OnSuccessCallback_120(void * context) { (static_cast(context))->OnSuccessResponse_120(); } - - static void OnFailureCallback_121(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_121(error); - } - - static void OnSuccessCallback_121(void * context, chip::CharSpan charString) - { - (static_cast(context))->OnSuccessResponse_121(charString); - } - - static void OnFailureCallback_122(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_122(error); - } - - static void OnSuccessCallback_122(void * context) { (static_cast(context))->OnSuccessResponse_122(); } - - static void OnFailureCallback_123(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_123(error); - } - - static void OnSuccessCallback_123(void * context, chip::CharSpan charString) - { - (static_cast(context))->OnSuccessResponse_123(charString); - } - - static void OnFailureCallback_124(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_124(error); - } - - static void OnSuccessCallback_124(void * context) { (static_cast(context))->OnSuccessResponse_124(); } - - static void OnFailureCallback_125(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_125(error); - } - - static void OnSuccessCallback_125(void * context, chip::CharSpan charString) - { - (static_cast(context))->OnSuccessResponse_125(charString); - } - - static void OnFailureCallback_126(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_126(error); - } - - static void OnSuccessCallback_126(void * context) { (static_cast(context))->OnSuccessResponse_126(); } - - static void OnFailureCallback_127(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_127(error); - } - - static void OnSuccessCallback_127(void * context, chip::CharSpan longCharString) - { - (static_cast(context))->OnSuccessResponse_127(longCharString); - } - - static void OnFailureCallback_128(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_128(error); - } - - static void OnSuccessCallback_128(void * context) { (static_cast(context))->OnSuccessResponse_128(); } - - static void OnFailureCallback_129(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_129(error); - } - - static void OnSuccessCallback_129(void * context, chip::CharSpan longCharString) - { - (static_cast(context))->OnSuccessResponse_129(longCharString); - } - - static void OnFailureCallback_130(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_130(error); - } - - static void OnSuccessCallback_130(void * context) { (static_cast(context))->OnSuccessResponse_130(); } - - static void OnFailureCallback_131(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_131(error); - } - - static void OnSuccessCallback_131(void * context, - const chip::app::DataModel::DecodableList & listLongOctetString) - { - (static_cast(context))->OnSuccessResponse_131(listLongOctetString); - } - - static void OnFailureCallback_132(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_132(error); - } - - static void OnSuccessCallback_132(void * context) { (static_cast(context))->OnSuccessResponse_132(); } - - static void OnFailureCallback_133(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_133(error); - } - - static void OnSuccessCallback_133(void * context, - const chip::app::DataModel::DecodableList & listLongOctetString) - { - (static_cast(context))->OnSuccessResponse_133(listLongOctetString); - } - - static void OnFailureCallback_134(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_134(error); - } - - static void OnSuccessCallback_134(void * context, uint64_t epochUs) - { - (static_cast(context))->OnSuccessResponse_134(epochUs); - } - - static void OnFailureCallback_135(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_135(error); - } - - static void OnSuccessCallback_135(void * context) { (static_cast(context))->OnSuccessResponse_135(); } - - static void OnFailureCallback_136(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_136(error); - } - - static void OnSuccessCallback_136(void * context, uint64_t epochUs) - { - (static_cast(context))->OnSuccessResponse_136(epochUs); - } - - static void OnFailureCallback_137(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_137(error); - } - - static void OnSuccessCallback_137(void * context) { (static_cast(context))->OnSuccessResponse_137(); } - - static void OnFailureCallback_138(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_138(error); - } - - static void OnSuccessCallback_138(void * context, uint64_t epochUs) - { - (static_cast(context))->OnSuccessResponse_138(epochUs); - } - - static void OnFailureCallback_139(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_139(error); - } - - static void OnSuccessCallback_139(void * context, uint32_t epochS) - { - (static_cast(context))->OnSuccessResponse_139(epochS); - } - - static void OnFailureCallback_140(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_140(error); - } - - static void OnSuccessCallback_140(void * context) { (static_cast(context))->OnSuccessResponse_140(); } - - static void OnFailureCallback_141(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_141(error); - } - - static void OnSuccessCallback_141(void * context, uint32_t epochS) - { - (static_cast(context))->OnSuccessResponse_141(epochS); - } - - static void OnFailureCallback_142(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_142(error); - } - - static void OnSuccessCallback_142(void * context) { (static_cast(context))->OnSuccessResponse_142(); } - - static void OnFailureCallback_143(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_143(error); - } - - static void OnSuccessCallback_143(void * context, uint32_t epochS) - { - (static_cast(context))->OnSuccessResponse_143(epochS); - } - - static void OnFailureCallback_144(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_144(error); - } - - static void OnSuccessCallback_144(void * context, bool unsupported) - { - (static_cast(context))->OnSuccessResponse_144(unsupported); - } - - static void OnFailureCallback_145(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_145(error); - } - - static void OnSuccessCallback_145(void * context) { (static_cast(context))->OnSuccessResponse_145(); } - - static void OnFailureCallback_148(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_148(error); - } - - static void OnSuccessCallback_148(void * context, chip::VendorId vendorId) - { - (static_cast(context))->OnSuccessResponse_148(vendorId); - } - - static void OnFailureCallback_149(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_149(error); - } - - static void OnSuccessCallback_149(void * context) { (static_cast(context))->OnSuccessResponse_149(); } - - static void OnFailureCallback_150(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_150(error); - } - - static void OnSuccessCallback_150(void * context, chip::VendorId vendorId) - { - (static_cast(context))->OnSuccessResponse_150(vendorId); - } - - static void OnFailureCallback_151(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_151(error); - } - - static void OnSuccessCallback_151(void * context) { (static_cast(context))->OnSuccessResponse_151(); } - - static void OnFailureCallback_168(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_168(error); - } - - static void OnSuccessCallback_168(void * context) { (static_cast(context))->OnSuccessResponse_168(); } - - static void OnFailureCallback_169(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_169(error); - } - - static void OnSuccessCallback_169(void * context, const chip::app::DataModel::DecodableList & listInt8u) - { - (static_cast(context))->OnSuccessResponse_169(listInt8u); - } - - static void OnFailureCallback_170(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_170(error); - } - - static void OnSuccessCallback_170(void * context) { (static_cast(context))->OnSuccessResponse_170(); } - - static void OnFailureCallback_171(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_171(error); - } - - static void OnSuccessCallback_171(void * context, const chip::app::DataModel::DecodableList & listOctetString) - { - (static_cast(context))->OnSuccessResponse_171(listOctetString); - } - - static void OnFailureCallback_172(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_172(error); - } - - static void OnSuccessCallback_172(void * context) { (static_cast(context))->OnSuccessResponse_172(); } - - static void OnFailureCallback_173(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_173(error); - } - - static void OnSuccessCallback_173( - void * context, - const chip::app::DataModel::DecodableList & - listStructOctetString) - { - (static_cast(context))->OnSuccessResponse_173(listStructOctetString); - } - - static void OnFailureCallback_176(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_176(error); - } - - static void OnSuccessCallback_176(void * context, - const chip::app::DataModel::DecodableList< - chip::app::Clusters::TestCluster::Structs::NullablesAndOptionalsStruct::DecodableType> & - listNullablesAndOptionalsStruct) - { - (static_cast(context))->OnSuccessResponse_176(listNullablesAndOptionalsStruct); - } - - static void OnFailureCallback_177(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_177(error); - } - - static void OnSuccessCallback_177(void * context) { (static_cast(context))->OnSuccessResponse_177(); } - - static void OnFailureCallback_178(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_178(error); - } - - static void OnSuccessCallback_178(void * context, - const chip::app::DataModel::DecodableList< - chip::app::Clusters::TestCluster::Structs::NullablesAndOptionalsStruct::DecodableType> & - listNullablesAndOptionalsStruct) - { - (static_cast(context))->OnSuccessResponse_178(listNullablesAndOptionalsStruct); - } - - static void OnFailureCallback_179(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_179(error); - } - - static void OnSuccessCallback_179(void * context) { (static_cast(context))->OnSuccessResponse_179(); } - - static void OnFailureCallback_180(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_180(error); - } - - static void OnSuccessCallback_180(void * context, const chip::app::DataModel::Nullable & nullableBoolean) - { - (static_cast(context))->OnSuccessResponse_180(nullableBoolean); - } - - static void OnFailureCallback_181(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_181(error); - } - - static void OnSuccessCallback_181(void * context) { (static_cast(context))->OnSuccessResponse_181(); } - - static void OnFailureCallback_182(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_182(error); - } - - static void OnSuccessCallback_182(void * context, const chip::app::DataModel::Nullable & nullableBoolean) - { - (static_cast(context))->OnSuccessResponse_182(nullableBoolean); - } - - static void OnFailureCallback_183(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_183(error); - } - - static void OnSuccessCallback_183(void * context) { (static_cast(context))->OnSuccessResponse_183(); } - - static void OnFailureCallback_184(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_184(error); - } - - static void OnSuccessCallback_184( - void * context, - const chip::app::DataModel::Nullable> & nullableBitmap8) - { - (static_cast(context))->OnSuccessResponse_184(nullableBitmap8); - } - - static void OnFailureCallback_185(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_185(error); - } - - static void OnSuccessCallback_185(void * context) { (static_cast(context))->OnSuccessResponse_185(); } - - static void OnFailureCallback_186(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_186(error); - } - - static void OnSuccessCallback_186( - void * context, - const chip::app::DataModel::Nullable> & nullableBitmap8) - { - (static_cast(context))->OnSuccessResponse_186(nullableBitmap8); - } - - static void OnFailureCallback_187(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_187(error); - } - - static void OnSuccessCallback_187(void * context) { (static_cast(context))->OnSuccessResponse_187(); } - - static void OnFailureCallback_188(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_188(error); - } - - static void OnSuccessCallback_188( - void * context, - const chip::app::DataModel::Nullable> & nullableBitmap8) - { - (static_cast(context))->OnSuccessResponse_188(nullableBitmap8); - } - - static void OnFailureCallback_189(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_189(error); - } - - static void OnSuccessCallback_189(void * context) { (static_cast(context))->OnSuccessResponse_189(); } - - static void OnFailureCallback_190(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_190(error); - } - - static void OnSuccessCallback_190( - void * context, - const chip::app::DataModel::Nullable> & nullableBitmap16) - { - (static_cast(context))->OnSuccessResponse_190(nullableBitmap16); - } - - static void OnFailureCallback_191(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_191(error); - } - - static void OnSuccessCallback_191(void * context) { (static_cast(context))->OnSuccessResponse_191(); } - - static void OnFailureCallback_192(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_192(error); - } - - static void OnSuccessCallback_192( - void * context, - const chip::app::DataModel::Nullable> & nullableBitmap16) - { - (static_cast(context))->OnSuccessResponse_192(nullableBitmap16); - } - - static void OnFailureCallback_193(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_193(error); - } - - static void OnSuccessCallback_193(void * context) { (static_cast(context))->OnSuccessResponse_193(); } - - static void OnFailureCallback_194(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_194(error); - } - - static void OnSuccessCallback_194( - void * context, - const chip::app::DataModel::Nullable> & nullableBitmap16) - { - (static_cast(context))->OnSuccessResponse_194(nullableBitmap16); - } - - static void OnFailureCallback_195(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_195(error); - } - - static void OnSuccessCallback_195(void * context) { (static_cast(context))->OnSuccessResponse_195(); } - - static void OnFailureCallback_196(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_196(error); - } - - static void OnSuccessCallback_196( - void * context, - const chip::app::DataModel::Nullable> & nullableBitmap32) - { - (static_cast(context))->OnSuccessResponse_196(nullableBitmap32); - } - - static void OnFailureCallback_197(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_197(error); - } - - static void OnSuccessCallback_197(void * context) { (static_cast(context))->OnSuccessResponse_197(); } - - static void OnFailureCallback_198(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_198(error); - } - - static void OnSuccessCallback_198( - void * context, - const chip::app::DataModel::Nullable> & nullableBitmap32) - { - (static_cast(context))->OnSuccessResponse_198(nullableBitmap32); - } - - static void OnFailureCallback_199(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_199(error); - } - - static void OnSuccessCallback_199(void * context) { (static_cast(context))->OnSuccessResponse_199(); } - - static void OnFailureCallback_200(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_200(error); - } - - static void OnSuccessCallback_200( - void * context, - const chip::app::DataModel::Nullable> & nullableBitmap32) - { - (static_cast(context))->OnSuccessResponse_200(nullableBitmap32); - } - - static void OnFailureCallback_201(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_201(error); - } - - static void OnSuccessCallback_201(void * context) { (static_cast(context))->OnSuccessResponse_201(); } - - static void OnFailureCallback_202(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_202(error); - } - - static void OnSuccessCallback_202( - void * context, - const chip::app::DataModel::Nullable> & nullableBitmap64) - { - (static_cast(context))->OnSuccessResponse_202(nullableBitmap64); - } - - static void OnFailureCallback_203(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_203(error); - } - - static void OnSuccessCallback_203(void * context) { (static_cast(context))->OnSuccessResponse_203(); } - - static void OnFailureCallback_204(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_204(error); - } - - static void OnSuccessCallback_204( - void * context, - const chip::app::DataModel::Nullable> & nullableBitmap64) - { - (static_cast(context))->OnSuccessResponse_204(nullableBitmap64); - } - - static void OnFailureCallback_205(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_205(error); - } - - static void OnSuccessCallback_205(void * context) { (static_cast(context))->OnSuccessResponse_205(); } - - static void OnFailureCallback_206(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_206(error); - } - - static void OnSuccessCallback_206( - void * context, - const chip::app::DataModel::Nullable> & nullableBitmap64) - { - (static_cast(context))->OnSuccessResponse_206(nullableBitmap64); - } - - static void OnFailureCallback_207(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_207(error); - } - - static void OnSuccessCallback_207(void * context) { (static_cast(context))->OnSuccessResponse_207(); } - - static void OnFailureCallback_208(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_208(error); - } - - static void OnSuccessCallback_208(void * context, const chip::app::DataModel::Nullable & nullableInt8u) - { - (static_cast(context))->OnSuccessResponse_208(nullableInt8u); - } - - static void OnFailureCallback_209(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_209(error); - } - - static void OnSuccessCallback_209(void * context) { (static_cast(context))->OnSuccessResponse_209(); } - - static void OnFailureCallback_210(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_210(error); - } - - static void OnSuccessCallback_210(void * context, const chip::app::DataModel::Nullable & nullableInt8u) - { - (static_cast(context))->OnSuccessResponse_210(nullableInt8u); - } - - static void OnFailureCallback_211(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_211(error); - } - - static void OnSuccessCallback_211(void * context) { (static_cast(context))->OnSuccessResponse_211(); } - - static void OnFailureCallback_212(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_212(error); - } - - static void OnSuccessCallback_212(void * context, const chip::app::DataModel::Nullable & nullableInt8u) - { - (static_cast(context))->OnSuccessResponse_212(nullableInt8u); - } - - static void OnFailureCallback_213(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_213(error); - } - - static void OnSuccessCallback_213(void * context, const chip::app::DataModel::Nullable & nullableInt8u) - { - (static_cast(context))->OnSuccessResponse_213(nullableInt8u); - } - - static void OnFailureCallback_214(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_214(error); - } - - static void OnSuccessCallback_214(void * context) { (static_cast(context))->OnSuccessResponse_214(); } - - static void OnFailureCallback_215(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_215(error); - } - - static void OnSuccessCallback_215(void * context, const chip::app::DataModel::Nullable & nullableInt8u) - { - (static_cast(context))->OnSuccessResponse_215(nullableInt8u); - } - - static void OnFailureCallback_216(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_216(error); - } - - static void OnSuccessCallback_216(void * context, const chip::app::DataModel::Nullable & nullableInt8u) - { - (static_cast(context))->OnSuccessResponse_216(nullableInt8u); - } - - static void OnFailureCallback_217(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_217(error); - } - - static void OnSuccessCallback_217(void * context, const chip::app::DataModel::Nullable & nullableInt8u) - { - (static_cast(context))->OnSuccessResponse_217(nullableInt8u); - } - - static void OnFailureCallback_218(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_218(error); - } - - static void OnSuccessCallback_218(void * context) { (static_cast(context))->OnSuccessResponse_218(); } - - static void OnFailureCallback_219(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_219(error); - } - - static void OnSuccessCallback_219(void * context, const chip::app::DataModel::Nullable & nullableInt8u) - { - (static_cast(context))->OnSuccessResponse_219(nullableInt8u); - } - - static void OnFailureCallback_220(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_220(error); - } - - static void OnSuccessCallback_220(void * context, const chip::app::DataModel::Nullable & nullableInt8u) - { - (static_cast(context))->OnSuccessResponse_220(nullableInt8u); - } - - static void OnFailureCallback_221(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_221(error); - } - - static void OnSuccessCallback_221(void * context) { (static_cast(context))->OnSuccessResponse_221(); } - - static void OnFailureCallback_222(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_222(error); - } - - static void OnSuccessCallback_222(void * context, const chip::app::DataModel::Nullable & nullableInt16u) - { - (static_cast(context))->OnSuccessResponse_222(nullableInt16u); - } - - static void OnFailureCallback_223(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_223(error); - } - - static void OnSuccessCallback_223(void * context) { (static_cast(context))->OnSuccessResponse_223(); } - - static void OnFailureCallback_224(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_224(error); - } - - static void OnSuccessCallback_224(void * context, const chip::app::DataModel::Nullable & nullableInt16u) - { - (static_cast(context))->OnSuccessResponse_224(nullableInt16u); - } - - static void OnFailureCallback_225(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_225(error); - } - - static void OnSuccessCallback_225(void * context) { (static_cast(context))->OnSuccessResponse_225(); } - - static void OnFailureCallback_226(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_226(error); - } - - static void OnSuccessCallback_226(void * context, const chip::app::DataModel::Nullable & nullableInt16u) - { - (static_cast(context))->OnSuccessResponse_226(nullableInt16u); - } - - static void OnFailureCallback_227(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_227(error); - } - - static void OnSuccessCallback_227(void * context) { (static_cast(context))->OnSuccessResponse_227(); } - - static void OnFailureCallback_228(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_228(error); - } - - static void OnSuccessCallback_228(void * context, const chip::app::DataModel::Nullable & nullableInt16u) - { - (static_cast(context))->OnSuccessResponse_228(nullableInt16u); - } - - static void OnFailureCallback_229(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_229(error); - } - - static void OnSuccessCallback_229(void * context, const chip::app::DataModel::Nullable & nullableInt16u) - { - (static_cast(context))->OnSuccessResponse_229(nullableInt16u); - } - - static void OnFailureCallback_230(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_230(error); - } - - static void OnSuccessCallback_230(void * context, const chip::app::DataModel::Nullable & nullableInt16u) - { - (static_cast(context))->OnSuccessResponse_230(nullableInt16u); - } - - static void OnFailureCallback_231(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_231(error); - } - - static void OnSuccessCallback_231(void * context) { (static_cast(context))->OnSuccessResponse_231(); } - - static void OnFailureCallback_232(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_232(error); - } - - static void OnSuccessCallback_232(void * context, const chip::app::DataModel::Nullable & nullableInt16u) - { - (static_cast(context))->OnSuccessResponse_232(nullableInt16u); - } - - static void OnFailureCallback_233(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_233(error); - } - - static void OnSuccessCallback_233(void * context, const chip::app::DataModel::Nullable & nullableInt16u) - { - (static_cast(context))->OnSuccessResponse_233(nullableInt16u); - } - - static void OnFailureCallback_234(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_234(error); - } - - static void OnSuccessCallback_234(void * context) { (static_cast(context))->OnSuccessResponse_234(); } - - static void OnFailureCallback_235(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_235(error); - } - - static void OnSuccessCallback_235(void * context, const chip::app::DataModel::Nullable & nullableInt32u) - { - (static_cast(context))->OnSuccessResponse_235(nullableInt32u); - } - - static void OnFailureCallback_236(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_236(error); - } - - static void OnSuccessCallback_236(void * context) { (static_cast(context))->OnSuccessResponse_236(); } - - static void OnFailureCallback_237(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_237(error); - } - - static void OnSuccessCallback_237(void * context, const chip::app::DataModel::Nullable & nullableInt32u) - { - (static_cast(context))->OnSuccessResponse_237(nullableInt32u); - } - - static void OnFailureCallback_238(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_238(error); - } - - static void OnSuccessCallback_238(void * context) { (static_cast(context))->OnSuccessResponse_238(); } - - static void OnFailureCallback_239(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_239(error); - } - - static void OnSuccessCallback_239(void * context, const chip::app::DataModel::Nullable & nullableInt32u) - { - (static_cast(context))->OnSuccessResponse_239(nullableInt32u); - } - - static void OnFailureCallback_240(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_240(error); - } - - static void OnSuccessCallback_240(void * context) { (static_cast(context))->OnSuccessResponse_240(); } - - static void OnFailureCallback_241(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_241(error); - } - - static void OnSuccessCallback_241(void * context, const chip::app::DataModel::Nullable & nullableInt32u) - { - (static_cast(context))->OnSuccessResponse_241(nullableInt32u); - } - - static void OnFailureCallback_242(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_242(error); - } - - static void OnSuccessCallback_242(void * context, const chip::app::DataModel::Nullable & nullableInt32u) - { - (static_cast(context))->OnSuccessResponse_242(nullableInt32u); - } - - static void OnFailureCallback_243(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_243(error); - } - - static void OnSuccessCallback_243(void * context, const chip::app::DataModel::Nullable & nullableInt32u) - { - (static_cast(context))->OnSuccessResponse_243(nullableInt32u); - } - - static void OnFailureCallback_244(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_244(error); - } - - static void OnSuccessCallback_244(void * context) { (static_cast(context))->OnSuccessResponse_244(); } - - static void OnFailureCallback_245(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_245(error); - } - - static void OnSuccessCallback_245(void * context, const chip::app::DataModel::Nullable & nullableInt32u) - { - (static_cast(context))->OnSuccessResponse_245(nullableInt32u); - } - - static void OnFailureCallback_246(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_246(error); - } - - static void OnSuccessCallback_246(void * context, const chip::app::DataModel::Nullable & nullableInt32u) - { - (static_cast(context))->OnSuccessResponse_246(nullableInt32u); - } - - static void OnFailureCallback_247(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_247(error); - } - - static void OnSuccessCallback_247(void * context) { (static_cast(context))->OnSuccessResponse_247(); } - - static void OnFailureCallback_248(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_248(error); - } - - static void OnSuccessCallback_248(void * context, const chip::app::DataModel::Nullable & nullableInt64u) - { - (static_cast(context))->OnSuccessResponse_248(nullableInt64u); - } - - static void OnFailureCallback_249(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_249(error); - } - - static void OnSuccessCallback_249(void * context) { (static_cast(context))->OnSuccessResponse_249(); } - - static void OnFailureCallback_250(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_250(error); - } - - static void OnSuccessCallback_250(void * context, const chip::app::DataModel::Nullable & nullableInt64u) - { - (static_cast(context))->OnSuccessResponse_250(nullableInt64u); - } - - static void OnFailureCallback_251(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_251(error); - } - - static void OnSuccessCallback_251(void * context) { (static_cast(context))->OnSuccessResponse_251(); } - - static void OnFailureCallback_252(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_252(error); - } - - static void OnSuccessCallback_252(void * context, const chip::app::DataModel::Nullable & nullableInt64u) - { - (static_cast(context))->OnSuccessResponse_252(nullableInt64u); - } - - static void OnFailureCallback_253(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_253(error); - } - - static void OnSuccessCallback_253(void * context) { (static_cast(context))->OnSuccessResponse_253(); } - - static void OnFailureCallback_254(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_254(error); - } - - static void OnSuccessCallback_254(void * context, const chip::app::DataModel::Nullable & nullableInt64u) - { - (static_cast(context))->OnSuccessResponse_254(nullableInt64u); - } - - static void OnFailureCallback_255(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_255(error); - } - - static void OnSuccessCallback_255(void * context, const chip::app::DataModel::Nullable & nullableInt64u) - { - (static_cast(context))->OnSuccessResponse_255(nullableInt64u); - } - - static void OnFailureCallback_256(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_256(error); - } - - static void OnSuccessCallback_256(void * context, const chip::app::DataModel::Nullable & nullableInt64u) - { - (static_cast(context))->OnSuccessResponse_256(nullableInt64u); - } - - static void OnFailureCallback_257(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_257(error); - } - - static void OnSuccessCallback_257(void * context) { (static_cast(context))->OnSuccessResponse_257(); } - - static void OnFailureCallback_258(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_258(error); - } - - static void OnSuccessCallback_258(void * context, const chip::app::DataModel::Nullable & nullableInt64u) - { - (static_cast(context))->OnSuccessResponse_258(nullableInt64u); - } - - static void OnFailureCallback_259(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_259(error); - } - - static void OnSuccessCallback_259(void * context, const chip::app::DataModel::Nullable & nullableInt64u) - { - (static_cast(context))->OnSuccessResponse_259(nullableInt64u); - } - - static void OnFailureCallback_260(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_260(error); - } - - static void OnSuccessCallback_260(void * context) { (static_cast(context))->OnSuccessResponse_260(); } - - static void OnFailureCallback_261(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_261(error); - } - - static void OnSuccessCallback_261(void * context, const chip::app::DataModel::Nullable & nullableInt8s) - { - (static_cast(context))->OnSuccessResponse_261(nullableInt8s); - } - - static void OnFailureCallback_262(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_262(error); - } - - static void OnSuccessCallback_262(void * context) { (static_cast(context))->OnSuccessResponse_262(); } - - static void OnFailureCallback_263(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_263(error); - } - - static void OnSuccessCallback_263(void * context, const chip::app::DataModel::Nullable & nullableInt8s) - { - (static_cast(context))->OnSuccessResponse_263(nullableInt8s); - } - - static void OnFailureCallback_264(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_264(error); - } - - static void OnSuccessCallback_264(void * context) { (static_cast(context))->OnSuccessResponse_264(); } - - static void OnFailureCallback_265(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_265(error); - } - - static void OnSuccessCallback_265(void * context, const chip::app::DataModel::Nullable & nullableInt8s) - { - (static_cast(context))->OnSuccessResponse_265(nullableInt8s); - } - - static void OnFailureCallback_266(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_266(error); - } - - static void OnSuccessCallback_266(void * context, const chip::app::DataModel::Nullable & nullableInt8s) - { - (static_cast(context))->OnSuccessResponse_266(nullableInt8s); - } - - static void OnFailureCallback_267(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_267(error); - } - - static void OnSuccessCallback_267(void * context, const chip::app::DataModel::Nullable & nullableInt8s) - { - (static_cast(context))->OnSuccessResponse_267(nullableInt8s); - } - - static void OnFailureCallback_268(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_268(error); - } - - static void OnSuccessCallback_268(void * context) { (static_cast(context))->OnSuccessResponse_268(); } - - static void OnFailureCallback_269(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_269(error); - } - - static void OnSuccessCallback_269(void * context, const chip::app::DataModel::Nullable & nullableInt8s) - { - (static_cast(context))->OnSuccessResponse_269(nullableInt8s); - } - - static void OnFailureCallback_270(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_270(error); - } - - static void OnSuccessCallback_270(void * context, const chip::app::DataModel::Nullable & nullableInt8s) - { - (static_cast(context))->OnSuccessResponse_270(nullableInt8s); - } - - static void OnFailureCallback_271(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_271(error); - } - - static void OnSuccessCallback_271(void * context) { (static_cast(context))->OnSuccessResponse_271(); } - - static void OnFailureCallback_272(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_272(error); - } - - static void OnSuccessCallback_272(void * context, const chip::app::DataModel::Nullable & nullableInt16s) - { - (static_cast(context))->OnSuccessResponse_272(nullableInt16s); - } - - static void OnFailureCallback_273(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_273(error); - } - - static void OnSuccessCallback_273(void * context) { (static_cast(context))->OnSuccessResponse_273(); } - - static void OnFailureCallback_274(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_274(error); - } - - static void OnSuccessCallback_274(void * context, const chip::app::DataModel::Nullable & nullableInt16s) - { - (static_cast(context))->OnSuccessResponse_274(nullableInt16s); - } - - static void OnFailureCallback_275(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_275(error); - } - - static void OnSuccessCallback_275(void * context) { (static_cast(context))->OnSuccessResponse_275(); } - - static void OnFailureCallback_276(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_276(error); - } - - static void OnSuccessCallback_276(void * context, const chip::app::DataModel::Nullable & nullableInt16s) - { - (static_cast(context))->OnSuccessResponse_276(nullableInt16s); - } - - static void OnFailureCallback_277(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_277(error); - } - - static void OnSuccessCallback_277(void * context, const chip::app::DataModel::Nullable & nullableInt16s) - { - (static_cast(context))->OnSuccessResponse_277(nullableInt16s); - } - - static void OnFailureCallback_278(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_278(error); - } - - static void OnSuccessCallback_278(void * context, const chip::app::DataModel::Nullable & nullableInt16s) - { - (static_cast(context))->OnSuccessResponse_278(nullableInt16s); - } - - static void OnFailureCallback_279(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_279(error); - } - - static void OnSuccessCallback_279(void * context) { (static_cast(context))->OnSuccessResponse_279(); } - - static void OnFailureCallback_280(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_280(error); - } - - static void OnSuccessCallback_280(void * context, const chip::app::DataModel::Nullable & nullableInt16s) - { - (static_cast(context))->OnSuccessResponse_280(nullableInt16s); - } - - static void OnFailureCallback_281(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_281(error); - } - - static void OnSuccessCallback_281(void * context, const chip::app::DataModel::Nullable & nullableInt16s) - { - (static_cast(context))->OnSuccessResponse_281(nullableInt16s); - } - - static void OnFailureCallback_282(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_282(error); - } - - static void OnSuccessCallback_282(void * context) { (static_cast(context))->OnSuccessResponse_282(); } - - static void OnFailureCallback_283(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_283(error); - } - - static void OnSuccessCallback_283(void * context, const chip::app::DataModel::Nullable & nullableInt32s) - { - (static_cast(context))->OnSuccessResponse_283(nullableInt32s); - } - - static void OnFailureCallback_284(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_284(error); - } - - static void OnSuccessCallback_284(void * context) { (static_cast(context))->OnSuccessResponse_284(); } - - static void OnFailureCallback_285(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_285(error); - } - - static void OnSuccessCallback_285(void * context, const chip::app::DataModel::Nullable & nullableInt32s) - { - (static_cast(context))->OnSuccessResponse_285(nullableInt32s); - } - - static void OnFailureCallback_286(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_286(error); - } - - static void OnSuccessCallback_286(void * context) { (static_cast(context))->OnSuccessResponse_286(); } - - static void OnFailureCallback_287(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_287(error); - } - - static void OnSuccessCallback_287(void * context, const chip::app::DataModel::Nullable & nullableInt32s) - { - (static_cast(context))->OnSuccessResponse_287(nullableInt32s); - } - - static void OnFailureCallback_288(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_288(error); - } - - static void OnSuccessCallback_288(void * context, const chip::app::DataModel::Nullable & nullableInt32s) - { - (static_cast(context))->OnSuccessResponse_288(nullableInt32s); - } - - static void OnFailureCallback_289(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_289(error); - } - - static void OnSuccessCallback_289(void * context, const chip::app::DataModel::Nullable & nullableInt32s) - { - (static_cast(context))->OnSuccessResponse_289(nullableInt32s); - } - - static void OnFailureCallback_290(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_290(error); - } - - static void OnSuccessCallback_290(void * context) { (static_cast(context))->OnSuccessResponse_290(); } - - static void OnFailureCallback_291(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_291(error); - } - - static void OnSuccessCallback_291(void * context, const chip::app::DataModel::Nullable & nullableInt32s) - { - (static_cast(context))->OnSuccessResponse_291(nullableInt32s); - } - - static void OnFailureCallback_292(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_292(error); - } - - static void OnSuccessCallback_292(void * context, const chip::app::DataModel::Nullable & nullableInt32s) - { - (static_cast(context))->OnSuccessResponse_292(nullableInt32s); - } - - static void OnFailureCallback_293(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_293(error); - } - - static void OnSuccessCallback_293(void * context) { (static_cast(context))->OnSuccessResponse_293(); } - - static void OnFailureCallback_294(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_294(error); - } - - static void OnSuccessCallback_294(void * context, const chip::app::DataModel::Nullable & nullableInt64s) - { - (static_cast(context))->OnSuccessResponse_294(nullableInt64s); - } - - static void OnFailureCallback_295(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_295(error); - } - - static void OnSuccessCallback_295(void * context) { (static_cast(context))->OnSuccessResponse_295(); } - - static void OnFailureCallback_296(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_296(error); - } - - static void OnSuccessCallback_296(void * context, const chip::app::DataModel::Nullable & nullableInt64s) - { - (static_cast(context))->OnSuccessResponse_296(nullableInt64s); - } - - static void OnFailureCallback_297(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_297(error); - } - - static void OnSuccessCallback_297(void * context) { (static_cast(context))->OnSuccessResponse_297(); } - - static void OnFailureCallback_298(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_298(error); - } - - static void OnSuccessCallback_298(void * context, const chip::app::DataModel::Nullable & nullableInt64s) - { - (static_cast(context))->OnSuccessResponse_298(nullableInt64s); - } - - static void OnFailureCallback_299(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_299(error); - } - - static void OnSuccessCallback_299(void * context, const chip::app::DataModel::Nullable & nullableInt64s) - { - (static_cast(context))->OnSuccessResponse_299(nullableInt64s); - } - - static void OnFailureCallback_300(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_300(error); - } - - static void OnSuccessCallback_300(void * context, const chip::app::DataModel::Nullable & nullableInt64s) - { - (static_cast(context))->OnSuccessResponse_300(nullableInt64s); - } - - static void OnFailureCallback_301(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_301(error); - } - - static void OnSuccessCallback_301(void * context) { (static_cast(context))->OnSuccessResponse_301(); } - - static void OnFailureCallback_302(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_302(error); - } - - static void OnSuccessCallback_302(void * context, const chip::app::DataModel::Nullable & nullableInt64s) - { - (static_cast(context))->OnSuccessResponse_302(nullableInt64s); - } - - static void OnFailureCallback_303(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_303(error); - } - - static void OnSuccessCallback_303(void * context, const chip::app::DataModel::Nullable & nullableInt64s) - { - (static_cast(context))->OnSuccessResponse_303(nullableInt64s); - } - - static void OnFailureCallback_304(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_304(error); - } - - static void OnSuccessCallback_304(void * context) { (static_cast(context))->OnSuccessResponse_304(); } - - static void OnFailureCallback_305(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_305(error); - } - - static void OnSuccessCallback_305(void * context, const chip::app::DataModel::Nullable & nullableFloatSingle) - { - (static_cast(context))->OnSuccessResponse_305(nullableFloatSingle); - } - - static void OnFailureCallback_306(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_306(error); - } - - static void OnSuccessCallback_306(void * context) { (static_cast(context))->OnSuccessResponse_306(); } - - static void OnFailureCallback_307(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_307(error); - } - - static void OnSuccessCallback_307(void * context, const chip::app::DataModel::Nullable & nullableFloatSingle) - { - (static_cast(context))->OnSuccessResponse_307(nullableFloatSingle); - } - - static void OnFailureCallback_308(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_308(error); - } - - static void OnSuccessCallback_308(void * context) { (static_cast(context))->OnSuccessResponse_308(); } - - static void OnFailureCallback_309(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_309(error); - } - - static void OnSuccessCallback_309(void * context, const chip::app::DataModel::Nullable & nullableFloatSingle) - { - (static_cast(context))->OnSuccessResponse_309(nullableFloatSingle); - } - - static void OnFailureCallback_310(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_310(error); - } - - static void OnSuccessCallback_310(void * context) { (static_cast(context))->OnSuccessResponse_310(); } - - static void OnFailureCallback_311(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_311(error); - } - - static void OnSuccessCallback_311(void * context, const chip::app::DataModel::Nullable & nullableFloatSingle) - { - (static_cast(context))->OnSuccessResponse_311(nullableFloatSingle); - } - - static void OnFailureCallback_312(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_312(error); - } - - static void OnSuccessCallback_312(void * context) { (static_cast(context))->OnSuccessResponse_312(); } - - static void OnFailureCallback_313(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_313(error); - } - - static void OnSuccessCallback_313(void * context, const chip::app::DataModel::Nullable & nullableFloatSingle) - { - (static_cast(context))->OnSuccessResponse_313(nullableFloatSingle); - } - - static void OnFailureCallback_314(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_314(error); - } - - static void OnSuccessCallback_314(void * context) { (static_cast(context))->OnSuccessResponse_314(); } - - static void OnFailureCallback_315(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_315(error); - } - - static void OnSuccessCallback_315(void * context, const chip::app::DataModel::Nullable & nullableFloatDouble) - { - (static_cast(context))->OnSuccessResponse_315(nullableFloatDouble); - } - - static void OnFailureCallback_316(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_316(error); - } - - static void OnSuccessCallback_316(void * context) { (static_cast(context))->OnSuccessResponse_316(); } - - static void OnFailureCallback_317(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_317(error); - } - - static void OnSuccessCallback_317(void * context, const chip::app::DataModel::Nullable & nullableFloatDouble) - { - (static_cast(context))->OnSuccessResponse_317(nullableFloatDouble); - } - - static void OnFailureCallback_318(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_318(error); - } - - static void OnSuccessCallback_318(void * context) { (static_cast(context))->OnSuccessResponse_318(); } - - static void OnFailureCallback_319(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_319(error); - } - - static void OnSuccessCallback_319(void * context, const chip::app::DataModel::Nullable & nullableFloatDouble) - { - (static_cast(context))->OnSuccessResponse_319(nullableFloatDouble); - } - - static void OnFailureCallback_320(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_320(error); - } - - static void OnSuccessCallback_320(void * context) { (static_cast(context))->OnSuccessResponse_320(); } - - static void OnFailureCallback_321(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_321(error); - } - - static void OnSuccessCallback_321(void * context, const chip::app::DataModel::Nullable & nullableFloatDouble) - { - (static_cast(context))->OnSuccessResponse_321(nullableFloatDouble); - } - - static void OnFailureCallback_322(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_322(error); - } - - static void OnSuccessCallback_322(void * context) { (static_cast(context))->OnSuccessResponse_322(); } - - static void OnFailureCallback_323(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_323(error); - } - - static void OnSuccessCallback_323(void * context, const chip::app::DataModel::Nullable & nullableFloatDouble) - { - (static_cast(context))->OnSuccessResponse_323(nullableFloatDouble); - } - - static void OnFailureCallback_324(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_324(error); - } - - static void OnSuccessCallback_324(void * context) { (static_cast(context))->OnSuccessResponse_324(); } - - static void OnFailureCallback_325(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_325(error); - } - - static void OnSuccessCallback_325(void * context, const chip::app::DataModel::Nullable & nullableEnum8) - { - (static_cast(context))->OnSuccessResponse_325(nullableEnum8); - } - - static void OnFailureCallback_326(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_326(error); - } - - static void OnSuccessCallback_326(void * context) { (static_cast(context))->OnSuccessResponse_326(); } - - static void OnFailureCallback_327(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_327(error); - } - - static void OnSuccessCallback_327(void * context, const chip::app::DataModel::Nullable & nullableEnum8) - { - (static_cast(context))->OnSuccessResponse_327(nullableEnum8); - } - - static void OnFailureCallback_328(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_328(error); - } - - static void OnSuccessCallback_328(void * context) { (static_cast(context))->OnSuccessResponse_328(); } - - static void OnFailureCallback_329(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_329(error); - } - - static void OnSuccessCallback_329(void * context, const chip::app::DataModel::Nullable & nullableEnum8) - { - (static_cast(context))->OnSuccessResponse_329(nullableEnum8); - } - - static void OnFailureCallback_330(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_330(error); - } - - static void OnSuccessCallback_330(void * context) { (static_cast(context))->OnSuccessResponse_330(); } - - static void OnFailureCallback_331(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_331(error); - } - - static void OnSuccessCallback_331(void * context, const chip::app::DataModel::Nullable & nullableEnum8) - { - (static_cast(context))->OnSuccessResponse_331(nullableEnum8); - } - - static void OnFailureCallback_332(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_332(error); - } - - static void OnSuccessCallback_332(void * context) { (static_cast(context))->OnSuccessResponse_332(); } - - static void OnFailureCallback_333(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_333(error); - } - - static void OnSuccessCallback_333(void * context, const chip::app::DataModel::Nullable & nullableEnum16) - { - (static_cast(context))->OnSuccessResponse_333(nullableEnum16); - } - - static void OnFailureCallback_334(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_334(error); - } - - static void OnSuccessCallback_334(void * context) { (static_cast(context))->OnSuccessResponse_334(); } - - static void OnFailureCallback_335(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_335(error); - } - - static void OnSuccessCallback_335(void * context, const chip::app::DataModel::Nullable & nullableEnum16) - { - (static_cast(context))->OnSuccessResponse_335(nullableEnum16); - } - - static void OnFailureCallback_336(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_336(error); - } - - static void OnSuccessCallback_336(void * context) { (static_cast(context))->OnSuccessResponse_336(); } - - static void OnFailureCallback_337(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_337(error); - } - - static void OnSuccessCallback_337(void * context, const chip::app::DataModel::Nullable & nullableEnum16) - { - (static_cast(context))->OnSuccessResponse_337(nullableEnum16); - } - - static void OnFailureCallback_338(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_338(error); - } - - static void OnSuccessCallback_338(void * context) { (static_cast(context))->OnSuccessResponse_338(); } - - static void OnFailureCallback_339(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_339(error); - } - - static void OnSuccessCallback_339(void * context, const chip::app::DataModel::Nullable & nullableEnum16) - { - (static_cast(context))->OnSuccessResponse_339(nullableEnum16); - } - - static void OnFailureCallback_340(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_340(error); - } - - static void OnSuccessCallback_340(void * context) { (static_cast(context))->OnSuccessResponse_340(); } - - static void OnFailureCallback_341(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_341(error); - } - - static void - OnSuccessCallback_341(void * context, - const chip::app::DataModel::Nullable & nullableEnumAttr) - { - (static_cast(context))->OnSuccessResponse_341(nullableEnumAttr); - } - - static void OnFailureCallback_342(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_342(error); - } - - static void OnSuccessCallback_342(void * context) { (static_cast(context))->OnSuccessResponse_342(); } - - static void OnFailureCallback_343(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_343(error); - } - - static void - OnSuccessCallback_343(void * context, - const chip::app::DataModel::Nullable & nullableEnumAttr) - { - (static_cast(context))->OnSuccessResponse_343(nullableEnumAttr); - } - - static void OnFailureCallback_344(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_344(error); - } - - static void OnSuccessCallback_344(void * context) { (static_cast(context))->OnSuccessResponse_344(); } - - static void OnFailureCallback_345(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_345(error); - } - - static void - OnSuccessCallback_345(void * context, - const chip::app::DataModel::Nullable & nullableEnumAttr) - { - (static_cast(context))->OnSuccessResponse_345(nullableEnumAttr); - } - - static void OnFailureCallback_346(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_346(error); - } - - static void OnSuccessCallback_346(void * context) { (static_cast(context))->OnSuccessResponse_346(); } - - static void OnFailureCallback_347(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_347(error); - } - - static void - OnSuccessCallback_347(void * context, - const chip::app::DataModel::Nullable & nullableEnumAttr) - { - (static_cast(context))->OnSuccessResponse_347(nullableEnumAttr); - } - - static void OnFailureCallback_348(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_348(error); - } - - static void OnSuccessCallback_348(void * context, const chip::app::DataModel::Nullable & nullableOctetString) - { - (static_cast(context))->OnSuccessResponse_348(nullableOctetString); - } - - static void OnFailureCallback_349(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_349(error); - } - - static void OnSuccessCallback_349(void * context) { (static_cast(context))->OnSuccessResponse_349(); } - - static void OnFailureCallback_350(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_350(error); - } - - static void OnSuccessCallback_350(void * context, const chip::app::DataModel::Nullable & nullableOctetString) - { - (static_cast(context))->OnSuccessResponse_350(nullableOctetString); - } - - static void OnFailureCallback_351(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_351(error); - } - - static void OnSuccessCallback_351(void * context) { (static_cast(context))->OnSuccessResponse_351(); } - - static void OnFailureCallback_352(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_352(error); - } - - static void OnSuccessCallback_352(void * context, const chip::app::DataModel::Nullable & nullableOctetString) - { - (static_cast(context))->OnSuccessResponse_352(nullableOctetString); - } - - static void OnFailureCallback_353(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_353(error); - } - - static void OnSuccessCallback_353(void * context) { (static_cast(context))->OnSuccessResponse_353(); } - - static void OnFailureCallback_354(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_354(error); - } - - static void OnSuccessCallback_354(void * context, const chip::app::DataModel::Nullable & nullableOctetString) - { - (static_cast(context))->OnSuccessResponse_354(nullableOctetString); - } - - static void OnFailureCallback_355(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_355(error); - } - - static void OnSuccessCallback_355(void * context, const chip::app::DataModel::Nullable & nullableCharString) - { - (static_cast(context))->OnSuccessResponse_355(nullableCharString); - } - - static void OnFailureCallback_356(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_356(error); - } - - static void OnSuccessCallback_356(void * context) { (static_cast(context))->OnSuccessResponse_356(); } - - static void OnFailureCallback_357(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_357(error); - } - - static void OnSuccessCallback_357(void * context, const chip::app::DataModel::Nullable & nullableCharString) - { - (static_cast(context))->OnSuccessResponse_357(nullableCharString); - } - - static void OnFailureCallback_358(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_358(error); - } - - static void OnSuccessCallback_358(void * context) { (static_cast(context))->OnSuccessResponse_358(); } - - static void OnFailureCallback_359(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_359(error); - } - - static void OnSuccessCallback_359(void * context, const chip::app::DataModel::Nullable & nullableCharString) - { - (static_cast(context))->OnSuccessResponse_359(nullableCharString); - } - - static void OnFailureCallback_360(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_360(error); - } - - static void OnSuccessCallback_360(void * context) { (static_cast(context))->OnSuccessResponse_360(); } - - static void OnFailureCallback_361(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_361(error); - } - - static void OnSuccessCallback_361(void * context, const chip::app::DataModel::Nullable & nullableCharString) - { - (static_cast(context))->OnSuccessResponse_361(nullableCharString); - } - - static void OnFailureCallback_362(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_362(error); - } - - static void OnSuccessCallback_362(void * context, const chip::app::DataModel::DecodableList & listInt8u) - { - (static_cast(context))->OnSuccessResponse_362(listInt8u); - } - - static void OnFailureCallback_363(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_363(error); - } - - static void OnSuccessCallback_363(void * context, const chip::app::DataModel::DecodableList & listInt8u) - { - (static_cast(context))->OnSuccessResponse_363(listInt8u); - } - - static void OnFailureCallback_366(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_366(error); - } - - static void OnSuccessCallback_366(void * context, const chip::app::DataModel::DecodableList & listInt8u) - { - (static_cast(context))->OnSuccessResponse_366(listInt8u); - } - - bool mReceivedReport_366 = false; - - static void OnFailureCallback_367(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_367(error); - } - - static void OnSuccessCallback_367(void * context, const chip::app::DataModel::DecodableList & listInt8u) - { - (static_cast(context))->OnSuccessResponse_367(listInt8u); - } - - static void OnSubscriptionEstablished_367(void * context) - { - (static_cast(context))->OnSubscriptionEstablishedResponse_367(); - } - - static void OnFailureCallback_368(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_368(error); - } - - static void OnSuccessCallback_368(void * context) { (static_cast(context))->OnSuccessResponse_368(); } - - static void OnFailureCallback_369(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_369(error); - } - - static void OnSuccessCallback_369(void * context, const chip::app::DataModel::DecodableList & listInt8u) - { - (static_cast(context))->OnSuccessResponse_369(listInt8u); - } - - bool mReceivedReport_369 = false; - - static void OnFailureCallback_370(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_370(error); - } - - static void OnSuccessCallback_370(void * context, uint8_t rangeRestrictedInt8u) - { - (static_cast(context))->OnSuccessResponse_370(rangeRestrictedInt8u); - } - - static void OnFailureCallback_371(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_371(error); - } - - static void OnSuccessCallback_371(void * context) { (static_cast(context))->OnSuccessResponse_371(); } - - static void OnFailureCallback_372(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_372(error); - } - - static void OnSuccessCallback_372(void * context) { (static_cast(context))->OnSuccessResponse_372(); } - - static void OnFailureCallback_373(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_373(error); - } - - static void OnSuccessCallback_373(void * context) { (static_cast(context))->OnSuccessResponse_373(); } - - static void OnFailureCallback_374(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_374(error); - } - - static void OnSuccessCallback_374(void * context) { (static_cast(context))->OnSuccessResponse_374(); } - - static void OnFailureCallback_375(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_375(error); - } - - static void OnSuccessCallback_375(void * context, uint8_t rangeRestrictedInt8u) - { - (static_cast(context))->OnSuccessResponse_375(rangeRestrictedInt8u); - } - - static void OnFailureCallback_376(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_376(error); - } - - static void OnSuccessCallback_376(void * context) { (static_cast(context))->OnSuccessResponse_376(); } - - static void OnFailureCallback_377(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_377(error); - } - - static void OnSuccessCallback_377(void * context, uint8_t rangeRestrictedInt8u) - { - (static_cast(context))->OnSuccessResponse_377(rangeRestrictedInt8u); - } - - static void OnFailureCallback_378(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_378(error); - } - - static void OnSuccessCallback_378(void * context) { (static_cast(context))->OnSuccessResponse_378(); } - - static void OnFailureCallback_379(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_379(error); - } - - static void OnSuccessCallback_379(void * context, uint8_t rangeRestrictedInt8u) - { - (static_cast(context))->OnSuccessResponse_379(rangeRestrictedInt8u); - } - - static void OnFailureCallback_380(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_380(error); - } - - static void OnSuccessCallback_380(void * context) { (static_cast(context))->OnSuccessResponse_380(); } - - static void OnFailureCallback_381(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_381(error); - } - - static void OnSuccessCallback_381(void * context, uint8_t rangeRestrictedInt8u) - { - (static_cast(context))->OnSuccessResponse_381(rangeRestrictedInt8u); - } - - static void OnFailureCallback_382(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_382(error); - } - - static void OnSuccessCallback_382(void * context, uint16_t rangeRestrictedInt16u) - { - (static_cast(context))->OnSuccessResponse_382(rangeRestrictedInt16u); - } - - static void OnFailureCallback_383(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_383(error); - } - - static void OnSuccessCallback_383(void * context) { (static_cast(context))->OnSuccessResponse_383(); } - - static void OnFailureCallback_384(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_384(error); - } - - static void OnSuccessCallback_384(void * context) { (static_cast(context))->OnSuccessResponse_384(); } - - static void OnFailureCallback_385(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_385(error); - } - - static void OnSuccessCallback_385(void * context) { (static_cast(context))->OnSuccessResponse_385(); } - - static void OnFailureCallback_386(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_386(error); - } - - static void OnSuccessCallback_386(void * context) { (static_cast(context))->OnSuccessResponse_386(); } - - static void OnFailureCallback_387(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_387(error); - } - - static void OnSuccessCallback_387(void * context, uint16_t rangeRestrictedInt16u) - { - (static_cast(context))->OnSuccessResponse_387(rangeRestrictedInt16u); - } - - static void OnFailureCallback_388(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_388(error); - } - - static void OnSuccessCallback_388(void * context) { (static_cast(context))->OnSuccessResponse_388(); } - - static void OnFailureCallback_389(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_389(error); - } - - static void OnSuccessCallback_389(void * context, uint16_t rangeRestrictedInt16u) - { - (static_cast(context))->OnSuccessResponse_389(rangeRestrictedInt16u); - } - - static void OnFailureCallback_390(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_390(error); - } - - static void OnSuccessCallback_390(void * context) { (static_cast(context))->OnSuccessResponse_390(); } - - static void OnFailureCallback_391(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_391(error); - } - - static void OnSuccessCallback_391(void * context, uint16_t rangeRestrictedInt16u) - { - (static_cast(context))->OnSuccessResponse_391(rangeRestrictedInt16u); - } - - static void OnFailureCallback_392(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_392(error); - } - - static void OnSuccessCallback_392(void * context) { (static_cast(context))->OnSuccessResponse_392(); } - - static void OnFailureCallback_393(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_393(error); - } - - static void OnSuccessCallback_393(void * context, uint16_t rangeRestrictedInt16u) - { - (static_cast(context))->OnSuccessResponse_393(rangeRestrictedInt16u); - } - - static void OnFailureCallback_394(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_394(error); - } - - static void OnSuccessCallback_394(void * context, int8_t rangeRestrictedInt8s) - { - (static_cast(context))->OnSuccessResponse_394(rangeRestrictedInt8s); - } - - static void OnFailureCallback_395(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_395(error); - } - - static void OnSuccessCallback_395(void * context) { (static_cast(context))->OnSuccessResponse_395(); } - - static void OnFailureCallback_396(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_396(error); - } - - static void OnSuccessCallback_396(void * context) { (static_cast(context))->OnSuccessResponse_396(); } - - static void OnFailureCallback_397(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_397(error); - } - - static void OnSuccessCallback_397(void * context) { (static_cast(context))->OnSuccessResponse_397(); } - - static void OnFailureCallback_398(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_398(error); - } - - static void OnSuccessCallback_398(void * context) { (static_cast(context))->OnSuccessResponse_398(); } - - static void OnFailureCallback_399(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_399(error); - } - - static void OnSuccessCallback_399(void * context, int8_t rangeRestrictedInt8s) - { - (static_cast(context))->OnSuccessResponse_399(rangeRestrictedInt8s); - } - - static void OnFailureCallback_400(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_400(error); - } - - static void OnSuccessCallback_400(void * context) { (static_cast(context))->OnSuccessResponse_400(); } - - static void OnFailureCallback_401(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_401(error); - } - - static void OnSuccessCallback_401(void * context, int8_t rangeRestrictedInt8s) - { - (static_cast(context))->OnSuccessResponse_401(rangeRestrictedInt8s); - } - - static void OnFailureCallback_402(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_402(error); - } - - static void OnSuccessCallback_402(void * context) { (static_cast(context))->OnSuccessResponse_402(); } - - static void OnFailureCallback_403(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_403(error); - } - - static void OnSuccessCallback_403(void * context, int8_t rangeRestrictedInt8s) - { - (static_cast(context))->OnSuccessResponse_403(rangeRestrictedInt8s); - } - - static void OnFailureCallback_404(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_404(error); - } - - static void OnSuccessCallback_404(void * context) { (static_cast(context))->OnSuccessResponse_404(); } - - static void OnFailureCallback_405(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_405(error); - } - - static void OnSuccessCallback_405(void * context, int8_t rangeRestrictedInt8s) - { - (static_cast(context))->OnSuccessResponse_405(rangeRestrictedInt8s); - } - - static void OnFailureCallback_406(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_406(error); - } - - static void OnSuccessCallback_406(void * context, int16_t rangeRestrictedInt16s) - { - (static_cast(context))->OnSuccessResponse_406(rangeRestrictedInt16s); - } - - static void OnFailureCallback_407(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_407(error); - } - - static void OnSuccessCallback_407(void * context) { (static_cast(context))->OnSuccessResponse_407(); } - - static void OnFailureCallback_408(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_408(error); - } - - static void OnSuccessCallback_408(void * context) { (static_cast(context))->OnSuccessResponse_408(); } - - static void OnFailureCallback_409(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_409(error); - } - - static void OnSuccessCallback_409(void * context) { (static_cast(context))->OnSuccessResponse_409(); } - - static void OnFailureCallback_410(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_410(error); - } - - static void OnSuccessCallback_410(void * context) { (static_cast(context))->OnSuccessResponse_410(); } - - static void OnFailureCallback_411(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_411(error); - } - - static void OnSuccessCallback_411(void * context, int16_t rangeRestrictedInt16s) - { - (static_cast(context))->OnSuccessResponse_411(rangeRestrictedInt16s); - } - - static void OnFailureCallback_412(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_412(error); - } - - static void OnSuccessCallback_412(void * context) { (static_cast(context))->OnSuccessResponse_412(); } - - static void OnFailureCallback_413(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_413(error); - } - - static void OnSuccessCallback_413(void * context, int16_t rangeRestrictedInt16s) - { - (static_cast(context))->OnSuccessResponse_413(rangeRestrictedInt16s); - } - - static void OnFailureCallback_414(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_414(error); - } - - static void OnSuccessCallback_414(void * context) { (static_cast(context))->OnSuccessResponse_414(); } - - static void OnFailureCallback_415(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_415(error); - } - - static void OnSuccessCallback_415(void * context, int16_t rangeRestrictedInt16s) - { - (static_cast(context))->OnSuccessResponse_415(rangeRestrictedInt16s); - } - - static void OnFailureCallback_416(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_416(error); - } - - static void OnSuccessCallback_416(void * context) { (static_cast(context))->OnSuccessResponse_416(); } - - static void OnFailureCallback_417(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_417(error); - } - - static void OnSuccessCallback_417(void * context, int16_t rangeRestrictedInt16s) - { - (static_cast(context))->OnSuccessResponse_417(rangeRestrictedInt16s); - } - - static void OnFailureCallback_418(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_418(error); - } - - static void OnSuccessCallback_418(void * context, const chip::app::DataModel::Nullable & nullableRangeRestrictedInt8u) - { - (static_cast(context))->OnSuccessResponse_418(nullableRangeRestrictedInt8u); - } - - static void OnFailureCallback_419(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_419(error); - } - - static void OnSuccessCallback_419(void * context) { (static_cast(context))->OnSuccessResponse_419(); } - - static void OnFailureCallback_420(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_420(error); - } - - static void OnSuccessCallback_420(void * context) { (static_cast(context))->OnSuccessResponse_420(); } - - static void OnFailureCallback_421(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_421(error); - } - - static void OnSuccessCallback_421(void * context) { (static_cast(context))->OnSuccessResponse_421(); } - - static void OnFailureCallback_422(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_422(error); - } - - static void OnSuccessCallback_422(void * context) { (static_cast(context))->OnSuccessResponse_422(); } - - static void OnFailureCallback_423(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_423(error); - } - - static void OnSuccessCallback_423(void * context, const chip::app::DataModel::Nullable & nullableRangeRestrictedInt8u) - { - (static_cast(context))->OnSuccessResponse_423(nullableRangeRestrictedInt8u); - } - - static void OnFailureCallback_424(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_424(error); - } - - static void OnSuccessCallback_424(void * context) { (static_cast(context))->OnSuccessResponse_424(); } - - static void OnFailureCallback_425(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_425(error); - } - - static void OnSuccessCallback_425(void * context, const chip::app::DataModel::Nullable & nullableRangeRestrictedInt8u) - { - (static_cast(context))->OnSuccessResponse_425(nullableRangeRestrictedInt8u); - } - - static void OnFailureCallback_426(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_426(error); - } - - static void OnSuccessCallback_426(void * context) { (static_cast(context))->OnSuccessResponse_426(); } - - static void OnFailureCallback_427(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_427(error); - } - - static void OnSuccessCallback_427(void * context, const chip::app::DataModel::Nullable & nullableRangeRestrictedInt8u) - { - (static_cast(context))->OnSuccessResponse_427(nullableRangeRestrictedInt8u); - } - - static void OnFailureCallback_428(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_428(error); - } - - static void OnSuccessCallback_428(void * context) { (static_cast(context))->OnSuccessResponse_428(); } - - static void OnFailureCallback_429(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_429(error); - } - - static void OnSuccessCallback_429(void * context, const chip::app::DataModel::Nullable & nullableRangeRestrictedInt8u) - { - (static_cast(context))->OnSuccessResponse_429(nullableRangeRestrictedInt8u); - } - - static void OnFailureCallback_430(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_430(error); - } - - static void OnSuccessCallback_430(void * context) { (static_cast(context))->OnSuccessResponse_430(); } - - static void OnFailureCallback_431(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_431(error); - } - - static void OnSuccessCallback_431(void * context, const chip::app::DataModel::Nullable & nullableRangeRestrictedInt8u) - { - (static_cast(context))->OnSuccessResponse_431(nullableRangeRestrictedInt8u); - } - - static void OnFailureCallback_432(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_432(error); - } - - static void OnSuccessCallback_432(void * context, - const chip::app::DataModel::Nullable & nullableRangeRestrictedInt16u) - { - (static_cast(context))->OnSuccessResponse_432(nullableRangeRestrictedInt16u); - } - - static void OnFailureCallback_433(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_433(error); - } - - static void OnSuccessCallback_433(void * context) { (static_cast(context))->OnSuccessResponse_433(); } - - static void OnFailureCallback_434(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_434(error); - } - - static void OnSuccessCallback_434(void * context) { (static_cast(context))->OnSuccessResponse_434(); } - - static void OnFailureCallback_435(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_435(error); - } - - static void OnSuccessCallback_435(void * context) { (static_cast(context))->OnSuccessResponse_435(); } - - static void OnFailureCallback_436(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_436(error); - } - - static void OnSuccessCallback_436(void * context) { (static_cast(context))->OnSuccessResponse_436(); } - - static void OnFailureCallback_437(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_437(error); - } - - static void OnSuccessCallback_437(void * context, - const chip::app::DataModel::Nullable & nullableRangeRestrictedInt16u) - { - (static_cast(context))->OnSuccessResponse_437(nullableRangeRestrictedInt16u); - } - - static void OnFailureCallback_438(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_438(error); - } - - static void OnSuccessCallback_438(void * context) { (static_cast(context))->OnSuccessResponse_438(); } - - static void OnFailureCallback_439(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_439(error); - } - - static void OnSuccessCallback_439(void * context, - const chip::app::DataModel::Nullable & nullableRangeRestrictedInt16u) - { - (static_cast(context))->OnSuccessResponse_439(nullableRangeRestrictedInt16u); - } - - static void OnFailureCallback_440(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_440(error); - } - - static void OnSuccessCallback_440(void * context) { (static_cast(context))->OnSuccessResponse_440(); } - - static void OnFailureCallback_441(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_441(error); - } - - static void OnSuccessCallback_441(void * context, - const chip::app::DataModel::Nullable & nullableRangeRestrictedInt16u) - { - (static_cast(context))->OnSuccessResponse_441(nullableRangeRestrictedInt16u); - } - - static void OnFailureCallback_442(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_442(error); - } - - static void OnSuccessCallback_442(void * context) { (static_cast(context))->OnSuccessResponse_442(); } - - static void OnFailureCallback_443(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_443(error); - } - - static void OnSuccessCallback_443(void * context, - const chip::app::DataModel::Nullable & nullableRangeRestrictedInt16u) - { - (static_cast(context))->OnSuccessResponse_443(nullableRangeRestrictedInt16u); - } - - static void OnFailureCallback_444(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_444(error); - } - - static void OnSuccessCallback_444(void * context) { (static_cast(context))->OnSuccessResponse_444(); } - - static void OnFailureCallback_445(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_445(error); - } - - static void OnSuccessCallback_445(void * context, - const chip::app::DataModel::Nullable & nullableRangeRestrictedInt16u) - { - (static_cast(context))->OnSuccessResponse_445(nullableRangeRestrictedInt16u); - } - - static void OnFailureCallback_446(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_446(error); - } - - static void OnSuccessCallback_446(void * context, const chip::app::DataModel::Nullable & nullableRangeRestrictedInt8s) - { - (static_cast(context))->OnSuccessResponse_446(nullableRangeRestrictedInt8s); - } - - static void OnFailureCallback_447(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_447(error); - } - - static void OnSuccessCallback_447(void * context) { (static_cast(context))->OnSuccessResponse_447(); } - - static void OnFailureCallback_448(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_448(error); - } - - static void OnSuccessCallback_448(void * context) { (static_cast(context))->OnSuccessResponse_448(); } - - static void OnFailureCallback_449(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_449(error); - } - - static void OnSuccessCallback_449(void * context) { (static_cast(context))->OnSuccessResponse_449(); } - - static void OnFailureCallback_450(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_450(error); - } - - static void OnSuccessCallback_450(void * context) { (static_cast(context))->OnSuccessResponse_450(); } - - static void OnFailureCallback_451(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_451(error); - } - - static void OnSuccessCallback_451(void * context, const chip::app::DataModel::Nullable & nullableRangeRestrictedInt8s) - { - (static_cast(context))->OnSuccessResponse_451(nullableRangeRestrictedInt8s); - } - - static void OnFailureCallback_452(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_452(error); - } - - static void OnSuccessCallback_452(void * context) { (static_cast(context))->OnSuccessResponse_452(); } - - static void OnFailureCallback_453(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_453(error); - } - - static void OnSuccessCallback_453(void * context, const chip::app::DataModel::Nullable & nullableRangeRestrictedInt8s) - { - (static_cast(context))->OnSuccessResponse_453(nullableRangeRestrictedInt8s); - } - - static void OnFailureCallback_454(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_454(error); - } - - static void OnSuccessCallback_454(void * context) { (static_cast(context))->OnSuccessResponse_454(); } - - static void OnFailureCallback_455(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_455(error); - } - - static void OnSuccessCallback_455(void * context, const chip::app::DataModel::Nullable & nullableRangeRestrictedInt8s) - { - (static_cast(context))->OnSuccessResponse_455(nullableRangeRestrictedInt8s); - } - - static void OnFailureCallback_456(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_456(error); - } - - static void OnSuccessCallback_456(void * context) { (static_cast(context))->OnSuccessResponse_456(); } - - static void OnFailureCallback_457(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_457(error); - } - - static void OnSuccessCallback_457(void * context, const chip::app::DataModel::Nullable & nullableRangeRestrictedInt8s) - { - (static_cast(context))->OnSuccessResponse_457(nullableRangeRestrictedInt8s); - } - - static void OnFailureCallback_458(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_458(error); - } - - static void OnSuccessCallback_458(void * context) { (static_cast(context))->OnSuccessResponse_458(); } - - static void OnFailureCallback_459(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_459(error); - } - - static void OnSuccessCallback_459(void * context, const chip::app::DataModel::Nullable & nullableRangeRestrictedInt8s) - { - (static_cast(context))->OnSuccessResponse_459(nullableRangeRestrictedInt8s); - } - - static void OnFailureCallback_460(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_460(error); - } - - static void OnSuccessCallback_460(void * context, const chip::app::DataModel::Nullable & nullableRangeRestrictedInt16s) - { - (static_cast(context))->OnSuccessResponse_460(nullableRangeRestrictedInt16s); - } - - static void OnFailureCallback_461(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_461(error); - } - - static void OnSuccessCallback_461(void * context) { (static_cast(context))->OnSuccessResponse_461(); } - - static void OnFailureCallback_462(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_462(error); - } - - static void OnSuccessCallback_462(void * context) { (static_cast(context))->OnSuccessResponse_462(); } - - static void OnFailureCallback_463(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_463(error); - } - - static void OnSuccessCallback_463(void * context) { (static_cast(context))->OnSuccessResponse_463(); } - - static void OnFailureCallback_464(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_464(error); - } - - static void OnSuccessCallback_464(void * context) { (static_cast(context))->OnSuccessResponse_464(); } - - static void OnFailureCallback_465(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_465(error); - } - - static void OnSuccessCallback_465(void * context, const chip::app::DataModel::Nullable & nullableRangeRestrictedInt16s) - { - (static_cast(context))->OnSuccessResponse_465(nullableRangeRestrictedInt16s); - } - - static void OnFailureCallback_466(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_466(error); - } - - static void OnSuccessCallback_466(void * context) { (static_cast(context))->OnSuccessResponse_466(); } - - static void OnFailureCallback_467(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_467(error); - } - - static void OnSuccessCallback_467(void * context, const chip::app::DataModel::Nullable & nullableRangeRestrictedInt16s) - { - (static_cast(context))->OnSuccessResponse_467(nullableRangeRestrictedInt16s); - } - - static void OnFailureCallback_468(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_468(error); - } - - static void OnSuccessCallback_468(void * context) { (static_cast(context))->OnSuccessResponse_468(); } - - static void OnFailureCallback_469(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_469(error); - } - - static void OnSuccessCallback_469(void * context, const chip::app::DataModel::Nullable & nullableRangeRestrictedInt16s) - { - (static_cast(context))->OnSuccessResponse_469(nullableRangeRestrictedInt16s); - } - - static void OnFailureCallback_470(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_470(error); - } - - static void OnSuccessCallback_470(void * context) { (static_cast(context))->OnSuccessResponse_470(); } - - static void OnFailureCallback_471(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_471(error); - } - - static void OnSuccessCallback_471(void * context, const chip::app::DataModel::Nullable & nullableRangeRestrictedInt16s) - { - (static_cast(context))->OnSuccessResponse_471(nullableRangeRestrictedInt16s); - } - - static void OnFailureCallback_472(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_472(error); - } - - static void OnSuccessCallback_472(void * context) { (static_cast(context))->OnSuccessResponse_472(); } - - static void OnFailureCallback_473(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_473(error); - } - - static void OnSuccessCallback_473(void * context, const chip::app::DataModel::Nullable & nullableRangeRestrictedInt16s) - { - (static_cast(context))->OnSuccessResponse_473(nullableRangeRestrictedInt16s); - } - - static void OnFailureCallback_474(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_474(error); - } - - static void OnSuccessCallback_474(void * context) { (static_cast(context))->OnSuccessResponse_474(); } - - static void OnFailureCallback_475(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_475(error); - } - - static void OnSuccessCallback_475(void * context) { (static_cast(context))->OnSuccessResponse_475(); } - - static void OnFailureCallback_476(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_476(error); - } - - static void OnSuccessCallback_476(void * context, bool generalErrorBoolean) - { - (static_cast(context))->OnSuccessResponse_476(generalErrorBoolean); - } - - static void OnFailureCallback_477(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_477(error); - } - - static void OnSuccessCallback_477(void * context, bool clusterErrorBoolean) - { - (static_cast(context))->OnSuccessResponse_477(clusterErrorBoolean); - } - - static void OnFailureCallback_478(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_478(error); - } - - static void OnSuccessCallback_478(void * context, - const chip::app::DataModel::DecodableList & acceptedCommandList) - { - (static_cast(context))->OnSuccessResponse_478(acceptedCommandList); - } - - static void OnFailureCallback_479(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_479(error); - } - - static void OnSuccessCallback_479(void * context, - const chip::app::DataModel::DecodableList & generatedCommandList) - { - (static_cast(context))->OnSuccessResponse_479(generatedCommandList); - } - - static void OnFailureCallback_480(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_480(error); - } - - static void OnSuccessCallback_480(void * context) { (static_cast(context))->OnSuccessResponse_480(); } - - static void OnFailureCallback_481(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_481(error); - } - - static void OnSuccessCallback_481(void * context, - const chip::app::Clusters::TestCluster::Structs::SimpleStruct::DecodableType & structAttr) - { - (static_cast(context))->OnSuccessResponse_481(structAttr); - } - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestSendTestCommand_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::TestCluster::Commands::Test::Type; - - RequestType request; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_1(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_1(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_1() { NextTest(); } - - CHIP_ERROR TestSendTestNotHandledCommand_2() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::TestCluster::Commands::TestNotHandled::Type; - - RequestType request; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_2(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_2(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_2(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_COMMAND)); - NextTest(); - } - - void OnSuccessResponse_2() { ThrowSuccessResponse(); } - - CHIP_ERROR TestSendTestSpecificCommand_3() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::TestCluster::Commands::TestSpecific::Type; - - RequestType request; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_3(data.returnValue); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_3(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_3(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_3(uint8_t returnValue) - { - VerifyOrReturn(CheckValue("returnValue", returnValue, 7)); - - NextTest(); - } - - CHIP_ERROR TestSendTestAddArgumentsCommand_4() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::TestCluster::Commands::TestAddArguments::Type; - - RequestType request; - request.arg1 = 3; - request.arg2 = 17; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_4(data.returnValue); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_4(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_4(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_4(uint8_t returnValue) - { - VerifyOrReturn(CheckValue("returnValue", returnValue, 20)); - - NextTest(); - } - - CHIP_ERROR TestSendFailingTestAddArgumentsCommand_5() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::TestCluster::Commands::TestAddArguments::Type; - - RequestType request; - request.arg1 = 250; - request.arg2 = 6; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_5(data.returnValue); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_5(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_5(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_COMMAND)); - NextTest(); - } - - void OnSuccessResponse_5(uint8_t returnValue) { ThrowSuccessResponse(); } - - CHIP_ERROR TestReadAttributeBooleanDefaultValue_6() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_6, OnFailureCallback_6, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_6(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_6(bool boolean) - { - VerifyOrReturn(CheckValue("boolean", boolean, 0)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeBooleanTrue_7() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - bool booleanArgument; - booleanArgument = 1; - - ReturnErrorOnFailure(cluster.WriteAttribute( - booleanArgument, this, OnSuccessCallback_7, OnFailureCallback_7)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_7(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_7() { NextTest(); } - - CHIP_ERROR TestReadAttributeBooleanTrue_8() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_8, OnFailureCallback_8, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_8(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_8(bool boolean) - { - VerifyOrReturn(CheckValue("boolean", boolean, 1)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeBooleanFalse_9() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - bool booleanArgument; - booleanArgument = 0; - - ReturnErrorOnFailure(cluster.WriteAttribute( - booleanArgument, this, OnSuccessCallback_9, OnFailureCallback_9)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_9(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_9() { NextTest(); } - - CHIP_ERROR TestReadAttributeBooleanFalse_10() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_10, OnFailureCallback_10, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_10(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_10(bool boolean) - { - VerifyOrReturn(CheckValue("boolean", boolean, 0)); - - NextTest(); - } - - CHIP_ERROR TestReadAttributeBitmap8DefaultValue_11() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_11, OnFailureCallback_11, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_11(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_11(chip::BitFlags bitmap8) - { - VerifyOrReturn(CheckValue("bitmap8", bitmap8, 0)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeBitmap8MaxValue_12() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::BitFlags bitmap8Argument; - bitmap8Argument = static_cast>(255); - - ReturnErrorOnFailure(cluster.WriteAttribute( - bitmap8Argument, this, OnSuccessCallback_12, OnFailureCallback_12)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_12(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_12() { NextTest(); } - - CHIP_ERROR TestReadAttributeBitmap8MaxValue_13() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_13, OnFailureCallback_13, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_13(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_13(chip::BitFlags bitmap8) - { - VerifyOrReturn(CheckValue("bitmap8", bitmap8, 255)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeBitmap8MinValue_14() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::BitFlags bitmap8Argument; - bitmap8Argument = static_cast>(0); - - ReturnErrorOnFailure(cluster.WriteAttribute( - bitmap8Argument, this, OnSuccessCallback_14, OnFailureCallback_14)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_14(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_14() { NextTest(); } - - CHIP_ERROR TestReadAttributeBitmap8MinValue_15() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_15, OnFailureCallback_15, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_15(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_15(chip::BitFlags bitmap8) - { - VerifyOrReturn(CheckValue("bitmap8", bitmap8, 0)); - - NextTest(); - } - - CHIP_ERROR TestReadAttributeBitmap16DefaultValue_16() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_16, OnFailureCallback_16, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_16(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_16(chip::BitFlags bitmap16) - { - VerifyOrReturn(CheckValue("bitmap16", bitmap16, 0U)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeBitmap16MaxValue_17() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::BitFlags bitmap16Argument; - bitmap16Argument = static_cast>(65535U); - - ReturnErrorOnFailure(cluster.WriteAttribute( - bitmap16Argument, this, OnSuccessCallback_17, OnFailureCallback_17)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_17(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_17() { NextTest(); } - - CHIP_ERROR TestReadAttributeBitmap16MaxValue_18() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_18, OnFailureCallback_18, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_18(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_18(chip::BitFlags bitmap16) - { - VerifyOrReturn(CheckValue("bitmap16", bitmap16, 65535U)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeBitmap16MinValue_19() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::BitFlags bitmap16Argument; - bitmap16Argument = static_cast>(0U); - - ReturnErrorOnFailure(cluster.WriteAttribute( - bitmap16Argument, this, OnSuccessCallback_19, OnFailureCallback_19)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_19(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_19() { NextTest(); } - - CHIP_ERROR TestReadAttributeBitmap16MinValue_20() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_20, OnFailureCallback_20, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_20(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_20(chip::BitFlags bitmap16) - { - VerifyOrReturn(CheckValue("bitmap16", bitmap16, 0U)); - - NextTest(); - } - - CHIP_ERROR TestReadAttributeBitmap32DefaultValue_21() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_21, OnFailureCallback_21, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_21(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_21(chip::BitFlags bitmap32) - { - VerifyOrReturn(CheckValue("bitmap32", bitmap32, 0UL)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeBitmap32MaxValue_22() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::BitFlags bitmap32Argument; - bitmap32Argument = static_cast>(4294967295UL); - - ReturnErrorOnFailure(cluster.WriteAttribute( - bitmap32Argument, this, OnSuccessCallback_22, OnFailureCallback_22)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_22(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_22() { NextTest(); } - - CHIP_ERROR TestReadAttributeBitmap32MaxValue_23() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_23, OnFailureCallback_23, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_23(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_23(chip::BitFlags bitmap32) - { - VerifyOrReturn(CheckValue("bitmap32", bitmap32, 4294967295UL)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeBitmap32MinValue_24() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::BitFlags bitmap32Argument; - bitmap32Argument = static_cast>(0UL); - - ReturnErrorOnFailure(cluster.WriteAttribute( - bitmap32Argument, this, OnSuccessCallback_24, OnFailureCallback_24)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_24(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_24() { NextTest(); } - - CHIP_ERROR TestReadAttributeBitmap32MinValue_25() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_25, OnFailureCallback_25, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_25(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_25(chip::BitFlags bitmap32) - { - VerifyOrReturn(CheckValue("bitmap32", bitmap32, 0UL)); - - NextTest(); - } - - CHIP_ERROR TestReadAttributeBitmap64DefaultValue_26() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_26, OnFailureCallback_26, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_26(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_26(chip::BitFlags bitmap64) - { - VerifyOrReturn(CheckValue("bitmap64", bitmap64, 0ULL)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeBitmap64MaxValue_27() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::BitFlags bitmap64Argument; - bitmap64Argument = static_cast>(18446744073709551615ULL); - - ReturnErrorOnFailure(cluster.WriteAttribute( - bitmap64Argument, this, OnSuccessCallback_27, OnFailureCallback_27)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_27(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_27() { NextTest(); } - - CHIP_ERROR TestReadAttributeBitmap64MaxValue_28() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_28, OnFailureCallback_28, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_28(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_28(chip::BitFlags bitmap64) - { - VerifyOrReturn(CheckValue("bitmap64", bitmap64, 18446744073709551615ULL)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeBitmap64MinValue_29() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::BitFlags bitmap64Argument; - bitmap64Argument = static_cast>(0ULL); - - ReturnErrorOnFailure(cluster.WriteAttribute( - bitmap64Argument, this, OnSuccessCallback_29, OnFailureCallback_29)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_29(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_29() { NextTest(); } - - CHIP_ERROR TestReadAttributeBitmap64MinValue_30() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_30, OnFailureCallback_30, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_30(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_30(chip::BitFlags bitmap64) - { - VerifyOrReturn(CheckValue("bitmap64", bitmap64, 0ULL)); - - NextTest(); - } - - CHIP_ERROR TestReadAttributeInt8uDefaultValue_31() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_31, OnFailureCallback_31, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_31(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_31(uint8_t int8u) - { - VerifyOrReturn(CheckValue("int8u", int8u, 0)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeInt8uMaxValue_32() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - uint8_t int8uArgument; - int8uArgument = 255; - - ReturnErrorOnFailure(cluster.WriteAttribute( - int8uArgument, this, OnSuccessCallback_32, OnFailureCallback_32)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_32(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_32() { NextTest(); } - - CHIP_ERROR TestReadAttributeInt8uMaxValue_33() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_33, OnFailureCallback_33, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_33(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_33(uint8_t int8u) - { - VerifyOrReturn(CheckValue("int8u", int8u, 255)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeInt8uMinValue_34() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - uint8_t int8uArgument; - int8uArgument = 0; - - ReturnErrorOnFailure(cluster.WriteAttribute( - int8uArgument, this, OnSuccessCallback_34, OnFailureCallback_34)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_34(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_34() { NextTest(); } - - CHIP_ERROR TestReadAttributeInt8uMinValue_35() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_35, OnFailureCallback_35, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_35(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_35(uint8_t int8u) - { - VerifyOrReturn(CheckValue("int8u", int8u, 0)); - - NextTest(); - } - - CHIP_ERROR TestReadAttributeInt16uDefaultValue_36() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_36, OnFailureCallback_36, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_36(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_36(uint16_t int16u) - { - VerifyOrReturn(CheckValue("int16u", int16u, 0U)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeInt16uMaxValue_37() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - uint16_t int16uArgument; - int16uArgument = 65535U; - - ReturnErrorOnFailure(cluster.WriteAttribute( - int16uArgument, this, OnSuccessCallback_37, OnFailureCallback_37)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_37(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_37() { NextTest(); } - - CHIP_ERROR TestReadAttributeInt16uMaxValue_38() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_38, OnFailureCallback_38, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_38(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_38(uint16_t int16u) - { - VerifyOrReturn(CheckValue("int16u", int16u, 65535U)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeInt16uMinValue_39() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - uint16_t int16uArgument; - int16uArgument = 0U; - - ReturnErrorOnFailure(cluster.WriteAttribute( - int16uArgument, this, OnSuccessCallback_39, OnFailureCallback_39)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_39(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_39() { NextTest(); } - - CHIP_ERROR TestReadAttributeInt16uMinValue_40() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_40, OnFailureCallback_40, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_40(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_40(uint16_t int16u) - { - VerifyOrReturn(CheckValue("int16u", int16u, 0U)); - - NextTest(); - } - - CHIP_ERROR TestReadAttributeInt32uDefaultValue_41() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_41, OnFailureCallback_41, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_41(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_41(uint32_t int32u) - { - VerifyOrReturn(CheckValue("int32u", int32u, 0UL)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeInt32uMaxValue_42() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - uint32_t int32uArgument; - int32uArgument = 4294967295UL; - - ReturnErrorOnFailure(cluster.WriteAttribute( - int32uArgument, this, OnSuccessCallback_42, OnFailureCallback_42)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_42(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_42() { NextTest(); } - - CHIP_ERROR TestReadAttributeInt32uMaxValue_43() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_43, OnFailureCallback_43, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_43(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_43(uint32_t int32u) - { - VerifyOrReturn(CheckValue("int32u", int32u, 4294967295UL)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeInt32uMinValue_44() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - uint32_t int32uArgument; - int32uArgument = 0UL; - - ReturnErrorOnFailure(cluster.WriteAttribute( - int32uArgument, this, OnSuccessCallback_44, OnFailureCallback_44)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_44(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_44() { NextTest(); } - - CHIP_ERROR TestReadAttributeInt32uMinValue_45() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_45, OnFailureCallback_45, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_45(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_45(uint32_t int32u) - { - VerifyOrReturn(CheckValue("int32u", int32u, 0UL)); - - NextTest(); - } - - CHIP_ERROR TestReadAttributeInt64uDefaultValue_46() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_46, OnFailureCallback_46, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_46(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_46(uint64_t int64u) - { - VerifyOrReturn(CheckValue("int64u", int64u, 0ULL)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeInt64uMaxValue_47() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - uint64_t int64uArgument; - int64uArgument = 18446744073709551615ULL; - - ReturnErrorOnFailure(cluster.WriteAttribute( - int64uArgument, this, OnSuccessCallback_47, OnFailureCallback_47)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_47(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_47() { NextTest(); } - - CHIP_ERROR TestReadAttributeInt64uMaxValue_48() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_48, OnFailureCallback_48, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_48(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_48(uint64_t int64u) - { - VerifyOrReturn(CheckValue("int64u", int64u, 18446744073709551615ULL)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeInt64uMinValue_49() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - uint64_t int64uArgument; - int64uArgument = 0ULL; - - ReturnErrorOnFailure(cluster.WriteAttribute( - int64uArgument, this, OnSuccessCallback_49, OnFailureCallback_49)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_49(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_49() { NextTest(); } - - CHIP_ERROR TestReadAttributeInt64uMinValue_50() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_50, OnFailureCallback_50, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_50(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_50(uint64_t int64u) - { - VerifyOrReturn(CheckValue("int64u", int64u, 0ULL)); - - NextTest(); - } - - CHIP_ERROR TestReadAttributeInt8sDefaultValue_51() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_51, OnFailureCallback_51, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_51(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_51(int8_t int8s) - { - VerifyOrReturn(CheckValue("int8s", int8s, 0)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeInt8sMaxValue_52() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - int8_t int8sArgument; - int8sArgument = 127; - - ReturnErrorOnFailure(cluster.WriteAttribute( - int8sArgument, this, OnSuccessCallback_52, OnFailureCallback_52)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_52(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_52() { NextTest(); } - - CHIP_ERROR TestReadAttributeInt8sMaxValue_53() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_53, OnFailureCallback_53, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_53(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_53(int8_t int8s) - { - VerifyOrReturn(CheckValue("int8s", int8s, 127)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeInt8sMinValue_54() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - int8_t int8sArgument; - int8sArgument = -128; - - ReturnErrorOnFailure(cluster.WriteAttribute( - int8sArgument, this, OnSuccessCallback_54, OnFailureCallback_54)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_54(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_54() { NextTest(); } - - CHIP_ERROR TestReadAttributeInt8sMinValue_55() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_55, OnFailureCallback_55, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_55(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_55(int8_t int8s) - { - VerifyOrReturn(CheckValue("int8s", int8s, -128)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeInt8sDefaultValue_56() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - int8_t int8sArgument; - int8sArgument = 0; - - ReturnErrorOnFailure(cluster.WriteAttribute( - int8sArgument, this, OnSuccessCallback_56, OnFailureCallback_56)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_56(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_56() { NextTest(); } - - CHIP_ERROR TestReadAttributeInt8sDefaultValue_57() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_57, OnFailureCallback_57, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_57(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_57(int8_t int8s) - { - VerifyOrReturn(CheckValue("int8s", int8s, 0)); - - NextTest(); - } - - CHIP_ERROR TestReadAttributeInt16sDefaultValue_58() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_58, OnFailureCallback_58, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_58(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_58(int16_t int16s) - { - VerifyOrReturn(CheckValue("int16s", int16s, 0)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeInt16sMaxValue_59() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - int16_t int16sArgument; - int16sArgument = 32767; - - ReturnErrorOnFailure(cluster.WriteAttribute( - int16sArgument, this, OnSuccessCallback_59, OnFailureCallback_59)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_59(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_59() { NextTest(); } - - CHIP_ERROR TestReadAttributeInt16sMaxValue_60() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_60, OnFailureCallback_60, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_60(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_60(int16_t int16s) - { - VerifyOrReturn(CheckValue("int16s", int16s, 32767)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeInt16sMinValue_61() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - int16_t int16sArgument; - int16sArgument = -32768; - - ReturnErrorOnFailure(cluster.WriteAttribute( - int16sArgument, this, OnSuccessCallback_61, OnFailureCallback_61)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_61(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_61() { NextTest(); } - - CHIP_ERROR TestReadAttributeInt16sMinValue_62() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_62, OnFailureCallback_62, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_62(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_62(int16_t int16s) - { - VerifyOrReturn(CheckValue("int16s", int16s, -32768)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeInt16sDefaultValue_63() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - int16_t int16sArgument; - int16sArgument = 0; - - ReturnErrorOnFailure(cluster.WriteAttribute( - int16sArgument, this, OnSuccessCallback_63, OnFailureCallback_63)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_63(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_63() { NextTest(); } - - CHIP_ERROR TestReadAttributeInt16sDefaultValue_64() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_64, OnFailureCallback_64, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_64(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_64(int16_t int16s) - { - VerifyOrReturn(CheckValue("int16s", int16s, 0)); - - NextTest(); - } - - CHIP_ERROR TestReadAttributeInt32sDefaultValue_65() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_65, OnFailureCallback_65, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_65(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_65(int32_t int32s) - { - VerifyOrReturn(CheckValue("int32s", int32s, 0L)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeInt32sMaxValue_66() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - int32_t int32sArgument; - int32sArgument = 2147483647L; - - ReturnErrorOnFailure(cluster.WriteAttribute( - int32sArgument, this, OnSuccessCallback_66, OnFailureCallback_66)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_66(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_66() { NextTest(); } - - CHIP_ERROR TestReadAttributeInt32sMaxValue_67() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_67, OnFailureCallback_67, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_67(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_67(int32_t int32s) - { - VerifyOrReturn(CheckValue("int32s", int32s, 2147483647L)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeInt32sMinValue_68() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - int32_t int32sArgument; - int32sArgument = -2147483648L; - - ReturnErrorOnFailure(cluster.WriteAttribute( - int32sArgument, this, OnSuccessCallback_68, OnFailureCallback_68)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_68(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_68() { NextTest(); } - - CHIP_ERROR TestReadAttributeInt32sMinValue_69() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_69, OnFailureCallback_69, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_69(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_69(int32_t int32s) - { - VerifyOrReturn(CheckValue("int32s", int32s, -2147483648L)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeInt32sDefaultValue_70() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - int32_t int32sArgument; - int32sArgument = 0L; - - ReturnErrorOnFailure(cluster.WriteAttribute( - int32sArgument, this, OnSuccessCallback_70, OnFailureCallback_70)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_70(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_70() { NextTest(); } - - CHIP_ERROR TestReadAttributeInt32sDefaultValue_71() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_71, OnFailureCallback_71, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_71(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_71(int32_t int32s) - { - VerifyOrReturn(CheckValue("int32s", int32s, 0L)); - - NextTest(); - } - - CHIP_ERROR TestReadAttributeInt64sDefaultValue_72() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_72, OnFailureCallback_72, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_72(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_72(int64_t int64s) - { - VerifyOrReturn(CheckValue("int64s", int64s, 0LL)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeInt64sMaxValue_73() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - int64_t int64sArgument; - int64sArgument = 9223372036854775807LL; - - ReturnErrorOnFailure(cluster.WriteAttribute( - int64sArgument, this, OnSuccessCallback_73, OnFailureCallback_73)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_73(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_73() { NextTest(); } - - CHIP_ERROR TestReadAttributeInt64sMaxValue_74() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_74, OnFailureCallback_74, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_74(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_74(int64_t int64s) - { - VerifyOrReturn(CheckValue("int64s", int64s, 9223372036854775807LL)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeInt64sMinValue_75() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - int64_t int64sArgument; - int64sArgument = -9223372036854775807LL; - - ReturnErrorOnFailure(cluster.WriteAttribute( - int64sArgument, this, OnSuccessCallback_75, OnFailureCallback_75)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_75(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_75() { NextTest(); } - - CHIP_ERROR TestReadAttributeInt64sMinValue_76() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_76, OnFailureCallback_76, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_76(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_76(int64_t int64s) - { - VerifyOrReturn(CheckValue("int64s", int64s, -9223372036854775807LL)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeInt64sDefaultValue_77() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - int64_t int64sArgument; - int64sArgument = 0LL; - - ReturnErrorOnFailure(cluster.WriteAttribute( - int64sArgument, this, OnSuccessCallback_77, OnFailureCallback_77)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_77(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_77() { NextTest(); } - - CHIP_ERROR TestReadAttributeInt64sDefaultValue_78() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_78, OnFailureCallback_78, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_78(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_78(int64_t int64s) - { - VerifyOrReturn(CheckValue("int64s", int64s, 0LL)); - - NextTest(); - } - - CHIP_ERROR TestReadAttributeSingleDefaultValue_79() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_79, OnFailureCallback_79, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_79(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_79(float floatSingle) - { - VerifyOrReturn(CheckValue("floatSingle", floatSingle, 0.0f)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeSingleMediumValue_80() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - float floatSingleArgument; - floatSingleArgument = 0.1f; - - ReturnErrorOnFailure(cluster.WriteAttribute( - floatSingleArgument, this, OnSuccessCallback_80, OnFailureCallback_80)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_80(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_80() { NextTest(); } - - CHIP_ERROR TestReadAttributeSingleMediumValue_81() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_81, OnFailureCallback_81, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_81(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_81(float floatSingle) - { - VerifyOrReturn(CheckValue("floatSingle", floatSingle, 0.1f)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeSingleLargeValue_82() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - float floatSingleArgument; - floatSingleArgument = 17000000000.0f; - - ReturnErrorOnFailure(cluster.WriteAttribute( - floatSingleArgument, this, OnSuccessCallback_82, OnFailureCallback_82)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_82(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_82() { NextTest(); } - - CHIP_ERROR TestReadAttributeSingleLargeValue_83() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_83, OnFailureCallback_83, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_83(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_83(float floatSingle) - { - VerifyOrReturn(CheckValue("floatSingle", floatSingle, 17000000000.0f)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeSingleSmallValue_84() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - float floatSingleArgument; - floatSingleArgument = 1.7e-10f; - - ReturnErrorOnFailure(cluster.WriteAttribute( - floatSingleArgument, this, OnSuccessCallback_84, OnFailureCallback_84)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_84(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_84() { NextTest(); } - - CHIP_ERROR TestReadAttributeSingleSmallValue_85() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_85, OnFailureCallback_85, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_85(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_85(float floatSingle) - { - VerifyOrReturn(CheckValue("floatSingle", floatSingle, 1.7e-10f)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeSingleDefaultValue_86() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - float floatSingleArgument; - floatSingleArgument = 0.0f; - - ReturnErrorOnFailure(cluster.WriteAttribute( - floatSingleArgument, this, OnSuccessCallback_86, OnFailureCallback_86)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_86(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_86() { NextTest(); } - - CHIP_ERROR TestReadAttributeSingleDefaultValue_87() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_87, OnFailureCallback_87, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_87(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_87(float floatSingle) - { - VerifyOrReturn(CheckValue("floatSingle", floatSingle, 0.0f)); - - NextTest(); - } - - CHIP_ERROR TestReadAttributeDoubleDefaultValue_88() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_88, OnFailureCallback_88, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_88(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_88(double floatDouble) - { - VerifyOrReturn(CheckValue("floatDouble", floatDouble, 0)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeDoubleMediumValue_89() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - double floatDoubleArgument; - floatDoubleArgument = 0.1234567890123; - - ReturnErrorOnFailure(cluster.WriteAttribute( - floatDoubleArgument, this, OnSuccessCallback_89, OnFailureCallback_89)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_89(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_89() { NextTest(); } - - CHIP_ERROR TestReadAttributeDoubleMediumValue_90() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_90, OnFailureCallback_90, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_90(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_90(double floatDouble) - { - VerifyOrReturn(CheckValue("floatDouble", floatDouble, 0.1234567890123)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeDoubleLargeValue_91() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - double floatDoubleArgument; - floatDoubleArgument = 1.7e+200; - - ReturnErrorOnFailure(cluster.WriteAttribute( - floatDoubleArgument, this, OnSuccessCallback_91, OnFailureCallback_91)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_91(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_91() { NextTest(); } - - CHIP_ERROR TestReadAttributeDoubleLargeValue_92() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_92, OnFailureCallback_92, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_92(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_92(double floatDouble) - { - VerifyOrReturn(CheckValue("floatDouble", floatDouble, 1.7e+200)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeDoubleSmallValue_93() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - double floatDoubleArgument; - floatDoubleArgument = 1.7e-200; - - ReturnErrorOnFailure(cluster.WriteAttribute( - floatDoubleArgument, this, OnSuccessCallback_93, OnFailureCallback_93)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_93(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_93() { NextTest(); } - - CHIP_ERROR TestReadAttributeDoubleSmallValue_94() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_94, OnFailureCallback_94, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_94(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_94(double floatDouble) - { - VerifyOrReturn(CheckValue("floatDouble", floatDouble, 1.7e-200)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeDoubleDefaultValue_95() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - double floatDoubleArgument; - floatDoubleArgument = 0; - - ReturnErrorOnFailure(cluster.WriteAttribute( - floatDoubleArgument, this, OnSuccessCallback_95, OnFailureCallback_95)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_95(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_95() { NextTest(); } - - CHIP_ERROR TestReadAttributeDoubleDefaultValue_96() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_96, OnFailureCallback_96, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_96(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_96(double floatDouble) - { - VerifyOrReturn(CheckValue("floatDouble", floatDouble, 0)); - - NextTest(); - } - - CHIP_ERROR TestReadAttributeEnum8DefaultValue_97() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_97, OnFailureCallback_97, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_97(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_97(uint8_t enum8) - { - VerifyOrReturn(CheckValue("enum8", enum8, 0)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeEnum8MaxValue_98() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - uint8_t enum8Argument; - enum8Argument = 255; - - ReturnErrorOnFailure(cluster.WriteAttribute( - enum8Argument, this, OnSuccessCallback_98, OnFailureCallback_98)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_98(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_98() { NextTest(); } - - CHIP_ERROR TestReadAttributeEnum8MaxValue_99() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_99, OnFailureCallback_99, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_99(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_99(uint8_t enum8) - { - VerifyOrReturn(CheckValue("enum8", enum8, 255)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeEnum8MinValue_100() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - uint8_t enum8Argument; - enum8Argument = 0; - - ReturnErrorOnFailure(cluster.WriteAttribute( - enum8Argument, this, OnSuccessCallback_100, OnFailureCallback_100)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_100(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_100() { NextTest(); } - - CHIP_ERROR TestReadAttributeEnum8MinValue_101() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_101, OnFailureCallback_101, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_101(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_101(uint8_t enum8) - { - VerifyOrReturn(CheckValue("enum8", enum8, 0)); - - NextTest(); - } - - CHIP_ERROR TestReadAttributeEnum16DefaultValue_102() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_102, OnFailureCallback_102, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_102(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_102(uint16_t enum16) - { - VerifyOrReturn(CheckValue("enum16", enum16, 0U)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeEnum16MaxValue_103() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - uint16_t enum16Argument; - enum16Argument = 65535U; - - ReturnErrorOnFailure(cluster.WriteAttribute( - enum16Argument, this, OnSuccessCallback_103, OnFailureCallback_103)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_103(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_103() { NextTest(); } - - CHIP_ERROR TestReadAttributeEnum16MaxValue_104() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_104, OnFailureCallback_104, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_104(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_104(uint16_t enum16) - { - VerifyOrReturn(CheckValue("enum16", enum16, 65535U)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeEnum16MinValue_105() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - uint16_t enum16Argument; - enum16Argument = 0U; - - ReturnErrorOnFailure(cluster.WriteAttribute( - enum16Argument, this, OnSuccessCallback_105, OnFailureCallback_105)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_105(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_105() { NextTest(); } - - CHIP_ERROR TestReadAttributeEnum16MinValue_106() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_106, OnFailureCallback_106, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_106(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_106(uint16_t enum16) - { - VerifyOrReturn(CheckValue("enum16", enum16, 0U)); - - NextTest(); - } - - CHIP_ERROR TestReadAttributeOctetStringDefaultValue_107() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_107, OnFailureCallback_107, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_107(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_107(chip::ByteSpan octetString) - { - VerifyOrReturn(CheckValueAsString("octetString", octetString, chip::ByteSpan(chip::Uint8::from_const_char(""), 0))); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeOctetStringWithEmbeddedNull_108() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::ByteSpan octetStringArgument; - octetStringArgument = chip::ByteSpan(chip::Uint8::from_const_char("Tes\000ti\000nggarbage: not in length on purpose"), 9); - - ReturnErrorOnFailure(cluster.WriteAttribute( - octetStringArgument, this, OnSuccessCallback_108, OnFailureCallback_108)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_108(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_108() { NextTest(); } - - CHIP_ERROR TestReadAttributeOctetStringWithEmbeddedNull_109() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_109, OnFailureCallback_109, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_109(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_109(chip::ByteSpan octetString) - { - VerifyOrReturn( - CheckValueAsString("octetString", octetString, chip::ByteSpan(chip::Uint8::from_const_char("Tes\000ti\000ng"), 9))); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeOctetStringWithWeirdChars_110() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::ByteSpan octetStringArgument; - octetStringArgument = - chip::ByteSpan(chip::Uint8::from_const_char("\015\012\377\042\240garbage: not in length on purpose"), 5); - - ReturnErrorOnFailure(cluster.WriteAttribute( - octetStringArgument, this, OnSuccessCallback_110, OnFailureCallback_110)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_110(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_110() { NextTest(); } - - CHIP_ERROR TestReadAttributeOctetStringWithWeirdChars_111() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_111, OnFailureCallback_111, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_111(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_111(chip::ByteSpan octetString) - { - VerifyOrReturn(CheckValueAsString("octetString", octetString, - chip::ByteSpan(chip::Uint8::from_const_char("\015\012\377\042\240"), 5))); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeOctetString_112() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::ByteSpan octetStringArgument; - octetStringArgument = chip::ByteSpan(chip::Uint8::from_const_char("TestValuegarbage: not in length on purpose"), 9); - - ReturnErrorOnFailure(cluster.WriteAttribute( - octetStringArgument, this, OnSuccessCallback_112, OnFailureCallback_112)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_112(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_112() { NextTest(); } - - CHIP_ERROR TestReadAttributeOctetString_113() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_113, OnFailureCallback_113, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_113(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_113(chip::ByteSpan octetString) - { - VerifyOrReturn( - CheckValueAsString("octetString", octetString, chip::ByteSpan(chip::Uint8::from_const_char("TestValue"), 9))); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeOctetString_114() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::ByteSpan octetStringArgument; - octetStringArgument = - chip::ByteSpan(chip::Uint8::from_const_char("TestValueLongerThan10garbage: not in length on purpose"), 21); - - ReturnErrorOnFailure(cluster.WriteAttribute( - octetStringArgument, this, OnSuccessCallback_114, OnFailureCallback_114)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_114(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - NextTest(); - } - - void OnSuccessResponse_114() { ThrowSuccessResponse(); } - - CHIP_ERROR TestReadAttributeOctetString_115() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_115, OnFailureCallback_115, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_115(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_115(chip::ByteSpan octetString) - { - VerifyOrReturn( - CheckValueAsString("octetString", octetString, chip::ByteSpan(chip::Uint8::from_const_char("TestValue"), 9))); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeOctetString_116() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::ByteSpan octetStringArgument; - octetStringArgument = chip::ByteSpan(chip::Uint8::from_const_char("garbage: not in length on purpose"), 0); - - ReturnErrorOnFailure(cluster.WriteAttribute( - octetStringArgument, this, OnSuccessCallback_116, OnFailureCallback_116)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_116(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_116() { NextTest(); } - - CHIP_ERROR TestReadAttributeLongOctetStringDefaultValue_117() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_117, OnFailureCallback_117, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_117(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_117(chip::ByteSpan longOctetString) - { - VerifyOrReturn(CheckValueAsString("longOctetString", longOctetString, chip::ByteSpan(chip::Uint8::from_const_char(""), 0))); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeLongOctetString_118() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::ByteSpan longOctetStringArgument; - longOctetStringArgument = chip::ByteSpan( - chip::Uint8::from_const_char( - "111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111" - "111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111" - "111111111111111111111111111111111111111111111111111111111111111111111111garbage: not in length on purpose"), - 300); - - ReturnErrorOnFailure(cluster.WriteAttribute( - longOctetStringArgument, this, OnSuccessCallback_118, OnFailureCallback_118)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_118(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_118() { NextTest(); } - - CHIP_ERROR TestReadAttributeLongOctetString_119() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_119, OnFailureCallback_119, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_119(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_119(chip::ByteSpan longOctetString) - { - VerifyOrReturn(CheckValueAsString( - "longOctetString", longOctetString, - chip::ByteSpan( - chip::Uint8::from_const_char( - "11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111" - "11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111" - "11111111111111111111111111111111111111111111111111111111111111111111111111111111"), - 300))); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeLongOctetString_120() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::ByteSpan longOctetStringArgument; - longOctetStringArgument = chip::ByteSpan(chip::Uint8::from_const_char("garbage: not in length on purpose"), 0); - - ReturnErrorOnFailure(cluster.WriteAttribute( - longOctetStringArgument, this, OnSuccessCallback_120, OnFailureCallback_120)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_120(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_120() { NextTest(); } - - CHIP_ERROR TestReadAttributeCharStringDefaultValue_121() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_121, OnFailureCallback_121, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_121(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_121(chip::CharSpan charString) - { - VerifyOrReturn(CheckValueAsString("charString", charString, chip::CharSpan("", 0))); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeCharString_122() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::CharSpan charStringArgument; - charStringArgument = chip::Span("☉T☉garbage: not in length on purpose", 7); - - ReturnErrorOnFailure(cluster.WriteAttribute( - charStringArgument, this, OnSuccessCallback_122, OnFailureCallback_122)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_122(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_122() { NextTest(); } - - CHIP_ERROR TestReadAttributeCharString_123() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_123, OnFailureCallback_123, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_123(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_123(chip::CharSpan charString) - { - VerifyOrReturn(CheckValueAsString("charString", charString, chip::CharSpan("☉T☉", 7))); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeCharStringValueTooLong_124() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::CharSpan charStringArgument; - charStringArgument = chip::Span("☉TestValueLongerThan10☉garbage: not in length on purpose", 27); - - ReturnErrorOnFailure(cluster.WriteAttribute( - charStringArgument, this, OnSuccessCallback_124, OnFailureCallback_124)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_124(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - NextTest(); - } - - void OnSuccessResponse_124() { ThrowSuccessResponse(); } - - CHIP_ERROR TestReadAttributeCharString_125() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_125, OnFailureCallback_125, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_125(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_125(chip::CharSpan charString) - { - VerifyOrReturn(CheckValueAsString("charString", charString, chip::CharSpan("☉T☉", 7))); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeCharStringEmpty_126() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::CharSpan charStringArgument; - charStringArgument = chip::Span("garbage: not in length on purpose", 0); - - ReturnErrorOnFailure(cluster.WriteAttribute( - charStringArgument, this, OnSuccessCallback_126, OnFailureCallback_126)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_126(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_126() { NextTest(); } - - CHIP_ERROR TestReadAttributeLongCharStringDefaultValue_127() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_127, OnFailureCallback_127, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_127(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_127(chip::CharSpan longCharString) - { - VerifyOrReturn(CheckValueAsString("longCharString", longCharString, chip::CharSpan("", 0))); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeLongCharString_128() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::CharSpan longCharStringArgument; - longCharStringArgument = chip::Span( - "☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉" - "☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉" - "☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉garbage: not in length on purpose", - 900); - - ReturnErrorOnFailure(cluster.WriteAttribute( - longCharStringArgument, this, OnSuccessCallback_128, OnFailureCallback_128)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_128(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_128() { NextTest(); } - - CHIP_ERROR TestReadAttributeLongCharString_129() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_129, OnFailureCallback_129, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_129(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_129(chip::CharSpan longCharString) - { - VerifyOrReturn(CheckValueAsString( - "longCharString", longCharString, - chip::CharSpan("☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉" - "☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉" - "☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉", - 900))); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeLongCharString_130() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::CharSpan longCharStringArgument; - longCharStringArgument = chip::Span("garbage: not in length on purpose", 0); - - ReturnErrorOnFailure(cluster.WriteAttribute( - longCharStringArgument, this, OnSuccessCallback_130, OnFailureCallback_130)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_130(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_130() { NextTest(); } - - CHIP_ERROR TestReadAttributeListLongOctetStringForChunkedRead_131() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_131, OnFailureCallback_131, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_131(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_131(const chip::app::DataModel::DecodableList & listLongOctetString) - { - { - auto iter_0 = listLongOctetString.begin(); - VerifyOrReturn(CheckNextListItemDecodes("listLongOctetString", iter_0, 0)); - VerifyOrReturn(CheckValueAsString( - "listLongOctetString[0]", iter_0.GetValue(), - chip::ByteSpan( - chip::Uint8::from_const_char( - "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789" - "abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123" - "456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcd" - "ef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef01234567" - "89abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"), - 512))); - VerifyOrReturn(CheckNextListItemDecodes("listLongOctetString", iter_0, 1)); - VerifyOrReturn(CheckValueAsString( - "listLongOctetString[1]", iter_0.GetValue(), - chip::ByteSpan( - chip::Uint8::from_const_char( - "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789" - "abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123" - "456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcd" - "ef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef01234567" - "89abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"), - 512))); - VerifyOrReturn(CheckNextListItemDecodes("listLongOctetString", iter_0, 2)); - VerifyOrReturn(CheckValueAsString( - "listLongOctetString[2]", iter_0.GetValue(), - chip::ByteSpan( - chip::Uint8::from_const_char( - "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789" - "abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123" - "456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcd" - "ef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef01234567" - "89abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"), - 512))); - VerifyOrReturn(CheckNextListItemDecodes("listLongOctetString", iter_0, 3)); - VerifyOrReturn(CheckValueAsString( - "listLongOctetString[3]", iter_0.GetValue(), - chip::ByteSpan( - chip::Uint8::from_const_char( - "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789" - "abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123" - "456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcd" - "ef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef01234567" - "89abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"), - 512))); - VerifyOrReturn(CheckNoMoreListItems("listLongOctetString", iter_0, 4)); - } - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeListLongOctetStringForChunkedWrite_132() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ListFreer listFreer; - chip::app::DataModel::List listLongOctetStringArgument; - - { - auto * listHolder_0 = new ListHolder(5); - listFreer.add(listHolder_0); - listHolder_0->mList[0] = chip::ByteSpan( - chip::Uint8::from_const_char( - "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcd" - "ef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789ab" - "cdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789" - "abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef01234567" - "89abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdefgarbage: not in length on purpose"), - 512); - listHolder_0->mList[1] = chip::ByteSpan( - chip::Uint8::from_const_char( - "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcd" - "ef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789ab" - "cdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789" - "abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef01234567" - "89abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdefgarbage: not in length on purpose"), - 512); - listHolder_0->mList[2] = chip::ByteSpan( - chip::Uint8::from_const_char( - "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcd" - "ef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789ab" - "cdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789" - "abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef01234567" - "89abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdefgarbage: not in length on purpose"), - 512); - listHolder_0->mList[3] = chip::ByteSpan( - chip::Uint8::from_const_char( - "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcd" - "ef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789ab" - "cdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789" - "abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef01234567" - "89abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdefgarbage: not in length on purpose"), - 512); - listHolder_0->mList[4] = chip::ByteSpan( - chip::Uint8::from_const_char( - "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcd" - "ef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789ab" - "cdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789" - "abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef01234567" - "89abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdefgarbage: not in length on purpose"), - 512); - listLongOctetStringArgument = chip::app::DataModel::List(listHolder_0->mList, 5); - } - - ReturnErrorOnFailure(cluster.WriteAttribute( - listLongOctetStringArgument, this, OnSuccessCallback_132, OnFailureCallback_132)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_132(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_132() { NextTest(); } - - CHIP_ERROR TestReadAttributeListLongOctetStringForChunkedRead_133() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_133, OnFailureCallback_133, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_133(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_133(const chip::app::DataModel::DecodableList & listLongOctetString) - { - { - auto iter_0 = listLongOctetString.begin(); - VerifyOrReturn(CheckNextListItemDecodes("listLongOctetString", iter_0, 0)); - VerifyOrReturn(CheckValueAsString( - "listLongOctetString[0]", iter_0.GetValue(), - chip::ByteSpan( - chip::Uint8::from_const_char( - "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789" - "abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123" - "456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcd" - "ef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef01234567" - "89abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"), - 512))); - VerifyOrReturn(CheckNextListItemDecodes("listLongOctetString", iter_0, 1)); - VerifyOrReturn(CheckValueAsString( - "listLongOctetString[1]", iter_0.GetValue(), - chip::ByteSpan( - chip::Uint8::from_const_char( - "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789" - "abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123" - "456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcd" - "ef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef01234567" - "89abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"), - 512))); - VerifyOrReturn(CheckNextListItemDecodes("listLongOctetString", iter_0, 2)); - VerifyOrReturn(CheckValueAsString( - "listLongOctetString[2]", iter_0.GetValue(), - chip::ByteSpan( - chip::Uint8::from_const_char( - "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789" - "abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123" - "456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcd" - "ef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef01234567" - "89abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"), - 512))); - VerifyOrReturn(CheckNextListItemDecodes("listLongOctetString", iter_0, 3)); - VerifyOrReturn(CheckValueAsString( - "listLongOctetString[3]", iter_0.GetValue(), - chip::ByteSpan( - chip::Uint8::from_const_char( - "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789" - "abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123" - "456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcd" - "ef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef01234567" - "89abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"), - 512))); - VerifyOrReturn(CheckNextListItemDecodes("listLongOctetString", iter_0, 4)); - VerifyOrReturn(CheckValueAsString( - "listLongOctetString[4]", iter_0.GetValue(), - chip::ByteSpan( - chip::Uint8::from_const_char( - "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789" - "abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123" - "456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcd" - "ef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef01234567" - "89abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"), - 512))); - VerifyOrReturn(CheckNoMoreListItems("listLongOctetString", iter_0, 5)); - } - - NextTest(); - } - - CHIP_ERROR TestReadAttributeEpochUsDefaultValue_134() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_134, OnFailureCallback_134, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_134(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_134(uint64_t epochUs) - { - VerifyOrReturn(CheckValue("epochUs", epochUs, 0ULL)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeEpochUsMaxValue_135() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - uint64_t epochUsArgument; - epochUsArgument = 18446744073709551615ULL; - - ReturnErrorOnFailure(cluster.WriteAttribute( - epochUsArgument, this, OnSuccessCallback_135, OnFailureCallback_135)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_135(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_135() { NextTest(); } - - CHIP_ERROR TestReadAttributeEpochUsMaxValue_136() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_136, OnFailureCallback_136, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_136(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_136(uint64_t epochUs) - { - VerifyOrReturn(CheckValue("epochUs", epochUs, 18446744073709551615ULL)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeEpochUsMinValue_137() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - uint64_t epochUsArgument; - epochUsArgument = 0ULL; - - ReturnErrorOnFailure(cluster.WriteAttribute( - epochUsArgument, this, OnSuccessCallback_137, OnFailureCallback_137)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_137(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_137() { NextTest(); } - - CHIP_ERROR TestReadAttributeEpochUsMinValue_138() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_138, OnFailureCallback_138, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_138(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_138(uint64_t epochUs) - { - VerifyOrReturn(CheckValue("epochUs", epochUs, 0ULL)); - - NextTest(); - } - - CHIP_ERROR TestReadAttributeEpochSDefaultValue_139() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_139, OnFailureCallback_139, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_139(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_139(uint32_t epochS) - { - VerifyOrReturn(CheckValue("epochS", epochS, 0UL)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeEpochSMaxValue_140() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - uint32_t epochSArgument; - epochSArgument = 4294967295UL; - - ReturnErrorOnFailure(cluster.WriteAttribute( - epochSArgument, this, OnSuccessCallback_140, OnFailureCallback_140)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_140(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_140() { NextTest(); } - - CHIP_ERROR TestReadAttributeEpochSMaxValue_141() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_141, OnFailureCallback_141, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_141(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_141(uint32_t epochS) - { - VerifyOrReturn(CheckValue("epochS", epochS, 4294967295UL)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeEpochSMinValue_142() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - uint32_t epochSArgument; - epochSArgument = 0UL; - - ReturnErrorOnFailure(cluster.WriteAttribute( - epochSArgument, this, OnSuccessCallback_142, OnFailureCallback_142)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_142(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_142() { NextTest(); } - - CHIP_ERROR TestReadAttributeEpochSMinValue_143() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_143, OnFailureCallback_143, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_143(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_143(uint32_t epochS) - { - VerifyOrReturn(CheckValue("epochS", epochS, 0UL)); - - NextTest(); - } - - CHIP_ERROR TestReadAttributeUnsupported_144() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_144, OnFailureCallback_144, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_144(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() - : ThrowFailureResponse(error); - } - - void OnSuccessResponse_144(bool unsupported) - { - VerifyOrReturn(CheckValue("unsupported", unsupported, 0)); - - NextTest(); - } - - CHIP_ERROR TestWriteattributeUnsupported_145() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - bool unsupportedArgument; - unsupportedArgument = 0; - - ReturnErrorOnFailure(cluster.WriteAttribute( - unsupportedArgument, this, OnSuccessCallback_145, OnFailureCallback_145)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_145(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() - : ThrowFailureResponse(error); - } - - void OnSuccessResponse_145() { NextTest(); } - - CHIP_ERROR TestSendTestCommandToUnsupportedEndpoint_146() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 200; - using RequestType = chip::app::Clusters::TestCluster::Commands::Test::Type; - - RequestType request; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_146(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_146(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_146(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_ENDPOINT)); - NextTest(); - } - - void OnSuccessResponse_146() { ThrowSuccessResponse(); } - - CHIP_ERROR TestSendTestCommandToUnsupportedCluster_147() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - using RequestType = chip::app::Clusters::TestCluster::Commands::Test::Type; - - RequestType request; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_147(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_147(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_147(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_CLUSTER)); - NextTest(); - } - - void OnSuccessResponse_147() { ThrowSuccessResponse(); } - - CHIP_ERROR TestReadAttributeVendorIdDefaultValue_148() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_148, OnFailureCallback_148, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_148(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_148(chip::VendorId vendorId) - { - VerifyOrReturn(CheckValue("vendorId", vendorId, 0U)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeVendorId_149() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::VendorId vendorIdArgument; - vendorIdArgument = static_cast(17); - - ReturnErrorOnFailure(cluster.WriteAttribute( - vendorIdArgument, this, OnSuccessCallback_149, OnFailureCallback_149)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_149(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_149() { NextTest(); } - - CHIP_ERROR TestReadAttributeVendorId_150() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_150, OnFailureCallback_150, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_150(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_150(chip::VendorId vendorId) - { - VerifyOrReturn(CheckValue("vendorId", vendorId, 17U)); - - NextTest(); - } - - CHIP_ERROR TestRestoreAttributeVendorId_151() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::VendorId vendorIdArgument; - vendorIdArgument = static_cast(0); - - ReturnErrorOnFailure(cluster.WriteAttribute( - vendorIdArgument, this, OnSuccessCallback_151, OnFailureCallback_151)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_151(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_151() { NextTest(); } - - CHIP_ERROR TestSendACommandWithAVendorIdAndEnum_152() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::TestCluster::Commands::TestEnumsRequest::Type; - - RequestType request; - request.arg1 = static_cast(20003); - request.arg2 = static_cast(101); - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_152(data.arg1, data.arg2); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_152(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_152(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_152(chip::VendorId arg1, chip::app::Clusters::TestCluster::SimpleEnum arg2) - { - VerifyOrReturn(CheckValue("arg1", arg1, 20003U)); - - VerifyOrReturn(CheckValue("arg2", arg2, 101)); - - NextTest(); - } - - CHIP_ERROR TestSendTestCommandWithStructArgumentAndArg1bIsTrue_153() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::TestCluster::Commands::TestStructArgumentRequest::Type; - - RequestType request; - - request.arg1.a = 0; - request.arg1.b = true; - request.arg1.c = static_cast(2); - request.arg1.d = chip::ByteSpan(chip::Uint8::from_const_char("octet_stringgarbage: not in length on purpose"), 12); - request.arg1.e = chip::Span("char_stringgarbage: not in length on purpose", 11); - request.arg1.f = static_cast>(1); - request.arg1.g = 0.0f; - request.arg1.h = 0; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_153(data.value); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_153(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_153(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_153(bool value) - { - VerifyOrReturn(CheckValue("value", value, true)); - - NextTest(); - } - - CHIP_ERROR TestSendTestCommandWithStructArgumentAndArg1bIsFalse_154() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::TestCluster::Commands::TestStructArgumentRequest::Type; - - RequestType request; - - request.arg1.a = 0; - request.arg1.b = false; - request.arg1.c = static_cast(2); - request.arg1.d = chip::ByteSpan(chip::Uint8::from_const_char("octet_stringgarbage: not in length on purpose"), 12); - request.arg1.e = chip::Span("char_stringgarbage: not in length on purpose", 11); - request.arg1.f = static_cast>(1); - request.arg1.g = 0.0f; - request.arg1.h = 0; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_154(data.value); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_154(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_154(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_154(bool value) - { - VerifyOrReturn(CheckValue("value", value, false)); - - NextTest(); - } - - CHIP_ERROR TestSendTestCommandWithNestedStructArgumentAndArg1cbIsTrue_155() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::TestCluster::Commands::TestNestedStructArgumentRequest::Type; - - RequestType request; - - request.arg1.a = 0; - request.arg1.b = true; - - request.arg1.c.a = 0; - request.arg1.c.b = true; - request.arg1.c.c = static_cast(2); - request.arg1.c.d = chip::ByteSpan(chip::Uint8::from_const_char("octet_stringgarbage: not in length on purpose"), 12); - request.arg1.c.e = chip::Span("char_stringgarbage: not in length on purpose", 11); - request.arg1.c.f = static_cast>(1); - request.arg1.c.g = 0.0f; - request.arg1.c.h = 0; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_155(data.value); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_155(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_155(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_155(bool value) - { - VerifyOrReturn(CheckValue("value", value, true)); - - NextTest(); - } - - CHIP_ERROR TestSendTestCommandWithNestedStructArgumentArg1cbIsFalse_156() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::TestCluster::Commands::TestNestedStructArgumentRequest::Type; - - RequestType request; - - request.arg1.a = 0; - request.arg1.b = true; - - request.arg1.c.a = 0; - request.arg1.c.b = false; - request.arg1.c.c = static_cast(2); - request.arg1.c.d = chip::ByteSpan(chip::Uint8::from_const_char("octet_stringgarbage: not in length on purpose"), 12); - request.arg1.c.e = chip::Span("char_stringgarbage: not in length on purpose", 11); - request.arg1.c.f = static_cast>(1); - request.arg1.c.g = 0.0f; - request.arg1.c.h = 0; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_156(data.value); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_156(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_156(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_156(bool value) - { - VerifyOrReturn(CheckValue("value", value, false)); - - NextTest(); - } - - CHIP_ERROR TestSendTestCommandWithNestedStructListArgumentAndAllFieldsBOfArg1dAreTrue_157() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::TestCluster::Commands::TestNestedStructListArgumentRequest::Type; - - ListFreer listFreer; - RequestType request; - - request.arg1.a = 0; - request.arg1.b = true; - - request.arg1.c.a = 0; - request.arg1.c.b = true; - request.arg1.c.c = static_cast(2); - request.arg1.c.d = chip::ByteSpan(chip::Uint8::from_const_char("octet_stringgarbage: not in length on purpose"), 12); - request.arg1.c.e = chip::Span("char_stringgarbage: not in length on purpose", 11); - request.arg1.c.f = static_cast>(1); - request.arg1.c.g = 0.0f; - request.arg1.c.h = 0; - - { - auto * listHolder_1 = new ListHolder(2); - listFreer.add(listHolder_1); - - listHolder_1->mList[0].a = 1; - listHolder_1->mList[0].b = true; - listHolder_1->mList[0].c = static_cast(3); - listHolder_1->mList[0].d = - chip::ByteSpan(chip::Uint8::from_const_char("nested_octet_stringgarbage: not in length on purpose"), 19); - listHolder_1->mList[0].e = chip::Span("nested_char_stringgarbage: not in length on purpose", 18); - listHolder_1->mList[0].f = static_cast>(1); - listHolder_1->mList[0].g = 0.0f; - listHolder_1->mList[0].h = 0; - - listHolder_1->mList[1].a = 2; - listHolder_1->mList[1].b = true; - listHolder_1->mList[1].c = static_cast(3); - listHolder_1->mList[1].d = - chip::ByteSpan(chip::Uint8::from_const_char("nested_octet_stringgarbage: not in length on purpose"), 19); - listHolder_1->mList[1].e = chip::Span("nested_char_stringgarbage: not in length on purpose", 18); - listHolder_1->mList[1].f = static_cast>(1); - listHolder_1->mList[1].g = 0.0f; - listHolder_1->mList[1].h = 0; - - request.arg1.d = - chip::app::DataModel::List(listHolder_1->mList, 2); - } - - { - auto * listHolder_1 = new ListHolder(3); - listFreer.add(listHolder_1); - listHolder_1->mList[0] = 1UL; - listHolder_1->mList[1] = 2UL; - listHolder_1->mList[2] = 3UL; - request.arg1.e = chip::app::DataModel::List(listHolder_1->mList, 3); - } - - { - auto * listHolder_1 = new ListHolder(3); - listFreer.add(listHolder_1); - listHolder_1->mList[0] = - chip::ByteSpan(chip::Uint8::from_const_char("octet_string_1garbage: not in length on purpose"), 14); - listHolder_1->mList[1] = - chip::ByteSpan(chip::Uint8::from_const_char("octect_string_2garbage: not in length on purpose"), 15); - listHolder_1->mList[2] = - chip::ByteSpan(chip::Uint8::from_const_char("octet_string_3garbage: not in length on purpose"), 14); - request.arg1.f = chip::app::DataModel::List(listHolder_1->mList, 3); - } - - { - auto * listHolder_1 = new ListHolder(2); - listFreer.add(listHolder_1); - listHolder_1->mList[0] = 0; - listHolder_1->mList[1] = 255; - request.arg1.g = chip::app::DataModel::List(listHolder_1->mList, 2); - } - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_157(data.value); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_157(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_157(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_157(bool value) - { - VerifyOrReturn(CheckValue("value", value, true)); - - NextTest(); - } - - CHIP_ERROR TestSendTestCommandWithNestedStructListArgumentAndSomeFieldsBOfArg1dAreFalse_158() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::TestCluster::Commands::TestNestedStructListArgumentRequest::Type; - - ListFreer listFreer; - RequestType request; - - request.arg1.a = 0; - request.arg1.b = true; - - request.arg1.c.a = 0; - request.arg1.c.b = true; - request.arg1.c.c = static_cast(2); - request.arg1.c.d = chip::ByteSpan(chip::Uint8::from_const_char("octet_stringgarbage: not in length on purpose"), 12); - request.arg1.c.e = chip::Span("char_stringgarbage: not in length on purpose", 11); - request.arg1.c.f = static_cast>(1); - request.arg1.c.g = 0.0f; - request.arg1.c.h = 0; - - { - auto * listHolder_1 = new ListHolder(2); - listFreer.add(listHolder_1); - - listHolder_1->mList[0].a = 1; - listHolder_1->mList[0].b = true; - listHolder_1->mList[0].c = static_cast(3); - listHolder_1->mList[0].d = - chip::ByteSpan(chip::Uint8::from_const_char("nested_octet_stringgarbage: not in length on purpose"), 19); - listHolder_1->mList[0].e = chip::Span("nested_char_stringgarbage: not in length on purpose", 18); - listHolder_1->mList[0].f = static_cast>(1); - listHolder_1->mList[0].g = 0.0f; - listHolder_1->mList[0].h = 0; - - listHolder_1->mList[1].a = 2; - listHolder_1->mList[1].b = false; - listHolder_1->mList[1].c = static_cast(3); - listHolder_1->mList[1].d = - chip::ByteSpan(chip::Uint8::from_const_char("nested_octet_stringgarbage: not in length on purpose"), 19); - listHolder_1->mList[1].e = chip::Span("nested_char_stringgarbage: not in length on purpose", 18); - listHolder_1->mList[1].f = static_cast>(1); - listHolder_1->mList[1].g = 0.0f; - listHolder_1->mList[1].h = 0; - - request.arg1.d = - chip::app::DataModel::List(listHolder_1->mList, 2); - } - - { - auto * listHolder_1 = new ListHolder(3); - listFreer.add(listHolder_1); - listHolder_1->mList[0] = 1UL; - listHolder_1->mList[1] = 2UL; - listHolder_1->mList[2] = 3UL; - request.arg1.e = chip::app::DataModel::List(listHolder_1->mList, 3); - } - - { - auto * listHolder_1 = new ListHolder(3); - listFreer.add(listHolder_1); - listHolder_1->mList[0] = - chip::ByteSpan(chip::Uint8::from_const_char("octet_string_1garbage: not in length on purpose"), 14); - listHolder_1->mList[1] = - chip::ByteSpan(chip::Uint8::from_const_char("octect_string_2garbage: not in length on purpose"), 15); - listHolder_1->mList[2] = - chip::ByteSpan(chip::Uint8::from_const_char("octet_string_3garbage: not in length on purpose"), 14); - request.arg1.f = chip::app::DataModel::List(listHolder_1->mList, 3); - } - - { - auto * listHolder_1 = new ListHolder(2); - listFreer.add(listHolder_1); - listHolder_1->mList[0] = 0; - listHolder_1->mList[1] = 255; - request.arg1.g = chip::app::DataModel::List(listHolder_1->mList, 2); - } - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_158(data.value); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_158(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_158(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_158(bool value) - { - VerifyOrReturn(CheckValue("value", value, false)); - - NextTest(); - } - - CHIP_ERROR TestSendTestCommandWithStructArgumentAndSeeWhatWeGetBack_159() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::TestCluster::Commands::SimpleStructEchoRequest::Type; - - RequestType request; - - request.arg1.a = 17; - request.arg1.b = false; - request.arg1.c = static_cast(2); - request.arg1.d = chip::ByteSpan(chip::Uint8::from_const_char("octet_stringgarbage: not in length on purpose"), 12); - request.arg1.e = chip::Span("char_stringgarbage: not in length on purpose", 11); - request.arg1.f = static_cast>(1); - request.arg1.g = 0.1f; - request.arg1.h = 0.1; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_159(data.arg1); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_159(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_159(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_159(const chip::app::Clusters::TestCluster::Structs::SimpleStruct::DecodableType & arg1) - { - VerifyOrReturn(CheckValue("arg1.a", arg1.a, 17)); - VerifyOrReturn(CheckValue("arg1.b", arg1.b, false)); - VerifyOrReturn(CheckValue("arg1.c", arg1.c, 2)); - VerifyOrReturn(CheckValueAsString("arg1.d", arg1.d, chip::ByteSpan(chip::Uint8::from_const_char("octet_string"), 12))); - VerifyOrReturn(CheckValueAsString("arg1.e", arg1.e, chip::CharSpan("char_string", 11))); - VerifyOrReturn(CheckValue("arg1.f", arg1.f, 1)); - VerifyOrReturn(CheckValue("arg1.g", arg1.g, 0.1f)); - VerifyOrReturn(CheckValue("arg1.h", arg1.h, 0.1)); - - NextTest(); - } - - CHIP_ERROR TestSendTestCommandWithListOfInt8uAndNoneOfThemIsSetTo0_160() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::TestCluster::Commands::TestListInt8UArgumentRequest::Type; - - ListFreer listFreer; - RequestType request; - - { - auto * listHolder_0 = new ListHolder(9); - listFreer.add(listHolder_0); - listHolder_0->mList[0] = 1; - listHolder_0->mList[1] = 2; - listHolder_0->mList[2] = 3; - listHolder_0->mList[3] = 4; - listHolder_0->mList[4] = 5; - listHolder_0->mList[5] = 6; - listHolder_0->mList[6] = 7; - listHolder_0->mList[7] = 8; - listHolder_0->mList[8] = 9; - request.arg1 = chip::app::DataModel::List(listHolder_0->mList, 9); - } - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_160(data.value); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_160(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_160(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_160(bool value) - { - VerifyOrReturn(CheckValue("value", value, true)); - - NextTest(); - } - - CHIP_ERROR TestSendTestCommandWithListOfInt8uAndOneOfThemIsSetTo0_161() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::TestCluster::Commands::TestListInt8UArgumentRequest::Type; - - ListFreer listFreer; - RequestType request; - - { - auto * listHolder_0 = new ListHolder(10); - listFreer.add(listHolder_0); - listHolder_0->mList[0] = 1; - listHolder_0->mList[1] = 2; - listHolder_0->mList[2] = 3; - listHolder_0->mList[3] = 4; - listHolder_0->mList[4] = 5; - listHolder_0->mList[5] = 6; - listHolder_0->mList[6] = 7; - listHolder_0->mList[7] = 8; - listHolder_0->mList[8] = 9; - listHolder_0->mList[9] = 0; - request.arg1 = chip::app::DataModel::List(listHolder_0->mList, 10); - } - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_161(data.value); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_161(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_161(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_161(bool value) - { - VerifyOrReturn(CheckValue("value", value, false)); - - NextTest(); - } - - CHIP_ERROR TestSendTestCommandWithListOfInt8uAndGetItReversed_162() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::TestCluster::Commands::TestListInt8UReverseRequest::Type; - - ListFreer listFreer; - RequestType request; - - { - auto * listHolder_0 = new ListHolder(9); - listFreer.add(listHolder_0); - listHolder_0->mList[0] = 1; - listHolder_0->mList[1] = 2; - listHolder_0->mList[2] = 3; - listHolder_0->mList[3] = 4; - listHolder_0->mList[4] = 5; - listHolder_0->mList[5] = 6; - listHolder_0->mList[6] = 7; - listHolder_0->mList[7] = 8; - listHolder_0->mList[8] = 9; - request.arg1 = chip::app::DataModel::List(listHolder_0->mList, 9); - } - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_162(data.arg1); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_162(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_162(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_162(const chip::app::DataModel::DecodableList & arg1) - { - { - auto iter_0 = arg1.begin(); - VerifyOrReturn(CheckNextListItemDecodes("arg1", iter_0, 0)); - VerifyOrReturn(CheckValue("arg1[0]", iter_0.GetValue(), 9)); - VerifyOrReturn(CheckNextListItemDecodes("arg1", iter_0, 1)); - VerifyOrReturn(CheckValue("arg1[1]", iter_0.GetValue(), 8)); - VerifyOrReturn(CheckNextListItemDecodes("arg1", iter_0, 2)); - VerifyOrReturn(CheckValue("arg1[2]", iter_0.GetValue(), 7)); - VerifyOrReturn(CheckNextListItemDecodes("arg1", iter_0, 3)); - VerifyOrReturn(CheckValue("arg1[3]", iter_0.GetValue(), 6)); - VerifyOrReturn(CheckNextListItemDecodes("arg1", iter_0, 4)); - VerifyOrReturn(CheckValue("arg1[4]", iter_0.GetValue(), 5)); - VerifyOrReturn(CheckNextListItemDecodes("arg1", iter_0, 5)); - VerifyOrReturn(CheckValue("arg1[5]", iter_0.GetValue(), 4)); - VerifyOrReturn(CheckNextListItemDecodes("arg1", iter_0, 6)); - VerifyOrReturn(CheckValue("arg1[6]", iter_0.GetValue(), 3)); - VerifyOrReturn(CheckNextListItemDecodes("arg1", iter_0, 7)); - VerifyOrReturn(CheckValue("arg1[7]", iter_0.GetValue(), 2)); - VerifyOrReturn(CheckNextListItemDecodes("arg1", iter_0, 8)); - VerifyOrReturn(CheckValue("arg1[8]", iter_0.GetValue(), 1)); - VerifyOrReturn(CheckNoMoreListItems("arg1", iter_0, 9)); - } - - NextTest(); - } - - CHIP_ERROR TestSendTestCommandWithEmptyListOfInt8uAndGetAnEmptyListBack_163() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::TestCluster::Commands::TestListInt8UReverseRequest::Type; - - ListFreer listFreer; - RequestType request; - - request.arg1 = chip::app::DataModel::List(); - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_163(data.arg1); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_163(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_163(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_163(const chip::app::DataModel::DecodableList & arg1) - { - { - auto iter_0 = arg1.begin(); - VerifyOrReturn(CheckNoMoreListItems("arg1", iter_0, 0)); - } - - NextTest(); - } - - CHIP_ERROR TestSendTestCommandWithListOfStructArgumentAndArg1bOfFirstItemIsTrue_164() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::TestCluster::Commands::TestListStructArgumentRequest::Type; - - ListFreer listFreer; - RequestType request; - - { - auto * listHolder_0 = new ListHolder(2); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].a = 0; - listHolder_0->mList[0].b = true; - listHolder_0->mList[0].c = static_cast(2); - listHolder_0->mList[0].d = - chip::ByteSpan(chip::Uint8::from_const_char("first_octet_stringgarbage: not in length on purpose"), 18); - listHolder_0->mList[0].e = chip::Span("first_char_stringgarbage: not in length on purpose", 17); - listHolder_0->mList[0].f = static_cast>(1); - listHolder_0->mList[0].g = 0.0f; - listHolder_0->mList[0].h = 0; - - listHolder_0->mList[1].a = 1; - listHolder_0->mList[1].b = true; - listHolder_0->mList[1].c = static_cast(3); - listHolder_0->mList[1].d = - chip::ByteSpan(chip::Uint8::from_const_char("second_octet_stringgarbage: not in length on purpose"), 19); - listHolder_0->mList[1].e = chip::Span("second_char_stringgarbage: not in length on purpose", 18); - listHolder_0->mList[1].f = static_cast>(1); - listHolder_0->mList[1].g = 0.0f; - listHolder_0->mList[1].h = 0; - - request.arg1 = - chip::app::DataModel::List(listHolder_0->mList, 2); - } - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_164(data.value); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_164(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_164(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_164(bool value) - { - VerifyOrReturn(CheckValue("value", value, true)); - - NextTest(); - } - - CHIP_ERROR TestSendTestCommandWithListOfStructArgumentAndArg1bOfFirstItemIsFalse_165() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::TestCluster::Commands::TestListStructArgumentRequest::Type; - - ListFreer listFreer; - RequestType request; - - { - auto * listHolder_0 = new ListHolder(2); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].a = 1; - listHolder_0->mList[0].b = true; - listHolder_0->mList[0].c = static_cast(3); - listHolder_0->mList[0].d = - chip::ByteSpan(chip::Uint8::from_const_char("second_octet_stringgarbage: not in length on purpose"), 19); - listHolder_0->mList[0].e = chip::Span("second_char_stringgarbage: not in length on purpose", 18); - listHolder_0->mList[0].f = static_cast>(1); - listHolder_0->mList[0].g = 0.0f; - listHolder_0->mList[0].h = 0; - - listHolder_0->mList[1].a = 0; - listHolder_0->mList[1].b = false; - listHolder_0->mList[1].c = static_cast(2); - listHolder_0->mList[1].d = - chip::ByteSpan(chip::Uint8::from_const_char("first_octet_stringgarbage: not in length on purpose"), 18); - listHolder_0->mList[1].e = chip::Span("first_char_stringgarbage: not in length on purpose", 17); - listHolder_0->mList[1].f = static_cast>(1); - listHolder_0->mList[1].g = 0.0f; - listHolder_0->mList[1].h = 0; - - request.arg1 = - chip::app::DataModel::List(listHolder_0->mList, 2); - } - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_165(data.value); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_165(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_165(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_165(bool value) - { - VerifyOrReturn(CheckValue("value", value, false)); - - NextTest(); - } - - CHIP_ERROR TestSendTestCommandWithListOfNestedStructListArgumentAndAllFieldsBOfElementsOfArg1dAreTrue_166() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::TestCluster::Commands::TestListNestedStructListArgumentRequest::Type; - - ListFreer listFreer; - RequestType request; - - { - auto * listHolder_0 = new ListHolder(1); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].a = 0; - listHolder_0->mList[0].b = true; - - listHolder_0->mList[0].c.a = 0; - listHolder_0->mList[0].c.b = true; - listHolder_0->mList[0].c.c = static_cast(2); - listHolder_0->mList[0].c.d = - chip::ByteSpan(chip::Uint8::from_const_char("octet_stringgarbage: not in length on purpose"), 12); - listHolder_0->mList[0].c.e = chip::Span("char_stringgarbage: not in length on purpose", 11); - listHolder_0->mList[0].c.f = static_cast>(1); - listHolder_0->mList[0].c.g = 0.0f; - listHolder_0->mList[0].c.h = 0; - - { - auto * listHolder_2 = new ListHolder(2); - listFreer.add(listHolder_2); - - listHolder_2->mList[0].a = 1; - listHolder_2->mList[0].b = true; - listHolder_2->mList[0].c = static_cast(3); - listHolder_2->mList[0].d = - chip::ByteSpan(chip::Uint8::from_const_char("nested_octet_stringgarbage: not in length on purpose"), 19); - listHolder_2->mList[0].e = chip::Span("nested_char_stringgarbage: not in length on purpose", 18); - listHolder_2->mList[0].f = static_cast>(1); - listHolder_2->mList[0].g = 0.0f; - listHolder_2->mList[0].h = 0; - - listHolder_2->mList[1].a = 2; - listHolder_2->mList[1].b = true; - listHolder_2->mList[1].c = static_cast(3); - listHolder_2->mList[1].d = - chip::ByteSpan(chip::Uint8::from_const_char("nested_octet_stringgarbage: not in length on purpose"), 19); - listHolder_2->mList[1].e = chip::Span("nested_char_stringgarbage: not in length on purpose", 18); - listHolder_2->mList[1].f = static_cast>(1); - listHolder_2->mList[1].g = 0.0f; - listHolder_2->mList[1].h = 0; - - listHolder_0->mList[0].d = - chip::app::DataModel::List(listHolder_2->mList, - 2); - } - - { - auto * listHolder_2 = new ListHolder(3); - listFreer.add(listHolder_2); - listHolder_2->mList[0] = 1UL; - listHolder_2->mList[1] = 2UL; - listHolder_2->mList[2] = 3UL; - listHolder_0->mList[0].e = chip::app::DataModel::List(listHolder_2->mList, 3); - } - - { - auto * listHolder_2 = new ListHolder(3); - listFreer.add(listHolder_2); - listHolder_2->mList[0] = - chip::ByteSpan(chip::Uint8::from_const_char("octet_string_1garbage: not in length on purpose"), 14); - listHolder_2->mList[1] = - chip::ByteSpan(chip::Uint8::from_const_char("octect_string_2garbage: not in length on purpose"), 15); - listHolder_2->mList[2] = - chip::ByteSpan(chip::Uint8::from_const_char("octet_string_3garbage: not in length on purpose"), 14); - listHolder_0->mList[0].f = chip::app::DataModel::List(listHolder_2->mList, 3); - } - - { - auto * listHolder_2 = new ListHolder(2); - listFreer.add(listHolder_2); - listHolder_2->mList[0] = 0; - listHolder_2->mList[1] = 255; - listHolder_0->mList[0].g = chip::app::DataModel::List(listHolder_2->mList, 2); - } - - request.arg1 = chip::app::DataModel::List( - listHolder_0->mList, 1); - } - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_166(data.value); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_166(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_166(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_166(bool value) - { - VerifyOrReturn(CheckValue("value", value, true)); - - NextTest(); - } - - CHIP_ERROR TestSendTestCommandWithNestedStructListArgumentAndSomeFieldsBOfElementsOfArg1dAreFalse_167() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::TestCluster::Commands::TestListNestedStructListArgumentRequest::Type; - - ListFreer listFreer; - RequestType request; - - { - auto * listHolder_0 = new ListHolder(1); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].a = 0; - listHolder_0->mList[0].b = true; - - listHolder_0->mList[0].c.a = 0; - listHolder_0->mList[0].c.b = true; - listHolder_0->mList[0].c.c = static_cast(2); - listHolder_0->mList[0].c.d = - chip::ByteSpan(chip::Uint8::from_const_char("octet_stringgarbage: not in length on purpose"), 12); - listHolder_0->mList[0].c.e = chip::Span("char_stringgarbage: not in length on purpose", 11); - listHolder_0->mList[0].c.f = static_cast>(1); - listHolder_0->mList[0].c.g = 0.0f; - listHolder_0->mList[0].c.h = 0; - - { - auto * listHolder_2 = new ListHolder(2); - listFreer.add(listHolder_2); - - listHolder_2->mList[0].a = 1; - listHolder_2->mList[0].b = true; - listHolder_2->mList[0].c = static_cast(3); - listHolder_2->mList[0].d = - chip::ByteSpan(chip::Uint8::from_const_char("nested_octet_stringgarbage: not in length on purpose"), 19); - listHolder_2->mList[0].e = chip::Span("nested_char_stringgarbage: not in length on purpose", 18); - listHolder_2->mList[0].f = static_cast>(1); - listHolder_2->mList[0].g = 0.0f; - listHolder_2->mList[0].h = 0; - - listHolder_2->mList[1].a = 2; - listHolder_2->mList[1].b = false; - listHolder_2->mList[1].c = static_cast(3); - listHolder_2->mList[1].d = - chip::ByteSpan(chip::Uint8::from_const_char("nested_octet_stringgarbage: not in length on purpose"), 19); - listHolder_2->mList[1].e = chip::Span("nested_char_stringgarbage: not in length on purpose", 18); - listHolder_2->mList[1].f = static_cast>(1); - listHolder_2->mList[1].g = 0.0f; - listHolder_2->mList[1].h = 0; - - listHolder_0->mList[0].d = - chip::app::DataModel::List(listHolder_2->mList, - 2); - } - - { - auto * listHolder_2 = new ListHolder(3); - listFreer.add(listHolder_2); - listHolder_2->mList[0] = 1UL; - listHolder_2->mList[1] = 2UL; - listHolder_2->mList[2] = 3UL; - listHolder_0->mList[0].e = chip::app::DataModel::List(listHolder_2->mList, 3); - } - - { - auto * listHolder_2 = new ListHolder(3); - listFreer.add(listHolder_2); - listHolder_2->mList[0] = - chip::ByteSpan(chip::Uint8::from_const_char("octet_string_1garbage: not in length on purpose"), 14); - listHolder_2->mList[1] = - chip::ByteSpan(chip::Uint8::from_const_char("octect_string_2garbage: not in length on purpose"), 15); - listHolder_2->mList[2] = - chip::ByteSpan(chip::Uint8::from_const_char("octet_string_3garbage: not in length on purpose"), 14); - listHolder_0->mList[0].f = chip::app::DataModel::List(listHolder_2->mList, 3); - } - - { - auto * listHolder_2 = new ListHolder(2); - listFreer.add(listHolder_2); - listHolder_2->mList[0] = 0; - listHolder_2->mList[1] = 255; - listHolder_0->mList[0].g = chip::app::DataModel::List(listHolder_2->mList, 2); - } - - request.arg1 = chip::app::DataModel::List( - listHolder_0->mList, 1); - } - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_167(data.value); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_167(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_167(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_167(bool value) - { - VerifyOrReturn(CheckValue("value", value, false)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeListWithListOfInt8uAndNoneOfThemIsSetTo0_168() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ListFreer listFreer; - chip::app::DataModel::List listInt8uArgument; - - { - auto * listHolder_0 = new ListHolder(4); - listFreer.add(listHolder_0); - listHolder_0->mList[0] = 1; - listHolder_0->mList[1] = 2; - listHolder_0->mList[2] = 3; - listHolder_0->mList[3] = 4; - listInt8uArgument = chip::app::DataModel::List(listHolder_0->mList, 4); - } - - ReturnErrorOnFailure(cluster.WriteAttribute( - listInt8uArgument, this, OnSuccessCallback_168, OnFailureCallback_168)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_168(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_168() { NextTest(); } - - CHIP_ERROR TestReadAttributeListWithListOfInt8u_169() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_169, OnFailureCallback_169, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_169(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_169(const chip::app::DataModel::DecodableList & listInt8u) - { - { - auto iter_0 = listInt8u.begin(); - VerifyOrReturn(CheckNextListItemDecodes("listInt8u", iter_0, 0)); - VerifyOrReturn(CheckValue("listInt8u[0]", iter_0.GetValue(), 1)); - VerifyOrReturn(CheckNextListItemDecodes("listInt8u", iter_0, 1)); - VerifyOrReturn(CheckValue("listInt8u[1]", iter_0.GetValue(), 2)); - VerifyOrReturn(CheckNextListItemDecodes("listInt8u", iter_0, 2)); - VerifyOrReturn(CheckValue("listInt8u[2]", iter_0.GetValue(), 3)); - VerifyOrReturn(CheckNextListItemDecodes("listInt8u", iter_0, 3)); - VerifyOrReturn(CheckValue("listInt8u[3]", iter_0.GetValue(), 4)); - VerifyOrReturn(CheckNoMoreListItems("listInt8u", iter_0, 4)); - } - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeListWithListOfOctetString_170() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ListFreer listFreer; - chip::app::DataModel::List listOctetStringArgument; - - { - auto * listHolder_0 = new ListHolder(4); - listFreer.add(listHolder_0); - listHolder_0->mList[0] = chip::ByteSpan(chip::Uint8::from_const_char("Test0garbage: not in length on purpose"), 5); - listHolder_0->mList[1] = chip::ByteSpan(chip::Uint8::from_const_char("Test1garbage: not in length on purpose"), 5); - listHolder_0->mList[2] = chip::ByteSpan(chip::Uint8::from_const_char("Test2garbage: not in length on purpose"), 5); - listHolder_0->mList[3] = chip::ByteSpan(chip::Uint8::from_const_char("Test3garbage: not in length on purpose"), 5); - listOctetStringArgument = chip::app::DataModel::List(listHolder_0->mList, 4); - } - - ReturnErrorOnFailure(cluster.WriteAttribute( - listOctetStringArgument, this, OnSuccessCallback_170, OnFailureCallback_170)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_170(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_170() { NextTest(); } - - CHIP_ERROR TestReadAttributeListWithListOfOctetString_171() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_171, OnFailureCallback_171, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_171(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_171(const chip::app::DataModel::DecodableList & listOctetString) - { - { - auto iter_0 = listOctetString.begin(); - VerifyOrReturn(CheckNextListItemDecodes("listOctetString", iter_0, 0)); - VerifyOrReturn(CheckValueAsString("listOctetString[0]", iter_0.GetValue(), - chip::ByteSpan(chip::Uint8::from_const_char("Test0"), 5))); - VerifyOrReturn(CheckNextListItemDecodes("listOctetString", iter_0, 1)); - VerifyOrReturn(CheckValueAsString("listOctetString[1]", iter_0.GetValue(), - chip::ByteSpan(chip::Uint8::from_const_char("Test1"), 5))); - VerifyOrReturn(CheckNextListItemDecodes("listOctetString", iter_0, 2)); - VerifyOrReturn(CheckValueAsString("listOctetString[2]", iter_0.GetValue(), - chip::ByteSpan(chip::Uint8::from_const_char("Test2"), 5))); - VerifyOrReturn(CheckNextListItemDecodes("listOctetString", iter_0, 3)); - VerifyOrReturn(CheckValueAsString("listOctetString[3]", iter_0.GetValue(), - chip::ByteSpan(chip::Uint8::from_const_char("Test3"), 5))); - VerifyOrReturn(CheckNoMoreListItems("listOctetString", iter_0, 4)); - } - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeListWithListOfListStructOctetString_172() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ListFreer listFreer; - chip::app::DataModel::List - listStructOctetStringArgument; - - { - auto * listHolder_0 = new ListHolder(4); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].fabricIndex = 0ULL; - listHolder_0->mList[0].operationalCert = - chip::ByteSpan(chip::Uint8::from_const_char("Test0garbage: not in length on purpose"), 5); - - listHolder_0->mList[1].fabricIndex = 1ULL; - listHolder_0->mList[1].operationalCert = - chip::ByteSpan(chip::Uint8::from_const_char("Test1garbage: not in length on purpose"), 5); - - listHolder_0->mList[2].fabricIndex = 2ULL; - listHolder_0->mList[2].operationalCert = - chip::ByteSpan(chip::Uint8::from_const_char("Test2garbage: not in length on purpose"), 5); - - listHolder_0->mList[3].fabricIndex = 3ULL; - listHolder_0->mList[3].operationalCert = - chip::ByteSpan(chip::Uint8::from_const_char("Test3garbage: not in length on purpose"), 5); - - listStructOctetStringArgument = - chip::app::DataModel::List( - listHolder_0->mList, 4); - } - - ReturnErrorOnFailure(cluster.WriteAttribute( - listStructOctetStringArgument, this, OnSuccessCallback_172, OnFailureCallback_172)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_172(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_172() { NextTest(); } - - CHIP_ERROR TestReadAttributeListWithListOfListStructOctetString_173() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_173, OnFailureCallback_173, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_173(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_173( - const chip::app::DataModel::DecodableList & - listStructOctetString) - { - { - auto iter_0 = listStructOctetString.begin(); - VerifyOrReturn(CheckNextListItemDecodes("listStructOctetString", iter_0, 0)); - VerifyOrReturn(CheckValue("listStructOctetString[0].fabricIndex", iter_0.GetValue().fabricIndex, 0ULL)); - VerifyOrReturn(CheckValueAsString("listStructOctetString[0].operationalCert", iter_0.GetValue().operationalCert, - chip::ByteSpan(chip::Uint8::from_const_char("Test0"), 5))); - VerifyOrReturn(CheckNextListItemDecodes("listStructOctetString", iter_0, 1)); - VerifyOrReturn(CheckValue("listStructOctetString[1].fabricIndex", iter_0.GetValue().fabricIndex, 1ULL)); - VerifyOrReturn(CheckValueAsString("listStructOctetString[1].operationalCert", iter_0.GetValue().operationalCert, - chip::ByteSpan(chip::Uint8::from_const_char("Test1"), 5))); - VerifyOrReturn(CheckNextListItemDecodes("listStructOctetString", iter_0, 2)); - VerifyOrReturn(CheckValue("listStructOctetString[2].fabricIndex", iter_0.GetValue().fabricIndex, 2ULL)); - VerifyOrReturn(CheckValueAsString("listStructOctetString[2].operationalCert", iter_0.GetValue().operationalCert, - chip::ByteSpan(chip::Uint8::from_const_char("Test2"), 5))); - VerifyOrReturn(CheckNextListItemDecodes("listStructOctetString", iter_0, 3)); - VerifyOrReturn(CheckValue("listStructOctetString[3].fabricIndex", iter_0.GetValue().fabricIndex, 3ULL)); - VerifyOrReturn(CheckValueAsString("listStructOctetString[3].operationalCert", iter_0.GetValue().operationalCert, - chip::ByteSpan(chip::Uint8::from_const_char("Test3"), 5))); - VerifyOrReturn(CheckNoMoreListItems("listStructOctetString", iter_0, 4)); - } - - NextTest(); - } - - CHIP_ERROR TestSendTestCommandWithOptionalArgSet_174() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::TestCluster::Commands::TestNullableOptionalRequest::Type; - - RequestType request; - request.arg1.Emplace(); - request.arg1.Value().SetNonNull(); - request.arg1.Value().Value() = 5; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context)) - ->OnSuccessResponse_174(data.wasPresent, data.wasNull, data.value, data.originalValue); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_174(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_174(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_174(bool wasPresent, const chip::Optional & wasNull, const chip::Optional & value, - const chip::Optional> & originalValue) - { - VerifyOrReturn(CheckValue("wasPresent", wasPresent, true)); - - VerifyOrReturn(CheckValuePresent("wasNull", wasNull)); - VerifyOrReturn(CheckValue("wasNull.Value()", wasNull.Value(), false)); - - VerifyOrReturn(CheckValuePresent("value", value)); - VerifyOrReturn(CheckValue("value.Value()", value.Value(), 5)); - - VerifyOrReturn(CheckValuePresent("originalValue", originalValue)); - VerifyOrReturn(CheckValueNonNull("originalValue.Value()", originalValue.Value())); - VerifyOrReturn(CheckValue("originalValue.Value().Value()", originalValue.Value().Value(), 5)); - - NextTest(); - } - - CHIP_ERROR TestSendTestCommandWithoutItsOptionalArg_175() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::TestCluster::Commands::TestNullableOptionalRequest::Type; - - RequestType request; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context)) - ->OnSuccessResponse_175(data.wasPresent, data.wasNull, data.value, data.originalValue); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_175(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_175(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_175(bool wasPresent, const chip::Optional & wasNull, const chip::Optional & value, - const chip::Optional> & originalValue) - { - VerifyOrReturn(CheckValue("wasPresent", wasPresent, false)); - - NextTest(); - } - - CHIP_ERROR TestReadListOfStructsContainingNullablesAndOptionals_176() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_176, OnFailureCallback_176, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_176(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_176(const chip::app::DataModel::DecodableList< - chip::app::Clusters::TestCluster::Structs::NullablesAndOptionalsStruct::DecodableType> & - listNullablesAndOptionalsStruct) - { - { - auto iter_0 = listNullablesAndOptionalsStruct.begin(); - VerifyOrReturn( - CheckNextListItemDecodes("listNullablesAndOptionalsStruct", iter_0, 0)); - VerifyOrReturn(CheckValueNull("listNullablesAndOptionalsStruct[0].nullableInt", iter_0.GetValue().nullableInt)); - VerifyOrReturn(CheckValueNull("listNullablesAndOptionalsStruct[0].nullableString", iter_0.GetValue().nullableString)); - VerifyOrReturn(CheckValueNull("listNullablesAndOptionalsStruct[0].nullableStruct", iter_0.GetValue().nullableStruct)); - VerifyOrReturn(CheckValueNull("listNullablesAndOptionalsStruct[0].nullableList", iter_0.GetValue().nullableList)); - VerifyOrReturn( - CheckNoMoreListItems("listNullablesAndOptionalsStruct", iter_0, 1)); - } - - NextTest(); - } - - CHIP_ERROR TestWriteListOfStructsContainingNullablesAndOptionals_177() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ListFreer listFreer; - chip::app::DataModel::List - listNullablesAndOptionalsStructArgument; - - { - auto * listHolder_0 = new ListHolder(1); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].nullableInt.SetNull(); - listHolder_0->mList[0].nullableString.SetNull(); - listHolder_0->mList[0].nullableStruct.SetNull(); - listHolder_0->mList[0].nullableList.SetNonNull(); - - { - auto * listHolder_3 = new ListHolder(2); - listFreer.add(listHolder_3); - listHolder_3->mList[0] = static_cast(1); - listHolder_3->mList[1] = static_cast(2); - listHolder_0->mList[0].nullableList.Value() = - chip::app::DataModel::List(listHolder_3->mList, 2); - } - - listNullablesAndOptionalsStructArgument = - chip::app::DataModel::List( - listHolder_0->mList, 1); - } - - ReturnErrorOnFailure( - cluster.WriteAttribute( - listNullablesAndOptionalsStructArgument, this, OnSuccessCallback_177, OnFailureCallback_177)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_177(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_177() { NextTest(); } - - CHIP_ERROR TestReadListOfStructsContainingNullablesAndOptionalsAfterWriting_178() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_178, OnFailureCallback_178, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_178(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_178(const chip::app::DataModel::DecodableList< - chip::app::Clusters::TestCluster::Structs::NullablesAndOptionalsStruct::DecodableType> & - listNullablesAndOptionalsStruct) - { - { - auto iter_0 = listNullablesAndOptionalsStruct.begin(); - VerifyOrReturn( - CheckNextListItemDecodes("listNullablesAndOptionalsStruct", iter_0, 0)); - VerifyOrReturn(CheckValueNull("listNullablesAndOptionalsStruct[0].nullableInt", iter_0.GetValue().nullableInt)); - VerifyOrReturn(CheckValueNull("listNullablesAndOptionalsStruct[0].nullableString", iter_0.GetValue().nullableString)); - VerifyOrReturn(CheckValueNull("listNullablesAndOptionalsStruct[0].nullableStruct", iter_0.GetValue().nullableStruct)); - VerifyOrReturn(CheckValueNonNull("listNullablesAndOptionalsStruct[0].nullableList", iter_0.GetValue().nullableList)); - { - auto iter_NaN = iter_0.GetValue().nullableList.Value().begin(); - VerifyOrReturn(CheckNextListItemDecodes( - "listNullablesAndOptionalsStruct[0].nullableList.Value()", iter_NaN, 0)); - VerifyOrReturn(CheckValue("listNullablesAndOptionalsStruct[0].nullableList.Value()[0]", iter_NaN.GetValue(), 1)); - VerifyOrReturn(CheckNextListItemDecodes( - "listNullablesAndOptionalsStruct[0].nullableList.Value()", iter_NaN, 1)); - VerifyOrReturn(CheckValue("listNullablesAndOptionalsStruct[0].nullableList.Value()[1]", iter_NaN.GetValue(), 2)); - VerifyOrReturn(CheckNoMoreListItems( - "listNullablesAndOptionalsStruct[0].nullableList.Value()", iter_NaN, 2)); - } - VerifyOrReturn( - CheckNoMoreListItems("listNullablesAndOptionalsStruct", iter_0, 1)); - } - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeNullableBooleanNull_179() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::DataModel::Nullable nullableBooleanArgument; - nullableBooleanArgument.SetNull(); - - ReturnErrorOnFailure(cluster.WriteAttribute( - nullableBooleanArgument, this, OnSuccessCallback_179, OnFailureCallback_179)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_179(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_179() { NextTest(); } - - CHIP_ERROR TestReadAttributeNullableBooleanNull_180() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_180, OnFailureCallback_180, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_180(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_180(const chip::app::DataModel::Nullable & nullableBoolean) - { - VerifyOrReturn(CheckValueNull("nullableBoolean", nullableBoolean)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeNullableBooleanTrue_181() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::DataModel::Nullable nullableBooleanArgument; - nullableBooleanArgument.SetNonNull(); - nullableBooleanArgument.Value() = true; - - ReturnErrorOnFailure(cluster.WriteAttribute( - nullableBooleanArgument, this, OnSuccessCallback_181, OnFailureCallback_181)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_181(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_181() { NextTest(); } - - CHIP_ERROR TestReadAttributeNullableBooleanTrue_182() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_182, OnFailureCallback_182, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_182(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_182(const chip::app::DataModel::Nullable & nullableBoolean) - { - VerifyOrReturn(CheckValueNonNull("nullableBoolean", nullableBoolean)); - VerifyOrReturn(CheckValue("nullableBoolean.Value()", nullableBoolean.Value(), true)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeNullableBitmap8MaxValue_183() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::DataModel::Nullable> nullableBitmap8Argument; - nullableBitmap8Argument.SetNonNull(); - nullableBitmap8Argument.Value() = static_cast>(254); - - ReturnErrorOnFailure(cluster.WriteAttribute( - nullableBitmap8Argument, this, OnSuccessCallback_183, OnFailureCallback_183)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_183(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_183() { NextTest(); } - - CHIP_ERROR TestReadAttributeNullableBitmap8MaxValue_184() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_184, OnFailureCallback_184, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_184(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_184( - const chip::app::DataModel::Nullable> & nullableBitmap8) - { - VerifyOrReturn(CheckValueNonNull("nullableBitmap8", nullableBitmap8)); - VerifyOrReturn(CheckValue("nullableBitmap8.Value()", nullableBitmap8.Value(), 254)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeNullableBitmap8InvalidValue_185() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::DataModel::Nullable> nullableBitmap8Argument; - nullableBitmap8Argument.SetNonNull(); - nullableBitmap8Argument.Value() = static_cast>(255); - - ReturnErrorOnFailure(cluster.WriteAttribute( - nullableBitmap8Argument, this, OnSuccessCallback_185, OnFailureCallback_185)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_185(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - NextTest(); - } - - void OnSuccessResponse_185() { ThrowSuccessResponse(); } - - CHIP_ERROR TestReadAttributeNullableBitmap8UnchangedValue_186() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_186, OnFailureCallback_186, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_186(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_186( - const chip::app::DataModel::Nullable> & nullableBitmap8) - { - VerifyOrReturn(CheckValueNonNull("nullableBitmap8", nullableBitmap8)); - VerifyOrReturn(CheckValue("nullableBitmap8.Value()", nullableBitmap8.Value(), 254)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeNullableBitmap8NullValue_187() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::DataModel::Nullable> nullableBitmap8Argument; - nullableBitmap8Argument.SetNull(); - - ReturnErrorOnFailure(cluster.WriteAttribute( - nullableBitmap8Argument, this, OnSuccessCallback_187, OnFailureCallback_187)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_187(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_187() { NextTest(); } - - CHIP_ERROR TestReadAttributeNullableBitmap8NullValue_188() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_188, OnFailureCallback_188, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_188(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_188( - const chip::app::DataModel::Nullable> & nullableBitmap8) - { - VerifyOrReturn(CheckValueNull("nullableBitmap8", nullableBitmap8)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeNullableBitmap16MaxValue_189() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::DataModel::Nullable> nullableBitmap16Argument; - nullableBitmap16Argument.SetNonNull(); - nullableBitmap16Argument.Value() = static_cast>(65534U); - - ReturnErrorOnFailure(cluster.WriteAttribute( - nullableBitmap16Argument, this, OnSuccessCallback_189, OnFailureCallback_189)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_189(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_189() { NextTest(); } - - CHIP_ERROR TestReadAttributeNullableBitmap16MaxValue_190() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_190, OnFailureCallback_190, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_190(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_190( - const chip::app::DataModel::Nullable> & nullableBitmap16) - { - VerifyOrReturn(CheckValueNonNull("nullableBitmap16", nullableBitmap16)); - VerifyOrReturn(CheckValue("nullableBitmap16.Value()", nullableBitmap16.Value(), 65534U)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeNullableBitmap16InvalidValue_191() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::DataModel::Nullable> nullableBitmap16Argument; - nullableBitmap16Argument.SetNonNull(); - nullableBitmap16Argument.Value() = static_cast>(65535U); - - ReturnErrorOnFailure(cluster.WriteAttribute( - nullableBitmap16Argument, this, OnSuccessCallback_191, OnFailureCallback_191)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_191(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - NextTest(); - } - - void OnSuccessResponse_191() { ThrowSuccessResponse(); } - - CHIP_ERROR TestReadAttributeNullableBitmap16UnchangedValue_192() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_192, OnFailureCallback_192, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_192(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_192( - const chip::app::DataModel::Nullable> & nullableBitmap16) - { - VerifyOrReturn(CheckValueNonNull("nullableBitmap16", nullableBitmap16)); - VerifyOrReturn(CheckValue("nullableBitmap16.Value()", nullableBitmap16.Value(), 65534U)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeNullableBitmap16NullValue_193() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::DataModel::Nullable> nullableBitmap16Argument; - nullableBitmap16Argument.SetNull(); - - ReturnErrorOnFailure(cluster.WriteAttribute( - nullableBitmap16Argument, this, OnSuccessCallback_193, OnFailureCallback_193)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_193(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_193() { NextTest(); } - - CHIP_ERROR TestReadAttributeNullableBitmap16NullValue_194() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_194, OnFailureCallback_194, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_194(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_194( - const chip::app::DataModel::Nullable> & nullableBitmap16) - { - VerifyOrReturn(CheckValueNull("nullableBitmap16", nullableBitmap16)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeNullableBitmap32MaxValue_195() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::DataModel::Nullable> nullableBitmap32Argument; - nullableBitmap32Argument.SetNonNull(); - nullableBitmap32Argument.Value() = - static_cast>(4294967294UL); - - ReturnErrorOnFailure(cluster.WriteAttribute( - nullableBitmap32Argument, this, OnSuccessCallback_195, OnFailureCallback_195)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_195(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_195() { NextTest(); } - - CHIP_ERROR TestReadAttributeNullableBitmap32MaxValue_196() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_196, OnFailureCallback_196, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_196(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_196( - const chip::app::DataModel::Nullable> & nullableBitmap32) - { - VerifyOrReturn(CheckValueNonNull("nullableBitmap32", nullableBitmap32)); - VerifyOrReturn(CheckValue("nullableBitmap32.Value()", nullableBitmap32.Value(), 4294967294UL)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeNullableBitmap32InvalidValue_197() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::DataModel::Nullable> nullableBitmap32Argument; - nullableBitmap32Argument.SetNonNull(); - nullableBitmap32Argument.Value() = - static_cast>(4294967295UL); - - ReturnErrorOnFailure(cluster.WriteAttribute( - nullableBitmap32Argument, this, OnSuccessCallback_197, OnFailureCallback_197)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_197(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - NextTest(); - } - - void OnSuccessResponse_197() { ThrowSuccessResponse(); } - - CHIP_ERROR TestReadAttributeNullableBitmap32UnchangedValue_198() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_198, OnFailureCallback_198, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_198(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_198( - const chip::app::DataModel::Nullable> & nullableBitmap32) - { - VerifyOrReturn(CheckValueNonNull("nullableBitmap32", nullableBitmap32)); - VerifyOrReturn(CheckValue("nullableBitmap32.Value()", nullableBitmap32.Value(), 4294967294UL)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeNullableBitmap32NullValue_199() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::DataModel::Nullable> nullableBitmap32Argument; - nullableBitmap32Argument.SetNull(); - - ReturnErrorOnFailure(cluster.WriteAttribute( - nullableBitmap32Argument, this, OnSuccessCallback_199, OnFailureCallback_199)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_199(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_199() { NextTest(); } - - CHIP_ERROR TestReadAttributeNullableBitmap32NullValue_200() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_200, OnFailureCallback_200, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_200(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_200( - const chip::app::DataModel::Nullable> & nullableBitmap32) - { - VerifyOrReturn(CheckValueNull("nullableBitmap32", nullableBitmap32)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeNullableBitmap64MaxValue_201() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::DataModel::Nullable> nullableBitmap64Argument; - nullableBitmap64Argument.SetNonNull(); - nullableBitmap64Argument.Value() = - static_cast>(18446744073709551614ULL); - - ReturnErrorOnFailure(cluster.WriteAttribute( - nullableBitmap64Argument, this, OnSuccessCallback_201, OnFailureCallback_201)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_201(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_201() { NextTest(); } - - CHIP_ERROR TestReadAttributeNullableBitmap64MaxValue_202() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_202, OnFailureCallback_202, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_202(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_202( - const chip::app::DataModel::Nullable> & nullableBitmap64) - { - VerifyOrReturn(CheckValueNonNull("nullableBitmap64", nullableBitmap64)); - VerifyOrReturn(CheckValue("nullableBitmap64.Value()", nullableBitmap64.Value(), 18446744073709551614ULL)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeNullableBitmap64InvalidValue_203() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::DataModel::Nullable> nullableBitmap64Argument; - nullableBitmap64Argument.SetNonNull(); - nullableBitmap64Argument.Value() = - static_cast>(18446744073709551615ULL); - - ReturnErrorOnFailure(cluster.WriteAttribute( - nullableBitmap64Argument, this, OnSuccessCallback_203, OnFailureCallback_203)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_203(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - NextTest(); - } - - void OnSuccessResponse_203() { ThrowSuccessResponse(); } - - CHIP_ERROR TestReadAttributeNullableBitmap64UnchangedValue_204() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_204, OnFailureCallback_204, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_204(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_204( - const chip::app::DataModel::Nullable> & nullableBitmap64) - { - VerifyOrReturn(CheckValueNonNull("nullableBitmap64", nullableBitmap64)); - VerifyOrReturn(CheckValue("nullableBitmap64.Value()", nullableBitmap64.Value(), 18446744073709551614ULL)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeNullableBitmap64NullValue_205() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::DataModel::Nullable> nullableBitmap64Argument; - nullableBitmap64Argument.SetNull(); - - ReturnErrorOnFailure(cluster.WriteAttribute( - nullableBitmap64Argument, this, OnSuccessCallback_205, OnFailureCallback_205)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_205(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_205() { NextTest(); } - - CHIP_ERROR TestReadAttributeNullableBitmap64NullValue_206() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_206, OnFailureCallback_206, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_206(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_206( - const chip::app::DataModel::Nullable> & nullableBitmap64) - { - VerifyOrReturn(CheckValueNull("nullableBitmap64", nullableBitmap64)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeNullableInt8uMinValue_207() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::DataModel::Nullable nullableInt8uArgument; - nullableInt8uArgument.SetNonNull(); - nullableInt8uArgument.Value() = 0; - - ReturnErrorOnFailure(cluster.WriteAttribute( - nullableInt8uArgument, this, OnSuccessCallback_207, OnFailureCallback_207)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_207(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_207() { NextTest(); } - - CHIP_ERROR TestReadAttributeNullableInt8uMinValue_208() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_208, OnFailureCallback_208, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_208(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_208(const chip::app::DataModel::Nullable & nullableInt8u) - { - VerifyOrReturn(CheckValueNonNull("nullableInt8u", nullableInt8u)); - VerifyOrReturn(CheckValue("nullableInt8u.Value()", nullableInt8u.Value(), 0)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeNullableInt8uMaxValue_209() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::DataModel::Nullable nullableInt8uArgument; - nullableInt8uArgument.SetNonNull(); - nullableInt8uArgument.Value() = 254; - - ReturnErrorOnFailure(cluster.WriteAttribute( - nullableInt8uArgument, this, OnSuccessCallback_209, OnFailureCallback_209)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_209(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_209() { NextTest(); } - - CHIP_ERROR TestReadAttributeNullableInt8uMaxValue_210() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_210, OnFailureCallback_210, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_210(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_210(const chip::app::DataModel::Nullable & nullableInt8u) - { - VerifyOrReturn(CheckValueNonNull("nullableInt8u", nullableInt8u)); - VerifyOrReturn(CheckValue("nullableInt8u.Value()", nullableInt8u.Value(), 254)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeNullableInt8uInvalidValue_211() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::DataModel::Nullable nullableInt8uArgument; - nullableInt8uArgument.SetNonNull(); - nullableInt8uArgument.Value() = 255; - - ReturnErrorOnFailure(cluster.WriteAttribute( - nullableInt8uArgument, this, OnSuccessCallback_211, OnFailureCallback_211)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_211(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - NextTest(); - } - - void OnSuccessResponse_211() { ThrowSuccessResponse(); } - - CHIP_ERROR TestReadAttributeNullableInt8uUnchangedValue_212() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_212, OnFailureCallback_212, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_212(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_212(const chip::app::DataModel::Nullable & nullableInt8u) - { - VerifyOrReturn(CheckValueNonNull("nullableInt8u", nullableInt8u)); - VerifyOrReturn(CheckValue("nullableInt8u.Value()", nullableInt8u.Value(), 254)); - - NextTest(); - } - - CHIP_ERROR TestReadAttributeNullableInt8uUnchangedValueWithConstraint_213() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_213, OnFailureCallback_213, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_213(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_213(const chip::app::DataModel::Nullable & nullableInt8u) - { - VerifyOrReturn(CheckValueNonNull("nullableInt8u", nullableInt8u)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeNullableInt8uNullValue_214() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::DataModel::Nullable nullableInt8uArgument; - nullableInt8uArgument.SetNull(); - - ReturnErrorOnFailure(cluster.WriteAttribute( - nullableInt8uArgument, this, OnSuccessCallback_214, OnFailureCallback_214)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_214(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_214() { NextTest(); } - - CHIP_ERROR TestReadAttributeNullableInt8uNullValue_215() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_215, OnFailureCallback_215, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_215(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_215(const chip::app::DataModel::Nullable & nullableInt8u) - { - VerifyOrReturn(CheckValueNull("nullableInt8u", nullableInt8u)); - - NextTest(); - } - - CHIP_ERROR TestReadAttributeNullableInt8uNullValueRange_216() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_216, OnFailureCallback_216, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_216(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_216(const chip::app::DataModel::Nullable & nullableInt8u) - { - VerifyOrReturn(CheckConstraintMinValue("nullableInt8u", nullableInt8u, 0)); - VerifyOrReturn(CheckConstraintMaxValue("nullableInt8u", nullableInt8u, 254)); - NextTest(); - } - - CHIP_ERROR TestReadAttributeNullableInt8uNullValueNot_217() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_217, OnFailureCallback_217, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_217(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_217(const chip::app::DataModel::Nullable & nullableInt8u) - { - VerifyOrReturn(CheckConstraintNotValue("nullableInt8u", nullableInt8u, 254)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeNullableInt8uValue_218() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::DataModel::Nullable nullableInt8uArgument; - nullableInt8uArgument.SetNonNull(); - nullableInt8uArgument.Value() = 128; - - ReturnErrorOnFailure(cluster.WriteAttribute( - nullableInt8uArgument, this, OnSuccessCallback_218, OnFailureCallback_218)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_218(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_218() { NextTest(); } - - CHIP_ERROR TestReadAttributeNullableInt8uValueInRange_219() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_219, OnFailureCallback_219, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_219(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_219(const chip::app::DataModel::Nullable & nullableInt8u) - { - VerifyOrReturn(CheckConstraintMinValue("nullableInt8u", nullableInt8u, 0)); - VerifyOrReturn(CheckConstraintMaxValue("nullableInt8u", nullableInt8u, 254)); - NextTest(); - } - - CHIP_ERROR TestReadAttributeNullableInt8uNotValueOk_220() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_220, OnFailureCallback_220, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_220(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_220(const chip::app::DataModel::Nullable & nullableInt8u) - { - VerifyOrReturn(CheckConstraintNotValue("nullableInt8u", nullableInt8u, 129)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeNullableInt16uMinValue_221() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::DataModel::Nullable nullableInt16uArgument; - nullableInt16uArgument.SetNonNull(); - nullableInt16uArgument.Value() = 0U; - - ReturnErrorOnFailure(cluster.WriteAttribute( - nullableInt16uArgument, this, OnSuccessCallback_221, OnFailureCallback_221)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_221(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_221() { NextTest(); } - - CHIP_ERROR TestReadAttributeNullableInt16uMinValue_222() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_222, OnFailureCallback_222, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_222(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_222(const chip::app::DataModel::Nullable & nullableInt16u) - { - VerifyOrReturn(CheckValueNonNull("nullableInt16u", nullableInt16u)); - VerifyOrReturn(CheckValue("nullableInt16u.Value()", nullableInt16u.Value(), 0U)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeNullableInt16uMaxValue_223() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::DataModel::Nullable nullableInt16uArgument; - nullableInt16uArgument.SetNonNull(); - nullableInt16uArgument.Value() = 65534U; - - ReturnErrorOnFailure(cluster.WriteAttribute( - nullableInt16uArgument, this, OnSuccessCallback_223, OnFailureCallback_223)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_223(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_223() { NextTest(); } - - CHIP_ERROR TestReadAttributeNullableInt16uMaxValue_224() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_224, OnFailureCallback_224, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_224(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_224(const chip::app::DataModel::Nullable & nullableInt16u) - { - VerifyOrReturn(CheckValueNonNull("nullableInt16u", nullableInt16u)); - VerifyOrReturn(CheckValue("nullableInt16u.Value()", nullableInt16u.Value(), 65534U)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeNullableInt16uInvalidValue_225() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::DataModel::Nullable nullableInt16uArgument; - nullableInt16uArgument.SetNonNull(); - nullableInt16uArgument.Value() = 65535U; - - ReturnErrorOnFailure(cluster.WriteAttribute( - nullableInt16uArgument, this, OnSuccessCallback_225, OnFailureCallback_225)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_225(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - NextTest(); - } - - void OnSuccessResponse_225() { ThrowSuccessResponse(); } - - CHIP_ERROR TestReadAttributeNullableInt16uUnchangedValue_226() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_226, OnFailureCallback_226, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_226(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_226(const chip::app::DataModel::Nullable & nullableInt16u) - { - VerifyOrReturn(CheckValueNonNull("nullableInt16u", nullableInt16u)); - VerifyOrReturn(CheckValue("nullableInt16u.Value()", nullableInt16u.Value(), 65534U)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeNullableInt16uNullValue_227() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::DataModel::Nullable nullableInt16uArgument; - nullableInt16uArgument.SetNull(); - - ReturnErrorOnFailure(cluster.WriteAttribute( - nullableInt16uArgument, this, OnSuccessCallback_227, OnFailureCallback_227)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_227(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_227() { NextTest(); } - - CHIP_ERROR TestReadAttributeNullableInt16uNullValue_228() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_228, OnFailureCallback_228, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_228(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_228(const chip::app::DataModel::Nullable & nullableInt16u) - { - VerifyOrReturn(CheckValueNull("nullableInt16u", nullableInt16u)); - - NextTest(); - } - - CHIP_ERROR TestReadAttributeNullableInt16uNullValueRange_229() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_229, OnFailureCallback_229, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_229(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_229(const chip::app::DataModel::Nullable & nullableInt16u) - { - VerifyOrReturn(CheckConstraintMinValue("nullableInt16u", nullableInt16u, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("nullableInt16u", nullableInt16u, 65534U)); - NextTest(); - } - - CHIP_ERROR TestReadAttributeNullableInt16uNullValueNot_230() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_230, OnFailureCallback_230, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_230(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_230(const chip::app::DataModel::Nullable & nullableInt16u) - { - VerifyOrReturn(CheckConstraintNotValue("nullableInt16u", nullableInt16u, 65534U)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeNullableInt16uValue_231() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::DataModel::Nullable nullableInt16uArgument; - nullableInt16uArgument.SetNonNull(); - nullableInt16uArgument.Value() = 32000U; - - ReturnErrorOnFailure(cluster.WriteAttribute( - nullableInt16uArgument, this, OnSuccessCallback_231, OnFailureCallback_231)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_231(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_231() { NextTest(); } - - CHIP_ERROR TestReadAttributeNullableInt16uValueInRange_232() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_232, OnFailureCallback_232, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_232(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_232(const chip::app::DataModel::Nullable & nullableInt16u) - { - VerifyOrReturn(CheckConstraintMinValue("nullableInt16u", nullableInt16u, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("nullableInt16u", nullableInt16u, 65534U)); - NextTest(); - } - - CHIP_ERROR TestReadAttributeNullableInt16uNotValueOk_233() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_233, OnFailureCallback_233, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_233(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_233(const chip::app::DataModel::Nullable & nullableInt16u) - { - VerifyOrReturn(CheckConstraintNotValue("nullableInt16u", nullableInt16u, 32001U)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeNullableInt32uMinValue_234() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::DataModel::Nullable nullableInt32uArgument; - nullableInt32uArgument.SetNonNull(); - nullableInt32uArgument.Value() = 0UL; - - ReturnErrorOnFailure(cluster.WriteAttribute( - nullableInt32uArgument, this, OnSuccessCallback_234, OnFailureCallback_234)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_234(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_234() { NextTest(); } - - CHIP_ERROR TestReadAttributeNullableInt32uMinValue_235() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_235, OnFailureCallback_235, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_235(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_235(const chip::app::DataModel::Nullable & nullableInt32u) - { - VerifyOrReturn(CheckValueNonNull("nullableInt32u", nullableInt32u)); - VerifyOrReturn(CheckValue("nullableInt32u.Value()", nullableInt32u.Value(), 0UL)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeNullableInt32uMaxValue_236() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::DataModel::Nullable nullableInt32uArgument; - nullableInt32uArgument.SetNonNull(); - nullableInt32uArgument.Value() = 4294967294UL; - - ReturnErrorOnFailure(cluster.WriteAttribute( - nullableInt32uArgument, this, OnSuccessCallback_236, OnFailureCallback_236)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_236(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_236() { NextTest(); } - - CHIP_ERROR TestReadAttributeNullableInt32uMaxValue_237() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_237, OnFailureCallback_237, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_237(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_237(const chip::app::DataModel::Nullable & nullableInt32u) - { - VerifyOrReturn(CheckValueNonNull("nullableInt32u", nullableInt32u)); - VerifyOrReturn(CheckValue("nullableInt32u.Value()", nullableInt32u.Value(), 4294967294UL)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeNullableInt32uInvalidValue_238() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::DataModel::Nullable nullableInt32uArgument; - nullableInt32uArgument.SetNonNull(); - nullableInt32uArgument.Value() = 4294967295UL; - - ReturnErrorOnFailure(cluster.WriteAttribute( - nullableInt32uArgument, this, OnSuccessCallback_238, OnFailureCallback_238)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_238(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - NextTest(); - } - - void OnSuccessResponse_238() { ThrowSuccessResponse(); } - - CHIP_ERROR TestReadAttributeNullableInt32uUnchangedValue_239() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_239, OnFailureCallback_239, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_239(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_239(const chip::app::DataModel::Nullable & nullableInt32u) - { - VerifyOrReturn(CheckValueNonNull("nullableInt32u", nullableInt32u)); - VerifyOrReturn(CheckValue("nullableInt32u.Value()", nullableInt32u.Value(), 4294967294UL)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeNullableInt32uNullValue_240() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::DataModel::Nullable nullableInt32uArgument; - nullableInt32uArgument.SetNull(); - - ReturnErrorOnFailure(cluster.WriteAttribute( - nullableInt32uArgument, this, OnSuccessCallback_240, OnFailureCallback_240)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_240(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_240() { NextTest(); } - - CHIP_ERROR TestReadAttributeNullableInt32uNullValue_241() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_241, OnFailureCallback_241, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_241(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_241(const chip::app::DataModel::Nullable & nullableInt32u) - { - VerifyOrReturn(CheckValueNull("nullableInt32u", nullableInt32u)); - - NextTest(); - } - - CHIP_ERROR TestReadAttributeNullableInt32uNullValueRange_242() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_242, OnFailureCallback_242, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_242(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_242(const chip::app::DataModel::Nullable & nullableInt32u) - { - VerifyOrReturn(CheckConstraintMinValue("nullableInt32u", nullableInt32u, 0UL)); - VerifyOrReturn(CheckConstraintMaxValue("nullableInt32u", nullableInt32u, 4294967294UL)); - NextTest(); - } - - CHIP_ERROR TestReadAttributeNullableInt32uNullValueNot_243() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_243, OnFailureCallback_243, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_243(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_243(const chip::app::DataModel::Nullable & nullableInt32u) - { - VerifyOrReturn(CheckConstraintNotValue("nullableInt32u", nullableInt32u, 4294967294UL)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeNullableInt32uValue_244() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::DataModel::Nullable nullableInt32uArgument; - nullableInt32uArgument.SetNonNull(); - nullableInt32uArgument.Value() = 2147483647UL; - - ReturnErrorOnFailure(cluster.WriteAttribute( - nullableInt32uArgument, this, OnSuccessCallback_244, OnFailureCallback_244)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_244(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_244() { NextTest(); } - - CHIP_ERROR TestReadAttributeNullableInt32uValueInRange_245() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_245, OnFailureCallback_245, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_245(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_245(const chip::app::DataModel::Nullable & nullableInt32u) - { - VerifyOrReturn(CheckConstraintMinValue("nullableInt32u", nullableInt32u, 0UL)); - VerifyOrReturn(CheckConstraintMaxValue("nullableInt32u", nullableInt32u, 4294967294UL)); - NextTest(); - } - - CHIP_ERROR TestReadAttributeNullableInt32uNotValueOk_246() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_246, OnFailureCallback_246, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_246(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_246(const chip::app::DataModel::Nullable & nullableInt32u) - { - VerifyOrReturn(CheckConstraintNotValue("nullableInt32u", nullableInt32u, 2147483648UL)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeNullableInt64uMinValue_247() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::DataModel::Nullable nullableInt64uArgument; - nullableInt64uArgument.SetNonNull(); - nullableInt64uArgument.Value() = 0ULL; - - ReturnErrorOnFailure(cluster.WriteAttribute( - nullableInt64uArgument, this, OnSuccessCallback_247, OnFailureCallback_247)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_247(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_247() { NextTest(); } - - CHIP_ERROR TestReadAttributeNullableInt64uMinValue_248() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_248, OnFailureCallback_248, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_248(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_248(const chip::app::DataModel::Nullable & nullableInt64u) - { - VerifyOrReturn(CheckValueNonNull("nullableInt64u", nullableInt64u)); - VerifyOrReturn(CheckValue("nullableInt64u.Value()", nullableInt64u.Value(), 0ULL)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeNullableInt64uMaxValue_249() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::DataModel::Nullable nullableInt64uArgument; - nullableInt64uArgument.SetNonNull(); - nullableInt64uArgument.Value() = 18446744073709551614ULL; - - ReturnErrorOnFailure(cluster.WriteAttribute( - nullableInt64uArgument, this, OnSuccessCallback_249, OnFailureCallback_249)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_249(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_249() { NextTest(); } - - CHIP_ERROR TestReadAttributeNullableInt64uMaxValue_250() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_250, OnFailureCallback_250, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_250(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_250(const chip::app::DataModel::Nullable & nullableInt64u) - { - VerifyOrReturn(CheckValueNonNull("nullableInt64u", nullableInt64u)); - VerifyOrReturn(CheckValue("nullableInt64u.Value()", nullableInt64u.Value(), 18446744073709551614ULL)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeNullableInt64uInvalidValue_251() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::DataModel::Nullable nullableInt64uArgument; - nullableInt64uArgument.SetNonNull(); - nullableInt64uArgument.Value() = 18446744073709551615ULL; - - ReturnErrorOnFailure(cluster.WriteAttribute( - nullableInt64uArgument, this, OnSuccessCallback_251, OnFailureCallback_251)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_251(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - NextTest(); - } - - void OnSuccessResponse_251() { ThrowSuccessResponse(); } - - CHIP_ERROR TestReadAttributeNullableInt64uUnchangedValue_252() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_252, OnFailureCallback_252, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_252(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_252(const chip::app::DataModel::Nullable & nullableInt64u) - { - VerifyOrReturn(CheckValueNonNull("nullableInt64u", nullableInt64u)); - VerifyOrReturn(CheckValue("nullableInt64u.Value()", nullableInt64u.Value(), 18446744073709551614ULL)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeNullableInt64uNullValue_253() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::DataModel::Nullable nullableInt64uArgument; - nullableInt64uArgument.SetNull(); - - ReturnErrorOnFailure(cluster.WriteAttribute( - nullableInt64uArgument, this, OnSuccessCallback_253, OnFailureCallback_253)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_253(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_253() { NextTest(); } - - CHIP_ERROR TestReadAttributeNullableInt64uNullValue_254() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_254, OnFailureCallback_254, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_254(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_254(const chip::app::DataModel::Nullable & nullableInt64u) - { - VerifyOrReturn(CheckValueNull("nullableInt64u", nullableInt64u)); - - NextTest(); - } - - CHIP_ERROR TestReadAttributeNullableInt64uNullValueRange_255() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_255, OnFailureCallback_255, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_255(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_255(const chip::app::DataModel::Nullable & nullableInt64u) - { - VerifyOrReturn(CheckConstraintMinValue("nullableInt64u", nullableInt64u, 0ULL)); - VerifyOrReturn(CheckConstraintMaxValue("nullableInt64u", nullableInt64u, 18446744073709551614ULL)); - NextTest(); - } - - CHIP_ERROR TestReadAttributeNullableInt64uNullValueNot_256() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_256, OnFailureCallback_256, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_256(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_256(const chip::app::DataModel::Nullable & nullableInt64u) - { - VerifyOrReturn(CheckConstraintNotValue("nullableInt64u", nullableInt64u, 18446744073709551614ULL)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeNullableInt64uValue_257() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::DataModel::Nullable nullableInt64uArgument; - nullableInt64uArgument.SetNonNull(); - nullableInt64uArgument.Value() = 18000000000000000000ULL; - - ReturnErrorOnFailure(cluster.WriteAttribute( - nullableInt64uArgument, this, OnSuccessCallback_257, OnFailureCallback_257)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_257(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_257() { NextTest(); } - - CHIP_ERROR TestReadAttributeNullableInt64uValueInRange_258() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_258, OnFailureCallback_258, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_258(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_258(const chip::app::DataModel::Nullable & nullableInt64u) - { - VerifyOrReturn(CheckConstraintMinValue("nullableInt64u", nullableInt64u, 0ULL)); - VerifyOrReturn(CheckConstraintMaxValue("nullableInt64u", nullableInt64u, 18446744073709551614ULL)); - NextTest(); - } - - CHIP_ERROR TestReadAttributeNullableInt64uNotValueOk_259() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_259, OnFailureCallback_259, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_259(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_259(const chip::app::DataModel::Nullable & nullableInt64u) - { - VerifyOrReturn(CheckConstraintNotValue("nullableInt64u", nullableInt64u, 18000000000000000001ULL)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeNullableInt8sMinValue_260() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::DataModel::Nullable nullableInt8sArgument; - nullableInt8sArgument.SetNonNull(); - nullableInt8sArgument.Value() = -127; - - ReturnErrorOnFailure(cluster.WriteAttribute( - nullableInt8sArgument, this, OnSuccessCallback_260, OnFailureCallback_260)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_260(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_260() { NextTest(); } - - CHIP_ERROR TestReadAttributeNullableInt8sMinValue_261() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_261, OnFailureCallback_261, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_261(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_261(const chip::app::DataModel::Nullable & nullableInt8s) - { - VerifyOrReturn(CheckValueNonNull("nullableInt8s", nullableInt8s)); - VerifyOrReturn(CheckValue("nullableInt8s.Value()", nullableInt8s.Value(), -127)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeNullableInt8sInvalidValue_262() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::DataModel::Nullable nullableInt8sArgument; - nullableInt8sArgument.SetNonNull(); - nullableInt8sArgument.Value() = -128; - - ReturnErrorOnFailure(cluster.WriteAttribute( - nullableInt8sArgument, this, OnSuccessCallback_262, OnFailureCallback_262)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_262(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - NextTest(); - } - - void OnSuccessResponse_262() { ThrowSuccessResponse(); } - - CHIP_ERROR TestReadAttributeNullableInt8sUnchangedValue_263() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_263, OnFailureCallback_263, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_263(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_263(const chip::app::DataModel::Nullable & nullableInt8s) - { - VerifyOrReturn(CheckValueNonNull("nullableInt8s", nullableInt8s)); - VerifyOrReturn(CheckValue("nullableInt8s.Value()", nullableInt8s.Value(), -127)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeNullableInt8sNullValue_264() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::DataModel::Nullable nullableInt8sArgument; - nullableInt8sArgument.SetNull(); - - ReturnErrorOnFailure(cluster.WriteAttribute( - nullableInt8sArgument, this, OnSuccessCallback_264, OnFailureCallback_264)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_264(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_264() { NextTest(); } - - CHIP_ERROR TestReadAttributeNullableInt8sNullValue_265() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_265, OnFailureCallback_265, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_265(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_265(const chip::app::DataModel::Nullable & nullableInt8s) - { - VerifyOrReturn(CheckValueNull("nullableInt8s", nullableInt8s)); - - NextTest(); - } - - CHIP_ERROR TestReadAttributeNullableInt8sNullValueRange_266() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_266, OnFailureCallback_266, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_266(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_266(const chip::app::DataModel::Nullable & nullableInt8s) - { - VerifyOrReturn(CheckConstraintMinValue("nullableInt8s", nullableInt8s, -127)); - VerifyOrReturn(CheckConstraintMaxValue("nullableInt8s", nullableInt8s, 127)); - NextTest(); - } - - CHIP_ERROR TestReadAttributeNullableInt8sNullValueNot_267() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_267, OnFailureCallback_267, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_267(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_267(const chip::app::DataModel::Nullable & nullableInt8s) - { - VerifyOrReturn(CheckConstraintNotValue("nullableInt8s", nullableInt8s, -127)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeNullableInt8sValue_268() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::DataModel::Nullable nullableInt8sArgument; - nullableInt8sArgument.SetNonNull(); - nullableInt8sArgument.Value() = -127; - - ReturnErrorOnFailure(cluster.WriteAttribute( - nullableInt8sArgument, this, OnSuccessCallback_268, OnFailureCallback_268)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_268(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_268() { NextTest(); } - - CHIP_ERROR TestReadAttributeNullableInt8sValueInRange_269() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_269, OnFailureCallback_269, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_269(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_269(const chip::app::DataModel::Nullable & nullableInt8s) - { - VerifyOrReturn(CheckConstraintMinValue("nullableInt8s", nullableInt8s, -127)); - VerifyOrReturn(CheckConstraintMaxValue("nullableInt8s", nullableInt8s, 127)); - NextTest(); - } - - CHIP_ERROR TestReadAttributeNullableInt8sNotValueOk_270() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_270, OnFailureCallback_270, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_270(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_270(const chip::app::DataModel::Nullable & nullableInt8s) - { - VerifyOrReturn(CheckConstraintNotValue("nullableInt8s", nullableInt8s, -126)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeNullableInt16sMinValue_271() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::DataModel::Nullable nullableInt16sArgument; - nullableInt16sArgument.SetNonNull(); - nullableInt16sArgument.Value() = -32767; - - ReturnErrorOnFailure(cluster.WriteAttribute( - nullableInt16sArgument, this, OnSuccessCallback_271, OnFailureCallback_271)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_271(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_271() { NextTest(); } - - CHIP_ERROR TestReadAttributeNullableInt16sMinValue_272() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_272, OnFailureCallback_272, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_272(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_272(const chip::app::DataModel::Nullable & nullableInt16s) - { - VerifyOrReturn(CheckValueNonNull("nullableInt16s", nullableInt16s)); - VerifyOrReturn(CheckValue("nullableInt16s.Value()", nullableInt16s.Value(), -32767)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeNullableInt16sInvalidValue_273() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::DataModel::Nullable nullableInt16sArgument; - nullableInt16sArgument.SetNonNull(); - nullableInt16sArgument.Value() = -32768; - - ReturnErrorOnFailure(cluster.WriteAttribute( - nullableInt16sArgument, this, OnSuccessCallback_273, OnFailureCallback_273)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_273(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - NextTest(); - } - - void OnSuccessResponse_273() { ThrowSuccessResponse(); } - - CHIP_ERROR TestReadAttributeNullableInt16sUnchangedValue_274() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_274, OnFailureCallback_274, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_274(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_274(const chip::app::DataModel::Nullable & nullableInt16s) - { - VerifyOrReturn(CheckValueNonNull("nullableInt16s", nullableInt16s)); - VerifyOrReturn(CheckValue("nullableInt16s.Value()", nullableInt16s.Value(), -32767)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeNullableInt16sNullValue_275() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::DataModel::Nullable nullableInt16sArgument; - nullableInt16sArgument.SetNull(); - - ReturnErrorOnFailure(cluster.WriteAttribute( - nullableInt16sArgument, this, OnSuccessCallback_275, OnFailureCallback_275)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_275(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_275() { NextTest(); } - - CHIP_ERROR TestReadAttributeNullableInt16sNullValue_276() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_276, OnFailureCallback_276, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_276(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_276(const chip::app::DataModel::Nullable & nullableInt16s) - { - VerifyOrReturn(CheckValueNull("nullableInt16s", nullableInt16s)); - - NextTest(); - } - - CHIP_ERROR TestReadAttributeNullableInt16sNullValueRange_277() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_277, OnFailureCallback_277, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_277(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_277(const chip::app::DataModel::Nullable & nullableInt16s) - { - VerifyOrReturn(CheckConstraintMinValue("nullableInt16s", nullableInt16s, -32767)); - VerifyOrReturn(CheckConstraintMaxValue("nullableInt16s", nullableInt16s, 32767)); - NextTest(); - } - - CHIP_ERROR TestReadAttributeNullableInt16sNullValueNot_278() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_278, OnFailureCallback_278, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_278(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_278(const chip::app::DataModel::Nullable & nullableInt16s) - { - VerifyOrReturn(CheckConstraintNotValue("nullableInt16s", nullableInt16s, -32767)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeNullableInt16sValue_279() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::DataModel::Nullable nullableInt16sArgument; - nullableInt16sArgument.SetNonNull(); - nullableInt16sArgument.Value() = -32767; - - ReturnErrorOnFailure(cluster.WriteAttribute( - nullableInt16sArgument, this, OnSuccessCallback_279, OnFailureCallback_279)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_279(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_279() { NextTest(); } - - CHIP_ERROR TestReadAttributeNullableInt16sValueInRange_280() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_280, OnFailureCallback_280, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_280(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_280(const chip::app::DataModel::Nullable & nullableInt16s) - { - VerifyOrReturn(CheckConstraintMinValue("nullableInt16s", nullableInt16s, -32767)); - VerifyOrReturn(CheckConstraintMaxValue("nullableInt16s", nullableInt16s, 32767)); - NextTest(); - } - - CHIP_ERROR TestReadAttributeNullableInt16sNotValueOk_281() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_281, OnFailureCallback_281, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_281(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_281(const chip::app::DataModel::Nullable & nullableInt16s) - { - VerifyOrReturn(CheckConstraintNotValue("nullableInt16s", nullableInt16s, -32766)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeNullableInt32sMinValue_282() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::DataModel::Nullable nullableInt32sArgument; - nullableInt32sArgument.SetNonNull(); - nullableInt32sArgument.Value() = -2147483647L; - - ReturnErrorOnFailure(cluster.WriteAttribute( - nullableInt32sArgument, this, OnSuccessCallback_282, OnFailureCallback_282)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_282(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_282() { NextTest(); } - - CHIP_ERROR TestReadAttributeNullableInt32sMinValue_283() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_283, OnFailureCallback_283, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_283(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_283(const chip::app::DataModel::Nullable & nullableInt32s) - { - VerifyOrReturn(CheckValueNonNull("nullableInt32s", nullableInt32s)); - VerifyOrReturn(CheckValue("nullableInt32s.Value()", nullableInt32s.Value(), -2147483647L)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeNullableInt32sInvalidValue_284() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::DataModel::Nullable nullableInt32sArgument; - nullableInt32sArgument.SetNonNull(); - nullableInt32sArgument.Value() = -2147483648L; - - ReturnErrorOnFailure(cluster.WriteAttribute( - nullableInt32sArgument, this, OnSuccessCallback_284, OnFailureCallback_284)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_284(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - NextTest(); - } - - void OnSuccessResponse_284() { ThrowSuccessResponse(); } - - CHIP_ERROR TestReadAttributeNullableInt32sUnchangedValue_285() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_285, OnFailureCallback_285, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_285(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_285(const chip::app::DataModel::Nullable & nullableInt32s) - { - VerifyOrReturn(CheckValueNonNull("nullableInt32s", nullableInt32s)); - VerifyOrReturn(CheckValue("nullableInt32s.Value()", nullableInt32s.Value(), -2147483647L)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeNullableInt32sNullValue_286() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::DataModel::Nullable nullableInt32sArgument; - nullableInt32sArgument.SetNull(); - - ReturnErrorOnFailure(cluster.WriteAttribute( - nullableInt32sArgument, this, OnSuccessCallback_286, OnFailureCallback_286)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_286(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_286() { NextTest(); } - - CHIP_ERROR TestReadAttributeNullableInt32sNullValue_287() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_287, OnFailureCallback_287, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_287(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_287(const chip::app::DataModel::Nullable & nullableInt32s) - { - VerifyOrReturn(CheckValueNull("nullableInt32s", nullableInt32s)); - - NextTest(); - } - - CHIP_ERROR TestReadAttributeNullableInt32sNullValueRange_288() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_288, OnFailureCallback_288, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_288(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_288(const chip::app::DataModel::Nullable & nullableInt32s) - { - VerifyOrReturn(CheckConstraintMinValue("nullableInt32s", nullableInt32s, -2147483647L)); - VerifyOrReturn(CheckConstraintMaxValue("nullableInt32s", nullableInt32s, 2147483647L)); - NextTest(); - } - - CHIP_ERROR TestReadAttributeNullableInt32sNullValueNot_289() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_289, OnFailureCallback_289, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_289(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_289(const chip::app::DataModel::Nullable & nullableInt32s) - { - VerifyOrReturn(CheckConstraintNotValue("nullableInt32s", nullableInt32s, -2147483647L)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeNullableInt32sValue_290() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::DataModel::Nullable nullableInt32sArgument; - nullableInt32sArgument.SetNonNull(); - nullableInt32sArgument.Value() = -2147483647L; - - ReturnErrorOnFailure(cluster.WriteAttribute( - nullableInt32sArgument, this, OnSuccessCallback_290, OnFailureCallback_290)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_290(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_290() { NextTest(); } - - CHIP_ERROR TestReadAttributeNullableInt32sValueInRange_291() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_291, OnFailureCallback_291, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_291(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_291(const chip::app::DataModel::Nullable & nullableInt32s) - { - VerifyOrReturn(CheckConstraintMinValue("nullableInt32s", nullableInt32s, -2147483647L)); - VerifyOrReturn(CheckConstraintMaxValue("nullableInt32s", nullableInt32s, 2147483647L)); - NextTest(); - } - - CHIP_ERROR TestReadAttributeNullableInt32sNotValueOk_292() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_292, OnFailureCallback_292, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_292(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_292(const chip::app::DataModel::Nullable & nullableInt32s) - { - VerifyOrReturn(CheckConstraintNotValue("nullableInt32s", nullableInt32s, -2147483646L)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeNullableInt64sMinValue_293() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::DataModel::Nullable nullableInt64sArgument; - nullableInt64sArgument.SetNonNull(); - nullableInt64sArgument.Value() = -9223372036854775807LL; - - ReturnErrorOnFailure(cluster.WriteAttribute( - nullableInt64sArgument, this, OnSuccessCallback_293, OnFailureCallback_293)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_293(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_293() { NextTest(); } - - CHIP_ERROR TestReadAttributeNullableInt64sMinValue_294() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_294, OnFailureCallback_294, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_294(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_294(const chip::app::DataModel::Nullable & nullableInt64s) - { - VerifyOrReturn(CheckValueNonNull("nullableInt64s", nullableInt64s)); - VerifyOrReturn(CheckValue("nullableInt64s.Value()", nullableInt64s.Value(), -9223372036854775807LL)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeNullableInt64sInvalidValue_295() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::DataModel::Nullable nullableInt64sArgument; - nullableInt64sArgument.SetNonNull(); - nullableInt64sArgument.Value() = -9223372036854775807LL - 1; - - ReturnErrorOnFailure(cluster.WriteAttribute( - nullableInt64sArgument, this, OnSuccessCallback_295, OnFailureCallback_295)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_295(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - NextTest(); - } - - void OnSuccessResponse_295() { ThrowSuccessResponse(); } - - CHIP_ERROR TestReadAttributeNullableInt64sUnchangedValue_296() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_296, OnFailureCallback_296, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_296(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_296(const chip::app::DataModel::Nullable & nullableInt64s) - { - VerifyOrReturn(CheckValueNonNull("nullableInt64s", nullableInt64s)); - VerifyOrReturn(CheckValue("nullableInt64s.Value()", nullableInt64s.Value(), -9223372036854775807LL)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeNullableInt64sNullValue_297() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::DataModel::Nullable nullableInt64sArgument; - nullableInt64sArgument.SetNull(); - - ReturnErrorOnFailure(cluster.WriteAttribute( - nullableInt64sArgument, this, OnSuccessCallback_297, OnFailureCallback_297)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_297(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_297() { NextTest(); } - - CHIP_ERROR TestReadAttributeNullableInt64sNullValue_298() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_298, OnFailureCallback_298, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_298(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_298(const chip::app::DataModel::Nullable & nullableInt64s) - { - VerifyOrReturn(CheckValueNull("nullableInt64s", nullableInt64s)); - - NextTest(); - } - - CHIP_ERROR TestReadAttributeNullableInt64sNullValueRange_299() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_299, OnFailureCallback_299, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_299(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_299(const chip::app::DataModel::Nullable & nullableInt64s) - { - VerifyOrReturn(CheckConstraintMinValue("nullableInt64s", nullableInt64s, -9223372036854775807LL)); - VerifyOrReturn(CheckConstraintMaxValue("nullableInt64s", nullableInt64s, 9223372036854775807LL)); - NextTest(); - } - - CHIP_ERROR TestReadAttributeNullableInt64sNullValueNot_300() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_300, OnFailureCallback_300, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_300(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_300(const chip::app::DataModel::Nullable & nullableInt64s) - { - VerifyOrReturn(CheckConstraintNotValue("nullableInt64s", nullableInt64s, -9223372036854775807LL)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeNullableInt64sValue_301() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::DataModel::Nullable nullableInt64sArgument; - nullableInt64sArgument.SetNonNull(); - nullableInt64sArgument.Value() = -9223372036854775807LL; - - ReturnErrorOnFailure(cluster.WriteAttribute( - nullableInt64sArgument, this, OnSuccessCallback_301, OnFailureCallback_301)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_301(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_301() { NextTest(); } - - CHIP_ERROR TestReadAttributeNullableInt64sValueInRange_302() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_302, OnFailureCallback_302, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_302(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_302(const chip::app::DataModel::Nullable & nullableInt64s) - { - VerifyOrReturn(CheckConstraintMinValue("nullableInt64s", nullableInt64s, -9223372036854775807LL)); - VerifyOrReturn(CheckConstraintMaxValue("nullableInt64s", nullableInt64s, 9223372036854775807LL)); - NextTest(); - } - - CHIP_ERROR TestReadAttributeNullableInt64sNotValueOk_303() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_303, OnFailureCallback_303, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_303(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_303(const chip::app::DataModel::Nullable & nullableInt64s) - { - VerifyOrReturn(CheckConstraintNotValue("nullableInt64s", nullableInt64s, -9223372036854775806LL)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeNullableSingleMediumValue_304() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::DataModel::Nullable nullableFloatSingleArgument; - nullableFloatSingleArgument.SetNonNull(); - nullableFloatSingleArgument.Value() = 0.1f; - - ReturnErrorOnFailure(cluster.WriteAttribute( - nullableFloatSingleArgument, this, OnSuccessCallback_304, OnFailureCallback_304)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_304(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_304() { NextTest(); } - - CHIP_ERROR TestReadAttributeNullableSingleMediumValue_305() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_305, OnFailureCallback_305, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_305(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_305(const chip::app::DataModel::Nullable & nullableFloatSingle) - { - VerifyOrReturn(CheckValueNonNull("nullableFloatSingle", nullableFloatSingle)); - VerifyOrReturn(CheckValue("nullableFloatSingle.Value()", nullableFloatSingle.Value(), 0.1f)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeNullableSingleLargestValue_306() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::DataModel::Nullable nullableFloatSingleArgument; - nullableFloatSingleArgument.SetNonNull(); - nullableFloatSingleArgument.Value() = INFINITY; - - ReturnErrorOnFailure(cluster.WriteAttribute( - nullableFloatSingleArgument, this, OnSuccessCallback_306, OnFailureCallback_306)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_306(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_306() { NextTest(); } - - CHIP_ERROR TestReadAttributeNullableSingleLargestValue_307() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_307, OnFailureCallback_307, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_307(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_307(const chip::app::DataModel::Nullable & nullableFloatSingle) - { - VerifyOrReturn(CheckValueNonNull("nullableFloatSingle", nullableFloatSingle)); - VerifyOrReturn(CheckValue("nullableFloatSingle.Value()", nullableFloatSingle.Value(), INFINITY)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeNullableSingleSmallestValue_308() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::DataModel::Nullable nullableFloatSingleArgument; - nullableFloatSingleArgument.SetNonNull(); - nullableFloatSingleArgument.Value() = -INFINITY; - - ReturnErrorOnFailure(cluster.WriteAttribute( - nullableFloatSingleArgument, this, OnSuccessCallback_308, OnFailureCallback_308)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_308(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_308() { NextTest(); } - - CHIP_ERROR TestReadAttributeNullableSingleSmallestValue_309() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_309, OnFailureCallback_309, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_309(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_309(const chip::app::DataModel::Nullable & nullableFloatSingle) - { - VerifyOrReturn(CheckValueNonNull("nullableFloatSingle", nullableFloatSingle)); - VerifyOrReturn(CheckValue("nullableFloatSingle.Value()", nullableFloatSingle.Value(), -INFINITY)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeNullableSingleNullValue_310() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::DataModel::Nullable nullableFloatSingleArgument; - nullableFloatSingleArgument.SetNull(); - - ReturnErrorOnFailure(cluster.WriteAttribute( - nullableFloatSingleArgument, this, OnSuccessCallback_310, OnFailureCallback_310)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_310(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_310() { NextTest(); } - - CHIP_ERROR TestReadAttributeNullableSingleNullValue_311() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_311, OnFailureCallback_311, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_311(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_311(const chip::app::DataModel::Nullable & nullableFloatSingle) - { - VerifyOrReturn(CheckValueNull("nullableFloatSingle", nullableFloatSingle)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeNullableSingle0Value_312() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::DataModel::Nullable nullableFloatSingleArgument; - nullableFloatSingleArgument.SetNonNull(); - nullableFloatSingleArgument.Value() = 0.0f; - - ReturnErrorOnFailure(cluster.WriteAttribute( - nullableFloatSingleArgument, this, OnSuccessCallback_312, OnFailureCallback_312)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_312(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_312() { NextTest(); } - - CHIP_ERROR TestReadAttributeNullableSingle0Value_313() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_313, OnFailureCallback_313, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_313(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_313(const chip::app::DataModel::Nullable & nullableFloatSingle) - { - VerifyOrReturn(CheckValueNonNull("nullableFloatSingle", nullableFloatSingle)); - VerifyOrReturn(CheckValue("nullableFloatSingle.Value()", nullableFloatSingle.Value(), 0.0f)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeNullableDoubleMediumValue_314() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::DataModel::Nullable nullableFloatDoubleArgument; - nullableFloatDoubleArgument.SetNonNull(); - nullableFloatDoubleArgument.Value() = 0.1234567890123; - - ReturnErrorOnFailure(cluster.WriteAttribute( - nullableFloatDoubleArgument, this, OnSuccessCallback_314, OnFailureCallback_314)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_314(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_314() { NextTest(); } - - CHIP_ERROR TestReadAttributeNullableDoubleMediumValue_315() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_315, OnFailureCallback_315, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_315(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_315(const chip::app::DataModel::Nullable & nullableFloatDouble) - { - VerifyOrReturn(CheckValueNonNull("nullableFloatDouble", nullableFloatDouble)); - VerifyOrReturn(CheckValue("nullableFloatDouble.Value()", nullableFloatDouble.Value(), 0.1234567890123)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeNullableDoubleLargestValue_316() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::DataModel::Nullable nullableFloatDoubleArgument; - nullableFloatDoubleArgument.SetNonNull(); - nullableFloatDoubleArgument.Value() = INFINITY; - - ReturnErrorOnFailure(cluster.WriteAttribute( - nullableFloatDoubleArgument, this, OnSuccessCallback_316, OnFailureCallback_316)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_316(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_316() { NextTest(); } - - CHIP_ERROR TestReadAttributeNullableDoubleLargestValue_317() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_317, OnFailureCallback_317, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_317(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_317(const chip::app::DataModel::Nullable & nullableFloatDouble) - { - VerifyOrReturn(CheckValueNonNull("nullableFloatDouble", nullableFloatDouble)); - VerifyOrReturn(CheckValue("nullableFloatDouble.Value()", nullableFloatDouble.Value(), INFINITY)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeNullableDoubleSmallestValue_318() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::DataModel::Nullable nullableFloatDoubleArgument; - nullableFloatDoubleArgument.SetNonNull(); - nullableFloatDoubleArgument.Value() = -INFINITY; - - ReturnErrorOnFailure(cluster.WriteAttribute( - nullableFloatDoubleArgument, this, OnSuccessCallback_318, OnFailureCallback_318)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_318(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_318() { NextTest(); } - - CHIP_ERROR TestReadAttributeNullableDoubleSmallestValue_319() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_319, OnFailureCallback_319, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_319(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_319(const chip::app::DataModel::Nullable & nullableFloatDouble) - { - VerifyOrReturn(CheckValueNonNull("nullableFloatDouble", nullableFloatDouble)); - VerifyOrReturn(CheckValue("nullableFloatDouble.Value()", nullableFloatDouble.Value(), -INFINITY)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeNullableDoubleNullValue_320() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::DataModel::Nullable nullableFloatDoubleArgument; - nullableFloatDoubleArgument.SetNull(); - - ReturnErrorOnFailure(cluster.WriteAttribute( - nullableFloatDoubleArgument, this, OnSuccessCallback_320, OnFailureCallback_320)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_320(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_320() { NextTest(); } - - CHIP_ERROR TestReadAttributeNullableDoubleNullValue_321() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_321, OnFailureCallback_321, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_321(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_321(const chip::app::DataModel::Nullable & nullableFloatDouble) - { - VerifyOrReturn(CheckValueNull("nullableFloatDouble", nullableFloatDouble)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeNullableDouble0Value_322() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::DataModel::Nullable nullableFloatDoubleArgument; - nullableFloatDoubleArgument.SetNonNull(); - nullableFloatDoubleArgument.Value() = 0; - - ReturnErrorOnFailure(cluster.WriteAttribute( - nullableFloatDoubleArgument, this, OnSuccessCallback_322, OnFailureCallback_322)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_322(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_322() { NextTest(); } - - CHIP_ERROR TestReadAttributeNullableDouble0Value_323() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_323, OnFailureCallback_323, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_323(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_323(const chip::app::DataModel::Nullable & nullableFloatDouble) - { - VerifyOrReturn(CheckValueNonNull("nullableFloatDouble", nullableFloatDouble)); - VerifyOrReturn(CheckValue("nullableFloatDouble.Value()", nullableFloatDouble.Value(), 0)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeNullableEnum8MinValue_324() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::DataModel::Nullable nullableEnum8Argument; - nullableEnum8Argument.SetNonNull(); - nullableEnum8Argument.Value() = 0; - - ReturnErrorOnFailure(cluster.WriteAttribute( - nullableEnum8Argument, this, OnSuccessCallback_324, OnFailureCallback_324)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_324(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_324() { NextTest(); } - - CHIP_ERROR TestReadAttributeNullableEnum8MinValue_325() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_325, OnFailureCallback_325, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_325(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_325(const chip::app::DataModel::Nullable & nullableEnum8) - { - VerifyOrReturn(CheckValueNonNull("nullableEnum8", nullableEnum8)); - VerifyOrReturn(CheckValue("nullableEnum8.Value()", nullableEnum8.Value(), 0)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeNullableEnum8MaxValue_326() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::DataModel::Nullable nullableEnum8Argument; - nullableEnum8Argument.SetNonNull(); - nullableEnum8Argument.Value() = 254; - - ReturnErrorOnFailure(cluster.WriteAttribute( - nullableEnum8Argument, this, OnSuccessCallback_326, OnFailureCallback_326)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_326(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_326() { NextTest(); } - - CHIP_ERROR TestReadAttributeNullableEnum8MaxValue_327() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_327, OnFailureCallback_327, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_327(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_327(const chip::app::DataModel::Nullable & nullableEnum8) - { - VerifyOrReturn(CheckValueNonNull("nullableEnum8", nullableEnum8)); - VerifyOrReturn(CheckValue("nullableEnum8.Value()", nullableEnum8.Value(), 254)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeNullableEnum8InvalidValue_328() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::DataModel::Nullable nullableEnum8Argument; - nullableEnum8Argument.SetNonNull(); - nullableEnum8Argument.Value() = 255; - - ReturnErrorOnFailure(cluster.WriteAttribute( - nullableEnum8Argument, this, OnSuccessCallback_328, OnFailureCallback_328)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_328(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - NextTest(); - } - - void OnSuccessResponse_328() { ThrowSuccessResponse(); } - - CHIP_ERROR TestReadAttributeNullableEnum8UnchangedValue_329() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_329, OnFailureCallback_329, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_329(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_329(const chip::app::DataModel::Nullable & nullableEnum8) - { - VerifyOrReturn(CheckValueNonNull("nullableEnum8", nullableEnum8)); - VerifyOrReturn(CheckValue("nullableEnum8.Value()", nullableEnum8.Value(), 254)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeNullableEnum8NullValue_330() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::DataModel::Nullable nullableEnum8Argument; - nullableEnum8Argument.SetNull(); - - ReturnErrorOnFailure(cluster.WriteAttribute( - nullableEnum8Argument, this, OnSuccessCallback_330, OnFailureCallback_330)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_330(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_330() { NextTest(); } - - CHIP_ERROR TestReadAttributeNullableEnum8NullValue_331() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_331, OnFailureCallback_331, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_331(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_331(const chip::app::DataModel::Nullable & nullableEnum8) - { - VerifyOrReturn(CheckValueNull("nullableEnum8", nullableEnum8)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeNullableEnum16MinValue_332() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::DataModel::Nullable nullableEnum16Argument; - nullableEnum16Argument.SetNonNull(); - nullableEnum16Argument.Value() = 0U; - - ReturnErrorOnFailure(cluster.WriteAttribute( - nullableEnum16Argument, this, OnSuccessCallback_332, OnFailureCallback_332)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_332(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_332() { NextTest(); } - - CHIP_ERROR TestReadAttributeNullableEnum16MinValue_333() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_333, OnFailureCallback_333, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_333(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_333(const chip::app::DataModel::Nullable & nullableEnum16) - { - VerifyOrReturn(CheckValueNonNull("nullableEnum16", nullableEnum16)); - VerifyOrReturn(CheckValue("nullableEnum16.Value()", nullableEnum16.Value(), 0U)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeNullableEnum16MaxValue_334() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::DataModel::Nullable nullableEnum16Argument; - nullableEnum16Argument.SetNonNull(); - nullableEnum16Argument.Value() = 65534U; - - ReturnErrorOnFailure(cluster.WriteAttribute( - nullableEnum16Argument, this, OnSuccessCallback_334, OnFailureCallback_334)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_334(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_334() { NextTest(); } - - CHIP_ERROR TestReadAttributeNullableEnum16MaxValue_335() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_335, OnFailureCallback_335, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_335(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_335(const chip::app::DataModel::Nullable & nullableEnum16) - { - VerifyOrReturn(CheckValueNonNull("nullableEnum16", nullableEnum16)); - VerifyOrReturn(CheckValue("nullableEnum16.Value()", nullableEnum16.Value(), 65534U)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeNullableEnum16InvalidValue_336() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::DataModel::Nullable nullableEnum16Argument; - nullableEnum16Argument.SetNonNull(); - nullableEnum16Argument.Value() = 65535U; - - ReturnErrorOnFailure(cluster.WriteAttribute( - nullableEnum16Argument, this, OnSuccessCallback_336, OnFailureCallback_336)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_336(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - NextTest(); - } - - void OnSuccessResponse_336() { ThrowSuccessResponse(); } - - CHIP_ERROR TestReadAttributeNullableEnum16UnchangedValue_337() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_337, OnFailureCallback_337, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_337(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_337(const chip::app::DataModel::Nullable & nullableEnum16) - { - VerifyOrReturn(CheckValueNonNull("nullableEnum16", nullableEnum16)); - VerifyOrReturn(CheckValue("nullableEnum16.Value()", nullableEnum16.Value(), 65534U)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeNullableEnum16NullValue_338() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::DataModel::Nullable nullableEnum16Argument; - nullableEnum16Argument.SetNull(); - - ReturnErrorOnFailure(cluster.WriteAttribute( - nullableEnum16Argument, this, OnSuccessCallback_338, OnFailureCallback_338)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_338(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_338() { NextTest(); } - - CHIP_ERROR TestReadAttributeNullableEnum16NullValue_339() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_339, OnFailureCallback_339, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_339(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_339(const chip::app::DataModel::Nullable & nullableEnum16) - { - VerifyOrReturn(CheckValueNull("nullableEnum16", nullableEnum16)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeNullableSimpleEnumMinValue_340() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::DataModel::Nullable nullableEnumAttrArgument; - nullableEnumAttrArgument.SetNonNull(); - nullableEnumAttrArgument.Value() = static_cast(0); - - ReturnErrorOnFailure(cluster.WriteAttribute( - nullableEnumAttrArgument, this, OnSuccessCallback_340, OnFailureCallback_340)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_340(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_340() { NextTest(); } - - CHIP_ERROR TestReadAttributeNullableSimpleEnumMinValue_341() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_341, OnFailureCallback_341, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_341(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void - OnSuccessResponse_341(const chip::app::DataModel::Nullable & nullableEnumAttr) - { - VerifyOrReturn(CheckValueNonNull("nullableEnumAttr", nullableEnumAttr)); - VerifyOrReturn(CheckValue("nullableEnumAttr.Value()", nullableEnumAttr.Value(), 0)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeNullableSimpleEnumMaxValue_342() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::DataModel::Nullable nullableEnumAttrArgument; - nullableEnumAttrArgument.SetNonNull(); - nullableEnumAttrArgument.Value() = static_cast(254); - - ReturnErrorOnFailure(cluster.WriteAttribute( - nullableEnumAttrArgument, this, OnSuccessCallback_342, OnFailureCallback_342)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_342(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_342() { NextTest(); } - - CHIP_ERROR TestReadAttributeNullableSimpleEnumMaxValue_343() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_343, OnFailureCallback_343, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_343(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void - OnSuccessResponse_343(const chip::app::DataModel::Nullable & nullableEnumAttr) - { - VerifyOrReturn(CheckValueNonNull("nullableEnumAttr", nullableEnumAttr)); - VerifyOrReturn(CheckValue("nullableEnumAttr.Value()", nullableEnumAttr.Value(), 254)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeNullableSimpleEnumInvalidValue_344() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::DataModel::Nullable nullableEnumAttrArgument; - nullableEnumAttrArgument.SetNonNull(); - nullableEnumAttrArgument.Value() = static_cast(255); - - ReturnErrorOnFailure(cluster.WriteAttribute( - nullableEnumAttrArgument, this, OnSuccessCallback_344, OnFailureCallback_344)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_344(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - NextTest(); - } - - void OnSuccessResponse_344() { ThrowSuccessResponse(); } - - CHIP_ERROR TestReadAttributeNullableSimpleEnumUnchangedValue_345() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_345, OnFailureCallback_345, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_345(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void - OnSuccessResponse_345(const chip::app::DataModel::Nullable & nullableEnumAttr) - { - VerifyOrReturn(CheckValueNonNull("nullableEnumAttr", nullableEnumAttr)); - VerifyOrReturn(CheckValue("nullableEnumAttr.Value()", nullableEnumAttr.Value(), 254)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeNullableSimpleEnumNullValue_346() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::DataModel::Nullable nullableEnumAttrArgument; - nullableEnumAttrArgument.SetNull(); - - ReturnErrorOnFailure(cluster.WriteAttribute( - nullableEnumAttrArgument, this, OnSuccessCallback_346, OnFailureCallback_346)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_346(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_346() { NextTest(); } - - CHIP_ERROR TestReadAttributeNullableSimpleEnumNullValue_347() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_347, OnFailureCallback_347, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_347(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void - OnSuccessResponse_347(const chip::app::DataModel::Nullable & nullableEnumAttr) - { - VerifyOrReturn(CheckValueNull("nullableEnumAttr", nullableEnumAttr)); - - NextTest(); - } - - CHIP_ERROR TestReadAttributeNullableOctetStringDefaultValue_348() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_348, OnFailureCallback_348, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_348(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_348(const chip::app::DataModel::Nullable & nullableOctetString) - { - VerifyOrReturn(CheckValueNonNull("nullableOctetString", nullableOctetString)); - VerifyOrReturn(CheckValueAsString("nullableOctetString.Value()", nullableOctetString.Value(), - chip::ByteSpan(chip::Uint8::from_const_char(""), 0))); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeNullableOctetString_349() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::DataModel::Nullable nullableOctetStringArgument; - nullableOctetStringArgument.SetNonNull(); - nullableOctetStringArgument.Value() = - chip::ByteSpan(chip::Uint8::from_const_char("TestValuegarbage: not in length on purpose"), 9); - - ReturnErrorOnFailure(cluster.WriteAttribute( - nullableOctetStringArgument, this, OnSuccessCallback_349, OnFailureCallback_349)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_349(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_349() { NextTest(); } - - CHIP_ERROR TestReadAttributeNullableOctetString_350() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_350, OnFailureCallback_350, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_350(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_350(const chip::app::DataModel::Nullable & nullableOctetString) - { - VerifyOrReturn(CheckValueNonNull("nullableOctetString", nullableOctetString)); - VerifyOrReturn(CheckValueAsString("nullableOctetString.Value()", nullableOctetString.Value(), - chip::ByteSpan(chip::Uint8::from_const_char("TestValue"), 9))); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeNullableOctetString_351() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::DataModel::Nullable nullableOctetStringArgument; - nullableOctetStringArgument.SetNull(); - - ReturnErrorOnFailure(cluster.WriteAttribute( - nullableOctetStringArgument, this, OnSuccessCallback_351, OnFailureCallback_351)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_351(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_351() { NextTest(); } - - CHIP_ERROR TestReadAttributeNullableOctetString_352() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_352, OnFailureCallback_352, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_352(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_352(const chip::app::DataModel::Nullable & nullableOctetString) - { - VerifyOrReturn(CheckValueNull("nullableOctetString", nullableOctetString)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeNullableOctetString_353() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::DataModel::Nullable nullableOctetStringArgument; - nullableOctetStringArgument.SetNonNull(); - nullableOctetStringArgument.Value() = chip::ByteSpan(chip::Uint8::from_const_char("garbage: not in length on purpose"), 0); - - ReturnErrorOnFailure(cluster.WriteAttribute( - nullableOctetStringArgument, this, OnSuccessCallback_353, OnFailureCallback_353)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_353(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_353() { NextTest(); } - - CHIP_ERROR TestReadAttributeNullableOctetString_354() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_354, OnFailureCallback_354, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_354(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_354(const chip::app::DataModel::Nullable & nullableOctetString) - { - VerifyOrReturn(CheckValueNonNull("nullableOctetString", nullableOctetString)); - VerifyOrReturn(CheckValueAsString("nullableOctetString.Value()", nullableOctetString.Value(), - chip::ByteSpan(chip::Uint8::from_const_char(""), 0))); - - NextTest(); - } - - CHIP_ERROR TestReadAttributeNullableCharStringDefaultValue_355() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_355, OnFailureCallback_355, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_355(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_355(const chip::app::DataModel::Nullable & nullableCharString) - { - VerifyOrReturn(CheckValueNonNull("nullableCharString", nullableCharString)); - VerifyOrReturn(CheckValueAsString("nullableCharString.Value()", nullableCharString.Value(), chip::CharSpan("", 0))); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeNullableCharString_356() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::DataModel::Nullable nullableCharStringArgument; - nullableCharStringArgument.SetNonNull(); - nullableCharStringArgument.Value() = chip::Span("☉T☉garbage: not in length on purpose", 7); - - ReturnErrorOnFailure(cluster.WriteAttribute( - nullableCharStringArgument, this, OnSuccessCallback_356, OnFailureCallback_356)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_356(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_356() { NextTest(); } - - CHIP_ERROR TestReadAttributeNullableCharString_357() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_357, OnFailureCallback_357, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_357(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_357(const chip::app::DataModel::Nullable & nullableCharString) - { - VerifyOrReturn(CheckValueNonNull("nullableCharString", nullableCharString)); - VerifyOrReturn(CheckValueAsString("nullableCharString.Value()", nullableCharString.Value(), chip::CharSpan("☉T☉", 7))); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeNullableCharStringValueTooLong_358() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::DataModel::Nullable nullableCharStringArgument; - nullableCharStringArgument.SetNull(); - - ReturnErrorOnFailure(cluster.WriteAttribute( - nullableCharStringArgument, this, OnSuccessCallback_358, OnFailureCallback_358)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_358(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_358() { NextTest(); } - - CHIP_ERROR TestReadAttributeNullableCharString_359() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_359, OnFailureCallback_359, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_359(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_359(const chip::app::DataModel::Nullable & nullableCharString) - { - VerifyOrReturn(CheckValueNull("nullableCharString", nullableCharString)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeNullableCharStringEmpty_360() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::DataModel::Nullable nullableCharStringArgument; - nullableCharStringArgument.SetNonNull(); - nullableCharStringArgument.Value() = chip::Span("garbage: not in length on purpose", 0); - - ReturnErrorOnFailure(cluster.WriteAttribute( - nullableCharStringArgument, this, OnSuccessCallback_360, OnFailureCallback_360)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_360(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_360() { NextTest(); } - - CHIP_ERROR TestReadAttributeNullableCharString_361() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_361, OnFailureCallback_361, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_361(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_361(const chip::app::DataModel::Nullable & nullableCharString) - { - VerifyOrReturn(CheckValueNonNull("nullableCharString", nullableCharString)); - VerifyOrReturn(CheckValueAsString("nullableCharString.Value()", nullableCharString.Value(), chip::CharSpan("", 0))); - - NextTest(); - } - - CHIP_ERROR TestReadAttributeFromNonexistentEndpoint_362() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 200; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_362, OnFailureCallback_362, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_362(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_ENDPOINT)); - NextTest(); - } - - void OnSuccessResponse_362(const chip::app::DataModel::DecodableList & listInt8u) { ThrowSuccessResponse(); } - - CHIP_ERROR TestReadAttributeFromNonexistentCluster_363() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_363, OnFailureCallback_363, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_363(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_CLUSTER)); - NextTest(); - } - - void OnSuccessResponse_363(const chip::app::DataModel::DecodableList & listInt8u) { ThrowSuccessResponse(); } - - CHIP_ERROR TestSendACommandThatTakesAnOptionalParameterButDoNotSetIt_364() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::TestCluster::Commands::TestSimpleOptionalArgumentRequest::Type; - - RequestType request; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_364(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_364(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_364(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_VALUE)); - NextTest(); - } - - void OnSuccessResponse_364() { ThrowSuccessResponse(); } - - CHIP_ERROR TestSendACommandThatTakesAnOptionalParameterButDoNotSetIt_365() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::TestCluster::Commands::TestSimpleOptionalArgumentRequest::Type; - - RequestType request; - request.arg1.Emplace(); - request.arg1.Value() = 1; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_365(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_365(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_365(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_365() { NextTest(); } - - CHIP_ERROR TestReportSubscribeToListAttribute_366() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - mTest_TestCluster_list_int8u_Reported = OnSuccessCallback_366; - return WaitForMs(0); - } - - void OnFailureResponse_366(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_366(const chip::app::DataModel::DecodableList & listInt8u) - { - mReceivedReport_366 = true; - { - auto iter_0 = listInt8u.begin(); - VerifyOrReturn(CheckNextListItemDecodes("listInt8u", iter_0, 0)); - VerifyOrReturn(CheckValue("listInt8u[0]", iter_0.GetValue(), 1)); - VerifyOrReturn(CheckNextListItemDecodes("listInt8u", iter_0, 1)); - VerifyOrReturn(CheckValue("listInt8u[1]", iter_0.GetValue(), 2)); - VerifyOrReturn(CheckNextListItemDecodes("listInt8u", iter_0, 2)); - VerifyOrReturn(CheckValue("listInt8u[2]", iter_0.GetValue(), 3)); - VerifyOrReturn(CheckNextListItemDecodes("listInt8u", iter_0, 3)); - VerifyOrReturn(CheckValue("listInt8u[3]", iter_0.GetValue(), 4)); - VerifyOrReturn(CheckNoMoreListItems("listInt8u", iter_0, 4)); - } - } - - CHIP_ERROR TestSubscribeToListAttribute_367() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - uint16_t minIntervalArgument; - minIntervalArgument = 2U; - uint16_t maxIntervalArgument; - maxIntervalArgument = 5U; - - ReturnErrorOnFailure(cluster.SubscribeAttribute( - this, OnSuccessCallback_367, OnFailureCallback_367, minIntervalArgument, maxIntervalArgument, - OnSubscriptionEstablished_367, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_367(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_367(const chip::app::DataModel::DecodableList & value) - { - if (mTest_TestCluster_list_int8u_Reported) - { - auto callback = mTest_TestCluster_list_int8u_Reported; - mTest_TestCluster_list_int8u_Reported = nullptr; - callback(this, value); - } - } - - void OnSubscriptionEstablishedResponse_367() - { - VerifyOrReturn(mReceivedReport_366, Exit("Initial report not received!")); - NextTest(); - } - - CHIP_ERROR TestWriteSubscribedToListAttribute_368() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ListFreer listFreer; - chip::app::DataModel::List listInt8uArgument; - - { - auto * listHolder_0 = new ListHolder(4); - listFreer.add(listHolder_0); - listHolder_0->mList[0] = 5; - listHolder_0->mList[1] = 6; - listHolder_0->mList[2] = 7; - listHolder_0->mList[3] = 8; - listInt8uArgument = chip::app::DataModel::List(listHolder_0->mList, 4); - } - - ReturnErrorOnFailure(cluster.WriteAttribute( - listInt8uArgument, this, OnSuccessCallback_368, OnFailureCallback_368)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_368(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_368() { NextTest(); } - - CHIP_ERROR TestCheckForListAttributeReport_369() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - mTest_TestCluster_list_int8u_Reported = OnSuccessCallback_369; - return CHIP_NO_ERROR; - } - - void OnFailureResponse_369(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_369(const chip::app::DataModel::DecodableList & listInt8u) - { - mReceivedReport_369 = true; - { - auto iter_0 = listInt8u.begin(); - VerifyOrReturn(CheckNextListItemDecodes("listInt8u", iter_0, 0)); - VerifyOrReturn(CheckValue("listInt8u[0]", iter_0.GetValue(), 5)); - VerifyOrReturn(CheckNextListItemDecodes("listInt8u", iter_0, 1)); - VerifyOrReturn(CheckValue("listInt8u[1]", iter_0.GetValue(), 6)); - VerifyOrReturn(CheckNextListItemDecodes("listInt8u", iter_0, 2)); - VerifyOrReturn(CheckValue("listInt8u[2]", iter_0.GetValue(), 7)); - VerifyOrReturn(CheckNextListItemDecodes("listInt8u", iter_0, 3)); - VerifyOrReturn(CheckValue("listInt8u[3]", iter_0.GetValue(), 8)); - VerifyOrReturn(CheckNoMoreListItems("listInt8u", iter_0, 4)); - } - - NextTest(); - } - - CHIP_ERROR TestReadRangeRestrictedUnsigned8BitInteger_370() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_370, OnFailureCallback_370, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_370(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_370(uint8_t rangeRestrictedInt8u) - { - VerifyOrReturn(CheckValue("rangeRestrictedInt8u", rangeRestrictedInt8u, 70)); - - NextTest(); - } - - CHIP_ERROR TestWriteMinValueToARangeRestrictedUnsigned8BitInteger_371() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - uint8_t rangeRestrictedInt8uArgument; - rangeRestrictedInt8uArgument = 0; - - ReturnErrorOnFailure(cluster.WriteAttribute( - rangeRestrictedInt8uArgument, this, OnSuccessCallback_371, OnFailureCallback_371)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_371(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - NextTest(); - } - - void OnSuccessResponse_371() { ThrowSuccessResponse(); } - - CHIP_ERROR TestWriteJustBelowRangeValueToARangeRestrictedUnsigned8BitInteger_372() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - uint8_t rangeRestrictedInt8uArgument; - rangeRestrictedInt8uArgument = 19; - - ReturnErrorOnFailure(cluster.WriteAttribute( - rangeRestrictedInt8uArgument, this, OnSuccessCallback_372, OnFailureCallback_372)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_372(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - NextTest(); - } - - void OnSuccessResponse_372() { ThrowSuccessResponse(); } - - CHIP_ERROR TestWriteJustAboveRangeValueToARangeRestrictedUnsigned8BitInteger_373() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - uint8_t rangeRestrictedInt8uArgument; - rangeRestrictedInt8uArgument = 101; - - ReturnErrorOnFailure(cluster.WriteAttribute( - rangeRestrictedInt8uArgument, this, OnSuccessCallback_373, OnFailureCallback_373)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_373(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - NextTest(); - } - - void OnSuccessResponse_373() { ThrowSuccessResponse(); } - - CHIP_ERROR TestWriteMaxValueToARangeRestrictedUnsigned8BitInteger_374() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - uint8_t rangeRestrictedInt8uArgument; - rangeRestrictedInt8uArgument = 255; - - ReturnErrorOnFailure(cluster.WriteAttribute( - rangeRestrictedInt8uArgument, this, OnSuccessCallback_374, OnFailureCallback_374)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_374(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - NextTest(); - } - - void OnSuccessResponse_374() { ThrowSuccessResponse(); } - - CHIP_ERROR TestVerifyRangeRestrictedUnsigned8BitIntegerValueHasNotChanged_375() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_375, OnFailureCallback_375, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_375(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_375(uint8_t rangeRestrictedInt8u) - { - VerifyOrReturn(CheckValue("rangeRestrictedInt8u", rangeRestrictedInt8u, 70)); - - NextTest(); - } - - CHIP_ERROR TestWriteMinValidValueToARangeRestrictedUnsigned8BitInteger_376() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - uint8_t rangeRestrictedInt8uArgument; - rangeRestrictedInt8uArgument = 20; - - ReturnErrorOnFailure(cluster.WriteAttribute( - rangeRestrictedInt8uArgument, this, OnSuccessCallback_376, OnFailureCallback_376)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_376(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_376() { NextTest(); } - - CHIP_ERROR TestVerifyRangeRestrictedUnsigned8BitIntegerValueIsAtMinValid_377() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_377, OnFailureCallback_377, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_377(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_377(uint8_t rangeRestrictedInt8u) - { - VerifyOrReturn(CheckValue("rangeRestrictedInt8u", rangeRestrictedInt8u, 20)); - - NextTest(); - } - - CHIP_ERROR TestWriteMaxValidValueToARangeRestrictedUnsigned8BitInteger_378() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - uint8_t rangeRestrictedInt8uArgument; - rangeRestrictedInt8uArgument = 100; - - ReturnErrorOnFailure(cluster.WriteAttribute( - rangeRestrictedInt8uArgument, this, OnSuccessCallback_378, OnFailureCallback_378)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_378(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_378() { NextTest(); } - - CHIP_ERROR TestVerifyRangeRestrictedUnsigned8BitIntegerValueIsAtMaxValid_379() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_379, OnFailureCallback_379, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_379(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_379(uint8_t rangeRestrictedInt8u) - { - VerifyOrReturn(CheckValue("rangeRestrictedInt8u", rangeRestrictedInt8u, 100)); - - NextTest(); - } - - CHIP_ERROR TestWriteMiddleValidValueToARangeRestrictedUnsigned8BitInteger_380() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - uint8_t rangeRestrictedInt8uArgument; - rangeRestrictedInt8uArgument = 50; - - ReturnErrorOnFailure(cluster.WriteAttribute( - rangeRestrictedInt8uArgument, this, OnSuccessCallback_380, OnFailureCallback_380)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_380(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_380() { NextTest(); } - - CHIP_ERROR TestVerifyRangeRestrictedUnsigned8BitIntegerValueIsAtMidValid_381() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_381, OnFailureCallback_381, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_381(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_381(uint8_t rangeRestrictedInt8u) - { - VerifyOrReturn(CheckValue("rangeRestrictedInt8u", rangeRestrictedInt8u, 50)); - - NextTest(); - } - - CHIP_ERROR TestReadRangeRestrictedUnsigned16BitInteger_382() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_382, OnFailureCallback_382, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_382(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_382(uint16_t rangeRestrictedInt16u) - { - VerifyOrReturn(CheckValue("rangeRestrictedInt16u", rangeRestrictedInt16u, 200U)); - - NextTest(); - } - - CHIP_ERROR TestWriteMinValueToARangeRestrictedUnsigned16BitInteger_383() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - uint16_t rangeRestrictedInt16uArgument; - rangeRestrictedInt16uArgument = 0U; - - ReturnErrorOnFailure(cluster.WriteAttribute( - rangeRestrictedInt16uArgument, this, OnSuccessCallback_383, OnFailureCallback_383)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_383(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - NextTest(); - } - - void OnSuccessResponse_383() { ThrowSuccessResponse(); } - - CHIP_ERROR TestWriteJustBelowRangeValueToARangeRestrictedUnsigned16BitInteger_384() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - uint16_t rangeRestrictedInt16uArgument; - rangeRestrictedInt16uArgument = 99U; - - ReturnErrorOnFailure(cluster.WriteAttribute( - rangeRestrictedInt16uArgument, this, OnSuccessCallback_384, OnFailureCallback_384)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_384(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - NextTest(); - } - - void OnSuccessResponse_384() { ThrowSuccessResponse(); } - - CHIP_ERROR TestWriteJustAboveRangeValueToARangeRestrictedUnsigned16BitInteger_385() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - uint16_t rangeRestrictedInt16uArgument; - rangeRestrictedInt16uArgument = 1001U; - - ReturnErrorOnFailure(cluster.WriteAttribute( - rangeRestrictedInt16uArgument, this, OnSuccessCallback_385, OnFailureCallback_385)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_385(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - NextTest(); - } - - void OnSuccessResponse_385() { ThrowSuccessResponse(); } - - CHIP_ERROR TestWriteMaxValueToARangeRestrictedUnsigned16BitInteger_386() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - uint16_t rangeRestrictedInt16uArgument; - rangeRestrictedInt16uArgument = 65535U; - - ReturnErrorOnFailure(cluster.WriteAttribute( - rangeRestrictedInt16uArgument, this, OnSuccessCallback_386, OnFailureCallback_386)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_386(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - NextTest(); - } - - void OnSuccessResponse_386() { ThrowSuccessResponse(); } - - CHIP_ERROR TestVerifyRangeRestrictedUnsigned16BitIntegerValueHasNotChanged_387() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_387, OnFailureCallback_387, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_387(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_387(uint16_t rangeRestrictedInt16u) - { - VerifyOrReturn(CheckValue("rangeRestrictedInt16u", rangeRestrictedInt16u, 200U)); - - NextTest(); - } - - CHIP_ERROR TestWriteMinValidValueToARangeRestrictedUnsigned16BitInteger_388() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - uint16_t rangeRestrictedInt16uArgument; - rangeRestrictedInt16uArgument = 100U; - - ReturnErrorOnFailure(cluster.WriteAttribute( - rangeRestrictedInt16uArgument, this, OnSuccessCallback_388, OnFailureCallback_388)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_388(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_388() { NextTest(); } - - CHIP_ERROR TestVerifyRangeRestrictedUnsigned16BitIntegerValueIsAtMinValid_389() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_389, OnFailureCallback_389, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_389(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_389(uint16_t rangeRestrictedInt16u) - { - VerifyOrReturn(CheckValue("rangeRestrictedInt16u", rangeRestrictedInt16u, 100U)); - - NextTest(); - } - - CHIP_ERROR TestWriteMaxValidValueToARangeRestrictedUnsigned16BitInteger_390() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - uint16_t rangeRestrictedInt16uArgument; - rangeRestrictedInt16uArgument = 1000U; - - ReturnErrorOnFailure(cluster.WriteAttribute( - rangeRestrictedInt16uArgument, this, OnSuccessCallback_390, OnFailureCallback_390)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_390(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_390() { NextTest(); } - - CHIP_ERROR TestVerifyRangeRestrictedUnsigned16BitIntegerValueIsAtMaxValid_391() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_391, OnFailureCallback_391, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_391(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_391(uint16_t rangeRestrictedInt16u) - { - VerifyOrReturn(CheckValue("rangeRestrictedInt16u", rangeRestrictedInt16u, 1000U)); - - NextTest(); - } - - CHIP_ERROR TestWriteMiddleValidValueToARangeRestrictedUnsigned16BitInteger_392() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - uint16_t rangeRestrictedInt16uArgument; - rangeRestrictedInt16uArgument = 500U; - - ReturnErrorOnFailure(cluster.WriteAttribute( - rangeRestrictedInt16uArgument, this, OnSuccessCallback_392, OnFailureCallback_392)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_392(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_392() { NextTest(); } - - CHIP_ERROR TestVerifyRangeRestrictedUnsigned16BitIntegerValueIsAtMidValid_393() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_393, OnFailureCallback_393, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_393(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_393(uint16_t rangeRestrictedInt16u) - { - VerifyOrReturn(CheckValue("rangeRestrictedInt16u", rangeRestrictedInt16u, 500U)); - - NextTest(); - } - - CHIP_ERROR TestReadRangeRestrictedSigned8BitInteger_394() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_394, OnFailureCallback_394, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_394(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_394(int8_t rangeRestrictedInt8s) - { - VerifyOrReturn(CheckValue("rangeRestrictedInt8s", rangeRestrictedInt8s, -20)); - - NextTest(); - } - - CHIP_ERROR TestWriteMinValueToARangeRestrictedSigned8BitInteger_395() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - int8_t rangeRestrictedInt8sArgument; - rangeRestrictedInt8sArgument = -128; - - ReturnErrorOnFailure(cluster.WriteAttribute( - rangeRestrictedInt8sArgument, this, OnSuccessCallback_395, OnFailureCallback_395)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_395(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - NextTest(); - } - - void OnSuccessResponse_395() { ThrowSuccessResponse(); } - - CHIP_ERROR TestWriteJustBelowRangeValueToARangeRestrictedSigned8BitInteger_396() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - int8_t rangeRestrictedInt8sArgument; - rangeRestrictedInt8sArgument = -41; - - ReturnErrorOnFailure(cluster.WriteAttribute( - rangeRestrictedInt8sArgument, this, OnSuccessCallback_396, OnFailureCallback_396)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_396(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - NextTest(); - } - - void OnSuccessResponse_396() { ThrowSuccessResponse(); } - - CHIP_ERROR TestWriteJustAboveRangeValueToARangeRestrictedSigned8BitInteger_397() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - int8_t rangeRestrictedInt8sArgument; - rangeRestrictedInt8sArgument = 51; - - ReturnErrorOnFailure(cluster.WriteAttribute( - rangeRestrictedInt8sArgument, this, OnSuccessCallback_397, OnFailureCallback_397)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_397(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - NextTest(); - } - - void OnSuccessResponse_397() { ThrowSuccessResponse(); } - - CHIP_ERROR TestWriteMaxValueToARangeRestrictedSigned8BitInteger_398() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - int8_t rangeRestrictedInt8sArgument; - rangeRestrictedInt8sArgument = 127; - - ReturnErrorOnFailure(cluster.WriteAttribute( - rangeRestrictedInt8sArgument, this, OnSuccessCallback_398, OnFailureCallback_398)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_398(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - NextTest(); - } - - void OnSuccessResponse_398() { ThrowSuccessResponse(); } - - CHIP_ERROR TestVerifyRangeRestrictedSigned8BitIntegerValueHasNotChanged_399() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_399, OnFailureCallback_399, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_399(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_399(int8_t rangeRestrictedInt8s) - { - VerifyOrReturn(CheckValue("rangeRestrictedInt8s", rangeRestrictedInt8s, -20)); - - NextTest(); - } - - CHIP_ERROR TestWriteMinValidValueToARangeRestrictedSigned8BitInteger_400() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - int8_t rangeRestrictedInt8sArgument; - rangeRestrictedInt8sArgument = -40; - - ReturnErrorOnFailure(cluster.WriteAttribute( - rangeRestrictedInt8sArgument, this, OnSuccessCallback_400, OnFailureCallback_400)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_400(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_400() { NextTest(); } - - CHIP_ERROR TestVerifyRangeRestrictedSigned8BitIntegerValueIsAtMinValid_401() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_401, OnFailureCallback_401, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_401(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_401(int8_t rangeRestrictedInt8s) - { - VerifyOrReturn(CheckValue("rangeRestrictedInt8s", rangeRestrictedInt8s, -40)); - - NextTest(); - } - - CHIP_ERROR TestWriteMaxValidValueToARangeRestrictedSigned8BitInteger_402() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - int8_t rangeRestrictedInt8sArgument; - rangeRestrictedInt8sArgument = 50; - - ReturnErrorOnFailure(cluster.WriteAttribute( - rangeRestrictedInt8sArgument, this, OnSuccessCallback_402, OnFailureCallback_402)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_402(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_402() { NextTest(); } - - CHIP_ERROR TestVerifyRangeRestrictedSigned8BitIntegerValueIsAtMaxValid_403() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_403, OnFailureCallback_403, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_403(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_403(int8_t rangeRestrictedInt8s) - { - VerifyOrReturn(CheckValue("rangeRestrictedInt8s", rangeRestrictedInt8s, 50)); - - NextTest(); - } - - CHIP_ERROR TestWriteMiddleValidValueToARangeRestrictedSigned8BitInteger_404() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - int8_t rangeRestrictedInt8sArgument; - rangeRestrictedInt8sArgument = 6; - - ReturnErrorOnFailure(cluster.WriteAttribute( - rangeRestrictedInt8sArgument, this, OnSuccessCallback_404, OnFailureCallback_404)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_404(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_404() { NextTest(); } - - CHIP_ERROR TestVerifyRangeRestrictedSigned8BitIntegerValueIsAtMidValid_405() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_405, OnFailureCallback_405, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_405(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_405(int8_t rangeRestrictedInt8s) - { - VerifyOrReturn(CheckValue("rangeRestrictedInt8s", rangeRestrictedInt8s, 6)); - - NextTest(); - } - - CHIP_ERROR TestReadRangeRestrictedSigned16BitInteger_406() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_406, OnFailureCallback_406, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_406(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_406(int16_t rangeRestrictedInt16s) - { - VerifyOrReturn(CheckValue("rangeRestrictedInt16s", rangeRestrictedInt16s, -100)); - - NextTest(); - } - - CHIP_ERROR TestWriteMinValueToARangeRestrictedSigned16BitInteger_407() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - int16_t rangeRestrictedInt16sArgument; - rangeRestrictedInt16sArgument = -32768; - - ReturnErrorOnFailure(cluster.WriteAttribute( - rangeRestrictedInt16sArgument, this, OnSuccessCallback_407, OnFailureCallback_407)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_407(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - NextTest(); - } - - void OnSuccessResponse_407() { ThrowSuccessResponse(); } - - CHIP_ERROR TestWriteJustBelowRangeValueToARangeRestrictedSigned16BitInteger_408() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - int16_t rangeRestrictedInt16sArgument; - rangeRestrictedInt16sArgument = -151; - - ReturnErrorOnFailure(cluster.WriteAttribute( - rangeRestrictedInt16sArgument, this, OnSuccessCallback_408, OnFailureCallback_408)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_408(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - NextTest(); - } - - void OnSuccessResponse_408() { ThrowSuccessResponse(); } - - CHIP_ERROR TestWriteJustAboveRangeValueToARangeRestrictedSigned16BitInteger_409() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - int16_t rangeRestrictedInt16sArgument; - rangeRestrictedInt16sArgument = 201; - - ReturnErrorOnFailure(cluster.WriteAttribute( - rangeRestrictedInt16sArgument, this, OnSuccessCallback_409, OnFailureCallback_409)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_409(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - NextTest(); - } - - void OnSuccessResponse_409() { ThrowSuccessResponse(); } - - CHIP_ERROR TestWriteMaxValueToARangeRestrictedSigned16BitInteger_410() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - int16_t rangeRestrictedInt16sArgument; - rangeRestrictedInt16sArgument = 32767; - - ReturnErrorOnFailure(cluster.WriteAttribute( - rangeRestrictedInt16sArgument, this, OnSuccessCallback_410, OnFailureCallback_410)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_410(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - NextTest(); - } - - void OnSuccessResponse_410() { ThrowSuccessResponse(); } - - CHIP_ERROR TestVerifyRangeRestrictedSigned16BitIntegerValueHasNotChanged_411() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_411, OnFailureCallback_411, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_411(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_411(int16_t rangeRestrictedInt16s) - { - VerifyOrReturn(CheckValue("rangeRestrictedInt16s", rangeRestrictedInt16s, -100)); - - NextTest(); - } - - CHIP_ERROR TestWriteMinValidValueToARangeRestrictedSigned16BitInteger_412() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - int16_t rangeRestrictedInt16sArgument; - rangeRestrictedInt16sArgument = -150; - - ReturnErrorOnFailure(cluster.WriteAttribute( - rangeRestrictedInt16sArgument, this, OnSuccessCallback_412, OnFailureCallback_412)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_412(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_412() { NextTest(); } - - CHIP_ERROR TestVerifyRangeRestrictedSigned16BitIntegerValueIsAtMinValid_413() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_413, OnFailureCallback_413, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_413(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_413(int16_t rangeRestrictedInt16s) - { - VerifyOrReturn(CheckValue("rangeRestrictedInt16s", rangeRestrictedInt16s, -150)); - - NextTest(); - } - - CHIP_ERROR TestWriteMaxValidValueToARangeRestrictedSigned16BitInteger_414() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - int16_t rangeRestrictedInt16sArgument; - rangeRestrictedInt16sArgument = 200; - - ReturnErrorOnFailure(cluster.WriteAttribute( - rangeRestrictedInt16sArgument, this, OnSuccessCallback_414, OnFailureCallback_414)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_414(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_414() { NextTest(); } - - CHIP_ERROR TestVerifyRangeRestrictedSigned16BitIntegerValueIsAtMaxValid_415() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_415, OnFailureCallback_415, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_415(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_415(int16_t rangeRestrictedInt16s) - { - VerifyOrReturn(CheckValue("rangeRestrictedInt16s", rangeRestrictedInt16s, 200)); - - NextTest(); - } - - CHIP_ERROR TestWriteMiddleValidValueToARangeRestrictedSigned16BitInteger_416() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - int16_t rangeRestrictedInt16sArgument; - rangeRestrictedInt16sArgument = 7; - - ReturnErrorOnFailure(cluster.WriteAttribute( - rangeRestrictedInt16sArgument, this, OnSuccessCallback_416, OnFailureCallback_416)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_416(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_416() { NextTest(); } - - CHIP_ERROR TestVerifyRangeRestrictedSigned16BitIntegerValueIsAtMidValid_417() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_417, OnFailureCallback_417, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_417(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_417(int16_t rangeRestrictedInt16s) - { - VerifyOrReturn(CheckValue("rangeRestrictedInt16s", rangeRestrictedInt16s, 7)); - - NextTest(); - } - - CHIP_ERROR TestReadNullableRangeRestrictedUnsigned8BitInteger_418() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_418, OnFailureCallback_418, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_418(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_418(const chip::app::DataModel::Nullable & nullableRangeRestrictedInt8u) - { - VerifyOrReturn(CheckValueNonNull("nullableRangeRestrictedInt8u", nullableRangeRestrictedInt8u)); - VerifyOrReturn(CheckValue("nullableRangeRestrictedInt8u.Value()", nullableRangeRestrictedInt8u.Value(), 70)); - - NextTest(); - } - - CHIP_ERROR TestWriteMinValueToANullableRangeRestrictedUnsigned8BitInteger_419() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::DataModel::Nullable nullableRangeRestrictedInt8uArgument; - nullableRangeRestrictedInt8uArgument.SetNonNull(); - nullableRangeRestrictedInt8uArgument.Value() = 0; - - ReturnErrorOnFailure( - cluster.WriteAttribute( - nullableRangeRestrictedInt8uArgument, this, OnSuccessCallback_419, OnFailureCallback_419)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_419(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - NextTest(); - } - - void OnSuccessResponse_419() { ThrowSuccessResponse(); } - - CHIP_ERROR TestWriteJustBelowRangeValueToANullableRangeRestrictedUnsigned8BitInteger_420() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::DataModel::Nullable nullableRangeRestrictedInt8uArgument; - nullableRangeRestrictedInt8uArgument.SetNonNull(); - nullableRangeRestrictedInt8uArgument.Value() = 19; - - ReturnErrorOnFailure( - cluster.WriteAttribute( - nullableRangeRestrictedInt8uArgument, this, OnSuccessCallback_420, OnFailureCallback_420)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_420(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - NextTest(); - } - - void OnSuccessResponse_420() { ThrowSuccessResponse(); } - - CHIP_ERROR TestWriteJustAboveRangeValueToANullableRangeRestrictedUnsigned8BitInteger_421() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::DataModel::Nullable nullableRangeRestrictedInt8uArgument; - nullableRangeRestrictedInt8uArgument.SetNonNull(); - nullableRangeRestrictedInt8uArgument.Value() = 101; - - ReturnErrorOnFailure( - cluster.WriteAttribute( - nullableRangeRestrictedInt8uArgument, this, OnSuccessCallback_421, OnFailureCallback_421)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_421(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - NextTest(); - } - - void OnSuccessResponse_421() { ThrowSuccessResponse(); } - - CHIP_ERROR TestWriteMaxValueToANullableRangeRestrictedUnsigned8BitInteger_422() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::DataModel::Nullable nullableRangeRestrictedInt8uArgument; - nullableRangeRestrictedInt8uArgument.SetNonNull(); - nullableRangeRestrictedInt8uArgument.Value() = 254; - - ReturnErrorOnFailure( - cluster.WriteAttribute( - nullableRangeRestrictedInt8uArgument, this, OnSuccessCallback_422, OnFailureCallback_422)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_422(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - NextTest(); - } - - void OnSuccessResponse_422() { ThrowSuccessResponse(); } - - CHIP_ERROR TestVerifyNullableRangeRestrictedUnsigned8BitIntegerValueHasNotChanged_423() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_423, OnFailureCallback_423, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_423(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_423(const chip::app::DataModel::Nullable & nullableRangeRestrictedInt8u) - { - VerifyOrReturn(CheckValueNonNull("nullableRangeRestrictedInt8u", nullableRangeRestrictedInt8u)); - VerifyOrReturn(CheckValue("nullableRangeRestrictedInt8u.Value()", nullableRangeRestrictedInt8u.Value(), 70)); - - NextTest(); - } - - CHIP_ERROR TestWriteMinValidValueToANullableRangeRestrictedUnsigned8BitInteger_424() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::DataModel::Nullable nullableRangeRestrictedInt8uArgument; - nullableRangeRestrictedInt8uArgument.SetNonNull(); - nullableRangeRestrictedInt8uArgument.Value() = 20; - - ReturnErrorOnFailure( - cluster.WriteAttribute( - nullableRangeRestrictedInt8uArgument, this, OnSuccessCallback_424, OnFailureCallback_424)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_424(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_424() { NextTest(); } - - CHIP_ERROR TestVerifyNullableRangeRestrictedUnsigned8BitIntegerValueIsAtMinValid_425() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_425, OnFailureCallback_425, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_425(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_425(const chip::app::DataModel::Nullable & nullableRangeRestrictedInt8u) - { - VerifyOrReturn(CheckValueNonNull("nullableRangeRestrictedInt8u", nullableRangeRestrictedInt8u)); - VerifyOrReturn(CheckValue("nullableRangeRestrictedInt8u.Value()", nullableRangeRestrictedInt8u.Value(), 20)); - - NextTest(); - } - - CHIP_ERROR TestWriteMaxValidValueToANullableRangeRestrictedUnsigned8BitInteger_426() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::DataModel::Nullable nullableRangeRestrictedInt8uArgument; - nullableRangeRestrictedInt8uArgument.SetNonNull(); - nullableRangeRestrictedInt8uArgument.Value() = 100; - - ReturnErrorOnFailure( - cluster.WriteAttribute( - nullableRangeRestrictedInt8uArgument, this, OnSuccessCallback_426, OnFailureCallback_426)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_426(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_426() { NextTest(); } - - CHIP_ERROR TestVerifyNullableRangeRestrictedUnsigned8BitIntegerValueIsAtMaxValid_427() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_427, OnFailureCallback_427, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_427(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_427(const chip::app::DataModel::Nullable & nullableRangeRestrictedInt8u) - { - VerifyOrReturn(CheckValueNonNull("nullableRangeRestrictedInt8u", nullableRangeRestrictedInt8u)); - VerifyOrReturn(CheckValue("nullableRangeRestrictedInt8u.Value()", nullableRangeRestrictedInt8u.Value(), 100)); - - NextTest(); - } - - CHIP_ERROR TestWriteMiddleValidValueToANullableRangeRestrictedUnsigned8BitInteger_428() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::DataModel::Nullable nullableRangeRestrictedInt8uArgument; - nullableRangeRestrictedInt8uArgument.SetNonNull(); - nullableRangeRestrictedInt8uArgument.Value() = 50; - - ReturnErrorOnFailure( - cluster.WriteAttribute( - nullableRangeRestrictedInt8uArgument, this, OnSuccessCallback_428, OnFailureCallback_428)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_428(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_428() { NextTest(); } - - CHIP_ERROR TestVerifyNullableRangeRestrictedUnsigned8BitIntegerValueIsAtMidValid_429() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_429, OnFailureCallback_429, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_429(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_429(const chip::app::DataModel::Nullable & nullableRangeRestrictedInt8u) - { - VerifyOrReturn(CheckValueNonNull("nullableRangeRestrictedInt8u", nullableRangeRestrictedInt8u)); - VerifyOrReturn(CheckValue("nullableRangeRestrictedInt8u.Value()", nullableRangeRestrictedInt8u.Value(), 50)); - - NextTest(); - } - - CHIP_ERROR TestWriteNullValueToANullableRangeRestrictedUnsigned8BitInteger_430() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::DataModel::Nullable nullableRangeRestrictedInt8uArgument; - nullableRangeRestrictedInt8uArgument.SetNull(); - - ReturnErrorOnFailure( - cluster.WriteAttribute( - nullableRangeRestrictedInt8uArgument, this, OnSuccessCallback_430, OnFailureCallback_430)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_430(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_430() { NextTest(); } - - CHIP_ERROR TestVerifyNullableRangeRestrictedUnsigned8BitIntegerValueIsNull_431() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_431, OnFailureCallback_431, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_431(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_431(const chip::app::DataModel::Nullable & nullableRangeRestrictedInt8u) - { - VerifyOrReturn(CheckValueNull("nullableRangeRestrictedInt8u", nullableRangeRestrictedInt8u)); - - NextTest(); - } - - CHIP_ERROR TestReadNullableRangeRestrictedUnsigned16BitInteger_432() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_432, OnFailureCallback_432, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_432(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_432(const chip::app::DataModel::Nullable & nullableRangeRestrictedInt16u) - { - VerifyOrReturn(CheckValueNonNull("nullableRangeRestrictedInt16u", nullableRangeRestrictedInt16u)); - VerifyOrReturn(CheckValue("nullableRangeRestrictedInt16u.Value()", nullableRangeRestrictedInt16u.Value(), 200U)); - - NextTest(); - } - - CHIP_ERROR TestWriteMinValueToANullableRangeRestrictedUnsigned16BitInteger_433() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::DataModel::Nullable nullableRangeRestrictedInt16uArgument; - nullableRangeRestrictedInt16uArgument.SetNonNull(); - nullableRangeRestrictedInt16uArgument.Value() = 0U; - - ReturnErrorOnFailure( - cluster.WriteAttribute( - nullableRangeRestrictedInt16uArgument, this, OnSuccessCallback_433, OnFailureCallback_433)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_433(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - NextTest(); - } - - void OnSuccessResponse_433() { ThrowSuccessResponse(); } - - CHIP_ERROR TestWriteJustBelowRangeValueToANullableRangeRestrictedUnsigned16BitInteger_434() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::DataModel::Nullable nullableRangeRestrictedInt16uArgument; - nullableRangeRestrictedInt16uArgument.SetNonNull(); - nullableRangeRestrictedInt16uArgument.Value() = 99U; - - ReturnErrorOnFailure( - cluster.WriteAttribute( - nullableRangeRestrictedInt16uArgument, this, OnSuccessCallback_434, OnFailureCallback_434)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_434(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - NextTest(); - } - - void OnSuccessResponse_434() { ThrowSuccessResponse(); } - - CHIP_ERROR TestWriteJustAboveRangeValueToANullableRangeRestrictedUnsigned16BitInteger_435() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::DataModel::Nullable nullableRangeRestrictedInt16uArgument; - nullableRangeRestrictedInt16uArgument.SetNonNull(); - nullableRangeRestrictedInt16uArgument.Value() = 1001U; - - ReturnErrorOnFailure( - cluster.WriteAttribute( - nullableRangeRestrictedInt16uArgument, this, OnSuccessCallback_435, OnFailureCallback_435)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_435(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - NextTest(); - } - - void OnSuccessResponse_435() { ThrowSuccessResponse(); } - - CHIP_ERROR TestWriteMaxValueToANullableRangeRestrictedUnsigned16BitInteger_436() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::DataModel::Nullable nullableRangeRestrictedInt16uArgument; - nullableRangeRestrictedInt16uArgument.SetNonNull(); - nullableRangeRestrictedInt16uArgument.Value() = 65534U; - - ReturnErrorOnFailure( - cluster.WriteAttribute( - nullableRangeRestrictedInt16uArgument, this, OnSuccessCallback_436, OnFailureCallback_436)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_436(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - NextTest(); - } - - void OnSuccessResponse_436() { ThrowSuccessResponse(); } - - CHIP_ERROR TestVerifyNullableRangeRestrictedUnsigned16BitIntegerValueHasNotChanged_437() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_437, OnFailureCallback_437, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_437(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_437(const chip::app::DataModel::Nullable & nullableRangeRestrictedInt16u) - { - VerifyOrReturn(CheckValueNonNull("nullableRangeRestrictedInt16u", nullableRangeRestrictedInt16u)); - VerifyOrReturn(CheckValue("nullableRangeRestrictedInt16u.Value()", nullableRangeRestrictedInt16u.Value(), 200U)); - - NextTest(); - } - - CHIP_ERROR TestWriteMinValidValueToANullableRangeRestrictedUnsigned16BitInteger_438() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::DataModel::Nullable nullableRangeRestrictedInt16uArgument; - nullableRangeRestrictedInt16uArgument.SetNonNull(); - nullableRangeRestrictedInt16uArgument.Value() = 100U; - - ReturnErrorOnFailure( - cluster.WriteAttribute( - nullableRangeRestrictedInt16uArgument, this, OnSuccessCallback_438, OnFailureCallback_438)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_438(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_438() { NextTest(); } - - CHIP_ERROR TestVerifyNullableRangeRestrictedUnsigned16BitIntegerValueIsAtMinValid_439() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_439, OnFailureCallback_439, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_439(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_439(const chip::app::DataModel::Nullable & nullableRangeRestrictedInt16u) - { - VerifyOrReturn(CheckValueNonNull("nullableRangeRestrictedInt16u", nullableRangeRestrictedInt16u)); - VerifyOrReturn(CheckValue("nullableRangeRestrictedInt16u.Value()", nullableRangeRestrictedInt16u.Value(), 100U)); - - NextTest(); - } - - CHIP_ERROR TestWriteMaxValidValueToANullableRangeRestrictedUnsigned16BitInteger_440() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::DataModel::Nullable nullableRangeRestrictedInt16uArgument; - nullableRangeRestrictedInt16uArgument.SetNonNull(); - nullableRangeRestrictedInt16uArgument.Value() = 1000U; - - ReturnErrorOnFailure( - cluster.WriteAttribute( - nullableRangeRestrictedInt16uArgument, this, OnSuccessCallback_440, OnFailureCallback_440)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_440(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_440() { NextTest(); } - - CHIP_ERROR TestVerifyNullableRangeRestrictedUnsigned16BitIntegerValueIsAtMaxValid_441() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_441, OnFailureCallback_441, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_441(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_441(const chip::app::DataModel::Nullable & nullableRangeRestrictedInt16u) - { - VerifyOrReturn(CheckValueNonNull("nullableRangeRestrictedInt16u", nullableRangeRestrictedInt16u)); - VerifyOrReturn(CheckValue("nullableRangeRestrictedInt16u.Value()", nullableRangeRestrictedInt16u.Value(), 1000U)); - - NextTest(); - } - - CHIP_ERROR TestWriteMiddleValidValueToANullableRangeRestrictedUnsigned16BitInteger_442() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::DataModel::Nullable nullableRangeRestrictedInt16uArgument; - nullableRangeRestrictedInt16uArgument.SetNonNull(); - nullableRangeRestrictedInt16uArgument.Value() = 500U; - - ReturnErrorOnFailure( - cluster.WriteAttribute( - nullableRangeRestrictedInt16uArgument, this, OnSuccessCallback_442, OnFailureCallback_442)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_442(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_442() { NextTest(); } - - CHIP_ERROR TestVerifyNullableRangeRestrictedUnsigned16BitIntegerValueIsAtMidValid_443() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_443, OnFailureCallback_443, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_443(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_443(const chip::app::DataModel::Nullable & nullableRangeRestrictedInt16u) - { - VerifyOrReturn(CheckValueNonNull("nullableRangeRestrictedInt16u", nullableRangeRestrictedInt16u)); - VerifyOrReturn(CheckValue("nullableRangeRestrictedInt16u.Value()", nullableRangeRestrictedInt16u.Value(), 500U)); - - NextTest(); - } - - CHIP_ERROR TestWriteNullValueToANullableRangeRestrictedUnsigned16BitInteger_444() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::DataModel::Nullable nullableRangeRestrictedInt16uArgument; - nullableRangeRestrictedInt16uArgument.SetNull(); - - ReturnErrorOnFailure( - cluster.WriteAttribute( - nullableRangeRestrictedInt16uArgument, this, OnSuccessCallback_444, OnFailureCallback_444)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_444(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_444() { NextTest(); } - - CHIP_ERROR TestVerifyNullableRangeRestrictedUnsigned16BitIntegerValueIsNull_445() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_445, OnFailureCallback_445, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_445(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_445(const chip::app::DataModel::Nullable & nullableRangeRestrictedInt16u) - { - VerifyOrReturn(CheckValueNull("nullableRangeRestrictedInt16u", nullableRangeRestrictedInt16u)); - - NextTest(); - } - - CHIP_ERROR TestReadNullableRangeRestrictedSigned8BitInteger_446() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_446, OnFailureCallback_446, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_446(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_446(const chip::app::DataModel::Nullable & nullableRangeRestrictedInt8s) - { - VerifyOrReturn(CheckValueNonNull("nullableRangeRestrictedInt8s", nullableRangeRestrictedInt8s)); - VerifyOrReturn(CheckValue("nullableRangeRestrictedInt8s.Value()", nullableRangeRestrictedInt8s.Value(), -20)); - - NextTest(); - } - - CHIP_ERROR TestWriteMinValueToANullableRangeRestrictedSigned8BitInteger_447() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::DataModel::Nullable nullableRangeRestrictedInt8sArgument; - nullableRangeRestrictedInt8sArgument.SetNonNull(); - nullableRangeRestrictedInt8sArgument.Value() = -127; - - ReturnErrorOnFailure( - cluster.WriteAttribute( - nullableRangeRestrictedInt8sArgument, this, OnSuccessCallback_447, OnFailureCallback_447)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_447(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - NextTest(); - } - - void OnSuccessResponse_447() { ThrowSuccessResponse(); } - - CHIP_ERROR TestWriteJustBelowRangeValueToANullableRangeRestrictedSigned8BitInteger_448() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::DataModel::Nullable nullableRangeRestrictedInt8sArgument; - nullableRangeRestrictedInt8sArgument.SetNonNull(); - nullableRangeRestrictedInt8sArgument.Value() = -41; - - ReturnErrorOnFailure( - cluster.WriteAttribute( - nullableRangeRestrictedInt8sArgument, this, OnSuccessCallback_448, OnFailureCallback_448)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_448(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - NextTest(); - } - - void OnSuccessResponse_448() { ThrowSuccessResponse(); } - - CHIP_ERROR TestWriteJustAboveRangeValueToANullableRangeRestrictedSigned8BitInteger_449() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::DataModel::Nullable nullableRangeRestrictedInt8sArgument; - nullableRangeRestrictedInt8sArgument.SetNonNull(); - nullableRangeRestrictedInt8sArgument.Value() = 51; - - ReturnErrorOnFailure( - cluster.WriteAttribute( - nullableRangeRestrictedInt8sArgument, this, OnSuccessCallback_449, OnFailureCallback_449)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_449(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - NextTest(); - } - - void OnSuccessResponse_449() { ThrowSuccessResponse(); } - - CHIP_ERROR TestWriteMaxValueToANullableRangeRestrictedSigned8BitInteger_450() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::DataModel::Nullable nullableRangeRestrictedInt8sArgument; - nullableRangeRestrictedInt8sArgument.SetNonNull(); - nullableRangeRestrictedInt8sArgument.Value() = 127; - - ReturnErrorOnFailure( - cluster.WriteAttribute( - nullableRangeRestrictedInt8sArgument, this, OnSuccessCallback_450, OnFailureCallback_450)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_450(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - NextTest(); - } - - void OnSuccessResponse_450() { ThrowSuccessResponse(); } - - CHIP_ERROR TestVerifyNullableRangeRestrictedSigned8BitIntegerValueHasNotChanged_451() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_451, OnFailureCallback_451, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_451(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_451(const chip::app::DataModel::Nullable & nullableRangeRestrictedInt8s) - { - VerifyOrReturn(CheckValueNonNull("nullableRangeRestrictedInt8s", nullableRangeRestrictedInt8s)); - VerifyOrReturn(CheckValue("nullableRangeRestrictedInt8s.Value()", nullableRangeRestrictedInt8s.Value(), -20)); - - NextTest(); - } - - CHIP_ERROR TestWriteMinValidValueToANullableRangeRestrictedSigned8BitInteger_452() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::DataModel::Nullable nullableRangeRestrictedInt8sArgument; - nullableRangeRestrictedInt8sArgument.SetNonNull(); - nullableRangeRestrictedInt8sArgument.Value() = -40; - - ReturnErrorOnFailure( - cluster.WriteAttribute( - nullableRangeRestrictedInt8sArgument, this, OnSuccessCallback_452, OnFailureCallback_452)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_452(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_452() { NextTest(); } - - CHIP_ERROR TestVerifyNullableRangeRestrictedSigned8BitIntegerValueIsAtMinValid_453() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_453, OnFailureCallback_453, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_453(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_453(const chip::app::DataModel::Nullable & nullableRangeRestrictedInt8s) - { - VerifyOrReturn(CheckValueNonNull("nullableRangeRestrictedInt8s", nullableRangeRestrictedInt8s)); - VerifyOrReturn(CheckValue("nullableRangeRestrictedInt8s.Value()", nullableRangeRestrictedInt8s.Value(), -40)); - - NextTest(); - } - - CHIP_ERROR TestWriteMaxValidValueToANullableRangeRestrictedSigned8BitInteger_454() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::DataModel::Nullable nullableRangeRestrictedInt8sArgument; - nullableRangeRestrictedInt8sArgument.SetNonNull(); - nullableRangeRestrictedInt8sArgument.Value() = 50; - - ReturnErrorOnFailure( - cluster.WriteAttribute( - nullableRangeRestrictedInt8sArgument, this, OnSuccessCallback_454, OnFailureCallback_454)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_454(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_454() { NextTest(); } - - CHIP_ERROR TestVerifyNullableRangeRestrictedSigned8BitIntegerValueIsAtMaxValid_455() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_455, OnFailureCallback_455, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_455(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_455(const chip::app::DataModel::Nullable & nullableRangeRestrictedInt8s) - { - VerifyOrReturn(CheckValueNonNull("nullableRangeRestrictedInt8s", nullableRangeRestrictedInt8s)); - VerifyOrReturn(CheckValue("nullableRangeRestrictedInt8s.Value()", nullableRangeRestrictedInt8s.Value(), 50)); - - NextTest(); - } - - CHIP_ERROR TestWriteMiddleValidValueToANullableRangeRestrictedSigned8BitInteger_456() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::DataModel::Nullable nullableRangeRestrictedInt8sArgument; - nullableRangeRestrictedInt8sArgument.SetNonNull(); - nullableRangeRestrictedInt8sArgument.Value() = 6; - - ReturnErrorOnFailure( - cluster.WriteAttribute( - nullableRangeRestrictedInt8sArgument, this, OnSuccessCallback_456, OnFailureCallback_456)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_456(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_456() { NextTest(); } - - CHIP_ERROR TestVerifyNullableRangeRestrictedSigned8BitIntegerValueIsAtMidValid_457() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_457, OnFailureCallback_457, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_457(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_457(const chip::app::DataModel::Nullable & nullableRangeRestrictedInt8s) - { - VerifyOrReturn(CheckValueNonNull("nullableRangeRestrictedInt8s", nullableRangeRestrictedInt8s)); - VerifyOrReturn(CheckValue("nullableRangeRestrictedInt8s.Value()", nullableRangeRestrictedInt8s.Value(), 6)); - - NextTest(); - } - - CHIP_ERROR TestWriteNullValueToANullableRangeRestrictedSigned8BitInteger_458() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::DataModel::Nullable nullableRangeRestrictedInt8sArgument; - nullableRangeRestrictedInt8sArgument.SetNull(); - - ReturnErrorOnFailure( - cluster.WriteAttribute( - nullableRangeRestrictedInt8sArgument, this, OnSuccessCallback_458, OnFailureCallback_458)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_458(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_458() { NextTest(); } - - CHIP_ERROR TestVerifyNullableRangeRestrictedSigned8BitIntegerValueIsAtNull_459() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_459, OnFailureCallback_459, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_459(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_459(const chip::app::DataModel::Nullable & nullableRangeRestrictedInt8s) - { - VerifyOrReturn(CheckValueNull("nullableRangeRestrictedInt8s", nullableRangeRestrictedInt8s)); - - NextTest(); - } - - CHIP_ERROR TestReadNullableRangeRestrictedSigned16BitInteger_460() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_460, OnFailureCallback_460, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_460(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_460(const chip::app::DataModel::Nullable & nullableRangeRestrictedInt16s) - { - VerifyOrReturn(CheckValueNonNull("nullableRangeRestrictedInt16s", nullableRangeRestrictedInt16s)); - VerifyOrReturn(CheckValue("nullableRangeRestrictedInt16s.Value()", nullableRangeRestrictedInt16s.Value(), -100)); - - NextTest(); - } - - CHIP_ERROR TestWriteMinValueToANullableRangeRestrictedSigned16BitInteger_461() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::DataModel::Nullable nullableRangeRestrictedInt16sArgument; - nullableRangeRestrictedInt16sArgument.SetNonNull(); - nullableRangeRestrictedInt16sArgument.Value() = -32767; - - ReturnErrorOnFailure( - cluster.WriteAttribute( - nullableRangeRestrictedInt16sArgument, this, OnSuccessCallback_461, OnFailureCallback_461)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_461(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - NextTest(); - } - - void OnSuccessResponse_461() { ThrowSuccessResponse(); } - - CHIP_ERROR TestWriteJustBelowRangeValueToANullableRangeRestrictedSigned16BitInteger_462() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::DataModel::Nullable nullableRangeRestrictedInt16sArgument; - nullableRangeRestrictedInt16sArgument.SetNonNull(); - nullableRangeRestrictedInt16sArgument.Value() = -151; - - ReturnErrorOnFailure( - cluster.WriteAttribute( - nullableRangeRestrictedInt16sArgument, this, OnSuccessCallback_462, OnFailureCallback_462)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_462(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - NextTest(); - } - - void OnSuccessResponse_462() { ThrowSuccessResponse(); } - - CHIP_ERROR TestWriteJustAboveRangeValueToANullableRangeRestrictedSigned16BitInteger_463() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::DataModel::Nullable nullableRangeRestrictedInt16sArgument; - nullableRangeRestrictedInt16sArgument.SetNonNull(); - nullableRangeRestrictedInt16sArgument.Value() = 201; - - ReturnErrorOnFailure( - cluster.WriteAttribute( - nullableRangeRestrictedInt16sArgument, this, OnSuccessCallback_463, OnFailureCallback_463)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_463(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - NextTest(); - } - - void OnSuccessResponse_463() { ThrowSuccessResponse(); } - - CHIP_ERROR TestWriteMaxValueToANullableRangeRestrictedSigned16BitInteger_464() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::DataModel::Nullable nullableRangeRestrictedInt16sArgument; - nullableRangeRestrictedInt16sArgument.SetNonNull(); - nullableRangeRestrictedInt16sArgument.Value() = 32767; - - ReturnErrorOnFailure( - cluster.WriteAttribute( - nullableRangeRestrictedInt16sArgument, this, OnSuccessCallback_464, OnFailureCallback_464)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_464(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - NextTest(); - } - - void OnSuccessResponse_464() { ThrowSuccessResponse(); } - - CHIP_ERROR TestVerifyNullableRangeRestrictedSigned16BitIntegerValueHasNotChanged_465() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_465, OnFailureCallback_465, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_465(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_465(const chip::app::DataModel::Nullable & nullableRangeRestrictedInt16s) - { - VerifyOrReturn(CheckValueNonNull("nullableRangeRestrictedInt16s", nullableRangeRestrictedInt16s)); - VerifyOrReturn(CheckValue("nullableRangeRestrictedInt16s.Value()", nullableRangeRestrictedInt16s.Value(), -100)); - - NextTest(); - } - - CHIP_ERROR TestWriteMinValidValueToANullableRangeRestrictedSigned16BitInteger_466() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::DataModel::Nullable nullableRangeRestrictedInt16sArgument; - nullableRangeRestrictedInt16sArgument.SetNonNull(); - nullableRangeRestrictedInt16sArgument.Value() = -150; - - ReturnErrorOnFailure( - cluster.WriteAttribute( - nullableRangeRestrictedInt16sArgument, this, OnSuccessCallback_466, OnFailureCallback_466)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_466(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_466() { NextTest(); } - - CHIP_ERROR TestVerifyNullableRangeRestrictedSigned16BitIntegerValueIsAtMinValid_467() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_467, OnFailureCallback_467, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_467(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_467(const chip::app::DataModel::Nullable & nullableRangeRestrictedInt16s) - { - VerifyOrReturn(CheckValueNonNull("nullableRangeRestrictedInt16s", nullableRangeRestrictedInt16s)); - VerifyOrReturn(CheckValue("nullableRangeRestrictedInt16s.Value()", nullableRangeRestrictedInt16s.Value(), -150)); - - NextTest(); - } - - CHIP_ERROR TestWriteMaxValidValueToANullableRangeRestrictedSigned16BitInteger_468() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::DataModel::Nullable nullableRangeRestrictedInt16sArgument; - nullableRangeRestrictedInt16sArgument.SetNonNull(); - nullableRangeRestrictedInt16sArgument.Value() = 200; - - ReturnErrorOnFailure( - cluster.WriteAttribute( - nullableRangeRestrictedInt16sArgument, this, OnSuccessCallback_468, OnFailureCallback_468)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_468(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_468() { NextTest(); } - - CHIP_ERROR TestVerifyNullableRangeRestrictedSigned16BitIntegerValueIsAtMaxValid_469() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_469, OnFailureCallback_469, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_469(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_469(const chip::app::DataModel::Nullable & nullableRangeRestrictedInt16s) - { - VerifyOrReturn(CheckValueNonNull("nullableRangeRestrictedInt16s", nullableRangeRestrictedInt16s)); - VerifyOrReturn(CheckValue("nullableRangeRestrictedInt16s.Value()", nullableRangeRestrictedInt16s.Value(), 200)); - - NextTest(); - } - - CHIP_ERROR TestWriteMiddleValidValueToANullableRangeRestrictedSigned16BitInteger_470() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::DataModel::Nullable nullableRangeRestrictedInt16sArgument; - nullableRangeRestrictedInt16sArgument.SetNonNull(); - nullableRangeRestrictedInt16sArgument.Value() = 7; - - ReturnErrorOnFailure( - cluster.WriteAttribute( - nullableRangeRestrictedInt16sArgument, this, OnSuccessCallback_470, OnFailureCallback_470)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_470(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_470() { NextTest(); } - - CHIP_ERROR TestVerifyNullableRangeRestrictedSigned16BitIntegerValueIsAtMidValid_471() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_471, OnFailureCallback_471, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_471(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_471(const chip::app::DataModel::Nullable & nullableRangeRestrictedInt16s) - { - VerifyOrReturn(CheckValueNonNull("nullableRangeRestrictedInt16s", nullableRangeRestrictedInt16s)); - VerifyOrReturn(CheckValue("nullableRangeRestrictedInt16s.Value()", nullableRangeRestrictedInt16s.Value(), 7)); - - NextTest(); - } - - CHIP_ERROR TestWriteNullValueToANullableRangeRestrictedSigned16BitInteger_472() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::DataModel::Nullable nullableRangeRestrictedInt16sArgument; - nullableRangeRestrictedInt16sArgument.SetNull(); - - ReturnErrorOnFailure( - cluster.WriteAttribute( - nullableRangeRestrictedInt16sArgument, this, OnSuccessCallback_472, OnFailureCallback_472)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_472(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_472() { NextTest(); } - - CHIP_ERROR TestVerifyNullableRangeRestrictedSigned16BitIntegerValueIsNull_473() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_473, OnFailureCallback_473, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_473(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_473(const chip::app::DataModel::Nullable & nullableRangeRestrictedInt16s) - { - VerifyOrReturn(CheckValueNull("nullableRangeRestrictedInt16s", nullableRangeRestrictedInt16s)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeThatReturnsGeneralStatusOnWrite_474() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - bool generalErrorBooleanArgument; - generalErrorBooleanArgument = false; - - ReturnErrorOnFailure(cluster.WriteAttribute( - generalErrorBooleanArgument, this, OnSuccessCallback_474, OnFailureCallback_474)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_474(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_DATA_TYPE)); - NextTest(); - } - - void OnSuccessResponse_474() { ThrowSuccessResponse(); } - - CHIP_ERROR TestWriteAttributeThatReturnsClusterSpecificStatusOnWrite_475() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - bool clusterErrorBooleanArgument; - clusterErrorBooleanArgument = false; - - ReturnErrorOnFailure(cluster.WriteAttribute( - clusterErrorBooleanArgument, this, OnSuccessCallback_475, OnFailureCallback_475)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_475(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); - NextTest(); - } - - void OnSuccessResponse_475() { ThrowSuccessResponse(); } - - CHIP_ERROR TestReadAttributeThatReturnsGeneralStatusOnRead_476() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_476, OnFailureCallback_476, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_476(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_DATA_TYPE)); - NextTest(); - } - - void OnSuccessResponse_476(bool generalErrorBoolean) { ThrowSuccessResponse(); } - - CHIP_ERROR TestReadAttributeThatReturnsClusterSpecificStatusOnRead_477() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_477, OnFailureCallback_477, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_477(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); - NextTest(); - } - - void OnSuccessResponse_477(bool clusterErrorBoolean) { ThrowSuccessResponse(); } - - CHIP_ERROR TestReadAcceptedCommandListAttribute_478() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_478, OnFailureCallback_478, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_478(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_478(const chip::app::DataModel::DecodableList & acceptedCommandList) - { - { - auto iter_0 = acceptedCommandList.begin(); - VerifyOrReturn(CheckNextListItemDecodes("acceptedCommandList", iter_0, 0)); - VerifyOrReturn(CheckValue("acceptedCommandList[0]", iter_0.GetValue(), 0UL)); - VerifyOrReturn(CheckNextListItemDecodes("acceptedCommandList", iter_0, 1)); - VerifyOrReturn(CheckValue("acceptedCommandList[1]", iter_0.GetValue(), 1UL)); - VerifyOrReturn(CheckNextListItemDecodes("acceptedCommandList", iter_0, 2)); - VerifyOrReturn(CheckValue("acceptedCommandList[2]", iter_0.GetValue(), 2UL)); - VerifyOrReturn(CheckNextListItemDecodes("acceptedCommandList", iter_0, 3)); - VerifyOrReturn(CheckValue("acceptedCommandList[3]", iter_0.GetValue(), 4UL)); - VerifyOrReturn(CheckNextListItemDecodes("acceptedCommandList", iter_0, 4)); - VerifyOrReturn(CheckValue("acceptedCommandList[4]", iter_0.GetValue(), 7UL)); - VerifyOrReturn(CheckNextListItemDecodes("acceptedCommandList", iter_0, 5)); - VerifyOrReturn(CheckValue("acceptedCommandList[5]", iter_0.GetValue(), 8UL)); - VerifyOrReturn(CheckNextListItemDecodes("acceptedCommandList", iter_0, 6)); - VerifyOrReturn(CheckValue("acceptedCommandList[6]", iter_0.GetValue(), 9UL)); - VerifyOrReturn(CheckNextListItemDecodes("acceptedCommandList", iter_0, 7)); - VerifyOrReturn(CheckValue("acceptedCommandList[7]", iter_0.GetValue(), 10UL)); - VerifyOrReturn(CheckNextListItemDecodes("acceptedCommandList", iter_0, 8)); - VerifyOrReturn(CheckValue("acceptedCommandList[8]", iter_0.GetValue(), 11UL)); - VerifyOrReturn(CheckNextListItemDecodes("acceptedCommandList", iter_0, 9)); - VerifyOrReturn(CheckValue("acceptedCommandList[9]", iter_0.GetValue(), 12UL)); - VerifyOrReturn(CheckNextListItemDecodes("acceptedCommandList", iter_0, 10)); - VerifyOrReturn(CheckValue("acceptedCommandList[10]", iter_0.GetValue(), 13UL)); - VerifyOrReturn(CheckNextListItemDecodes("acceptedCommandList", iter_0, 11)); - VerifyOrReturn(CheckValue("acceptedCommandList[11]", iter_0.GetValue(), 14UL)); - VerifyOrReturn(CheckNextListItemDecodes("acceptedCommandList", iter_0, 12)); - VerifyOrReturn(CheckValue("acceptedCommandList[12]", iter_0.GetValue(), 15UL)); - VerifyOrReturn(CheckNextListItemDecodes("acceptedCommandList", iter_0, 13)); - VerifyOrReturn(CheckValue("acceptedCommandList[13]", iter_0.GetValue(), 17UL)); - VerifyOrReturn(CheckNextListItemDecodes("acceptedCommandList", iter_0, 14)); - VerifyOrReturn(CheckValue("acceptedCommandList[14]", iter_0.GetValue(), 18UL)); - VerifyOrReturn(CheckNextListItemDecodes("acceptedCommandList", iter_0, 15)); - VerifyOrReturn(CheckValue("acceptedCommandList[15]", iter_0.GetValue(), 19UL)); - VerifyOrReturn(CheckNextListItemDecodes("acceptedCommandList", iter_0, 16)); - VerifyOrReturn(CheckValue("acceptedCommandList[16]", iter_0.GetValue(), 20UL)); - VerifyOrReturn(CheckNextListItemDecodes("acceptedCommandList", iter_0, 17)); - VerifyOrReturn(CheckValue("acceptedCommandList[17]", iter_0.GetValue(), 21UL)); - VerifyOrReturn(CheckNoMoreListItems("acceptedCommandList", iter_0, 18)); - } - - NextTest(); - } - - CHIP_ERROR TestReadGeneratedCommandListAttribute_479() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_479, OnFailureCallback_479, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_479(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_479(const chip::app::DataModel::DecodableList & generatedCommandList) - { - { - auto iter_0 = generatedCommandList.begin(); - VerifyOrReturn(CheckNextListItemDecodes("generatedCommandList", iter_0, 0)); - VerifyOrReturn(CheckValue("generatedCommandList[0]", iter_0.GetValue(), 0UL)); - VerifyOrReturn(CheckNextListItemDecodes("generatedCommandList", iter_0, 1)); - VerifyOrReturn(CheckValue("generatedCommandList[1]", iter_0.GetValue(), 1UL)); - VerifyOrReturn(CheckNextListItemDecodes("generatedCommandList", iter_0, 2)); - VerifyOrReturn(CheckValue("generatedCommandList[2]", iter_0.GetValue(), 4UL)); - VerifyOrReturn(CheckNextListItemDecodes("generatedCommandList", iter_0, 3)); - VerifyOrReturn(CheckValue("generatedCommandList[3]", iter_0.GetValue(), 5UL)); - VerifyOrReturn(CheckNextListItemDecodes("generatedCommandList", iter_0, 4)); - VerifyOrReturn(CheckValue("generatedCommandList[4]", iter_0.GetValue(), 6UL)); - VerifyOrReturn(CheckNextListItemDecodes("generatedCommandList", iter_0, 5)); - VerifyOrReturn(CheckValue("generatedCommandList[5]", iter_0.GetValue(), 9UL)); - VerifyOrReturn(CheckNextListItemDecodes("generatedCommandList", iter_0, 6)); - VerifyOrReturn(CheckValue("generatedCommandList[6]", iter_0.GetValue(), 10UL)); - VerifyOrReturn(CheckNextListItemDecodes("generatedCommandList", iter_0, 7)); - VerifyOrReturn(CheckValue("generatedCommandList[7]", iter_0.GetValue(), 11UL)); - VerifyOrReturn(CheckNoMoreListItems("generatedCommandList", iter_0, 8)); - } - - NextTest(); - } - - CHIP_ERROR TestWriteStructTypedAttribute_480() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::Clusters::TestCluster::Structs::SimpleStruct::Type structAttrArgument; - - structAttrArgument.a = 5; - structAttrArgument.b = true; - structAttrArgument.c = static_cast(2); - structAttrArgument.d = chip::ByteSpan(chip::Uint8::from_const_char("abcgarbage: not in length on purpose"), 3); - structAttrArgument.e = chip::Span("garbage: not in length on purpose", 0); - structAttrArgument.f = static_cast>(17); - structAttrArgument.g = 1.5f; - structAttrArgument.h = 3.14159265358979; - - ReturnErrorOnFailure(cluster.WriteAttribute( - structAttrArgument, this, OnSuccessCallback_480, OnFailureCallback_480)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_480(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_480() { NextTest(); } - - CHIP_ERROR TestReadStructTypedAttribute_481() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_481, OnFailureCallback_481, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_481(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_481(const chip::app::Clusters::TestCluster::Structs::SimpleStruct::DecodableType & structAttr) - { - VerifyOrReturn(CheckValue("structAttr.a", structAttr.a, 5)); - VerifyOrReturn(CheckValue("structAttr.b", structAttr.b, true)); - VerifyOrReturn(CheckValue("structAttr.c", structAttr.c, 2)); - VerifyOrReturn(CheckValueAsString("structAttr.d", structAttr.d, chip::ByteSpan(chip::Uint8::from_const_char("abc"), 3))); - VerifyOrReturn(CheckValueAsString("structAttr.e", structAttr.e, chip::CharSpan("", 0))); - VerifyOrReturn(CheckValue("structAttr.f", structAttr.f, 17)); - VerifyOrReturn(CheckValue("structAttr.g", structAttr.g, 1.5f)); - VerifyOrReturn(CheckValue("structAttr.h", structAttr.h, 3.14159265358979)); - - NextTest(); - } -}; - -class TestClusterComplexTypesSuite : public TestCommand -{ -public: - TestClusterComplexTypesSuite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("TestClusterComplexTypes", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~TestClusterComplexTypesSuite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: TestClusterComplexTypes\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: TestClusterComplexTypes\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Send Test Command with optional arg set to null.\n"); - err = TestSendTestCommandWithOptionalArgSetToNull_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Send command that needs timed invoke without a timeout value\n"); - err = TestSendCommandThatNeedsTimedInvokeWithoutATimeoutValue_2(); - break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Send command that needs timed invoke with a long timeout value\n"); - err = TestSendCommandThatNeedsTimedInvokeWithALongTimeoutValue_3(); - break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Send command that needs timed invoke with a too-short timeout value\n"); - err = TestSendCommandThatNeedsTimedInvokeWithATooShortTimeoutValue_4(); - break; - case 5: - ChipLogProgress(chipTool, - " ***** Test Step 5 : Send command that does not need timed invoke with a long timeout value\n"); - err = TestSendCommandThatDoesNotNeedTimedInvokeWithALongTimeoutValue_5(); - break; - case 6: - ChipLogProgress(chipTool, - " ***** Test Step 6 : Send command that does not need timed invoke with a too-short timeout value\n"); - err = TestSendCommandThatDoesNotNeedTimedInvokeWithATooShortTimeoutValue_6(); - break; - case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : Read attribute that needs timed write initial state\n"); - err = TestReadAttributeThatNeedsTimedWriteInitialState_7(); - break; - case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : Write attribute that needs timed write without a timeout value\n"); - err = TestWriteAttributeThatNeedsTimedWriteWithoutATimeoutValue_8(); - break; - case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : Read attribute that needs timed write state unchanged 1\n"); - err = TestReadAttributeThatNeedsTimedWriteStateUnchanged1_9(); - break; - case 10: - ChipLogProgress(chipTool, - " ***** Test Step 10 : Write attribute that needs timed write with a too-short timeout value\n"); - err = TestWriteAttributeThatNeedsTimedWriteWithATooShortTimeoutValue_10(); - break; - case 11: - ChipLogProgress(chipTool, " ***** Test Step 11 : Read attribute that needs timed write state unchanged 2\n"); - err = TestReadAttributeThatNeedsTimedWriteStateUnchanged2_11(); - break; - case 12: - ChipLogProgress(chipTool, " ***** Test Step 12 : Write attribute that needs timed write with a long timeout value\n"); - err = TestWriteAttributeThatNeedsTimedWriteWithALongTimeoutValue_12(); - break; - case 13: - ChipLogProgress(chipTool, " ***** Test Step 13 : Read attribute that needs timed write state changed\n"); - err = TestReadAttributeThatNeedsTimedWriteStateChanged_13(); - break; - case 14: - ChipLogProgress(chipTool, " ***** Test Step 14 : Write attribute that needs timed write reset to default\n"); - err = TestWriteAttributeThatNeedsTimedWriteResetToDefault_14(); - break; - case 15: - ChipLogProgress(chipTool, " ***** Test Step 15 : Read attribute that does not need timed write initial value\n"); - err = TestReadAttributeThatDoesNotNeedTimedWriteInitialValue_15(); - break; - case 16: - ChipLogProgress( - chipTool, " ***** Test Step 16 : Write attribute that does not need timed write with a too-short timeout value\n"); - err = TestWriteAttributeThatDoesNotNeedTimedWriteWithATooShortTimeoutValue_16(); - break; - case 17: - ChipLogProgress(chipTool, " ***** Test Step 17 : Read attribute that does not need timed write unchanged value\n"); - err = TestReadAttributeThatDoesNotNeedTimedWriteUnchangedValue_17(); - break; - case 18: - ChipLogProgress(chipTool, - " ***** Test Step 18 : Write attribute that does not need timed write with a long timeout value\n"); - err = TestWriteAttributeThatDoesNotNeedTimedWriteWithALongTimeoutValue_18(); - break; - case 19: - ChipLogProgress(chipTool, " ***** Test Step 19 : Read attribute that does not need timed write changed value\n"); - err = TestReadAttributeThatDoesNotNeedTimedWriteChangedValue_19(); - break; - case 20: - ChipLogProgress(chipTool, " ***** Test Step 20 : Write attribute that does not need timed write reset to default\n"); - err = TestWriteAttributeThatDoesNotNeedTimedWriteResetToDefault_20(); - break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 21; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - static void OnFailureCallback_7(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_7(error); - } - - static void OnSuccessCallback_7(void * context, bool timedWriteBoolean) - { - (static_cast(context))->OnSuccessResponse_7(timedWriteBoolean); - } - - static void OnFailureCallback_8(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_8(error); - } - - static void OnSuccessCallback_8(void * context) - { - (static_cast(context))->OnSuccessResponse_8(); - } - - static void OnFailureCallback_9(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_9(error); - } - - static void OnSuccessCallback_9(void * context, bool timedWriteBoolean) - { - (static_cast(context))->OnSuccessResponse_9(timedWriteBoolean); - } - - static void OnFailureCallback_10(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_10(error); - } - - static void OnSuccessCallback_10(void * context) - { - (static_cast(context))->OnSuccessResponse_10(); - } - - static void OnFailureCallback_11(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_11(error); - } - - static void OnSuccessCallback_11(void * context, bool timedWriteBoolean) - { - (static_cast(context))->OnSuccessResponse_11(timedWriteBoolean); - } - - static void OnFailureCallback_12(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_12(error); - } - - static void OnSuccessCallback_12(void * context) - { - (static_cast(context))->OnSuccessResponse_12(); - } - - static void OnFailureCallback_13(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_13(error); - } - - static void OnSuccessCallback_13(void * context, bool timedWriteBoolean) - { - (static_cast(context))->OnSuccessResponse_13(timedWriteBoolean); - } - - static void OnFailureCallback_14(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_14(error); - } - - static void OnSuccessCallback_14(void * context) - { - (static_cast(context))->OnSuccessResponse_14(); - } - - static void OnFailureCallback_15(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_15(error); - } - - static void OnSuccessCallback_15(void * context, bool boolean) - { - (static_cast(context))->OnSuccessResponse_15(boolean); - } - - static void OnFailureCallback_16(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_16(error); - } - - static void OnSuccessCallback_16(void * context) - { - (static_cast(context))->OnSuccessResponse_16(); - } - - static void OnFailureCallback_17(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_17(error); - } - - static void OnSuccessCallback_17(void * context, bool boolean) - { - (static_cast(context))->OnSuccessResponse_17(boolean); - } - - static void OnFailureCallback_18(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_18(error); - } - - static void OnSuccessCallback_18(void * context) - { - (static_cast(context))->OnSuccessResponse_18(); - } - - static void OnFailureCallback_19(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_19(error); - } - - static void OnSuccessCallback_19(void * context, bool boolean) - { - (static_cast(context))->OnSuccessResponse_19(boolean); - } - - static void OnFailureCallback_20(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_20(error); - } - - static void OnSuccessCallback_20(void * context) - { - (static_cast(context))->OnSuccessResponse_20(); - } - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestSendTestCommandWithOptionalArgSetToNull_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::TestCluster::Commands::TestNullableOptionalRequest::Type; - - RequestType request; - request.arg1.Emplace(); - request.arg1.Value().SetNull(); - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context)) - ->OnSuccessResponse_1(data.wasPresent, data.wasNull, data.value, data.originalValue); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_1(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_1(bool wasPresent, const chip::Optional & wasNull, const chip::Optional & value, - const chip::Optional> & originalValue) - { - VerifyOrReturn(CheckValue("wasPresent", wasPresent, true)); - - VerifyOrReturn(CheckValuePresent("wasNull", wasNull)); - VerifyOrReturn(CheckValue("wasNull.Value()", wasNull.Value(), true)); - - VerifyOrReturn(CheckValuePresent("originalValue", originalValue)); - VerifyOrReturn(CheckValueNull("originalValue.Value()", originalValue.Value())); - - NextTest(); - } - - CHIP_ERROR TestSendCommandThatNeedsTimedInvokeWithoutATimeoutValue_2() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::TestCluster::Commands::TimedInvokeRequest::Type; - - RequestType request; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_2(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_2(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request, - chip::NullOptional)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_2(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_NEEDS_TIMED_INTERACTION)); - NextTest(); - } - - void OnSuccessResponse_2() { ThrowSuccessResponse(); } - - CHIP_ERROR TestSendCommandThatNeedsTimedInvokeWithALongTimeoutValue_3() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::TestCluster::Commands::TimedInvokeRequest::Type; - - RequestType request; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_3(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_3(error); - }; - - ReturnErrorOnFailure( - chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request, 10000)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_3(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_3() { NextTest(); } - - CHIP_ERROR TestSendCommandThatNeedsTimedInvokeWithATooShortTimeoutValue_4() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::TestCluster::Commands::TimedInvokeRequest::Type; - - RequestType request; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_4(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_4(error); - }; - - ReturnErrorOnFailure( - chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request, 1)); - using namespace chip::System::Clock::Literals; - BusyWaitFor(100_ms); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_4(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_ACCESS)); - NextTest(); - } - - void OnSuccessResponse_4() { ThrowSuccessResponse(); } - - CHIP_ERROR TestSendCommandThatDoesNotNeedTimedInvokeWithALongTimeoutValue_5() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::TestCluster::Commands::Test::Type; - - RequestType request; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_5(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_5(error); - }; - - ReturnErrorOnFailure( - chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request, 10000)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_5(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_5() { NextTest(); } - - CHIP_ERROR TestSendCommandThatDoesNotNeedTimedInvokeWithATooShortTimeoutValue_6() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::TestCluster::Commands::Test::Type; - - RequestType request; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_6(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_6(error); - }; - - ReturnErrorOnFailure( - chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request, 1)); - using namespace chip::System::Clock::Literals; - BusyWaitFor(100_ms); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_6(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_ACCESS)); - NextTest(); - } - - void OnSuccessResponse_6() { ThrowSuccessResponse(); } - - CHIP_ERROR TestReadAttributeThatNeedsTimedWriteInitialState_7() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_7, OnFailureCallback_7, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_7(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_7(bool timedWriteBoolean) - { - VerifyOrReturn(CheckValue("timedWriteBoolean", timedWriteBoolean, false)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeThatNeedsTimedWriteWithoutATimeoutValue_8() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - bool timedWriteBooleanArgument; - timedWriteBooleanArgument = true; - - ReturnErrorOnFailure(cluster.WriteAttribute( - timedWriteBooleanArgument, this, OnSuccessCallback_8, OnFailureCallback_8, chip::NullOptional)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_8(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_NEEDS_TIMED_INTERACTION)); - NextTest(); - } - - void OnSuccessResponse_8() { ThrowSuccessResponse(); } - - CHIP_ERROR TestReadAttributeThatNeedsTimedWriteStateUnchanged1_9() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_9, OnFailureCallback_9, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_9(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_9(bool timedWriteBoolean) - { - VerifyOrReturn(CheckValue("timedWriteBoolean", timedWriteBoolean, false)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeThatNeedsTimedWriteWithATooShortTimeoutValue_10() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - bool timedWriteBooleanArgument; - timedWriteBooleanArgument = true; - - ReturnErrorOnFailure(cluster.WriteAttribute( - timedWriteBooleanArgument, this, OnSuccessCallback_10, OnFailureCallback_10, 1)); - using namespace chip::System::Clock::Literals; - BusyWaitFor(100_ms); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_10(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_ACCESS)); - NextTest(); - } - - void OnSuccessResponse_10() { ThrowSuccessResponse(); } - - CHIP_ERROR TestReadAttributeThatNeedsTimedWriteStateUnchanged2_11() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_11, OnFailureCallback_11, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_11(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_11(bool timedWriteBoolean) - { - VerifyOrReturn(CheckValue("timedWriteBoolean", timedWriteBoolean, false)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeThatNeedsTimedWriteWithALongTimeoutValue_12() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - bool timedWriteBooleanArgument; - timedWriteBooleanArgument = true; - - ReturnErrorOnFailure(cluster.WriteAttribute( - timedWriteBooleanArgument, this, OnSuccessCallback_12, OnFailureCallback_12, 10000)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_12(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_12() { NextTest(); } - - CHIP_ERROR TestReadAttributeThatNeedsTimedWriteStateChanged_13() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_13, OnFailureCallback_13, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_13(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_13(bool timedWriteBoolean) - { - VerifyOrReturn(CheckValue("timedWriteBoolean", timedWriteBoolean, true)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeThatNeedsTimedWriteResetToDefault_14() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - bool timedWriteBooleanArgument; - timedWriteBooleanArgument = false; - - ReturnErrorOnFailure(cluster.WriteAttribute( - timedWriteBooleanArgument, this, OnSuccessCallback_14, OnFailureCallback_14, 10000)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_14(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_14() { NextTest(); } - - CHIP_ERROR TestReadAttributeThatDoesNotNeedTimedWriteInitialValue_15() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_15, OnFailureCallback_15, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_15(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_15(bool boolean) - { - VerifyOrReturn(CheckValue("boolean", boolean, false)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeThatDoesNotNeedTimedWriteWithATooShortTimeoutValue_16() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - bool booleanArgument; - booleanArgument = true; - - ReturnErrorOnFailure(cluster.WriteAttribute( - booleanArgument, this, OnSuccessCallback_16, OnFailureCallback_16, 1)); - using namespace chip::System::Clock::Literals; - BusyWaitFor(100_ms); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_16(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_ACCESS)); - NextTest(); - } - - void OnSuccessResponse_16() { ThrowSuccessResponse(); } - - CHIP_ERROR TestReadAttributeThatDoesNotNeedTimedWriteUnchangedValue_17() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_17, OnFailureCallback_17, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_17(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_17(bool boolean) - { - VerifyOrReturn(CheckValue("boolean", boolean, false)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeThatDoesNotNeedTimedWriteWithALongTimeoutValue_18() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - bool booleanArgument; - booleanArgument = true; - - ReturnErrorOnFailure(cluster.WriteAttribute( - booleanArgument, this, OnSuccessCallback_18, OnFailureCallback_18, 10000)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_18(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_18() { NextTest(); } - - CHIP_ERROR TestReadAttributeThatDoesNotNeedTimedWriteChangedValue_19() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_19, OnFailureCallback_19, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_19(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_19(bool boolean) - { - VerifyOrReturn(CheckValue("boolean", boolean, true)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeThatDoesNotNeedTimedWriteResetToDefault_20() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - bool booleanArgument; - booleanArgument = false; - - ReturnErrorOnFailure(cluster.WriteAttribute( - booleanArgument, this, OnSuccessCallback_20, OnFailureCallback_20)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_20(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_20() { NextTest(); } -}; - -class TestConstraintsSuite : public TestCommand -{ -public: - TestConstraintsSuite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("TestConstraints", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~TestConstraintsSuite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: TestConstraints\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: TestConstraints\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Write attribute INT32U Value\n"); - err = TestWriteAttributeInt32uValue_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Read attribute INT32U Value MinValue Constraints\n"); - err = TestReadAttributeInt32uValueMinValueConstraints_2(); - break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Read attribute INT32U Value MaxValue Constraints\n"); - err = TestReadAttributeInt32uValueMaxValueConstraints_3(); - break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Read attribute INT32U Value NotValue Constraints\n"); - err = TestReadAttributeInt32uValueNotValueConstraints_4(); - break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Write attribute INT32U Value Back to Default Value\n"); - err = TestWriteAttributeInt32uValueBackToDefaultValue_5(); - break; - case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : Write attribute CHAR_STRING Value\n"); - err = TestWriteAttributeCharStringValue_6(); - break; - case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : Read attribute CHAR_STRING Value MinLength Constraints\n"); - err = TestReadAttributeCharStringValueMinLengthConstraints_7(); - break; - case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : Read attribute CHAR_STRING Value MaxLength Constraints\n"); - err = TestReadAttributeCharStringValueMaxLengthConstraints_8(); - break; - case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : Read attribute CHAR_STRING Value StartsWith Constraints\n"); - err = TestReadAttributeCharStringValueStartsWithConstraints_9(); - break; - case 10: - ChipLogProgress(chipTool, " ***** Test Step 10 : Read attribute CHAR_STRING Value EndsWith Constraints\n"); - err = TestReadAttributeCharStringValueEndsWithConstraints_10(); - break; - case 11: - ChipLogProgress(chipTool, " ***** Test Step 11 : Write attribute CHAR_STRING Value\n"); - err = TestWriteAttributeCharStringValue_11(); - break; - case 12: - ChipLogProgress(chipTool, - " ***** Test Step 12 : Read attribute CHAR_STRING Value isLowerCase/isUpperCase Constraints\n"); - err = TestReadAttributeCharStringValueIsLowerCaseIsUpperCaseConstraints_12(); - break; - case 13: - ChipLogProgress(chipTool, " ***** Test Step 13 : Write attribute CHAR_STRING Value\n"); - err = TestWriteAttributeCharStringValue_13(); - break; - case 14: - ChipLogProgress(chipTool, - " ***** Test Step 14 : Read attribute CHAR_STRING Value isLowerCase/isUpperCase Constraints\n"); - err = TestReadAttributeCharStringValueIsLowerCaseIsUpperCaseConstraints_14(); - break; - case 15: - ChipLogProgress(chipTool, " ***** Test Step 15 : Write attribute CHAR_STRING Value\n"); - err = TestWriteAttributeCharStringValue_15(); - break; - case 16: - ChipLogProgress(chipTool, - " ***** Test Step 16 : Read attribute CHAR_STRING Value isLowerCase/isUpperCase Constraints\n"); - err = TestReadAttributeCharStringValueIsLowerCaseIsUpperCaseConstraints_16(); - break; - case 17: - ChipLogProgress(chipTool, " ***** Test Step 17 : Write attribute CHAR_STRING Value\n"); - err = TestWriteAttributeCharStringValue_17(); - break; - case 18: - ChipLogProgress(chipTool, " ***** Test Step 18 : Read attribute CHAR_STRING Value isHexString Constraints\n"); - err = TestReadAttributeCharStringValueIsHexStringConstraints_18(); - break; - case 19: - ChipLogProgress(chipTool, " ***** Test Step 19 : Write attribute CHAR_STRING Value\n"); - err = TestWriteAttributeCharStringValue_19(); - break; - case 20: - ChipLogProgress(chipTool, " ***** Test Step 20 : Read attribute CHAR_STRING Value isHexString Constraints\n"); - err = TestReadAttributeCharStringValueIsHexStringConstraints_20(); - break; - case 21: - ChipLogProgress(chipTool, " ***** Test Step 21 : Write attribute CHAR_STRING Value Back to Default Value\n"); - err = TestWriteAttributeCharStringValueBackToDefaultValue_21(); - break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 22; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - static void OnFailureCallback_1(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_1(error); - } - - static void OnSuccessCallback_1(void * context) { (static_cast(context))->OnSuccessResponse_1(); } - - static void OnFailureCallback_2(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_2(error); - } - - static void OnSuccessCallback_2(void * context, uint32_t int32u) - { - (static_cast(context))->OnSuccessResponse_2(int32u); - } - - static void OnFailureCallback_3(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_3(error); - } - - static void OnSuccessCallback_3(void * context, uint32_t int32u) - { - (static_cast(context))->OnSuccessResponse_3(int32u); - } - - static void OnFailureCallback_4(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_4(error); - } - - static void OnSuccessCallback_4(void * context, uint32_t int32u) - { - (static_cast(context))->OnSuccessResponse_4(int32u); - } - - static void OnFailureCallback_5(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_5(error); - } - - static void OnSuccessCallback_5(void * context) { (static_cast(context))->OnSuccessResponse_5(); } - - static void OnFailureCallback_6(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_6(error); - } - - static void OnSuccessCallback_6(void * context) { (static_cast(context))->OnSuccessResponse_6(); } - - static void OnFailureCallback_7(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_7(error); - } - - static void OnSuccessCallback_7(void * context, chip::CharSpan charString) - { - (static_cast(context))->OnSuccessResponse_7(charString); - } - - static void OnFailureCallback_8(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_8(error); - } - - static void OnSuccessCallback_8(void * context, chip::CharSpan charString) - { - (static_cast(context))->OnSuccessResponse_8(charString); - } - - static void OnFailureCallback_9(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_9(error); - } - - static void OnSuccessCallback_9(void * context, chip::CharSpan charString) - { - (static_cast(context))->OnSuccessResponse_9(charString); - } - - static void OnFailureCallback_10(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_10(error); - } - - static void OnSuccessCallback_10(void * context, chip::CharSpan charString) - { - (static_cast(context))->OnSuccessResponse_10(charString); - } - - static void OnFailureCallback_11(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_11(error); - } - - static void OnSuccessCallback_11(void * context) { (static_cast(context))->OnSuccessResponse_11(); } - - static void OnFailureCallback_12(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_12(error); - } - - static void OnSuccessCallback_12(void * context, chip::CharSpan charString) - { - (static_cast(context))->OnSuccessResponse_12(charString); - } - - static void OnFailureCallback_13(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_13(error); - } - - static void OnSuccessCallback_13(void * context) { (static_cast(context))->OnSuccessResponse_13(); } - - static void OnFailureCallback_14(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_14(error); - } - - static void OnSuccessCallback_14(void * context, chip::CharSpan charString) - { - (static_cast(context))->OnSuccessResponse_14(charString); - } - - static void OnFailureCallback_15(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_15(error); - } - - static void OnSuccessCallback_15(void * context) { (static_cast(context))->OnSuccessResponse_15(); } - - static void OnFailureCallback_16(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_16(error); - } - - static void OnSuccessCallback_16(void * context, chip::CharSpan charString) - { - (static_cast(context))->OnSuccessResponse_16(charString); - } - - static void OnFailureCallback_17(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_17(error); - } - - static void OnSuccessCallback_17(void * context) { (static_cast(context))->OnSuccessResponse_17(); } - - static void OnFailureCallback_18(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_18(error); - } - - static void OnSuccessCallback_18(void * context, chip::CharSpan charString) - { - (static_cast(context))->OnSuccessResponse_18(charString); - } - - static void OnFailureCallback_19(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_19(error); - } - - static void OnSuccessCallback_19(void * context) { (static_cast(context))->OnSuccessResponse_19(); } - - static void OnFailureCallback_20(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_20(error); - } - - static void OnSuccessCallback_20(void * context, chip::CharSpan charString) - { - (static_cast(context))->OnSuccessResponse_20(charString); - } - - static void OnFailureCallback_21(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_21(error); - } - - static void OnSuccessCallback_21(void * context) { (static_cast(context))->OnSuccessResponse_21(); } - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestWriteAttributeInt32uValue_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - uint32_t int32uArgument; - int32uArgument = 5UL; - - ReturnErrorOnFailure(cluster.WriteAttribute( - int32uArgument, this, OnSuccessCallback_1, OnFailureCallback_1)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_1() { NextTest(); } - - CHIP_ERROR TestReadAttributeInt32uValueMinValueConstraints_2() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_2, OnFailureCallback_2, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_2(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_2(uint32_t int32u) - { - VerifyOrReturn(CheckConstraintMinValue("int32u", int32u, 5UL)); - NextTest(); - } - - CHIP_ERROR TestReadAttributeInt32uValueMaxValueConstraints_3() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_3, OnFailureCallback_3, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_3(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_3(uint32_t int32u) - { - VerifyOrReturn(CheckConstraintMaxValue("int32u", int32u, 5UL)); - NextTest(); - } - - CHIP_ERROR TestReadAttributeInt32uValueNotValueConstraints_4() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_4, OnFailureCallback_4, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_4(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_4(uint32_t int32u) - { - VerifyOrReturn(CheckConstraintNotValue("int32u", int32u, 6UL)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeInt32uValueBackToDefaultValue_5() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - uint32_t int32uArgument; - int32uArgument = 0UL; - - ReturnErrorOnFailure(cluster.WriteAttribute( - int32uArgument, this, OnSuccessCallback_5, OnFailureCallback_5)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_5(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_5() { NextTest(); } - - CHIP_ERROR TestWriteAttributeCharStringValue_6() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::CharSpan charStringArgument; - charStringArgument = chip::Span("** Test **garbage: not in length on purpose", 10); - - ReturnErrorOnFailure(cluster.WriteAttribute( - charStringArgument, this, OnSuccessCallback_6, OnFailureCallback_6)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_6(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_6() { NextTest(); } - - CHIP_ERROR TestReadAttributeCharStringValueMinLengthConstraints_7() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_7, OnFailureCallback_7, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_7(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_7(chip::CharSpan charString) - { - VerifyOrReturn(CheckConstraintMinLength("charString", charString.size(), 5)); - NextTest(); - } - - CHIP_ERROR TestReadAttributeCharStringValueMaxLengthConstraints_8() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_8, OnFailureCallback_8, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_8(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_8(chip::CharSpan charString) - { - VerifyOrReturn(CheckConstraintMaxLength("charString", charString.size(), 20)); - NextTest(); - } - - CHIP_ERROR TestReadAttributeCharStringValueStartsWithConstraints_9() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_9, OnFailureCallback_9, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_9(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_9(chip::CharSpan charString) - { - VerifyOrReturn(CheckConstraintStartsWith("charString", charString, "**")); - NextTest(); - } - - CHIP_ERROR TestReadAttributeCharStringValueEndsWithConstraints_10() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_10, OnFailureCallback_10, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_10(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_10(chip::CharSpan charString) - { - VerifyOrReturn(CheckConstraintEndsWith("charString", charString, "**")); - NextTest(); - } - - CHIP_ERROR TestWriteAttributeCharStringValue_11() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::CharSpan charStringArgument; - charStringArgument = chip::Span("lowercasegarbage: not in length on purpose", 9); - - ReturnErrorOnFailure(cluster.WriteAttribute( - charStringArgument, this, OnSuccessCallback_11, OnFailureCallback_11)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_11(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_11() { NextTest(); } - - CHIP_ERROR TestReadAttributeCharStringValueIsLowerCaseIsUpperCaseConstraints_12() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_12, OnFailureCallback_12, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_12(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_12(chip::CharSpan charString) - { - VerifyOrReturn(CheckConstraintIsUpperCase("charString", charString, false)); - VerifyOrReturn(CheckConstraintIsLowerCase("charString", charString, true)); - NextTest(); - } - - CHIP_ERROR TestWriteAttributeCharStringValue_13() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::CharSpan charStringArgument; - charStringArgument = chip::Span("UPPERCASEgarbage: not in length on purpose", 9); - - ReturnErrorOnFailure(cluster.WriteAttribute( - charStringArgument, this, OnSuccessCallback_13, OnFailureCallback_13)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_13(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_13() { NextTest(); } - - CHIP_ERROR TestReadAttributeCharStringValueIsLowerCaseIsUpperCaseConstraints_14() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_14, OnFailureCallback_14, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_14(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_14(chip::CharSpan charString) - { - VerifyOrReturn(CheckConstraintIsUpperCase("charString", charString, true)); - VerifyOrReturn(CheckConstraintIsLowerCase("charString", charString, false)); - NextTest(); - } - - CHIP_ERROR TestWriteAttributeCharStringValue_15() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::CharSpan charStringArgument; - charStringArgument = chip::Span("lowUPPERgarbage: not in length on purpose", 8); - - ReturnErrorOnFailure(cluster.WriteAttribute( - charStringArgument, this, OnSuccessCallback_15, OnFailureCallback_15)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_15(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_15() { NextTest(); } - - CHIP_ERROR TestReadAttributeCharStringValueIsLowerCaseIsUpperCaseConstraints_16() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_16, OnFailureCallback_16, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_16(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_16(chip::CharSpan charString) - { - VerifyOrReturn(CheckConstraintIsUpperCase("charString", charString, false)); - VerifyOrReturn(CheckConstraintIsLowerCase("charString", charString, false)); - NextTest(); - } - - CHIP_ERROR TestWriteAttributeCharStringValue_17() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::CharSpan charStringArgument; - charStringArgument = chip::Span("ABCDEF012Vgarbage: not in length on purpose", 10); - - ReturnErrorOnFailure(cluster.WriteAttribute( - charStringArgument, this, OnSuccessCallback_17, OnFailureCallback_17)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_17(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_17() { NextTest(); } - - CHIP_ERROR TestReadAttributeCharStringValueIsHexStringConstraints_18() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_18, OnFailureCallback_18, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_18(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_18(chip::CharSpan charString) - { - VerifyOrReturn(CheckConstraintIsHexString("charString", charString, false)); - NextTest(); - } - - CHIP_ERROR TestWriteAttributeCharStringValue_19() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::CharSpan charStringArgument; - charStringArgument = chip::Span("ABCDEF0123garbage: not in length on purpose", 10); - - ReturnErrorOnFailure(cluster.WriteAttribute( - charStringArgument, this, OnSuccessCallback_19, OnFailureCallback_19)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_19(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_19() { NextTest(); } - - CHIP_ERROR TestReadAttributeCharStringValueIsHexStringConstraints_20() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_20, OnFailureCallback_20, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_20(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_20(chip::CharSpan charString) - { - VerifyOrReturn(CheckConstraintIsHexString("charString", charString, true)); - NextTest(); - } - - CHIP_ERROR TestWriteAttributeCharStringValueBackToDefaultValue_21() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::CharSpan charStringArgument; - charStringArgument = chip::Span("garbage: not in length on purpose", 0); - - ReturnErrorOnFailure(cluster.WriteAttribute( - charStringArgument, this, OnSuccessCallback_21, OnFailureCallback_21)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_21(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_21() { NextTest(); } -}; - -class TestDelayCommandsSuite : public TestCommand -{ -public: - TestDelayCommandsSuite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("TestDelayCommands", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~TestDelayCommandsSuite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: TestDelayCommands\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: TestDelayCommands\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Wait 100ms\n"); - err = TestWait100ms_1(); - break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 2; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 1: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestWait100ms_1() - { - SetIdentity(kIdentityAlpha); - return WaitForMs(100); - } -}; - -class TestDiscoverySuite : public TestCommand -{ -public: - TestDiscoverySuite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("TestDiscovery", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("discriminator", 0, UINT16_MAX, &mDiscriminator); - AddArgument("vendorId", 0, UINT16_MAX, &mVendorId); - AddArgument("productId", 0, UINT16_MAX, &mProductId); - AddArgument("deviceType", 0, UINT16_MAX, &mDeviceType); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~TestDiscoverySuite() - { - if (deviceInstanceNameBeforeRebootBuffer != nullptr) - { - chip::Platform::MemoryFree(deviceInstanceNameBeforeRebootBuffer); - deviceInstanceNameBeforeRebootBuffer = nullptr; - } - } - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: TestDiscovery\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: TestDiscovery\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Reboot target device\n"); - err = TestRebootTargetDevice_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Open Commissioning Window with too-short timeout\n"); - err = TestOpenCommissioningWindowWithTooShortTimeout_2(); - break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Open Commissioning Window with too-long timeout\n"); - err = TestOpenCommissioningWindowWithTooLongTimeout_3(); - break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Open Commissioning Window\n"); - err = TestOpenCommissioningWindow_4(); - break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Check Instance Name\n"); - err = TestCheckInstanceName_5(); - break; - case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : Check Long Discriminator _L\n"); - err = TestCheckLongDiscriminatorL_6(); - break; - case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : Check Short Discriminator (_S)\n"); - err = TestCheckShortDiscriminatorS_7(); - break; - case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : Check Commissioning Mode (_CM)\n"); - err = TestCheckCommissioningModeCm_8(); - break; - case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : Check Vendor ID (_V)\n"); - if (ShouldSkip("VENDOR_SUBTYPE")) - { - NextTest(); - return; - } - err = TestCheckVendorIdV_9(); - break; - case 10: - ChipLogProgress(chipTool, " ***** Test Step 10 : TXT key for discriminator (D)\n"); - err = TestTxtKeyForDiscriminatorD_10(); - break; - case 11: - ChipLogProgress(chipTool, " ***** Test Step 11 : TXT key for Vendor ID and Product ID (VP)\n"); - if (ShouldSkip("VP_KEY")) - { - NextTest(); - return; - } - err = TestTxtKeyForVendorIdAndProductIdVp_11(); - break; - case 12: - ChipLogProgress(chipTool, " ***** Test Step 12 : TXT key for Vendor ID and Product ID (VP)\n"); - if (ShouldSkip("VP_KEY")) - { - NextTest(); - return; - } - err = TestTxtKeyForVendorIdAndProductIdVp_12(); - break; - case 13: - ChipLogProgress(chipTool, " ***** Test Step 13 : Optional TXT key for MRP Retry Interval Idle (CRI)\n"); - if (ShouldSkip("CRI_COMM_DISCOVERY_KEY")) - { - NextTest(); - return; - } - err = TestOptionalTxtKeyForMrpRetryIntervalIdleCri_13(); - break; - case 14: - ChipLogProgress(chipTool, " ***** Test Step 14 : Optional TXT key for MRP Retry Interval Active (CRA)\n"); - if (ShouldSkip("CRA_COMM_DISCOVERY_KEY")) - { - NextTest(); - return; - } - err = TestOptionalTxtKeyForMrpRetryIntervalActiveCra_14(); - break; - case 15: - ChipLogProgress(chipTool, " ***** Test Step 15 : TXT key for commissioning mode (CM)\n"); - err = TestTxtKeyForCommissioningModeCm_15(); - break; - case 16: - ChipLogProgress(chipTool, " ***** Test Step 16 : Optional TXT key for device name (DN)\n"); - if (ShouldSkip("DN_KEY")) - { - NextTest(); - return; - } - err = TestOptionalTxtKeyForDeviceNameDn_16(); - break; - case 17: - ChipLogProgress(chipTool, " ***** Test Step 17 : Optional TXT key for rotating device identifier (RI)\n"); - if (ShouldSkip("RI_KEY")) - { - NextTest(); - return; - } - err = TestOptionalTxtKeyForRotatingDeviceIdentifierRi_17(); - break; - case 18: - ChipLogProgress(chipTool, " ***** Test Step 18 : Optional TXT key for pairing hint (PH)\n"); - if (ShouldSkip("PH_KEY")) - { - NextTest(); - return; - } - err = TestOptionalTxtKeyForPairingHintPh_18(); - break; - case 19: - ChipLogProgress(chipTool, " ***** Test Step 19 : Optional TXT key for pairing instructions (PI)\n"); - if (ShouldSkip("PI_KEY")) - { - NextTest(); - return; - } - err = TestOptionalTxtKeyForPairingInstructionsPi_19(); - break; - case 20: - ChipLogProgress(chipTool, " ***** Test Step 20 : Check IPs\n"); - err = TestCheckIPs_20(); - break; - case 21: - ChipLogProgress(chipTool, " ***** Test Step 21 : Reboot target device\n"); - err = TestRebootTargetDevice_21(); - break; - case 22: - ChipLogProgress(chipTool, " ***** Test Step 22 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_22(); - break; - case 23: - ChipLogProgress(chipTool, " ***** Test Step 23 : Open Commissioning Window\n"); - err = TestOpenCommissioningWindow_23(); - break; - case 24: - ChipLogProgress(chipTool, " ***** Test Step 24 : Check Instance Name\n"); - err = TestCheckInstanceName_24(); - break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 25; - - chip::Optional mNodeId; - chip::Optional mEndpoint; - chip::Optional mDiscriminator; - chip::Optional mVendorId; - chip::Optional mProductId; - chip::Optional mDeviceType; - chip::Optional mTimeout; - - char * deviceInstanceNameBeforeRebootBuffer = nullptr; - chip::CharSpan deviceInstanceNameBeforeReboot; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 1: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 5: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - - VerifyOrReturn(CheckConstraintIsUpperCase("value.instanceName", value.instanceName, true)); - VerifyOrReturn(CheckConstraintIsHexString("value.instanceName", value.instanceName, true)); - VerifyOrReturn(CheckConstraintMinLength("value.instanceName", value.instanceName.size(), 16)); - VerifyOrReturn(CheckConstraintMaxLength("value.instanceName", value.instanceName.size(), 16)); - if (deviceInstanceNameBeforeRebootBuffer != nullptr) - { - chip::Platform::MemoryFree(deviceInstanceNameBeforeRebootBuffer); - } - deviceInstanceNameBeforeRebootBuffer = static_cast(chip::Platform::MemoryAlloc(value.instanceName.size())); - memcpy(deviceInstanceNameBeforeRebootBuffer, value.instanceName.data(), value.instanceName.size()); - deviceInstanceNameBeforeReboot = chip::CharSpan(deviceInstanceNameBeforeRebootBuffer, value.instanceName.size()); - } - shouldContinue = true; - break; - case 6: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - } - shouldContinue = true; - break; - case 7: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - } - shouldContinue = true; - break; - case 8: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - } - shouldContinue = true; - break; - case 9: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - } - shouldContinue = true; - break; - case 10: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - - VerifyOrReturn(CheckValue("longDiscriminator", value.longDiscriminator, - mDiscriminator.HasValue() ? mDiscriminator.Value() : 3840U)); - VerifyOrReturn(CheckConstraintMinValue("value.longDiscriminator", value.longDiscriminator, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value.longDiscriminator", value.longDiscriminator, 4096U)); - } - shouldContinue = true; - break; - case 11: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - - VerifyOrReturn(CheckValue("vendorId", value.vendorId, mVendorId.HasValue() ? mVendorId.Value() : 65521U)); - } - shouldContinue = true; - break; - case 12: - if (IsUnsupported(status.mStatus)) - { - shouldContinue = true; - return; - } - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - - VerifyOrReturn(CheckValue("productId", value.productId, mProductId.HasValue() ? mProductId.Value() : 32769U)); - } - shouldContinue = true; - break; - case 13: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - - VerifyOrReturn(CheckValuePresent("value.mrpRetryIntervalIdle", value.mrpRetryIntervalIdle)); - VerifyOrReturn( - CheckConstraintMaxValue("value.mrpRetryIntervalIdle.Value()", value.mrpRetryIntervalIdle.Value(), 3600000UL)); - } - shouldContinue = true; - break; - case 14: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - - VerifyOrReturn(CheckValuePresent("value.mrpRetryIntervalActive", value.mrpRetryIntervalActive)); - VerifyOrReturn(CheckConstraintMaxValue("value.mrpRetryIntervalActive.Value()", value.mrpRetryIntervalActive.Value(), - 3600000UL)); - } - shouldContinue = true; - break; - case 15: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - - VerifyOrReturn(CheckValue("commissioningMode", value.commissioningMode, 1)); - } - shouldContinue = true; - break; - case 16: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - - VerifyOrReturn(CheckConstraintMaxLength("value.deviceName", value.deviceName.size(), 32)); - } - shouldContinue = true; - break; - case 17: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - - VerifyOrReturn(CheckConstraintMaxValue("value.rotatingIdLen", value.rotatingIdLen, 100ULL)); - } - shouldContinue = true; - break; - case 18: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - - VerifyOrReturn(CheckConstraintNotValue("value.pairingHint", value.pairingHint, 0U)); - } - shouldContinue = true; - break; - case 19: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - - VerifyOrReturn(CheckConstraintMaxLength("value.pairingInstruction", value.pairingInstruction.size(), 128)); - } - shouldContinue = true; - break; - case 20: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - - VerifyOrReturn(CheckConstraintMinValue("value.numIPs", value.numIPs, 1)); - } - shouldContinue = true; - break; - case 21: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 22: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 24: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - - VerifyOrReturn(CheckConstraintIsUpperCase("value.instanceName", value.instanceName, true)); - VerifyOrReturn(CheckConstraintIsHexString("value.instanceName", value.instanceName, true)); - VerifyOrReturn(CheckConstraintMinLength("value.instanceName", value.instanceName.size(), 16)); - VerifyOrReturn(CheckConstraintMaxLength("value.instanceName", value.instanceName.size(), 16)); - VerifyOrReturn(CheckConstraintNotValue("value.instanceName", value.instanceName, deviceInstanceNameBeforeReboot)); - } - shouldContinue = true; - break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - // - // Tests methods - // - - CHIP_ERROR TestRebootTargetDevice_0() - { - SetIdentity(kIdentityAlpha); - return Reboot(mDiscriminator.HasValue() ? mDiscriminator.Value() : 3840U); - } - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_1() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestOpenCommissioningWindowWithTooShortTimeout_2() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - using RequestType = chip::app::Clusters::AdministratorCommissioning::Commands::OpenBasicCommissioningWindow::Type; - - RequestType request; - request.commissioningTimeout = 120U; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_2(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_2(error); - }; - - ReturnErrorOnFailure( - chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request, 10000)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_2(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_COMMAND)); - NextTest(); - } - - void OnSuccessResponse_2() { ThrowSuccessResponse(); } - - CHIP_ERROR TestOpenCommissioningWindowWithTooLongTimeout_3() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - using RequestType = chip::app::Clusters::AdministratorCommissioning::Commands::OpenBasicCommissioningWindow::Type; - - RequestType request; - request.commissioningTimeout = 1000U; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_3(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_3(error); - }; - - ReturnErrorOnFailure( - chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request, 10000)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_3(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_COMMAND)); - NextTest(); - } - - void OnSuccessResponse_3() { ThrowSuccessResponse(); } - - CHIP_ERROR TestOpenCommissioningWindow_4() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - using RequestType = chip::app::Clusters::AdministratorCommissioning::Commands::OpenBasicCommissioningWindow::Type; - - RequestType request; - request.commissioningTimeout = 180U; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_4(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_4(error); - }; - - ReturnErrorOnFailure( - chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request, 10000)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_4(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_4() { NextTest(); } - - CHIP_ERROR TestCheckInstanceName_5() - { - SetIdentity(kIdentityAlpha); - return FindCommissionable(); - } - - CHIP_ERROR TestCheckLongDiscriminatorL_6() - { - SetIdentity(kIdentityAlpha); - return FindCommissionableByLongDiscriminator(mDiscriminator.HasValue() ? mDiscriminator.Value() : 3840U); - } - - CHIP_ERROR TestCheckShortDiscriminatorS_7() - { - SetIdentity(kIdentityAlpha); - return FindCommissionableByShortDiscriminator(mDiscriminator.HasValue() ? mDiscriminator.Value() : 3840U); - } - - CHIP_ERROR TestCheckCommissioningModeCm_8() - { - SetIdentity(kIdentityAlpha); - return FindCommissionableByCommissioningMode(); - } - - CHIP_ERROR TestCheckVendorIdV_9() - { - SetIdentity(kIdentityAlpha); - return FindCommissionableByVendorId(mVendorId.HasValue() ? mVendorId.Value() : 65521U); - } - - CHIP_ERROR TestTxtKeyForDiscriminatorD_10() - { - SetIdentity(kIdentityAlpha); - return FindCommissionable(); - } - - CHIP_ERROR TestTxtKeyForVendorIdAndProductIdVp_11() - { - SetIdentity(kIdentityAlpha); - return FindCommissionable(); - } - - CHIP_ERROR TestTxtKeyForVendorIdAndProductIdVp_12() - { - SetIdentity(kIdentityAlpha); - return FindCommissionable(); - } - - CHIP_ERROR TestOptionalTxtKeyForMrpRetryIntervalIdleCri_13() - { - SetIdentity(kIdentityAlpha); - return FindCommissionable(); - } - - CHIP_ERROR TestOptionalTxtKeyForMrpRetryIntervalActiveCra_14() - { - SetIdentity(kIdentityAlpha); - return FindCommissionable(); - } - - CHIP_ERROR TestTxtKeyForCommissioningModeCm_15() - { - SetIdentity(kIdentityAlpha); - return FindCommissionable(); - } - - CHIP_ERROR TestOptionalTxtKeyForDeviceNameDn_16() - { - SetIdentity(kIdentityAlpha); - return FindCommissionable(); - } - - CHIP_ERROR TestOptionalTxtKeyForRotatingDeviceIdentifierRi_17() - { - SetIdentity(kIdentityAlpha); - return FindCommissionable(); - } - - CHIP_ERROR TestOptionalTxtKeyForPairingHintPh_18() - { - SetIdentity(kIdentityAlpha); - return FindCommissionable(); - } - - CHIP_ERROR TestOptionalTxtKeyForPairingInstructionsPi_19() - { - SetIdentity(kIdentityAlpha); - return FindCommissionable(); - } - - CHIP_ERROR TestCheckIPs_20() - { - SetIdentity(kIdentityAlpha); - return FindCommissionable(); - } - - CHIP_ERROR TestRebootTargetDevice_21() - { - SetIdentity(kIdentityAlpha); - return Reboot(mDiscriminator.HasValue() ? mDiscriminator.Value() : 3840U); - } - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_22() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestOpenCommissioningWindow_23() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - using RequestType = chip::app::Clusters::AdministratorCommissioning::Commands::OpenBasicCommissioningWindow::Type; - - RequestType request; - request.commissioningTimeout = 180U; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_23(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_23(error); - }; - - ReturnErrorOnFailure( - chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request, 10000)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_23(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_23() { NextTest(); } - - CHIP_ERROR TestCheckInstanceName_24() - { - SetIdentity(kIdentityAlpha); - return FindCommissionable(); - } -}; - -class TestLogCommandsSuite : public TestCommand -{ -public: - TestLogCommandsSuite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("TestLogCommands", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~TestLogCommandsSuite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: TestLogCommands\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: TestLogCommands\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Log a simple message\n"); - err = TestLogASimpleMessage_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Do a simple user prompt message\n"); - err = TestDoASimpleUserPromptMessage_2(); - break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 3; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 1: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 2: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestLogASimpleMessage_1() - { - SetIdentity(kIdentityAlpha); - return Log("This is a simple message"); - } - - CHIP_ERROR TestDoASimpleUserPromptMessage_2() - { - SetIdentity(kIdentityAlpha); - return UserPrompt("This is a simple message"); - } -}; - -class TestSaveAsSuite : public TestCommand -{ -public: - TestSaveAsSuite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("TestSaveAs", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~TestSaveAsSuite() - { - if (readAttributeCharStringDefaultValueBuffer != nullptr) - { - chip::Platform::MemoryFree(readAttributeCharStringDefaultValueBuffer); - readAttributeCharStringDefaultValueBuffer = nullptr; - } - if (readAttributeCharStringNotDefaultValueBuffer != nullptr) - { - chip::Platform::MemoryFree(readAttributeCharStringNotDefaultValueBuffer); - readAttributeCharStringNotDefaultValueBuffer = nullptr; - } - if (readAttributeOctetStringDefaultValueBuffer != nullptr) - { - chip::Platform::MemoryFree(readAttributeOctetStringDefaultValueBuffer); - readAttributeOctetStringDefaultValueBuffer = nullptr; - } - if (readAttributeOctetStringNotDefaultValueBuffer != nullptr) - { - chip::Platform::MemoryFree(readAttributeOctetStringNotDefaultValueBuffer); - readAttributeOctetStringNotDefaultValueBuffer = nullptr; - } - } - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: TestSaveAs\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: TestSaveAs\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Send Test Add Arguments Command\n"); - err = TestSendTestAddArgumentsCommand_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Send Test Add Arguments Command\n"); - err = TestSendTestAddArgumentsCommand_2(); - break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Send Test Add Arguments Command\n"); - err = TestSendTestAddArgumentsCommand_3(); - break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Read attribute BOOLEAN Default Value\n"); - err = TestReadAttributeBooleanDefaultValue_4(); - break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Write attribute BOOLEAN Not Default Value\n"); - err = TestWriteAttributeBooleanNotDefaultValue_5(); - break; - case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : Read attribute BOOLEAN Not Default Value\n"); - err = TestReadAttributeBooleanNotDefaultValue_6(); - break; - case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : Write attribute BOOLEAN DefaultValue\n"); - err = TestWriteAttributeBooleanDefaultValue_7(); - break; - case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : Read attribute BOOLEAN False\n"); - err = TestReadAttributeBooleanFalse_8(); - break; - case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : Read attribute BITMAP8 Default Value\n"); - err = TestReadAttributeBitmap8DefaultValue_9(); - break; - case 10: - ChipLogProgress(chipTool, " ***** Test Step 10 : Write attribute BITMAP8 Not Default Value\n"); - err = TestWriteAttributeBitmap8NotDefaultValue_10(); - break; - case 11: - ChipLogProgress(chipTool, " ***** Test Step 11 : Read attribute BITMAP8 Not Default Value\n"); - err = TestReadAttributeBitmap8NotDefaultValue_11(); - break; - case 12: - ChipLogProgress(chipTool, " ***** Test Step 12 : Write attribute BITMAP8 Default Value\n"); - err = TestWriteAttributeBitmap8DefaultValue_12(); - break; - case 13: - ChipLogProgress(chipTool, " ***** Test Step 13 : Read attribute BITMAP8 Default Value\n"); - err = TestReadAttributeBitmap8DefaultValue_13(); - break; - case 14: - ChipLogProgress(chipTool, " ***** Test Step 14 : Read attribute BITMAP16 Default Value\n"); - err = TestReadAttributeBitmap16DefaultValue_14(); - break; - case 15: - ChipLogProgress(chipTool, " ***** Test Step 15 : Write attribute BITMAP16 Not Default Value\n"); - err = TestWriteAttributeBitmap16NotDefaultValue_15(); - break; - case 16: - ChipLogProgress(chipTool, " ***** Test Step 16 : Read attribute BITMAP16 Not Default Value\n"); - err = TestReadAttributeBitmap16NotDefaultValue_16(); - break; - case 17: - ChipLogProgress(chipTool, " ***** Test Step 17 : Write attribute BITMAP16 Default Value\n"); - err = TestWriteAttributeBitmap16DefaultValue_17(); - break; - case 18: - ChipLogProgress(chipTool, " ***** Test Step 18 : Read attribute BITMAP16 Default Value\n"); - err = TestReadAttributeBitmap16DefaultValue_18(); - break; - case 19: - ChipLogProgress(chipTool, " ***** Test Step 19 : Read attribute BITMAP32 Default Value\n"); - err = TestReadAttributeBitmap32DefaultValue_19(); - break; - case 20: - ChipLogProgress(chipTool, " ***** Test Step 20 : Write attribute BITMAP32 Not Default Value\n"); - err = TestWriteAttributeBitmap32NotDefaultValue_20(); - break; - case 21: - ChipLogProgress(chipTool, " ***** Test Step 21 : Read attribute BITMAP32 Not Default Value\n"); - err = TestReadAttributeBitmap32NotDefaultValue_21(); - break; - case 22: - ChipLogProgress(chipTool, " ***** Test Step 22 : Write attribute BITMAP32 Default Value\n"); - err = TestWriteAttributeBitmap32DefaultValue_22(); - break; - case 23: - ChipLogProgress(chipTool, " ***** Test Step 23 : Read attribute BITMAP32 Default Value\n"); - err = TestReadAttributeBitmap32DefaultValue_23(); - break; - case 24: - ChipLogProgress(chipTool, " ***** Test Step 24 : Read attribute BITMAP64 Default Value\n"); - err = TestReadAttributeBitmap64DefaultValue_24(); - break; - case 25: - ChipLogProgress(chipTool, " ***** Test Step 25 : Write attribute BITMAP64 Not Default Value\n"); - err = TestWriteAttributeBitmap64NotDefaultValue_25(); - break; - case 26: - ChipLogProgress(chipTool, " ***** Test Step 26 : Read attribute BITMAP64 Default Value\n"); - err = TestReadAttributeBitmap64DefaultValue_26(); - break; - case 27: - ChipLogProgress(chipTool, " ***** Test Step 27 : Write attribute BITMAP64 Default Value\n"); - err = TestWriteAttributeBitmap64DefaultValue_27(); - break; - case 28: - ChipLogProgress(chipTool, " ***** Test Step 28 : Read attribute BITMAP64 Default Value\n"); - err = TestReadAttributeBitmap64DefaultValue_28(); - break; - case 29: - ChipLogProgress(chipTool, " ***** Test Step 29 : Read attribute INT8U Default Value\n"); - err = TestReadAttributeInt8uDefaultValue_29(); - break; - case 30: - ChipLogProgress(chipTool, " ***** Test Step 30 : Write attribute INT8U Not Default Value\n"); - err = TestWriteAttributeInt8uNotDefaultValue_30(); - break; - case 31: - ChipLogProgress(chipTool, " ***** Test Step 31 : Read attribute INT8U Not Default Value\n"); - err = TestReadAttributeInt8uNotDefaultValue_31(); - break; - case 32: - ChipLogProgress(chipTool, " ***** Test Step 32 : Write attribute INT8U Default Value\n"); - err = TestWriteAttributeInt8uDefaultValue_32(); - break; - case 33: - ChipLogProgress(chipTool, " ***** Test Step 33 : Read attribute INT8U Default Value\n"); - err = TestReadAttributeInt8uDefaultValue_33(); - break; - case 34: - ChipLogProgress(chipTool, " ***** Test Step 34 : Read attribute INT16U Default Value\n"); - err = TestReadAttributeInt16uDefaultValue_34(); - break; - case 35: - ChipLogProgress(chipTool, " ***** Test Step 35 : Write attribute INT16U Not Default Value\n"); - err = TestWriteAttributeInt16uNotDefaultValue_35(); - break; - case 36: - ChipLogProgress(chipTool, " ***** Test Step 36 : Read attribute INT16U Not Default Value\n"); - err = TestReadAttributeInt16uNotDefaultValue_36(); - break; - case 37: - ChipLogProgress(chipTool, " ***** Test Step 37 : Write attribute INT16U Default Value\n"); - err = TestWriteAttributeInt16uDefaultValue_37(); - break; - case 38: - ChipLogProgress(chipTool, " ***** Test Step 38 : Read attribute INT16U Default Value\n"); - err = TestReadAttributeInt16uDefaultValue_38(); - break; - case 39: - ChipLogProgress(chipTool, " ***** Test Step 39 : Read attribute INT32U Default Value\n"); - err = TestReadAttributeInt32uDefaultValue_39(); - break; - case 40: - ChipLogProgress(chipTool, " ***** Test Step 40 : Write attribute INT32U Not Default Value\n"); - err = TestWriteAttributeInt32uNotDefaultValue_40(); - break; - case 41: - ChipLogProgress(chipTool, " ***** Test Step 41 : Read attribute INT32U Not Default Value\n"); - err = TestReadAttributeInt32uNotDefaultValue_41(); - break; - case 42: - ChipLogProgress(chipTool, " ***** Test Step 42 : Write attribute INT32U Default Value\n"); - err = TestWriteAttributeInt32uDefaultValue_42(); - break; - case 43: - ChipLogProgress(chipTool, " ***** Test Step 43 : Read attribute INT32U Default Value\n"); - err = TestReadAttributeInt32uDefaultValue_43(); - break; - case 44: - ChipLogProgress(chipTool, " ***** Test Step 44 : Read attribute INT64U Default Value\n"); - err = TestReadAttributeInt64uDefaultValue_44(); - break; - case 45: - ChipLogProgress(chipTool, " ***** Test Step 45 : Write attribute INT64U Not Default Value\n"); - err = TestWriteAttributeInt64uNotDefaultValue_45(); - break; - case 46: - ChipLogProgress(chipTool, " ***** Test Step 46 : Read attribute INT64U Not Default Value\n"); - err = TestReadAttributeInt64uNotDefaultValue_46(); - break; - case 47: - ChipLogProgress(chipTool, " ***** Test Step 47 : Write attribute INT64U Default Value\n"); - err = TestWriteAttributeInt64uDefaultValue_47(); - break; - case 48: - ChipLogProgress(chipTool, " ***** Test Step 48 : Read attribute INT64U Default Value\n"); - err = TestReadAttributeInt64uDefaultValue_48(); - break; - case 49: - ChipLogProgress(chipTool, " ***** Test Step 49 : Read attribute INT8S Default Value\n"); - err = TestReadAttributeInt8sDefaultValue_49(); - break; - case 50: - ChipLogProgress(chipTool, " ***** Test Step 50 : Write attribute INT8S Not Default Value\n"); - err = TestWriteAttributeInt8sNotDefaultValue_50(); - break; - case 51: - ChipLogProgress(chipTool, " ***** Test Step 51 : Read attribute INT8S Not Default Value\n"); - err = TestReadAttributeInt8sNotDefaultValue_51(); - break; - case 52: - ChipLogProgress(chipTool, " ***** Test Step 52 : Write attribute INT8S Default Value\n"); - err = TestWriteAttributeInt8sDefaultValue_52(); - break; - case 53: - ChipLogProgress(chipTool, " ***** Test Step 53 : Read attribute INT8S Default Value\n"); - err = TestReadAttributeInt8sDefaultValue_53(); - break; - case 54: - ChipLogProgress(chipTool, " ***** Test Step 54 : Read attribute INT16S Default Value\n"); - err = TestReadAttributeInt16sDefaultValue_54(); - break; - case 55: - ChipLogProgress(chipTool, " ***** Test Step 55 : Write attribute INT16S Not Default Value\n"); - err = TestWriteAttributeInt16sNotDefaultValue_55(); - break; - case 56: - ChipLogProgress(chipTool, " ***** Test Step 56 : Read attribute INT16S Not Default Value\n"); - err = TestReadAttributeInt16sNotDefaultValue_56(); - break; - case 57: - ChipLogProgress(chipTool, " ***** Test Step 57 : Write attribute INT16S Default Value\n"); - err = TestWriteAttributeInt16sDefaultValue_57(); - break; - case 58: - ChipLogProgress(chipTool, " ***** Test Step 58 : Read attribute INT16S Default Value\n"); - err = TestReadAttributeInt16sDefaultValue_58(); - break; - case 59: - ChipLogProgress(chipTool, " ***** Test Step 59 : Read attribute INT32S Default Value\n"); - err = TestReadAttributeInt32sDefaultValue_59(); - break; - case 60: - ChipLogProgress(chipTool, " ***** Test Step 60 : Write attribute INT32S Not Default Value\n"); - err = TestWriteAttributeInt32sNotDefaultValue_60(); - break; - case 61: - ChipLogProgress(chipTool, " ***** Test Step 61 : Read attribute INT32S Not Default Value\n"); - err = TestReadAttributeInt32sNotDefaultValue_61(); - break; - case 62: - ChipLogProgress(chipTool, " ***** Test Step 62 : Write attribute INT32S Default Value\n"); - err = TestWriteAttributeInt32sDefaultValue_62(); - break; - case 63: - ChipLogProgress(chipTool, " ***** Test Step 63 : Read attribute INT32S Default Value\n"); - err = TestReadAttributeInt32sDefaultValue_63(); - break; - case 64: - ChipLogProgress(chipTool, " ***** Test Step 64 : Read attribute INT64S Default Value\n"); - err = TestReadAttributeInt64sDefaultValue_64(); - break; - case 65: - ChipLogProgress(chipTool, " ***** Test Step 65 : Write attribute INTS Not Default Value\n"); - err = TestWriteAttributeIntsNotDefaultValue_65(); - break; - case 66: - ChipLogProgress(chipTool, " ***** Test Step 66 : Read attribute INT64S Not Default Value\n"); - err = TestReadAttributeInt64sNotDefaultValue_66(); - break; - case 67: - ChipLogProgress(chipTool, " ***** Test Step 67 : Write attribute INT64S Default Value\n"); - err = TestWriteAttributeInt64sDefaultValue_67(); - break; - case 68: - ChipLogProgress(chipTool, " ***** Test Step 68 : Read attribute INT64S Default Value\n"); - err = TestReadAttributeInt64sDefaultValue_68(); - break; - case 69: - ChipLogProgress(chipTool, " ***** Test Step 69 : Read attribute ENUM8 Default Value\n"); - err = TestReadAttributeEnum8DefaultValue_69(); - break; - case 70: - ChipLogProgress(chipTool, " ***** Test Step 70 : Write attribute ENUM8 Not Default Value\n"); - err = TestWriteAttributeEnum8NotDefaultValue_70(); - break; - case 71: - ChipLogProgress(chipTool, " ***** Test Step 71 : Read attribute ENUM8 Not Default Value\n"); - err = TestReadAttributeEnum8NotDefaultValue_71(); - break; - case 72: - ChipLogProgress(chipTool, " ***** Test Step 72 : Write attribute ENUM8 Default Value\n"); - err = TestWriteAttributeEnum8DefaultValue_72(); - break; - case 73: - ChipLogProgress(chipTool, " ***** Test Step 73 : Read attribute ENUM8 Default Value\n"); - err = TestReadAttributeEnum8DefaultValue_73(); - break; - case 74: - ChipLogProgress(chipTool, " ***** Test Step 74 : Read attribute ENUM16 Default Value\n"); - err = TestReadAttributeEnum16DefaultValue_74(); - break; - case 75: - ChipLogProgress(chipTool, " ***** Test Step 75 : Write attribute ENUM16 Not Default Value\n"); - err = TestWriteAttributeEnum16NotDefaultValue_75(); - break; - case 76: - ChipLogProgress(chipTool, " ***** Test Step 76 : Read attribute ENUM16 Not Default Value\n"); - err = TestReadAttributeEnum16NotDefaultValue_76(); - break; - case 77: - ChipLogProgress(chipTool, " ***** Test Step 77 : Write attribute ENUM16 Default Value\n"); - err = TestWriteAttributeEnum16DefaultValue_77(); - break; - case 78: - ChipLogProgress(chipTool, " ***** Test Step 78 : Read attribute ENUM16 Default Value\n"); - err = TestReadAttributeEnum16DefaultValue_78(); - break; - case 79: - ChipLogProgress(chipTool, " ***** Test Step 79 : Read attribute EPOCH_US Default Value\n"); - err = TestReadAttributeEpochUsDefaultValue_79(); - break; - case 80: - ChipLogProgress(chipTool, " ***** Test Step 80 : Write attribute EPOCH_US Not Default Value\n"); - err = TestWriteAttributeEpochUsNotDefaultValue_80(); - break; - case 81: - ChipLogProgress(chipTool, " ***** Test Step 81 : Read attribute EPOCH_US Not Default Value\n"); - err = TestReadAttributeEpochUsNotDefaultValue_81(); - break; - case 82: - ChipLogProgress(chipTool, " ***** Test Step 82 : Write attribute EPOCH_US Default Value\n"); - err = TestWriteAttributeEpochUsDefaultValue_82(); - break; - case 83: - ChipLogProgress(chipTool, " ***** Test Step 83 : Read attribute EPOCH_US Default Value\n"); - err = TestReadAttributeEpochUsDefaultValue_83(); - break; - case 84: - ChipLogProgress(chipTool, " ***** Test Step 84 : Read attribute EPOCH_S Default Value\n"); - err = TestReadAttributeEpochSDefaultValue_84(); - break; - case 85: - ChipLogProgress(chipTool, " ***** Test Step 85 : Write attribute EPOCH_S Not Default Value\n"); - err = TestWriteAttributeEpochSNotDefaultValue_85(); - break; - case 86: - ChipLogProgress(chipTool, " ***** Test Step 86 : Read attribute EPOCH_S Not Default Value\n"); - err = TestReadAttributeEpochSNotDefaultValue_86(); - break; - case 87: - ChipLogProgress(chipTool, " ***** Test Step 87 : Write attribute EPOCH_S Default Value\n"); - err = TestWriteAttributeEpochSDefaultValue_87(); - break; - case 88: - ChipLogProgress(chipTool, " ***** Test Step 88 : Read attribute EPOCH_S Default Value\n"); - err = TestReadAttributeEpochSDefaultValue_88(); - break; - case 89: - ChipLogProgress(chipTool, " ***** Test Step 89 : Read attribute vendor_id Default Value\n"); - err = TestReadAttributeVendorIdDefaultValue_89(); - break; - case 90: - ChipLogProgress(chipTool, " ***** Test Step 90 : Write attribute vendor_id Not Default Value\n"); - err = TestWriteAttributeVendorIdNotDefaultValue_90(); - break; - case 91: - ChipLogProgress(chipTool, " ***** Test Step 91 : Read attribute vendor_id Not Default Value\n"); - err = TestReadAttributeVendorIdNotDefaultValue_91(); - break; - case 92: - ChipLogProgress(chipTool, " ***** Test Step 92 : Write attribute vendor_id Default Value\n"); - err = TestWriteAttributeVendorIdDefaultValue_92(); - break; - case 93: - ChipLogProgress(chipTool, " ***** Test Step 93 : Read attribute vendor_id Default Value\n"); - err = TestReadAttributeVendorIdDefaultValue_93(); - break; - case 94: - ChipLogProgress(chipTool, " ***** Test Step 94 : Read attribute char_string Default Value\n"); - err = TestReadAttributeCharStringDefaultValue_94(); - break; - case 95: - ChipLogProgress(chipTool, - " ***** Test Step 95 : Read attribute char_string Default Value and compare to saved value\n"); - err = TestReadAttributeCharStringDefaultValueAndCompareToSavedValue_95(); - break; - case 96: - ChipLogProgress(chipTool, " ***** Test Step 96 : Write attribute char_string Not Default Value\n"); - err = TestWriteAttributeCharStringNotDefaultValue_96(); - break; - case 97: - ChipLogProgress(chipTool, " ***** Test Step 97 : Read attribute char_string Not Default Value\n"); - err = TestReadAttributeCharStringNotDefaultValue_97(); - break; - case 98: - ChipLogProgress(chipTool, - " ***** Test Step 98 : Read attribute char_string Not Default Value and compare to saved value\n"); - err = TestReadAttributeCharStringNotDefaultValueAndCompareToSavedValue_98(); - break; - case 99: - ChipLogProgress(chipTool, " ***** Test Step 99 : Write attribute char_string Not Default Value from saved value\n"); - err = TestWriteAttributeCharStringNotDefaultValueFromSavedValue_99(); - break; - case 100: - ChipLogProgress(chipTool, - " ***** Test Step 100 : Read attribute char_string Not Default Value and compare to expected value\n"); - err = TestReadAttributeCharStringNotDefaultValueAndCompareToExpectedValue_100(); - break; - case 101: - ChipLogProgress(chipTool, " ***** Test Step 101 : Write attribute char_string Default Value\n"); - err = TestWriteAttributeCharStringDefaultValue_101(); - break; - case 102: - ChipLogProgress(chipTool, " ***** Test Step 102 : Read attribute octet_string Default Value\n"); - err = TestReadAttributeOctetStringDefaultValue_102(); - break; - case 103: - ChipLogProgress(chipTool, - " ***** Test Step 103 : Read attribute octet_string Default Value and compare to saved value\n"); - err = TestReadAttributeOctetStringDefaultValueAndCompareToSavedValue_103(); - break; - case 104: - ChipLogProgress(chipTool, " ***** Test Step 104 : Write attribute octet_string Not Default Value\n"); - err = TestWriteAttributeOctetStringNotDefaultValue_104(); - break; - case 105: - ChipLogProgress(chipTool, " ***** Test Step 105 : Read attribute octet_string Not Default Value\n"); - err = TestReadAttributeOctetStringNotDefaultValue_105(); - break; - case 106: - ChipLogProgress(chipTool, - " ***** Test Step 106 : Read attribute octet_string Not Default Value and compare to saved value\n"); - err = TestReadAttributeOctetStringNotDefaultValueAndCompareToSavedValue_106(); - break; - case 107: - ChipLogProgress(chipTool, " ***** Test Step 107 : Write attribute octet_string Not Default Value from saved value\n"); - err = TestWriteAttributeOctetStringNotDefaultValueFromSavedValue_107(); - break; - case 108: - ChipLogProgress(chipTool, - " ***** Test Step 108 : Read attribute octet_string Not Default Value and compare to expected value\n"); - err = TestReadAttributeOctetStringNotDefaultValueAndCompareToExpectedValue_108(); - break; - case 109: - ChipLogProgress(chipTool, " ***** Test Step 109 : Write attribute octet_string Default Value\n"); - err = TestWriteAttributeOctetStringDefaultValue_109(); - break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 110; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - uint8_t TestAddArgumentDefaultValue; - bool readAttributeBooleanDefaultValue; - chip::BitFlags readAttributeBitmap8DefaultValue; - chip::BitFlags readAttributeBitmap16DefaultValue; - chip::BitFlags readAttributeBitmap32DefaultValue; - chip::BitFlags readAttributeBitmap64DefaultValue; - uint8_t readAttributeInt8uDefaultValue; - uint16_t readAttributeInt16uDefaultValue; - uint32_t readAttributeInt32uDefaultValue; - uint64_t readAttributeInt64uDefaultValue; - int8_t readAttributeInt8sDefaultValue; - int16_t readAttributeInt16sDefaultValue; - int32_t readAttributeInt32sDefaultValue; - int64_t readAttributeInt64sDefaultValue; - uint8_t readAttributeEnum8DefaultValue; - uint16_t readAttributeEnum16DefaultValue; - uint64_t readAttributeEpochUSDefaultValue; - uint32_t readAttributeEpochSDefaultValue; - chip::VendorId readAttributeVendorIdDefaultValue; - char * readAttributeCharStringDefaultValueBuffer = nullptr; - chip::CharSpan readAttributeCharStringDefaultValue; - char * readAttributeCharStringNotDefaultValueBuffer = nullptr; - chip::CharSpan readAttributeCharStringNotDefaultValue; - uint8_t * readAttributeOctetStringDefaultValueBuffer = nullptr; - chip::ByteSpan readAttributeOctetStringDefaultValue; - uint8_t * readAttributeOctetStringNotDefaultValueBuffer = nullptr; - chip::ByteSpan readAttributeOctetStringNotDefaultValue; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - static void OnFailureCallback_4(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_4(error); - } - - static void OnSuccessCallback_4(void * context, bool boolean) - { - (static_cast(context))->OnSuccessResponse_4(boolean); - } - - static void OnFailureCallback_5(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_5(error); - } - - static void OnSuccessCallback_5(void * context) { (static_cast(context))->OnSuccessResponse_5(); } - - static void OnFailureCallback_6(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_6(error); - } - - static void OnSuccessCallback_6(void * context, bool boolean) - { - (static_cast(context))->OnSuccessResponse_6(boolean); - } - - static void OnFailureCallback_7(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_7(error); - } - - static void OnSuccessCallback_7(void * context) { (static_cast(context))->OnSuccessResponse_7(); } - - static void OnFailureCallback_8(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_8(error); - } - - static void OnSuccessCallback_8(void * context, bool boolean) - { - (static_cast(context))->OnSuccessResponse_8(boolean); - } - - static void OnFailureCallback_9(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_9(error); - } - - static void OnSuccessCallback_9(void * context, chip::BitFlags bitmap8) - { - (static_cast(context))->OnSuccessResponse_9(bitmap8); - } - - static void OnFailureCallback_10(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_10(error); - } - - static void OnSuccessCallback_10(void * context) { (static_cast(context))->OnSuccessResponse_10(); } - - static void OnFailureCallback_11(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_11(error); - } - - static void OnSuccessCallback_11(void * context, chip::BitFlags bitmap8) - { - (static_cast(context))->OnSuccessResponse_11(bitmap8); - } - - static void OnFailureCallback_12(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_12(error); - } - - static void OnSuccessCallback_12(void * context) { (static_cast(context))->OnSuccessResponse_12(); } - - static void OnFailureCallback_13(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_13(error); - } - - static void OnSuccessCallback_13(void * context, chip::BitFlags bitmap8) - { - (static_cast(context))->OnSuccessResponse_13(bitmap8); - } - - static void OnFailureCallback_14(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_14(error); - } - - static void OnSuccessCallback_14(void * context, chip::BitFlags bitmap16) - { - (static_cast(context))->OnSuccessResponse_14(bitmap16); - } - - static void OnFailureCallback_15(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_15(error); - } - - static void OnSuccessCallback_15(void * context) { (static_cast(context))->OnSuccessResponse_15(); } - - static void OnFailureCallback_16(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_16(error); - } - - static void OnSuccessCallback_16(void * context, chip::BitFlags bitmap16) - { - (static_cast(context))->OnSuccessResponse_16(bitmap16); - } - - static void OnFailureCallback_17(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_17(error); - } - - static void OnSuccessCallback_17(void * context) { (static_cast(context))->OnSuccessResponse_17(); } - - static void OnFailureCallback_18(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_18(error); - } - - static void OnSuccessCallback_18(void * context, chip::BitFlags bitmap16) - { - (static_cast(context))->OnSuccessResponse_18(bitmap16); - } - - static void OnFailureCallback_19(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_19(error); - } - - static void OnSuccessCallback_19(void * context, chip::BitFlags bitmap32) - { - (static_cast(context))->OnSuccessResponse_19(bitmap32); - } - - static void OnFailureCallback_20(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_20(error); - } - - static void OnSuccessCallback_20(void * context) { (static_cast(context))->OnSuccessResponse_20(); } - - static void OnFailureCallback_21(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_21(error); - } - - static void OnSuccessCallback_21(void * context, chip::BitFlags bitmap32) - { - (static_cast(context))->OnSuccessResponse_21(bitmap32); - } - - static void OnFailureCallback_22(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_22(error); - } - - static void OnSuccessCallback_22(void * context) { (static_cast(context))->OnSuccessResponse_22(); } - - static void OnFailureCallback_23(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_23(error); - } - - static void OnSuccessCallback_23(void * context, chip::BitFlags bitmap32) - { - (static_cast(context))->OnSuccessResponse_23(bitmap32); - } - - static void OnFailureCallback_24(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_24(error); - } - - static void OnSuccessCallback_24(void * context, chip::BitFlags bitmap64) - { - (static_cast(context))->OnSuccessResponse_24(bitmap64); - } - - static void OnFailureCallback_25(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_25(error); - } - - static void OnSuccessCallback_25(void * context) { (static_cast(context))->OnSuccessResponse_25(); } - - static void OnFailureCallback_26(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_26(error); - } - - static void OnSuccessCallback_26(void * context, chip::BitFlags bitmap64) - { - (static_cast(context))->OnSuccessResponse_26(bitmap64); - } - - static void OnFailureCallback_27(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_27(error); - } - - static void OnSuccessCallback_27(void * context) { (static_cast(context))->OnSuccessResponse_27(); } - - static void OnFailureCallback_28(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_28(error); - } - - static void OnSuccessCallback_28(void * context, chip::BitFlags bitmap64) - { - (static_cast(context))->OnSuccessResponse_28(bitmap64); - } - - static void OnFailureCallback_29(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_29(error); - } - - static void OnSuccessCallback_29(void * context, uint8_t int8u) - { - (static_cast(context))->OnSuccessResponse_29(int8u); - } - - static void OnFailureCallback_30(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_30(error); - } - - static void OnSuccessCallback_30(void * context) { (static_cast(context))->OnSuccessResponse_30(); } - - static void OnFailureCallback_31(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_31(error); - } - - static void OnSuccessCallback_31(void * context, uint8_t int8u) - { - (static_cast(context))->OnSuccessResponse_31(int8u); - } - - static void OnFailureCallback_32(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_32(error); - } - - static void OnSuccessCallback_32(void * context) { (static_cast(context))->OnSuccessResponse_32(); } - - static void OnFailureCallback_33(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_33(error); - } - - static void OnSuccessCallback_33(void * context, uint8_t int8u) - { - (static_cast(context))->OnSuccessResponse_33(int8u); - } - - static void OnFailureCallback_34(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_34(error); - } - - static void OnSuccessCallback_34(void * context, uint16_t int16u) - { - (static_cast(context))->OnSuccessResponse_34(int16u); - } - - static void OnFailureCallback_35(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_35(error); - } - - static void OnSuccessCallback_35(void * context) { (static_cast(context))->OnSuccessResponse_35(); } - - static void OnFailureCallback_36(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_36(error); - } - - static void OnSuccessCallback_36(void * context, uint16_t int16u) - { - (static_cast(context))->OnSuccessResponse_36(int16u); - } - - static void OnFailureCallback_37(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_37(error); - } - - static void OnSuccessCallback_37(void * context) { (static_cast(context))->OnSuccessResponse_37(); } - - static void OnFailureCallback_38(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_38(error); - } - - static void OnSuccessCallback_38(void * context, uint16_t int16u) - { - (static_cast(context))->OnSuccessResponse_38(int16u); - } - - static void OnFailureCallback_39(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_39(error); - } - - static void OnSuccessCallback_39(void * context, uint32_t int32u) - { - (static_cast(context))->OnSuccessResponse_39(int32u); - } - - static void OnFailureCallback_40(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_40(error); - } - - static void OnSuccessCallback_40(void * context) { (static_cast(context))->OnSuccessResponse_40(); } - - static void OnFailureCallback_41(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_41(error); - } - - static void OnSuccessCallback_41(void * context, uint32_t int32u) - { - (static_cast(context))->OnSuccessResponse_41(int32u); - } - - static void OnFailureCallback_42(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_42(error); - } - - static void OnSuccessCallback_42(void * context) { (static_cast(context))->OnSuccessResponse_42(); } - - static void OnFailureCallback_43(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_43(error); - } - - static void OnSuccessCallback_43(void * context, uint32_t int32u) - { - (static_cast(context))->OnSuccessResponse_43(int32u); - } - - static void OnFailureCallback_44(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_44(error); - } - - static void OnSuccessCallback_44(void * context, uint64_t int64u) - { - (static_cast(context))->OnSuccessResponse_44(int64u); - } - - static void OnFailureCallback_45(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_45(error); - } - - static void OnSuccessCallback_45(void * context) { (static_cast(context))->OnSuccessResponse_45(); } - - static void OnFailureCallback_46(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_46(error); - } - - static void OnSuccessCallback_46(void * context, uint64_t int64u) - { - (static_cast(context))->OnSuccessResponse_46(int64u); - } - - static void OnFailureCallback_47(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_47(error); - } - - static void OnSuccessCallback_47(void * context) { (static_cast(context))->OnSuccessResponse_47(); } - - static void OnFailureCallback_48(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_48(error); - } - - static void OnSuccessCallback_48(void * context, uint64_t int64u) - { - (static_cast(context))->OnSuccessResponse_48(int64u); - } - - static void OnFailureCallback_49(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_49(error); - } - - static void OnSuccessCallback_49(void * context, int8_t int8s) - { - (static_cast(context))->OnSuccessResponse_49(int8s); - } - - static void OnFailureCallback_50(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_50(error); - } - - static void OnSuccessCallback_50(void * context) { (static_cast(context))->OnSuccessResponse_50(); } - - static void OnFailureCallback_51(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_51(error); - } - - static void OnSuccessCallback_51(void * context, int8_t int8s) - { - (static_cast(context))->OnSuccessResponse_51(int8s); - } - - static void OnFailureCallback_52(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_52(error); - } - - static void OnSuccessCallback_52(void * context) { (static_cast(context))->OnSuccessResponse_52(); } - - static void OnFailureCallback_53(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_53(error); - } - - static void OnSuccessCallback_53(void * context, int8_t int8s) - { - (static_cast(context))->OnSuccessResponse_53(int8s); - } - - static void OnFailureCallback_54(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_54(error); - } - - static void OnSuccessCallback_54(void * context, int16_t int16s) - { - (static_cast(context))->OnSuccessResponse_54(int16s); - } - - static void OnFailureCallback_55(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_55(error); - } - - static void OnSuccessCallback_55(void * context) { (static_cast(context))->OnSuccessResponse_55(); } - - static void OnFailureCallback_56(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_56(error); - } - - static void OnSuccessCallback_56(void * context, int16_t int16s) - { - (static_cast(context))->OnSuccessResponse_56(int16s); - } - - static void OnFailureCallback_57(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_57(error); - } - - static void OnSuccessCallback_57(void * context) { (static_cast(context))->OnSuccessResponse_57(); } - - static void OnFailureCallback_58(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_58(error); - } - - static void OnSuccessCallback_58(void * context, int16_t int16s) - { - (static_cast(context))->OnSuccessResponse_58(int16s); - } - - static void OnFailureCallback_59(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_59(error); - } - - static void OnSuccessCallback_59(void * context, int32_t int32s) - { - (static_cast(context))->OnSuccessResponse_59(int32s); - } - - static void OnFailureCallback_60(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_60(error); - } - - static void OnSuccessCallback_60(void * context) { (static_cast(context))->OnSuccessResponse_60(); } - - static void OnFailureCallback_61(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_61(error); - } - - static void OnSuccessCallback_61(void * context, int32_t int32s) - { - (static_cast(context))->OnSuccessResponse_61(int32s); - } - - static void OnFailureCallback_62(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_62(error); - } - - static void OnSuccessCallback_62(void * context) { (static_cast(context))->OnSuccessResponse_62(); } - - static void OnFailureCallback_63(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_63(error); - } - - static void OnSuccessCallback_63(void * context, int32_t int32s) - { - (static_cast(context))->OnSuccessResponse_63(int32s); - } - - static void OnFailureCallback_64(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_64(error); - } - - static void OnSuccessCallback_64(void * context, int64_t int64s) - { - (static_cast(context))->OnSuccessResponse_64(int64s); - } - - static void OnFailureCallback_65(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_65(error); - } - - static void OnSuccessCallback_65(void * context) { (static_cast(context))->OnSuccessResponse_65(); } - - static void OnFailureCallback_66(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_66(error); - } - - static void OnSuccessCallback_66(void * context, int64_t int64s) - { - (static_cast(context))->OnSuccessResponse_66(int64s); - } - - static void OnFailureCallback_67(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_67(error); - } - - static void OnSuccessCallback_67(void * context) { (static_cast(context))->OnSuccessResponse_67(); } - - static void OnFailureCallback_68(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_68(error); - } - - static void OnSuccessCallback_68(void * context, int64_t int64s) - { - (static_cast(context))->OnSuccessResponse_68(int64s); - } - - static void OnFailureCallback_69(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_69(error); - } - - static void OnSuccessCallback_69(void * context, uint8_t enum8) - { - (static_cast(context))->OnSuccessResponse_69(enum8); - } - - static void OnFailureCallback_70(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_70(error); - } - - static void OnSuccessCallback_70(void * context) { (static_cast(context))->OnSuccessResponse_70(); } - - static void OnFailureCallback_71(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_71(error); - } - - static void OnSuccessCallback_71(void * context, uint8_t enum8) - { - (static_cast(context))->OnSuccessResponse_71(enum8); - } - - static void OnFailureCallback_72(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_72(error); - } - - static void OnSuccessCallback_72(void * context) { (static_cast(context))->OnSuccessResponse_72(); } - - static void OnFailureCallback_73(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_73(error); - } - - static void OnSuccessCallback_73(void * context, uint8_t enum8) - { - (static_cast(context))->OnSuccessResponse_73(enum8); - } - - static void OnFailureCallback_74(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_74(error); - } - - static void OnSuccessCallback_74(void * context, uint16_t enum16) - { - (static_cast(context))->OnSuccessResponse_74(enum16); - } - - static void OnFailureCallback_75(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_75(error); - } - - static void OnSuccessCallback_75(void * context) { (static_cast(context))->OnSuccessResponse_75(); } - - static void OnFailureCallback_76(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_76(error); - } - - static void OnSuccessCallback_76(void * context, uint16_t enum16) - { - (static_cast(context))->OnSuccessResponse_76(enum16); - } - - static void OnFailureCallback_77(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_77(error); - } - - static void OnSuccessCallback_77(void * context) { (static_cast(context))->OnSuccessResponse_77(); } - - static void OnFailureCallback_78(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_78(error); - } - - static void OnSuccessCallback_78(void * context, uint16_t enum16) - { - (static_cast(context))->OnSuccessResponse_78(enum16); - } - - static void OnFailureCallback_79(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_79(error); - } - - static void OnSuccessCallback_79(void * context, uint64_t epochUs) - { - (static_cast(context))->OnSuccessResponse_79(epochUs); - } - - static void OnFailureCallback_80(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_80(error); - } - - static void OnSuccessCallback_80(void * context) { (static_cast(context))->OnSuccessResponse_80(); } - - static void OnFailureCallback_81(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_81(error); - } - - static void OnSuccessCallback_81(void * context, uint64_t epochUs) - { - (static_cast(context))->OnSuccessResponse_81(epochUs); - } - - static void OnFailureCallback_82(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_82(error); - } - - static void OnSuccessCallback_82(void * context) { (static_cast(context))->OnSuccessResponse_82(); } - - static void OnFailureCallback_83(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_83(error); - } - - static void OnSuccessCallback_83(void * context, uint64_t epochUs) - { - (static_cast(context))->OnSuccessResponse_83(epochUs); - } - - static void OnFailureCallback_84(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_84(error); - } - - static void OnSuccessCallback_84(void * context, uint32_t epochS) - { - (static_cast(context))->OnSuccessResponse_84(epochS); - } - - static void OnFailureCallback_85(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_85(error); - } - - static void OnSuccessCallback_85(void * context) { (static_cast(context))->OnSuccessResponse_85(); } - - static void OnFailureCallback_86(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_86(error); - } - - static void OnSuccessCallback_86(void * context, uint32_t epochS) - { - (static_cast(context))->OnSuccessResponse_86(epochS); - } - - static void OnFailureCallback_87(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_87(error); - } - - static void OnSuccessCallback_87(void * context) { (static_cast(context))->OnSuccessResponse_87(); } - - static void OnFailureCallback_88(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_88(error); - } - - static void OnSuccessCallback_88(void * context, uint32_t epochS) - { - (static_cast(context))->OnSuccessResponse_88(epochS); - } - - static void OnFailureCallback_89(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_89(error); - } - - static void OnSuccessCallback_89(void * context, chip::VendorId vendorId) - { - (static_cast(context))->OnSuccessResponse_89(vendorId); - } - - static void OnFailureCallback_90(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_90(error); - } - - static void OnSuccessCallback_90(void * context) { (static_cast(context))->OnSuccessResponse_90(); } - - static void OnFailureCallback_91(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_91(error); - } - - static void OnSuccessCallback_91(void * context, chip::VendorId vendorId) - { - (static_cast(context))->OnSuccessResponse_91(vendorId); - } - - static void OnFailureCallback_92(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_92(error); - } - - static void OnSuccessCallback_92(void * context) { (static_cast(context))->OnSuccessResponse_92(); } - - static void OnFailureCallback_93(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_93(error); - } - - static void OnSuccessCallback_93(void * context, chip::VendorId vendorId) - { - (static_cast(context))->OnSuccessResponse_93(vendorId); - } - - static void OnFailureCallback_94(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_94(error); - } - - static void OnSuccessCallback_94(void * context, chip::CharSpan charString) - { - (static_cast(context))->OnSuccessResponse_94(charString); - } - - static void OnFailureCallback_95(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_95(error); - } - - static void OnSuccessCallback_95(void * context, chip::CharSpan charString) - { - (static_cast(context))->OnSuccessResponse_95(charString); - } - - static void OnFailureCallback_96(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_96(error); - } - - static void OnSuccessCallback_96(void * context) { (static_cast(context))->OnSuccessResponse_96(); } - - static void OnFailureCallback_97(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_97(error); - } - - static void OnSuccessCallback_97(void * context, chip::CharSpan charString) - { - (static_cast(context))->OnSuccessResponse_97(charString); - } - - static void OnFailureCallback_98(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_98(error); - } - - static void OnSuccessCallback_98(void * context, chip::CharSpan charString) - { - (static_cast(context))->OnSuccessResponse_98(charString); - } - - static void OnFailureCallback_99(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_99(error); - } - - static void OnSuccessCallback_99(void * context) { (static_cast(context))->OnSuccessResponse_99(); } - - static void OnFailureCallback_100(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_100(error); - } - - static void OnSuccessCallback_100(void * context, chip::CharSpan charString) - { - (static_cast(context))->OnSuccessResponse_100(charString); - } - - static void OnFailureCallback_101(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_101(error); - } - - static void OnSuccessCallback_101(void * context) { (static_cast(context))->OnSuccessResponse_101(); } - - static void OnFailureCallback_102(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_102(error); - } - - static void OnSuccessCallback_102(void * context, chip::ByteSpan octetString) - { - (static_cast(context))->OnSuccessResponse_102(octetString); - } - - static void OnFailureCallback_103(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_103(error); - } - - static void OnSuccessCallback_103(void * context, chip::ByteSpan octetString) - { - (static_cast(context))->OnSuccessResponse_103(octetString); - } - - static void OnFailureCallback_104(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_104(error); - } - - static void OnSuccessCallback_104(void * context) { (static_cast(context))->OnSuccessResponse_104(); } - - static void OnFailureCallback_105(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_105(error); - } - - static void OnSuccessCallback_105(void * context, chip::ByteSpan octetString) - { - (static_cast(context))->OnSuccessResponse_105(octetString); - } - - static void OnFailureCallback_106(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_106(error); - } - - static void OnSuccessCallback_106(void * context, chip::ByteSpan octetString) - { - (static_cast(context))->OnSuccessResponse_106(octetString); - } - - static void OnFailureCallback_107(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_107(error); - } - - static void OnSuccessCallback_107(void * context) { (static_cast(context))->OnSuccessResponse_107(); } - - static void OnFailureCallback_108(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_108(error); - } - - static void OnSuccessCallback_108(void * context, chip::ByteSpan octetString) - { - (static_cast(context))->OnSuccessResponse_108(octetString); - } - - static void OnFailureCallback_109(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_109(error); - } - - static void OnSuccessCallback_109(void * context) { (static_cast(context))->OnSuccessResponse_109(); } - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestSendTestAddArgumentsCommand_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::TestCluster::Commands::TestAddArguments::Type; - - RequestType request; - request.arg1 = 3; - request.arg2 = 17; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_1(data.returnValue); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_1(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_1(uint8_t returnValue) - { - VerifyOrReturn(CheckValue("returnValue", returnValue, 20)); - - TestAddArgumentDefaultValue = returnValue; - NextTest(); - } - - CHIP_ERROR TestSendTestAddArgumentsCommand_2() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::TestCluster::Commands::TestAddArguments::Type; - - RequestType request; - request.arg1 = 3; - request.arg2 = 17; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_2(data.returnValue); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_2(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_2(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_2(uint8_t returnValue) - { - VerifyOrReturn(CheckValue("returnValue", returnValue, TestAddArgumentDefaultValue)); - - NextTest(); - } - - CHIP_ERROR TestSendTestAddArgumentsCommand_3() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::TestCluster::Commands::TestAddArguments::Type; - - RequestType request; - request.arg1 = 3; - request.arg2 = TestAddArgumentDefaultValue; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_3(data.returnValue); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_3(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_3(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_3(uint8_t returnValue) - { - VerifyOrReturn(CheckConstraintNotValue("returnValue", returnValue, TestAddArgumentDefaultValue)); - - NextTest(); - } - - CHIP_ERROR TestReadAttributeBooleanDefaultValue_4() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_4, OnFailureCallback_4, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_4(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_4(bool boolean) - { - VerifyOrReturn(CheckValue("boolean", boolean, 0)); - - readAttributeBooleanDefaultValue = boolean; - NextTest(); - } - - CHIP_ERROR TestWriteAttributeBooleanNotDefaultValue_5() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - bool booleanArgument; - booleanArgument = 1; - - ReturnErrorOnFailure(cluster.WriteAttribute( - booleanArgument, this, OnSuccessCallback_5, OnFailureCallback_5)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_5(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_5() { NextTest(); } - - CHIP_ERROR TestReadAttributeBooleanNotDefaultValue_6() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_6, OnFailureCallback_6, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_6(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_6(bool boolean) - { - VerifyOrReturn(CheckConstraintNotValue("boolean", boolean, readAttributeBooleanDefaultValue)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeBooleanDefaultValue_7() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - bool booleanArgument; - booleanArgument = readAttributeBooleanDefaultValue; - - ReturnErrorOnFailure(cluster.WriteAttribute( - booleanArgument, this, OnSuccessCallback_7, OnFailureCallback_7)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_7(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_7() { NextTest(); } - - CHIP_ERROR TestReadAttributeBooleanFalse_8() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_8, OnFailureCallback_8, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_8(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_8(bool boolean) - { - VerifyOrReturn(CheckValue("boolean", boolean, readAttributeBooleanDefaultValue)); - - NextTest(); - } - - CHIP_ERROR TestReadAttributeBitmap8DefaultValue_9() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_9, OnFailureCallback_9, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_9(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_9(chip::BitFlags bitmap8) - { - VerifyOrReturn(CheckValue("bitmap8", bitmap8, 0)); - - readAttributeBitmap8DefaultValue = bitmap8; - NextTest(); - } - - CHIP_ERROR TestWriteAttributeBitmap8NotDefaultValue_10() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::BitFlags bitmap8Argument; - bitmap8Argument = static_cast>(1); - - ReturnErrorOnFailure(cluster.WriteAttribute( - bitmap8Argument, this, OnSuccessCallback_10, OnFailureCallback_10)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_10(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_10() { NextTest(); } - - CHIP_ERROR TestReadAttributeBitmap8NotDefaultValue_11() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_11, OnFailureCallback_11, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_11(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_11(chip::BitFlags bitmap8) - { - VerifyOrReturn(CheckConstraintNotValue("bitmap8", bitmap8, readAttributeBitmap8DefaultValue)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeBitmap8DefaultValue_12() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::BitFlags bitmap8Argument; - bitmap8Argument = readAttributeBitmap8DefaultValue; - - ReturnErrorOnFailure(cluster.WriteAttribute( - bitmap8Argument, this, OnSuccessCallback_12, OnFailureCallback_12)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_12(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_12() { NextTest(); } - - CHIP_ERROR TestReadAttributeBitmap8DefaultValue_13() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_13, OnFailureCallback_13, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_13(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_13(chip::BitFlags bitmap8) - { - VerifyOrReturn(CheckValue("bitmap8", bitmap8, readAttributeBitmap8DefaultValue)); - - NextTest(); - } - - CHIP_ERROR TestReadAttributeBitmap16DefaultValue_14() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_14, OnFailureCallback_14, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_14(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_14(chip::BitFlags bitmap16) - { - VerifyOrReturn(CheckValue("bitmap16", bitmap16, 0U)); - - readAttributeBitmap16DefaultValue = bitmap16; - NextTest(); - } - - CHIP_ERROR TestWriteAttributeBitmap16NotDefaultValue_15() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::BitFlags bitmap16Argument; - bitmap16Argument = static_cast>(1U); - - ReturnErrorOnFailure(cluster.WriteAttribute( - bitmap16Argument, this, OnSuccessCallback_15, OnFailureCallback_15)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_15(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_15() { NextTest(); } - - CHIP_ERROR TestReadAttributeBitmap16NotDefaultValue_16() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_16, OnFailureCallback_16, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_16(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_16(chip::BitFlags bitmap16) - { - VerifyOrReturn(CheckConstraintNotValue("bitmap16", bitmap16, readAttributeBitmap16DefaultValue)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeBitmap16DefaultValue_17() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::BitFlags bitmap16Argument; - bitmap16Argument = readAttributeBitmap16DefaultValue; - - ReturnErrorOnFailure(cluster.WriteAttribute( - bitmap16Argument, this, OnSuccessCallback_17, OnFailureCallback_17)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_17(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_17() { NextTest(); } - - CHIP_ERROR TestReadAttributeBitmap16DefaultValue_18() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_18, OnFailureCallback_18, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_18(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_18(chip::BitFlags bitmap16) - { - VerifyOrReturn(CheckValue("bitmap16", bitmap16, readAttributeBitmap16DefaultValue)); - - NextTest(); - } - - CHIP_ERROR TestReadAttributeBitmap32DefaultValue_19() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_19, OnFailureCallback_19, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_19(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_19(chip::BitFlags bitmap32) - { - VerifyOrReturn(CheckValue("bitmap32", bitmap32, 0UL)); - - readAttributeBitmap32DefaultValue = bitmap32; - NextTest(); - } - - CHIP_ERROR TestWriteAttributeBitmap32NotDefaultValue_20() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::BitFlags bitmap32Argument; - bitmap32Argument = static_cast>(1UL); - - ReturnErrorOnFailure(cluster.WriteAttribute( - bitmap32Argument, this, OnSuccessCallback_20, OnFailureCallback_20)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_20(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_20() { NextTest(); } - - CHIP_ERROR TestReadAttributeBitmap32NotDefaultValue_21() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_21, OnFailureCallback_21, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_21(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_21(chip::BitFlags bitmap32) - { - VerifyOrReturn(CheckConstraintNotValue("bitmap32", bitmap32, readAttributeBitmap32DefaultValue)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeBitmap32DefaultValue_22() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::BitFlags bitmap32Argument; - bitmap32Argument = readAttributeBitmap32DefaultValue; - - ReturnErrorOnFailure(cluster.WriteAttribute( - bitmap32Argument, this, OnSuccessCallback_22, OnFailureCallback_22)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_22(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_22() { NextTest(); } - - CHIP_ERROR TestReadAttributeBitmap32DefaultValue_23() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_23, OnFailureCallback_23, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_23(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_23(chip::BitFlags bitmap32) - { - VerifyOrReturn(CheckValue("bitmap32", bitmap32, readAttributeBitmap32DefaultValue)); - - NextTest(); - } - - CHIP_ERROR TestReadAttributeBitmap64DefaultValue_24() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_24, OnFailureCallback_24, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_24(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_24(chip::BitFlags bitmap64) - { - VerifyOrReturn(CheckValue("bitmap64", bitmap64, 0ULL)); - - readAttributeBitmap64DefaultValue = bitmap64; - NextTest(); - } - - CHIP_ERROR TestWriteAttributeBitmap64NotDefaultValue_25() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::BitFlags bitmap64Argument; - bitmap64Argument = static_cast>(1ULL); - - ReturnErrorOnFailure(cluster.WriteAttribute( - bitmap64Argument, this, OnSuccessCallback_25, OnFailureCallback_25)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_25(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_25() { NextTest(); } - - CHIP_ERROR TestReadAttributeBitmap64DefaultValue_26() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_26, OnFailureCallback_26, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_26(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_26(chip::BitFlags bitmap64) - { - VerifyOrReturn(CheckConstraintNotValue("bitmap64", bitmap64, readAttributeBitmap64DefaultValue)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeBitmap64DefaultValue_27() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::BitFlags bitmap64Argument; - bitmap64Argument = readAttributeBitmap64DefaultValue; - - ReturnErrorOnFailure(cluster.WriteAttribute( - bitmap64Argument, this, OnSuccessCallback_27, OnFailureCallback_27)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_27(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_27() { NextTest(); } - - CHIP_ERROR TestReadAttributeBitmap64DefaultValue_28() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_28, OnFailureCallback_28, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_28(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_28(chip::BitFlags bitmap64) - { - VerifyOrReturn(CheckValue("bitmap64", bitmap64, readAttributeBitmap64DefaultValue)); - - NextTest(); - } - - CHIP_ERROR TestReadAttributeInt8uDefaultValue_29() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_29, OnFailureCallback_29, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_29(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_29(uint8_t int8u) - { - VerifyOrReturn(CheckValue("int8u", int8u, 0)); - - readAttributeInt8uDefaultValue = int8u; - NextTest(); - } - - CHIP_ERROR TestWriteAttributeInt8uNotDefaultValue_30() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - uint8_t int8uArgument; - int8uArgument = 1; - - ReturnErrorOnFailure(cluster.WriteAttribute( - int8uArgument, this, OnSuccessCallback_30, OnFailureCallback_30)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_30(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_30() { NextTest(); } - - CHIP_ERROR TestReadAttributeInt8uNotDefaultValue_31() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_31, OnFailureCallback_31, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_31(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_31(uint8_t int8u) - { - VerifyOrReturn(CheckConstraintNotValue("int8u", int8u, readAttributeInt8uDefaultValue)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeInt8uDefaultValue_32() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - uint8_t int8uArgument; - int8uArgument = readAttributeInt8uDefaultValue; - - ReturnErrorOnFailure(cluster.WriteAttribute( - int8uArgument, this, OnSuccessCallback_32, OnFailureCallback_32)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_32(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_32() { NextTest(); } - - CHIP_ERROR TestReadAttributeInt8uDefaultValue_33() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_33, OnFailureCallback_33, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_33(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_33(uint8_t int8u) - { - VerifyOrReturn(CheckValue("int8u", int8u, readAttributeInt8uDefaultValue)); - - NextTest(); - } - - CHIP_ERROR TestReadAttributeInt16uDefaultValue_34() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_34, OnFailureCallback_34, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_34(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_34(uint16_t int16u) - { - VerifyOrReturn(CheckValue("int16u", int16u, 0U)); - - readAttributeInt16uDefaultValue = int16u; - NextTest(); - } - - CHIP_ERROR TestWriteAttributeInt16uNotDefaultValue_35() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - uint16_t int16uArgument; - int16uArgument = 1U; - - ReturnErrorOnFailure(cluster.WriteAttribute( - int16uArgument, this, OnSuccessCallback_35, OnFailureCallback_35)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_35(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_35() { NextTest(); } - - CHIP_ERROR TestReadAttributeInt16uNotDefaultValue_36() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_36, OnFailureCallback_36, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_36(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_36(uint16_t int16u) - { - VerifyOrReturn(CheckConstraintNotValue("int16u", int16u, readAttributeInt16uDefaultValue)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeInt16uDefaultValue_37() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - uint16_t int16uArgument; - int16uArgument = readAttributeInt16uDefaultValue; - - ReturnErrorOnFailure(cluster.WriteAttribute( - int16uArgument, this, OnSuccessCallback_37, OnFailureCallback_37)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_37(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_37() { NextTest(); } - - CHIP_ERROR TestReadAttributeInt16uDefaultValue_38() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_38, OnFailureCallback_38, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_38(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_38(uint16_t int16u) - { - VerifyOrReturn(CheckValue("int16u", int16u, readAttributeInt16uDefaultValue)); - - NextTest(); - } - - CHIP_ERROR TestReadAttributeInt32uDefaultValue_39() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_39, OnFailureCallback_39, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_39(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_39(uint32_t int32u) - { - VerifyOrReturn(CheckValue("int32u", int32u, 0UL)); - - readAttributeInt32uDefaultValue = int32u; - NextTest(); - } - - CHIP_ERROR TestWriteAttributeInt32uNotDefaultValue_40() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - uint32_t int32uArgument; - int32uArgument = 1UL; - - ReturnErrorOnFailure(cluster.WriteAttribute( - int32uArgument, this, OnSuccessCallback_40, OnFailureCallback_40)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_40(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_40() { NextTest(); } - - CHIP_ERROR TestReadAttributeInt32uNotDefaultValue_41() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_41, OnFailureCallback_41, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_41(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_41(uint32_t int32u) - { - VerifyOrReturn(CheckConstraintNotValue("int32u", int32u, readAttributeInt32uDefaultValue)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeInt32uDefaultValue_42() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - uint32_t int32uArgument; - int32uArgument = readAttributeInt32uDefaultValue; - - ReturnErrorOnFailure(cluster.WriteAttribute( - int32uArgument, this, OnSuccessCallback_42, OnFailureCallback_42)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_42(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_42() { NextTest(); } - - CHIP_ERROR TestReadAttributeInt32uDefaultValue_43() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_43, OnFailureCallback_43, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_43(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_43(uint32_t int32u) - { - VerifyOrReturn(CheckValue("int32u", int32u, readAttributeInt32uDefaultValue)); - - NextTest(); - } - - CHIP_ERROR TestReadAttributeInt64uDefaultValue_44() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_44, OnFailureCallback_44, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_44(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_44(uint64_t int64u) - { - VerifyOrReturn(CheckValue("int64u", int64u, 0ULL)); - - readAttributeInt64uDefaultValue = int64u; - NextTest(); - } - - CHIP_ERROR TestWriteAttributeInt64uNotDefaultValue_45() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - uint64_t int64uArgument; - int64uArgument = 1ULL; - - ReturnErrorOnFailure(cluster.WriteAttribute( - int64uArgument, this, OnSuccessCallback_45, OnFailureCallback_45)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_45(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_45() { NextTest(); } - - CHIP_ERROR TestReadAttributeInt64uNotDefaultValue_46() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_46, OnFailureCallback_46, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_46(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_46(uint64_t int64u) - { - VerifyOrReturn(CheckConstraintNotValue("int64u", int64u, readAttributeInt64uDefaultValue)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeInt64uDefaultValue_47() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - uint64_t int64uArgument; - int64uArgument = readAttributeInt64uDefaultValue; - - ReturnErrorOnFailure(cluster.WriteAttribute( - int64uArgument, this, OnSuccessCallback_47, OnFailureCallback_47)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_47(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_47() { NextTest(); } - - CHIP_ERROR TestReadAttributeInt64uDefaultValue_48() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_48, OnFailureCallback_48, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_48(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_48(uint64_t int64u) - { - VerifyOrReturn(CheckValue("int64u", int64u, readAttributeInt64uDefaultValue)); - - NextTest(); - } - - CHIP_ERROR TestReadAttributeInt8sDefaultValue_49() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_49, OnFailureCallback_49, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_49(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_49(int8_t int8s) - { - VerifyOrReturn(CheckValue("int8s", int8s, 0)); - - readAttributeInt8sDefaultValue = int8s; - NextTest(); - } - - CHIP_ERROR TestWriteAttributeInt8sNotDefaultValue_50() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - int8_t int8sArgument; - int8sArgument = 1; - - ReturnErrorOnFailure(cluster.WriteAttribute( - int8sArgument, this, OnSuccessCallback_50, OnFailureCallback_50)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_50(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_50() { NextTest(); } - - CHIP_ERROR TestReadAttributeInt8sNotDefaultValue_51() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_51, OnFailureCallback_51, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_51(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_51(int8_t int8s) - { - VerifyOrReturn(CheckConstraintNotValue("int8s", int8s, readAttributeInt8sDefaultValue)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeInt8sDefaultValue_52() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - int8_t int8sArgument; - int8sArgument = readAttributeInt8sDefaultValue; - - ReturnErrorOnFailure(cluster.WriteAttribute( - int8sArgument, this, OnSuccessCallback_52, OnFailureCallback_52)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_52(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_52() { NextTest(); } - - CHIP_ERROR TestReadAttributeInt8sDefaultValue_53() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_53, OnFailureCallback_53, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_53(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_53(int8_t int8s) - { - VerifyOrReturn(CheckValue("int8s", int8s, readAttributeInt8sDefaultValue)); - - NextTest(); - } - - CHIP_ERROR TestReadAttributeInt16sDefaultValue_54() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_54, OnFailureCallback_54, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_54(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_54(int16_t int16s) - { - VerifyOrReturn(CheckValue("int16s", int16s, 0)); - - readAttributeInt16sDefaultValue = int16s; - NextTest(); - } - - CHIP_ERROR TestWriteAttributeInt16sNotDefaultValue_55() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - int16_t int16sArgument; - int16sArgument = 1; - - ReturnErrorOnFailure(cluster.WriteAttribute( - int16sArgument, this, OnSuccessCallback_55, OnFailureCallback_55)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_55(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_55() { NextTest(); } - - CHIP_ERROR TestReadAttributeInt16sNotDefaultValue_56() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_56, OnFailureCallback_56, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_56(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_56(int16_t int16s) - { - VerifyOrReturn(CheckConstraintNotValue("int16s", int16s, readAttributeInt16sDefaultValue)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeInt16sDefaultValue_57() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - int16_t int16sArgument; - int16sArgument = readAttributeInt16sDefaultValue; - - ReturnErrorOnFailure(cluster.WriteAttribute( - int16sArgument, this, OnSuccessCallback_57, OnFailureCallback_57)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_57(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_57() { NextTest(); } - - CHIP_ERROR TestReadAttributeInt16sDefaultValue_58() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_58, OnFailureCallback_58, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_58(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_58(int16_t int16s) - { - VerifyOrReturn(CheckValue("int16s", int16s, readAttributeInt16sDefaultValue)); - - NextTest(); - } - - CHIP_ERROR TestReadAttributeInt32sDefaultValue_59() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_59, OnFailureCallback_59, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_59(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_59(int32_t int32s) - { - VerifyOrReturn(CheckValue("int32s", int32s, 0L)); - - readAttributeInt32sDefaultValue = int32s; - NextTest(); - } - - CHIP_ERROR TestWriteAttributeInt32sNotDefaultValue_60() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - int32_t int32sArgument; - int32sArgument = 1L; - - ReturnErrorOnFailure(cluster.WriteAttribute( - int32sArgument, this, OnSuccessCallback_60, OnFailureCallback_60)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_60(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_60() { NextTest(); } - - CHIP_ERROR TestReadAttributeInt32sNotDefaultValue_61() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_61, OnFailureCallback_61, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_61(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_61(int32_t int32s) - { - VerifyOrReturn(CheckConstraintNotValue("int32s", int32s, readAttributeInt32sDefaultValue)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeInt32sDefaultValue_62() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - int32_t int32sArgument; - int32sArgument = readAttributeInt32sDefaultValue; - - ReturnErrorOnFailure(cluster.WriteAttribute( - int32sArgument, this, OnSuccessCallback_62, OnFailureCallback_62)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_62(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_62() { NextTest(); } - - CHIP_ERROR TestReadAttributeInt32sDefaultValue_63() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_63, OnFailureCallback_63, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_63(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_63(int32_t int32s) - { - VerifyOrReturn(CheckValue("int32s", int32s, readAttributeInt32sDefaultValue)); - - NextTest(); - } - - CHIP_ERROR TestReadAttributeInt64sDefaultValue_64() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_64, OnFailureCallback_64, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_64(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_64(int64_t int64s) - { - VerifyOrReturn(CheckValue("int64s", int64s, 0LL)); - - readAttributeInt64sDefaultValue = int64s; - NextTest(); - } - - CHIP_ERROR TestWriteAttributeIntsNotDefaultValue_65() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - int64_t int64sArgument; - int64sArgument = 1LL; - - ReturnErrorOnFailure(cluster.WriteAttribute( - int64sArgument, this, OnSuccessCallback_65, OnFailureCallback_65)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_65(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_65() { NextTest(); } - - CHIP_ERROR TestReadAttributeInt64sNotDefaultValue_66() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_66, OnFailureCallback_66, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_66(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_66(int64_t int64s) - { - VerifyOrReturn(CheckConstraintNotValue("int64s", int64s, readAttributeInt64sDefaultValue)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeInt64sDefaultValue_67() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - int64_t int64sArgument; - int64sArgument = readAttributeInt64sDefaultValue; - - ReturnErrorOnFailure(cluster.WriteAttribute( - int64sArgument, this, OnSuccessCallback_67, OnFailureCallback_67)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_67(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_67() { NextTest(); } - - CHIP_ERROR TestReadAttributeInt64sDefaultValue_68() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_68, OnFailureCallback_68, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_68(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_68(int64_t int64s) - { - VerifyOrReturn(CheckValue("int64s", int64s, readAttributeInt64sDefaultValue)); - - NextTest(); - } - - CHIP_ERROR TestReadAttributeEnum8DefaultValue_69() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_69, OnFailureCallback_69, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_69(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_69(uint8_t enum8) - { - VerifyOrReturn(CheckValue("enum8", enum8, 0)); - - readAttributeEnum8DefaultValue = enum8; - NextTest(); - } - - CHIP_ERROR TestWriteAttributeEnum8NotDefaultValue_70() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - uint8_t enum8Argument; - enum8Argument = 1; - - ReturnErrorOnFailure(cluster.WriteAttribute( - enum8Argument, this, OnSuccessCallback_70, OnFailureCallback_70)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_70(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_70() { NextTest(); } - - CHIP_ERROR TestReadAttributeEnum8NotDefaultValue_71() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_71, OnFailureCallback_71, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_71(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_71(uint8_t enum8) - { - VerifyOrReturn(CheckConstraintNotValue("enum8", enum8, readAttributeEnum8DefaultValue)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeEnum8DefaultValue_72() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - uint8_t enum8Argument; - enum8Argument = readAttributeEnum8DefaultValue; - - ReturnErrorOnFailure(cluster.WriteAttribute( - enum8Argument, this, OnSuccessCallback_72, OnFailureCallback_72)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_72(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_72() { NextTest(); } - - CHIP_ERROR TestReadAttributeEnum8DefaultValue_73() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_73, OnFailureCallback_73, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_73(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_73(uint8_t enum8) - { - VerifyOrReturn(CheckValue("enum8", enum8, readAttributeEnum8DefaultValue)); - - NextTest(); - } - - CHIP_ERROR TestReadAttributeEnum16DefaultValue_74() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_74, OnFailureCallback_74, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_74(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_74(uint16_t enum16) - { - VerifyOrReturn(CheckValue("enum16", enum16, 0U)); - - readAttributeEnum16DefaultValue = enum16; - NextTest(); - } - - CHIP_ERROR TestWriteAttributeEnum16NotDefaultValue_75() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - uint16_t enum16Argument; - enum16Argument = 1U; - - ReturnErrorOnFailure(cluster.WriteAttribute( - enum16Argument, this, OnSuccessCallback_75, OnFailureCallback_75)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_75(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_75() { NextTest(); } - - CHIP_ERROR TestReadAttributeEnum16NotDefaultValue_76() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_76, OnFailureCallback_76, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_76(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_76(uint16_t enum16) - { - VerifyOrReturn(CheckConstraintNotValue("enum16", enum16, readAttributeEnum16DefaultValue)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeEnum16DefaultValue_77() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - uint16_t enum16Argument; - enum16Argument = readAttributeEnum16DefaultValue; - - ReturnErrorOnFailure(cluster.WriteAttribute( - enum16Argument, this, OnSuccessCallback_77, OnFailureCallback_77)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_77(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_77() { NextTest(); } - - CHIP_ERROR TestReadAttributeEnum16DefaultValue_78() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_78, OnFailureCallback_78, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_78(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_78(uint16_t enum16) - { - VerifyOrReturn(CheckValue("enum16", enum16, readAttributeEnum16DefaultValue)); - - NextTest(); - } - - CHIP_ERROR TestReadAttributeEpochUsDefaultValue_79() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_79, OnFailureCallback_79, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_79(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_79(uint64_t epochUs) - { - VerifyOrReturn(CheckValue("epochUs", epochUs, 0ULL)); - - readAttributeEpochUSDefaultValue = epochUs; - NextTest(); - } - - CHIP_ERROR TestWriteAttributeEpochUsNotDefaultValue_80() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - uint64_t epochUsArgument; - epochUsArgument = 1ULL; - - ReturnErrorOnFailure(cluster.WriteAttribute( - epochUsArgument, this, OnSuccessCallback_80, OnFailureCallback_80)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_80(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_80() { NextTest(); } - - CHIP_ERROR TestReadAttributeEpochUsNotDefaultValue_81() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_81, OnFailureCallback_81, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_81(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_81(uint64_t epochUs) - { - VerifyOrReturn(CheckConstraintNotValue("epochUs", epochUs, readAttributeEpochUSDefaultValue)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeEpochUsDefaultValue_82() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - uint64_t epochUsArgument; - epochUsArgument = readAttributeEpochUSDefaultValue; - - ReturnErrorOnFailure(cluster.WriteAttribute( - epochUsArgument, this, OnSuccessCallback_82, OnFailureCallback_82)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_82(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_82() { NextTest(); } - - CHIP_ERROR TestReadAttributeEpochUsDefaultValue_83() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_83, OnFailureCallback_83, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_83(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_83(uint64_t epochUs) - { - VerifyOrReturn(CheckValue("epochUs", epochUs, readAttributeEpochUSDefaultValue)); - - NextTest(); - } - - CHIP_ERROR TestReadAttributeEpochSDefaultValue_84() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_84, OnFailureCallback_84, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_84(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_84(uint32_t epochS) - { - VerifyOrReturn(CheckValue("epochS", epochS, 0UL)); - - readAttributeEpochSDefaultValue = epochS; - NextTest(); - } - - CHIP_ERROR TestWriteAttributeEpochSNotDefaultValue_85() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - uint32_t epochSArgument; - epochSArgument = 1UL; - - ReturnErrorOnFailure(cluster.WriteAttribute( - epochSArgument, this, OnSuccessCallback_85, OnFailureCallback_85)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_85(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_85() { NextTest(); } - - CHIP_ERROR TestReadAttributeEpochSNotDefaultValue_86() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_86, OnFailureCallback_86, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_86(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_86(uint32_t epochS) - { - VerifyOrReturn(CheckConstraintNotValue("epochS", epochS, readAttributeEpochSDefaultValue)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeEpochSDefaultValue_87() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - uint32_t epochSArgument; - epochSArgument = readAttributeEpochSDefaultValue; - - ReturnErrorOnFailure(cluster.WriteAttribute( - epochSArgument, this, OnSuccessCallback_87, OnFailureCallback_87)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_87(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_87() { NextTest(); } - - CHIP_ERROR TestReadAttributeEpochSDefaultValue_88() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_88, OnFailureCallback_88, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_88(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_88(uint32_t epochS) - { - VerifyOrReturn(CheckValue("epochS", epochS, readAttributeEpochSDefaultValue)); - - NextTest(); - } - - CHIP_ERROR TestReadAttributeVendorIdDefaultValue_89() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_89, OnFailureCallback_89, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_89(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_89(chip::VendorId vendorId) - { - VerifyOrReturn(CheckValue("vendorId", vendorId, 0U)); - - readAttributeVendorIdDefaultValue = vendorId; - NextTest(); - } - - CHIP_ERROR TestWriteAttributeVendorIdNotDefaultValue_90() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::VendorId vendorIdArgument; - vendorIdArgument = static_cast(1); - - ReturnErrorOnFailure(cluster.WriteAttribute( - vendorIdArgument, this, OnSuccessCallback_90, OnFailureCallback_90)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_90(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_90() { NextTest(); } - - CHIP_ERROR TestReadAttributeVendorIdNotDefaultValue_91() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_91, OnFailureCallback_91, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_91(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_91(chip::VendorId vendorId) - { - VerifyOrReturn(CheckConstraintNotValue("vendorId", vendorId, readAttributeVendorIdDefaultValue)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeVendorIdDefaultValue_92() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::VendorId vendorIdArgument; - vendorIdArgument = readAttributeVendorIdDefaultValue; - - ReturnErrorOnFailure(cluster.WriteAttribute( - vendorIdArgument, this, OnSuccessCallback_92, OnFailureCallback_92)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_92(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_92() { NextTest(); } - - CHIP_ERROR TestReadAttributeVendorIdDefaultValue_93() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_93, OnFailureCallback_93, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_93(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_93(chip::VendorId vendorId) - { - VerifyOrReturn(CheckValue("vendorId", vendorId, readAttributeVendorIdDefaultValue)); - - NextTest(); - } - - CHIP_ERROR TestReadAttributeCharStringDefaultValue_94() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_94, OnFailureCallback_94, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_94(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_94(chip::CharSpan charString) - { - VerifyOrReturn(CheckValueAsString("charString", charString, chip::CharSpan("", 0))); - - if (readAttributeCharStringDefaultValueBuffer != nullptr) - { - chip::Platform::MemoryFree(readAttributeCharStringDefaultValueBuffer); - } - readAttributeCharStringDefaultValueBuffer = static_cast(chip::Platform::MemoryAlloc(charString.size())); - memcpy(readAttributeCharStringDefaultValueBuffer, charString.data(), charString.size()); - readAttributeCharStringDefaultValue = chip::CharSpan(readAttributeCharStringDefaultValueBuffer, charString.size()); - NextTest(); - } - - CHIP_ERROR TestReadAttributeCharStringDefaultValueAndCompareToSavedValue_95() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_95, OnFailureCallback_95, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_95(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_95(chip::CharSpan charString) - { - VerifyOrReturn(CheckValueAsString("charString", charString, readAttributeCharStringDefaultValue)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeCharStringNotDefaultValue_96() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::CharSpan charStringArgument; - charStringArgument = chip::Span("NotDefaultgarbage: not in length on purpose", 10); - - ReturnErrorOnFailure(cluster.WriteAttribute( - charStringArgument, this, OnSuccessCallback_96, OnFailureCallback_96)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_96(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_96() { NextTest(); } - - CHIP_ERROR TestReadAttributeCharStringNotDefaultValue_97() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_97, OnFailureCallback_97, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_97(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_97(chip::CharSpan charString) - { - VerifyOrReturn(CheckValueAsString("charString", charString, chip::CharSpan("NotDefault", 10))); - VerifyOrReturn(CheckConstraintNotValue("charString", charString, readAttributeCharStringDefaultValue)); - - if (readAttributeCharStringNotDefaultValueBuffer != nullptr) - { - chip::Platform::MemoryFree(readAttributeCharStringNotDefaultValueBuffer); - } - readAttributeCharStringNotDefaultValueBuffer = static_cast(chip::Platform::MemoryAlloc(charString.size())); - memcpy(readAttributeCharStringNotDefaultValueBuffer, charString.data(), charString.size()); - readAttributeCharStringNotDefaultValue = chip::CharSpan(readAttributeCharStringNotDefaultValueBuffer, charString.size()); - NextTest(); - } - - CHIP_ERROR TestReadAttributeCharStringNotDefaultValueAndCompareToSavedValue_98() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_98, OnFailureCallback_98, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_98(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_98(chip::CharSpan charString) - { - VerifyOrReturn(CheckValueAsString("charString", charString, readAttributeCharStringNotDefaultValue)); - VerifyOrReturn(CheckConstraintNotValue("charString", charString, readAttributeCharStringDefaultValue)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeCharStringNotDefaultValueFromSavedValue_99() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::CharSpan charStringArgument; - charStringArgument = readAttributeCharStringNotDefaultValue; - - ReturnErrorOnFailure(cluster.WriteAttribute( - charStringArgument, this, OnSuccessCallback_99, OnFailureCallback_99)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_99(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_99() { NextTest(); } - - CHIP_ERROR TestReadAttributeCharStringNotDefaultValueAndCompareToExpectedValue_100() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_100, OnFailureCallback_100, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_100(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_100(chip::CharSpan charString) - { - VerifyOrReturn(CheckValueAsString("charString", charString, chip::CharSpan("NotDefault", 10))); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeCharStringDefaultValue_101() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::CharSpan charStringArgument; - charStringArgument = readAttributeCharStringDefaultValue; - - ReturnErrorOnFailure(cluster.WriteAttribute( - charStringArgument, this, OnSuccessCallback_101, OnFailureCallback_101)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_101(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_101() { NextTest(); } - - CHIP_ERROR TestReadAttributeOctetStringDefaultValue_102() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_102, OnFailureCallback_102, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_102(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_102(chip::ByteSpan octetString) - { - VerifyOrReturn(CheckValueAsString("octetString", octetString, chip::ByteSpan(chip::Uint8::from_const_char(""), 0))); - - if (readAttributeOctetStringDefaultValueBuffer != nullptr) - { - chip::Platform::MemoryFree(readAttributeOctetStringDefaultValueBuffer); - } - readAttributeOctetStringDefaultValueBuffer = static_cast(chip::Platform::MemoryAlloc(octetString.size())); - memcpy(readAttributeOctetStringDefaultValueBuffer, octetString.data(), octetString.size()); - readAttributeOctetStringDefaultValue = chip::ByteSpan(readAttributeOctetStringDefaultValueBuffer, octetString.size()); - NextTest(); - } - - CHIP_ERROR TestReadAttributeOctetStringDefaultValueAndCompareToSavedValue_103() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_103, OnFailureCallback_103, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_103(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_103(chip::ByteSpan octetString) - { - VerifyOrReturn(CheckValueAsString("octetString", octetString, readAttributeOctetStringDefaultValue)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeOctetStringNotDefaultValue_104() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::ByteSpan octetStringArgument; - octetStringArgument = chip::ByteSpan(chip::Uint8::from_const_char("NotDefaultgarbage: not in length on purpose"), 10); - - ReturnErrorOnFailure(cluster.WriteAttribute( - octetStringArgument, this, OnSuccessCallback_104, OnFailureCallback_104)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_104(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_104() { NextTest(); } - - CHIP_ERROR TestReadAttributeOctetStringNotDefaultValue_105() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_105, OnFailureCallback_105, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_105(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_105(chip::ByteSpan octetString) - { - VerifyOrReturn( - CheckValueAsString("octetString", octetString, chip::ByteSpan(chip::Uint8::from_const_char("NotDefault"), 10))); - VerifyOrReturn(CheckConstraintNotValue("octetString", octetString, readAttributeOctetStringDefaultValue)); - - if (readAttributeOctetStringNotDefaultValueBuffer != nullptr) - { - chip::Platform::MemoryFree(readAttributeOctetStringNotDefaultValueBuffer); - } - readAttributeOctetStringNotDefaultValueBuffer = static_cast(chip::Platform::MemoryAlloc(octetString.size())); - memcpy(readAttributeOctetStringNotDefaultValueBuffer, octetString.data(), octetString.size()); - readAttributeOctetStringNotDefaultValue = chip::ByteSpan(readAttributeOctetStringNotDefaultValueBuffer, octetString.size()); - NextTest(); - } - - CHIP_ERROR TestReadAttributeOctetStringNotDefaultValueAndCompareToSavedValue_106() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_106, OnFailureCallback_106, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_106(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_106(chip::ByteSpan octetString) - { - VerifyOrReturn(CheckValueAsString("octetString", octetString, readAttributeOctetStringNotDefaultValue)); - VerifyOrReturn(CheckConstraintNotValue("octetString", octetString, readAttributeOctetStringDefaultValue)); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeOctetStringNotDefaultValueFromSavedValue_107() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::ByteSpan octetStringArgument; - octetStringArgument = readAttributeOctetStringNotDefaultValue; - - ReturnErrorOnFailure(cluster.WriteAttribute( - octetStringArgument, this, OnSuccessCallback_107, OnFailureCallback_107)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_107(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_107() { NextTest(); } - - CHIP_ERROR TestReadAttributeOctetStringNotDefaultValueAndCompareToExpectedValue_108() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_108, OnFailureCallback_108, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_108(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_108(chip::ByteSpan octetString) - { - VerifyOrReturn( - CheckValueAsString("octetString", octetString, chip::ByteSpan(chip::Uint8::from_const_char("NotDefault"), 10))); - - NextTest(); - } - - CHIP_ERROR TestWriteAttributeOctetStringDefaultValue_109() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TestClusterClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::ByteSpan octetStringArgument; - octetStringArgument = readAttributeOctetStringDefaultValue; - - ReturnErrorOnFailure(cluster.WriteAttribute( - octetStringArgument, this, OnSuccessCallback_109, OnFailureCallback_109)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_109(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_109() { NextTest(); } -}; - -class TestConfigVariablesSuite : public TestCommand -{ -public: - TestConfigVariablesSuite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("TestConfigVariables", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("arg1", 0, UINT8_MAX, &mArg1); - AddArgument("returnValueWithArg1", 0, UINT8_MAX, &mReturnValueWithArg1); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~TestConfigVariablesSuite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: TestConfigVariables\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: TestConfigVariables\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Send Test Add Arguments Command\n"); - err = TestSendTestAddArgumentsCommand_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Send Test Add Arguments Command\n"); - err = TestSendTestAddArgumentsCommand_2(); - break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 3; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mArg1; - chip::Optional mReturnValueWithArg1; - chip::Optional mTimeout; - - uint8_t TestAddArgumentDefaultValue; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestSendTestAddArgumentsCommand_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::TestCluster::Commands::TestAddArguments::Type; - - RequestType request; - request.arg1 = 3; - request.arg2 = 17; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_1(data.returnValue); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_1(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_1(uint8_t returnValue) - { - VerifyOrReturn(CheckValue("returnValue", returnValue, 20)); - - TestAddArgumentDefaultValue = returnValue; - NextTest(); - } - - CHIP_ERROR TestSendTestAddArgumentsCommand_2() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::TestCluster::Commands::TestAddArguments::Type; - - RequestType request; - request.arg1 = mArg1.HasValue() ? mArg1.Value() : 5; - request.arg2 = TestAddArgumentDefaultValue; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_2(data.returnValue); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_2(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_2(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_2(uint8_t returnValue) - { - VerifyOrReturn(CheckValue("returnValue", returnValue, mReturnValueWithArg1.HasValue() ? mReturnValueWithArg1.Value() : 25)); - - NextTest(); - } -}; - -class TestDescriptorClusterSuite : public TestCommand -{ -public: - TestDescriptorClusterSuite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("TestDescriptorCluster", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~TestDescriptorClusterSuite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: TestDescriptorCluster\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: TestDescriptorCluster\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Read attribute Device list\n"); - err = TestReadAttributeDeviceList_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Read attribute Server list\n"); - err = TestReadAttributeServerList_2(); - break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Read attribute Client list\n"); - err = TestReadAttributeClientList_3(); - break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Read attribute Parts list\n"); - err = TestReadAttributePartsList_4(); - break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 5; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - static void OnFailureCallback_1(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_1(error); - } - - static void OnSuccessCallback_1( - void * context, - const chip::app::DataModel::DecodableList & deviceList) - { - (static_cast(context))->OnSuccessResponse_1(deviceList); - } - - static void OnFailureCallback_2(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_2(error); - } - - static void OnSuccessCallback_2(void * context, const chip::app::DataModel::DecodableList & serverList) - { - (static_cast(context))->OnSuccessResponse_2(serverList); - } - - static void OnFailureCallback_3(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_3(error); - } - - static void OnSuccessCallback_3(void * context, const chip::app::DataModel::DecodableList & clientList) - { - (static_cast(context))->OnSuccessResponse_3(clientList); - } - - static void OnFailureCallback_4(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_4(error); - } - - static void OnSuccessCallback_4(void * context, const chip::app::DataModel::DecodableList & partsList) - { - (static_cast(context))->OnSuccessResponse_4(partsList); - } - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestReadAttributeDeviceList_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::DescriptorClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_1, OnFailureCallback_1, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_1( - const chip::app::DataModel::DecodableList & deviceList) - { - { - auto iter_0 = deviceList.begin(); - VerifyOrReturn(CheckNextListItemDecodes("deviceList", iter_0, 0)); - VerifyOrReturn(CheckValue("deviceList[0].type", iter_0.GetValue().type, 22UL)); - VerifyOrReturn(CheckValue("deviceList[0].revision", iter_0.GetValue().revision, 1U)); - VerifyOrReturn(CheckNoMoreListItems("deviceList", iter_0, 1)); - } - - NextTest(); - } - - CHIP_ERROR TestReadAttributeServerList_2() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::DescriptorClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_2, OnFailureCallback_2, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_2(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_2(const chip::app::DataModel::DecodableList & serverList) - { - { - auto iter_0 = serverList.begin(); - VerifyOrReturn(CheckNextListItemDecodes("serverList", iter_0, 0)); - VerifyOrReturn(CheckValue("serverList[0]", iter_0.GetValue(), 3UL)); - VerifyOrReturn(CheckNextListItemDecodes("serverList", iter_0, 1)); - VerifyOrReturn(CheckValue("serverList[1]", iter_0.GetValue(), 4UL)); - VerifyOrReturn(CheckNextListItemDecodes("serverList", iter_0, 2)); - VerifyOrReturn(CheckValue("serverList[2]", iter_0.GetValue(), 29UL)); - VerifyOrReturn(CheckNextListItemDecodes("serverList", iter_0, 3)); - VerifyOrReturn(CheckValue("serverList[3]", iter_0.GetValue(), 30UL)); - VerifyOrReturn(CheckNextListItemDecodes("serverList", iter_0, 4)); - VerifyOrReturn(CheckValue("serverList[4]", iter_0.GetValue(), 31UL)); - VerifyOrReturn(CheckNextListItemDecodes("serverList", iter_0, 5)); - VerifyOrReturn(CheckValue("serverList[5]", iter_0.GetValue(), 40UL)); - VerifyOrReturn(CheckNextListItemDecodes("serverList", iter_0, 6)); - VerifyOrReturn(CheckValue("serverList[6]", iter_0.GetValue(), 42UL)); - VerifyOrReturn(CheckNextListItemDecodes("serverList", iter_0, 7)); - VerifyOrReturn(CheckValue("serverList[7]", iter_0.GetValue(), 43UL)); - VerifyOrReturn(CheckNextListItemDecodes("serverList", iter_0, 8)); - VerifyOrReturn(CheckValue("serverList[8]", iter_0.GetValue(), 44UL)); - VerifyOrReturn(CheckNextListItemDecodes("serverList", iter_0, 9)); - VerifyOrReturn(CheckValue("serverList[9]", iter_0.GetValue(), 45UL)); - VerifyOrReturn(CheckNextListItemDecodes("serverList", iter_0, 10)); - VerifyOrReturn(CheckValue("serverList[10]", iter_0.GetValue(), 46UL)); - VerifyOrReturn(CheckNextListItemDecodes("serverList", iter_0, 11)); - VerifyOrReturn(CheckValue("serverList[11]", iter_0.GetValue(), 48UL)); - VerifyOrReturn(CheckNextListItemDecodes("serverList", iter_0, 12)); - VerifyOrReturn(CheckValue("serverList[12]", iter_0.GetValue(), 49UL)); - VerifyOrReturn(CheckNextListItemDecodes("serverList", iter_0, 13)); - VerifyOrReturn(CheckValue("serverList[13]", iter_0.GetValue(), 50UL)); - VerifyOrReturn(CheckNextListItemDecodes("serverList", iter_0, 14)); - VerifyOrReturn(CheckValue("serverList[14]", iter_0.GetValue(), 51UL)); - VerifyOrReturn(CheckNextListItemDecodes("serverList", iter_0, 15)); - VerifyOrReturn(CheckValue("serverList[15]", iter_0.GetValue(), 52UL)); - VerifyOrReturn(CheckNextListItemDecodes("serverList", iter_0, 16)); - VerifyOrReturn(CheckValue("serverList[16]", iter_0.GetValue(), 53UL)); - VerifyOrReturn(CheckNextListItemDecodes("serverList", iter_0, 17)); - VerifyOrReturn(CheckValue("serverList[17]", iter_0.GetValue(), 54UL)); - VerifyOrReturn(CheckNextListItemDecodes("serverList", iter_0, 18)); - VerifyOrReturn(CheckValue("serverList[18]", iter_0.GetValue(), 55UL)); - VerifyOrReturn(CheckNextListItemDecodes("serverList", iter_0, 19)); - VerifyOrReturn(CheckValue("serverList[19]", iter_0.GetValue(), 60UL)); - VerifyOrReturn(CheckNextListItemDecodes("serverList", iter_0, 20)); - VerifyOrReturn(CheckValue("serverList[20]", iter_0.GetValue(), 62UL)); - VerifyOrReturn(CheckNextListItemDecodes("serverList", iter_0, 21)); - VerifyOrReturn(CheckValue("serverList[21]", iter_0.GetValue(), 63UL)); - VerifyOrReturn(CheckNextListItemDecodes("serverList", iter_0, 22)); - VerifyOrReturn(CheckValue("serverList[22]", iter_0.GetValue(), 64UL)); - VerifyOrReturn(CheckNextListItemDecodes("serverList", iter_0, 23)); - VerifyOrReturn(CheckValue("serverList[23]", iter_0.GetValue(), 65UL)); - VerifyOrReturn(CheckNextListItemDecodes("serverList", iter_0, 24)); - VerifyOrReturn(CheckValue("serverList[24]", iter_0.GetValue(), 1029UL)); - VerifyOrReturn(CheckNoMoreListItems("serverList", iter_0, 25)); - } - - NextTest(); - } - - CHIP_ERROR TestReadAttributeClientList_3() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::DescriptorClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_3, OnFailureCallback_3, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_3(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_3(const chip::app::DataModel::DecodableList & clientList) - { - { - auto iter_0 = clientList.begin(); - VerifyOrReturn(CheckNextListItemDecodes("clientList", iter_0, 0)); - VerifyOrReturn(CheckValue("clientList[0]", iter_0.GetValue(), 41UL)); - VerifyOrReturn(CheckNoMoreListItems("clientList", iter_0, 1)); - } - - NextTest(); - } - - CHIP_ERROR TestReadAttributePartsList_4() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::DescriptorClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_4, OnFailureCallback_4, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_4(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_4(const chip::app::DataModel::DecodableList & partsList) - { - { - auto iter_0 = partsList.begin(); - VerifyOrReturn(CheckNextListItemDecodes("partsList", iter_0, 0)); - VerifyOrReturn(CheckValue("partsList[0]", iter_0.GetValue(), 1U)); - VerifyOrReturn(CheckNextListItemDecodes("partsList", iter_0, 1)); - VerifyOrReturn(CheckValue("partsList[1]", iter_0.GetValue(), 2U)); - VerifyOrReturn(CheckNoMoreListItems("partsList", iter_0, 2)); - } - - NextTest(); - } -}; - -class TestBasicInformationSuite : public TestCommand -{ -public: - TestBasicInformationSuite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("TestBasicInformation", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~TestBasicInformationSuite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: TestBasicInformation\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: TestBasicInformation\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Read location\n"); - err = TestReadLocation_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Write location\n"); - err = TestWriteLocation_2(); - break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Read back location\n"); - err = TestReadBackLocation_3(); - break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Restore initial location value\n"); - err = TestRestoreInitialLocationValue_4(); - break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Read AttributeList value\n"); - err = TestReadAttributeListValue_5(); - break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 6; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - static void OnFailureCallback_1(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_1(error); - } - - static void OnSuccessCallback_1(void * context, chip::CharSpan location) - { - (static_cast(context))->OnSuccessResponse_1(location); - } - - static void OnFailureCallback_2(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_2(error); - } - - static void OnSuccessCallback_2(void * context) { (static_cast(context))->OnSuccessResponse_2(); } - - static void OnFailureCallback_3(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_3(error); - } - - static void OnSuccessCallback_3(void * context, chip::CharSpan location) - { - (static_cast(context))->OnSuccessResponse_3(location); - } - - static void OnFailureCallback_4(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_4(error); - } - - static void OnSuccessCallback_4(void * context) { (static_cast(context))->OnSuccessResponse_4(); } - - static void OnFailureCallback_5(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_5(error); - } - - static void OnSuccessCallback_5(void * context, const chip::app::DataModel::DecodableList & attributeList) - { - (static_cast(context))->OnSuccessResponse_5(attributeList); - } - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestReadLocation_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::BasicClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_1, OnFailureCallback_1, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_1(chip::CharSpan location) - { - VerifyOrReturn(CheckValueAsString("location", location, chip::CharSpan("XX", 2))); - - NextTest(); - } - - CHIP_ERROR TestWriteLocation_2() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::BasicClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::CharSpan locationArgument; - locationArgument = chip::Span("USgarbage: not in length on purpose", 2); - - ReturnErrorOnFailure(cluster.WriteAttribute( - locationArgument, this, OnSuccessCallback_2, OnFailureCallback_2)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_2(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_2() { NextTest(); } - - CHIP_ERROR TestReadBackLocation_3() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::BasicClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_3, OnFailureCallback_3, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_3(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_3(chip::CharSpan location) - { - VerifyOrReturn(CheckValueAsString("location", location, chip::CharSpan("US", 2))); - - NextTest(); - } - - CHIP_ERROR TestRestoreInitialLocationValue_4() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::BasicClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::CharSpan locationArgument; - locationArgument = chip::Span("XXgarbage: not in length on purpose", 2); - - ReturnErrorOnFailure(cluster.WriteAttribute( - locationArgument, this, OnSuccessCallback_4, OnFailureCallback_4)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_4(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_4() { NextTest(); } - - CHIP_ERROR TestReadAttributeListValue_5() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::BasicClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_5, OnFailureCallback_5, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_5(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_5(const chip::app::DataModel::DecodableList & attributeList) - { - { - auto iter_0 = attributeList.begin(); - VerifyOrReturn(CheckNextListItemDecodes("attributeList", iter_0, 0)); - VerifyOrReturn(CheckValue("attributeList[0]", iter_0.GetValue(), 0UL)); - VerifyOrReturn(CheckNextListItemDecodes("attributeList", iter_0, 1)); - VerifyOrReturn(CheckValue("attributeList[1]", iter_0.GetValue(), 1UL)); - VerifyOrReturn(CheckNextListItemDecodes("attributeList", iter_0, 2)); - VerifyOrReturn(CheckValue("attributeList[2]", iter_0.GetValue(), 2UL)); - VerifyOrReturn(CheckNextListItemDecodes("attributeList", iter_0, 3)); - VerifyOrReturn(CheckValue("attributeList[3]", iter_0.GetValue(), 3UL)); - VerifyOrReturn(CheckNextListItemDecodes("attributeList", iter_0, 4)); - VerifyOrReturn(CheckValue("attributeList[4]", iter_0.GetValue(), 4UL)); - VerifyOrReturn(CheckNextListItemDecodes("attributeList", iter_0, 5)); - VerifyOrReturn(CheckValue("attributeList[5]", iter_0.GetValue(), 5UL)); - VerifyOrReturn(CheckNextListItemDecodes("attributeList", iter_0, 6)); - VerifyOrReturn(CheckValue("attributeList[6]", iter_0.GetValue(), 6UL)); - VerifyOrReturn(CheckNextListItemDecodes("attributeList", iter_0, 7)); - VerifyOrReturn(CheckValue("attributeList[7]", iter_0.GetValue(), 7UL)); - VerifyOrReturn(CheckNextListItemDecodes("attributeList", iter_0, 8)); - VerifyOrReturn(CheckValue("attributeList[8]", iter_0.GetValue(), 8UL)); - VerifyOrReturn(CheckNextListItemDecodes("attributeList", iter_0, 9)); - VerifyOrReturn(CheckValue("attributeList[9]", iter_0.GetValue(), 9UL)); - VerifyOrReturn(CheckNextListItemDecodes("attributeList", iter_0, 10)); - VerifyOrReturn(CheckValue("attributeList[10]", iter_0.GetValue(), 10UL)); - VerifyOrReturn(CheckNextListItemDecodes("attributeList", iter_0, 11)); - VerifyOrReturn(CheckValue("attributeList[11]", iter_0.GetValue(), 11UL)); - VerifyOrReturn(CheckNextListItemDecodes("attributeList", iter_0, 12)); - VerifyOrReturn(CheckValue("attributeList[12]", iter_0.GetValue(), 12UL)); - VerifyOrReturn(CheckNextListItemDecodes("attributeList", iter_0, 13)); - VerifyOrReturn(CheckValue("attributeList[13]", iter_0.GetValue(), 13UL)); - VerifyOrReturn(CheckNextListItemDecodes("attributeList", iter_0, 14)); - VerifyOrReturn(CheckValue("attributeList[14]", iter_0.GetValue(), 14UL)); - VerifyOrReturn(CheckNextListItemDecodes("attributeList", iter_0, 15)); - VerifyOrReturn(CheckValue("attributeList[15]", iter_0.GetValue(), 15UL)); - VerifyOrReturn(CheckNextListItemDecodes("attributeList", iter_0, 16)); - VerifyOrReturn(CheckValue("attributeList[16]", iter_0.GetValue(), 16UL)); - VerifyOrReturn(CheckNextListItemDecodes("attributeList", iter_0, 17)); - VerifyOrReturn(CheckValue("attributeList[17]", iter_0.GetValue(), 17UL)); - VerifyOrReturn(CheckNextListItemDecodes("attributeList", iter_0, 18)); - VerifyOrReturn(CheckValue("attributeList[18]", iter_0.GetValue(), 18UL)); - VerifyOrReturn(CheckNextListItemDecodes("attributeList", iter_0, 19)); - VerifyOrReturn(CheckValue("attributeList[19]", iter_0.GetValue(), 19UL)); - VerifyOrReturn(CheckNextListItemDecodes("attributeList", iter_0, 20)); - VerifyOrReturn(CheckValue("attributeList[20]", iter_0.GetValue(), 65528UL)); - VerifyOrReturn(CheckNextListItemDecodes("attributeList", iter_0, 21)); - VerifyOrReturn(CheckValue("attributeList[21]", iter_0.GetValue(), 65529UL)); - VerifyOrReturn(CheckNextListItemDecodes("attributeList", iter_0, 22)); - VerifyOrReturn(CheckValue("attributeList[22]", iter_0.GetValue(), 65531UL)); - VerifyOrReturn(CheckNextListItemDecodes("attributeList", iter_0, 23)); - VerifyOrReturn(CheckValue("attributeList[23]", iter_0.GetValue(), 65533UL)); - VerifyOrReturn(CheckNoMoreListItems("attributeList", iter_0, 24)); - } - - NextTest(); - } -}; - -class TestGeneralCommissioningSuite : public TestCommand -{ -public: - TestGeneralCommissioningSuite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("TestGeneralCommissioning", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~TestGeneralCommissioningSuite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: TestGeneralCommissioning\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: TestGeneralCommissioning\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Write Breadcrumb (1/2)\n"); - err = TestWriteBreadcrumb12_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Read back Breadcrumb (1/2)\n"); - err = TestReadBackBreadcrumb12_2(); - break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Write Breadcrumb (2/2)\n"); - err = TestWriteBreadcrumb22_3(); - break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Read back Breadcrumb (2/2)\n"); - err = TestReadBackBreadcrumb22_4(); - break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Validate presence of SupportsConcurrentConnection\n"); - err = TestValidatePresenceOfSupportsConcurrentConnection_5(); - break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 6; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - static void OnFailureCallback_1(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_1(error); - } - - static void OnSuccessCallback_1(void * context) - { - (static_cast(context))->OnSuccessResponse_1(); - } - - static void OnFailureCallback_2(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_2(error); - } - - static void OnSuccessCallback_2(void * context, uint64_t breadcrumb) - { - (static_cast(context))->OnSuccessResponse_2(breadcrumb); - } - - static void OnFailureCallback_3(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_3(error); - } - - static void OnSuccessCallback_3(void * context) - { - (static_cast(context))->OnSuccessResponse_3(); - } - - static void OnFailureCallback_4(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_4(error); - } - - static void OnSuccessCallback_4(void * context, uint64_t breadcrumb) - { - (static_cast(context))->OnSuccessResponse_4(breadcrumb); - } - - static void OnFailureCallback_5(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_5(error); - } - - static void OnSuccessCallback_5(void * context, bool supportsConcurrentConnection) - { - (static_cast(context))->OnSuccessResponse_5(supportsConcurrentConnection); - } - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestWriteBreadcrumb12_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::GeneralCommissioningClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - uint64_t breadcrumbArgument; - breadcrumbArgument = 137438953472ULL; - - ReturnErrorOnFailure(cluster.WriteAttribute( - breadcrumbArgument, this, OnSuccessCallback_1, OnFailureCallback_1)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_1() { NextTest(); } - - CHIP_ERROR TestReadBackBreadcrumb12_2() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::GeneralCommissioningClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_2, OnFailureCallback_2, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_2(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_2(uint64_t breadcrumb) - { - VerifyOrReturn(CheckValue("breadcrumb", breadcrumb, 137438953472ULL)); - - NextTest(); - } - - CHIP_ERROR TestWriteBreadcrumb22_3() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::GeneralCommissioningClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - uint64_t breadcrumbArgument; - breadcrumbArgument = 81ULL; - - ReturnErrorOnFailure(cluster.WriteAttribute( - breadcrumbArgument, this, OnSuccessCallback_3, OnFailureCallback_3)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_3(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_3() { NextTest(); } - - CHIP_ERROR TestReadBackBreadcrumb22_4() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::GeneralCommissioningClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_4, OnFailureCallback_4, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_4(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_4(uint64_t breadcrumb) - { - VerifyOrReturn(CheckValue("breadcrumb", breadcrumb, 81ULL)); - - NextTest(); - } - - CHIP_ERROR TestValidatePresenceOfSupportsConcurrentConnection_5() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::GeneralCommissioningClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_5, OnFailureCallback_5, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_5(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_5(bool supportsConcurrentConnection) - { - VerifyOrReturn(CheckConstraintType("supportsConcurrentConnection", "", "bool")); - NextTest(); - } -}; - -class TestIdentifyClusterSuite : public TestCommand -{ -public: - TestIdentifyClusterSuite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("TestIdentifyCluster", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~TestIdentifyClusterSuite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: TestIdentifyCluster\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: TestIdentifyCluster\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Send Identify command and expect success response\n"); - err = TestSendIdentifyCommandAndExpectSuccessResponse_1(); - break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 2; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestSendIdentifyCommandAndExpectSuccessResponse_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - using RequestType = chip::app::Clusters::Identify::Commands::Identify::Type; - - RequestType request; - request.identifyTime = 0U; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_1(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_1(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_1() { NextTest(); } -}; - -class TestOperationalCredentialsClusterSuite : public TestCommand -{ -public: - TestOperationalCredentialsClusterSuite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("TestOperationalCredentialsCluster", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~TestOperationalCredentialsClusterSuite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: TestOperationalCredentialsCluster\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: TestOperationalCredentialsCluster\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Read number of supported fabrics\n"); - err = TestReadNumberOfSupportedFabrics_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Read number of commissioned fabrics\n"); - err = TestReadNumberOfCommissionedFabrics_2(); - break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Read current fabric index\n"); - err = TestReadCurrentFabricIndex_3(); - break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Remove nonexistent fabric\n"); - err = TestRemoveNonexistentFabric_4(); - break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Read fabric list before setting label\n"); - err = TestReadFabricListBeforeSettingLabel_5(); - break; - case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : Set the fabric label\n"); - err = TestSetTheFabricLabel_6(); - break; - case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : Read fabric list after setting label\n"); - err = TestReadFabricListAfterSettingLabel_7(); - break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 8; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - chip::FabricIndex ourFabricIndex; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - static void OnFailureCallback_1(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_1(error); - } - - static void OnSuccessCallback_1(void * context, uint8_t supportedFabrics) - { - (static_cast(context))->OnSuccessResponse_1(supportedFabrics); - } - - static void OnFailureCallback_2(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_2(error); - } - - static void OnSuccessCallback_2(void * context, uint8_t commissionedFabrics) - { - (static_cast(context))->OnSuccessResponse_2(commissionedFabrics); - } - - static void OnFailureCallback_3(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_3(error); - } - - static void OnSuccessCallback_3(void * context, chip::FabricIndex currentFabricIndex) - { - (static_cast(context))->OnSuccessResponse_3(currentFabricIndex); - } - - static void OnFailureCallback_5(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_5(error); - } - - static void - OnSuccessCallback_5(void * context, - const chip::app::DataModel::DecodableList< - chip::app::Clusters::OperationalCredentials::Structs::FabricDescriptor::DecodableType> & fabrics) - { - (static_cast(context))->OnSuccessResponse_5(fabrics); - } - - static void OnFailureCallback_7(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_7(error); - } - - static void - OnSuccessCallback_7(void * context, - const chip::app::DataModel::DecodableList< - chip::app::Clusters::OperationalCredentials::Structs::FabricDescriptor::DecodableType> & fabrics) - { - (static_cast(context))->OnSuccessResponse_7(fabrics); - } - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestReadNumberOfSupportedFabrics_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::OperationalCredentialsClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_1, OnFailureCallback_1, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_1(uint8_t supportedFabrics) - { - VerifyOrReturn(CheckConstraintType("supportedFabrics", "", "uint8")); - VerifyOrReturn(CheckConstraintMinValue("supportedFabrics", supportedFabrics, 4)); - NextTest(); - } - - CHIP_ERROR TestReadNumberOfCommissionedFabrics_2() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::OperationalCredentialsClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_2, OnFailureCallback_2, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_2(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_2(uint8_t commissionedFabrics) - { - VerifyOrReturn(CheckConstraintType("commissionedFabrics", "", "uint8")); - VerifyOrReturn(CheckConstraintMinValue("commissionedFabrics", commissionedFabrics, 1)); - NextTest(); - } - - CHIP_ERROR TestReadCurrentFabricIndex_3() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::OperationalCredentialsClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_3, OnFailureCallback_3, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_3(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_3(chip::FabricIndex currentFabricIndex) - { - VerifyOrReturn(CheckConstraintType("currentFabricIndex", "", "uint8")); - VerifyOrReturn(CheckConstraintMinValue("currentFabricIndex", currentFabricIndex, 1)); - ourFabricIndex = currentFabricIndex; - NextTest(); - } - - CHIP_ERROR TestRemoveNonexistentFabric_4() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - using RequestType = chip::app::Clusters::OperationalCredentials::Commands::RemoveFabric::Type; - - RequestType request; - request.fabricIndex = 243; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context)) - ->OnSuccessResponse_4(data.statusCode, data.fabricIndex, data.debugText); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_4(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_4(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_4(chip::app::Clusters::OperationalCredentials::OperationalCertStatus statusCode, - const chip::Optional & fabricIndex, - const chip::Optional & debugText) - { - VerifyOrReturn(CheckValue("statusCode", statusCode, 11)); - - NextTest(); - } - - CHIP_ERROR TestReadFabricListBeforeSettingLabel_5() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::OperationalCredentialsClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_5, OnFailureCallback_5, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_5(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_5(const chip::app::DataModel::DecodableList< - chip::app::Clusters::OperationalCredentials::Structs::FabricDescriptor::DecodableType> & fabrics) - { - { - auto iter_0 = fabrics.begin(); - VerifyOrReturn(CheckNextListItemDecodes("fabrics", iter_0, 0)); - VerifyOrReturn(CheckValueAsString("fabrics[0].label", iter_0.GetValue().label, chip::CharSpan("", 0))); - VerifyOrReturn(CheckValue("fabrics[0].fabricIndex", iter_0.GetValue().fabricIndex, ourFabricIndex)); - VerifyOrReturn(CheckNoMoreListItems("fabrics", iter_0, 1)); - } - - NextTest(); - } - - CHIP_ERROR TestSetTheFabricLabel_6() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - using RequestType = chip::app::Clusters::OperationalCredentials::Commands::UpdateFabricLabel::Type; - - RequestType request; - request.label = chip::Span("Batcavegarbage: not in length on purpose", 7); - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context)) - ->OnSuccessResponse_6(data.statusCode, data.fabricIndex, data.debugText); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_6(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_6(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_6(chip::app::Clusters::OperationalCredentials::OperationalCertStatus statusCode, - const chip::Optional & fabricIndex, - const chip::Optional & debugText) - { - VerifyOrReturn(CheckValue("statusCode", statusCode, 0)); - - VerifyOrReturn(CheckValuePresent("fabricIndex", fabricIndex)); - VerifyOrReturn(CheckValue("fabricIndex.Value()", fabricIndex.Value(), ourFabricIndex)); - - NextTest(); - } - - CHIP_ERROR TestReadFabricListAfterSettingLabel_7() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::OperationalCredentialsClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_7, OnFailureCallback_7, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_7(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_7(const chip::app::DataModel::DecodableList< - chip::app::Clusters::OperationalCredentials::Structs::FabricDescriptor::DecodableType> & fabrics) - { - { - auto iter_0 = fabrics.begin(); - VerifyOrReturn(CheckNextListItemDecodes("fabrics", iter_0, 0)); - VerifyOrReturn(CheckValueAsString("fabrics[0].label", iter_0.GetValue().label, chip::CharSpan("Batcave", 7))); - VerifyOrReturn(CheckValue("fabrics[0].fabricIndex", iter_0.GetValue().fabricIndex, ourFabricIndex)); - VerifyOrReturn(CheckNoMoreListItems("fabrics", iter_0, 1)); - } - - NextTest(); - } -}; - -class TestModeSelectClusterSuite : public TestCommand -{ -public: - TestModeSelectClusterSuite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("TestModeSelectCluster", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("discriminator", 0, UINT16_MAX, &mDiscriminator); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~TestModeSelectClusterSuite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: TestModeSelectCluster\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: TestModeSelectCluster\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Read Description\n"); - err = TestReadDescription_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Read StandardNamespace\n"); - err = TestReadStandardNamespace_2(); - break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Read SupportedModes\n"); - err = TestReadSupportedModes_3(); - break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Read CurrentMode\n"); - err = TestReadCurrentMode_4(); - break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Read StartUpMode\n"); - err = TestReadStartUpMode_5(); - break; - case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : Read OnMode\n"); - err = TestReadOnMode_6(); - break; - case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : Change to Supported Mode\n"); - err = TestChangeToSupportedMode_7(); - break; - case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : Verify Current Mode Change\n"); - err = TestVerifyCurrentModeChange_8(); - break; - case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : Change to Unsupported Mode\n"); - err = TestChangeToUnsupportedMode_9(); - break; - case 10: - ChipLogProgress(chipTool, " ***** Test Step 10 : Toggle OnOff\n"); - err = TestToggleOnOff_10(); - break; - case 11: - ChipLogProgress(chipTool, " ***** Test Step 11 : Toggle OnOff\n"); - err = TestToggleOnOff_11(); - break; - case 12: - ChipLogProgress(chipTool, " ***** Test Step 12 : Verify Current Mode does not change when OnMode is null\n"); - err = TestVerifyCurrentModeDoesNotChangeWhenOnModeIsNull_12(); - break; - case 13: - ChipLogProgress(chipTool, " ***** Test Step 13 : Change to Unsupported OnMode\n"); - err = TestChangeToUnsupportedOnMode_13(); - break; - case 14: - ChipLogProgress(chipTool, " ***** Test Step 14 : Change OnMode\n"); - err = TestChangeOnMode_14(); - break; - case 15: - ChipLogProgress(chipTool, " ***** Test Step 15 : Verify OnMode\n"); - err = TestVerifyOnMode_15(); - break; - case 16: - ChipLogProgress(chipTool, " ***** Test Step 16 : Toggle OnOff\n"); - err = TestToggleOnOff_16(); - break; - case 17: - ChipLogProgress(chipTool, " ***** Test Step 17 : Toggle OnOff\n"); - err = TestToggleOnOff_17(); - break; - case 18: - ChipLogProgress(chipTool, " ***** Test Step 18 : Verify Current Mode Changes if OnMode is not null\n"); - err = TestVerifyCurrentModeChangesIfOnModeIsNotNull_18(); - break; - case 19: - ChipLogProgress(chipTool, " ***** Test Step 19 : Change to Unsupported StartUp Mode\n"); - err = TestChangeToUnsupportedStartUpMode_19(); - break; - case 20: - ChipLogProgress(chipTool, " ***** Test Step 20 : Change to Supported StartUp Mode\n"); - err = TestChangeToSupportedStartUpMode_20(); - break; - case 21: - ChipLogProgress(chipTool, " ***** Test Step 21 : Verify StartUp Mode Change\n"); - err = TestVerifyStartUpModeChange_21(); - break; - case 22: - ChipLogProgress(chipTool, " ***** Test Step 22 : Change CurrentMode to another value\n"); - err = TestChangeCurrentModeToAnotherValue_22(); - break; - case 23: - ChipLogProgress(chipTool, " ***** Test Step 23 : Change On Mode\n"); - err = TestChangeOnMode_23(); - break; - case 24: - ChipLogProgress(chipTool, " ***** Test Step 24 : Set StartUpOnOff\n"); - err = TestSetStartUpOnOff_24(); - break; - case 25: - ChipLogProgress(chipTool, " ***** Test Step 25 : Reboot target device\n"); - err = TestRebootTargetDevice_25(); - break; - case 26: - ChipLogProgress(chipTool, " ***** Test Step 26 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_26(); - break; - case 27: - ChipLogProgress(chipTool, - " ***** Test Step 27 : Verify Current Mode Change based on OnMode, as it overwrites StartUpMode\n"); - err = TestVerifyCurrentModeChangeBasedOnOnModeAsItOverwritesStartUpMode_27(); - break; - case 28: - ChipLogProgress(chipTool, " ***** Test Step 28 : Change On Mode to Null\n"); - err = TestChangeOnModeToNull_28(); - break; - case 29: - ChipLogProgress(chipTool, " ***** Test Step 29 : Reboot target device\n"); - err = TestRebootTargetDevice_29(); - break; - case 30: - ChipLogProgress(chipTool, " ***** Test Step 30 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_30(); - break; - case 31: - ChipLogProgress(chipTool, " ***** Test Step 31 : Verify Current Mode Change based on new StartUp Mode\n"); - err = TestVerifyCurrentModeChangeBasedOnNewStartUpMode_31(); - break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 32; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mDiscriminator; - chip::Optional mTimeout; - - uint8_t currentModeBeforeToggle; - chip::app::DataModel::Nullable OnModeValue; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 25: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 26: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 29: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 30: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - static void OnFailureCallback_1(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_1(error); - } - - static void OnSuccessCallback_1(void * context, chip::CharSpan description) - { - (static_cast(context))->OnSuccessResponse_1(description); - } - - static void OnFailureCallback_2(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_2(error); - } - - static void OnSuccessCallback_2(void * context, const chip::app::DataModel::Nullable & standardNamespace) - { - (static_cast(context))->OnSuccessResponse_2(standardNamespace); - } - - static void OnFailureCallback_3(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_3(error); - } - - static void OnSuccessCallback_3( - void * context, - const chip::app::DataModel::DecodableList & - supportedModes) - { - (static_cast(context))->OnSuccessResponse_3(supportedModes); - } - - static void OnFailureCallback_4(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_4(error); - } - - static void OnSuccessCallback_4(void * context, uint8_t currentMode) - { - (static_cast(context))->OnSuccessResponse_4(currentMode); - } - - static void OnFailureCallback_5(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_5(error); - } - - static void OnSuccessCallback_5(void * context, const chip::app::DataModel::Nullable & startUpMode) - { - (static_cast(context))->OnSuccessResponse_5(startUpMode); - } - - static void OnFailureCallback_6(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_6(error); - } - - static void OnSuccessCallback_6(void * context, const chip::app::DataModel::Nullable & onMode) - { - (static_cast(context))->OnSuccessResponse_6(onMode); - } - - static void OnFailureCallback_8(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_8(error); - } - - static void OnSuccessCallback_8(void * context, uint8_t currentMode) - { - (static_cast(context))->OnSuccessResponse_8(currentMode); - } - - static void OnFailureCallback_12(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_12(error); - } - - static void OnSuccessCallback_12(void * context, uint8_t currentMode) - { - (static_cast(context))->OnSuccessResponse_12(currentMode); - } - - static void OnFailureCallback_13(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_13(error); - } - - static void OnSuccessCallback_13(void * context) - { - (static_cast(context))->OnSuccessResponse_13(); - } - - static void OnFailureCallback_14(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_14(error); - } - - static void OnSuccessCallback_14(void * context) - { - (static_cast(context))->OnSuccessResponse_14(); - } - - static void OnFailureCallback_15(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_15(error); - } - - static void OnSuccessCallback_15(void * context, const chip::app::DataModel::Nullable & onMode) - { - (static_cast(context))->OnSuccessResponse_15(onMode); - } - - static void OnFailureCallback_18(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_18(error); - } - - static void OnSuccessCallback_18(void * context, uint8_t currentMode) - { - (static_cast(context))->OnSuccessResponse_18(currentMode); - } - - static void OnFailureCallback_19(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_19(error); - } - - static void OnSuccessCallback_19(void * context) - { - (static_cast(context))->OnSuccessResponse_19(); - } - - static void OnFailureCallback_20(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_20(error); - } - - static void OnSuccessCallback_20(void * context) - { - (static_cast(context))->OnSuccessResponse_20(); - } - - static void OnFailureCallback_21(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_21(error); - } - - static void OnSuccessCallback_21(void * context, const chip::app::DataModel::Nullable & startUpMode) - { - (static_cast(context))->OnSuccessResponse_21(startUpMode); - } - - static void OnFailureCallback_23(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_23(error); - } - - static void OnSuccessCallback_23(void * context) - { - (static_cast(context))->OnSuccessResponse_23(); - } - - static void OnFailureCallback_24(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_24(error); - } - - static void OnSuccessCallback_24(void * context) - { - (static_cast(context))->OnSuccessResponse_24(); - } - - static void OnFailureCallback_27(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_27(error); - } - - static void OnSuccessCallback_27(void * context, uint8_t currentMode) - { - (static_cast(context))->OnSuccessResponse_27(currentMode); - } - - static void OnFailureCallback_28(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_28(error); - } - - static void OnSuccessCallback_28(void * context) - { - (static_cast(context))->OnSuccessResponse_28(); - } - - static void OnFailureCallback_31(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_31(error); - } - - static void OnSuccessCallback_31(void * context, uint8_t currentMode) - { - (static_cast(context))->OnSuccessResponse_31(currentMode); - } - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestReadDescription_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ModeSelectClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_1, OnFailureCallback_1, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_1(chip::CharSpan description) - { - VerifyOrReturn(CheckValueAsString("description", description, chip::CharSpan("Coffee", 6))); - - NextTest(); - } - - CHIP_ERROR TestReadStandardNamespace_2() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ModeSelectClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_2, OnFailureCallback_2, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_2(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_2(const chip::app::DataModel::Nullable & standardNamespace) - { - VerifyOrReturn(CheckValueNonNull("standardNamespace", standardNamespace)); - VerifyOrReturn(CheckValue("standardNamespace.Value()", standardNamespace.Value(), 0U)); - - NextTest(); - } - - CHIP_ERROR TestReadSupportedModes_3() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ModeSelectClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_3, OnFailureCallback_3, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_3(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_3( - const chip::app::DataModel::DecodableList & - supportedModes) - { - { - auto iter_0 = supportedModes.begin(); - VerifyOrReturn(CheckNextListItemDecodes("supportedModes", iter_0, 0)); - VerifyOrReturn(CheckValueAsString("supportedModes[0].label", iter_0.GetValue().label, chip::CharSpan("Black", 5))); - VerifyOrReturn(CheckValue("supportedModes[0].mode", iter_0.GetValue().mode, 0)); - VerifyOrReturn(CheckValue("supportedModes[0].semanticTag", iter_0.GetValue().semanticTag, 0UL)); - VerifyOrReturn(CheckNextListItemDecodes("supportedModes", iter_0, 1)); - VerifyOrReturn( - CheckValueAsString("supportedModes[1].label", iter_0.GetValue().label, chip::CharSpan("Cappuccino", 10))); - VerifyOrReturn(CheckValue("supportedModes[1].mode", iter_0.GetValue().mode, 4)); - VerifyOrReturn(CheckValue("supportedModes[1].semanticTag", iter_0.GetValue().semanticTag, 0UL)); - VerifyOrReturn(CheckNextListItemDecodes("supportedModes", iter_0, 2)); - VerifyOrReturn(CheckValueAsString("supportedModes[2].label", iter_0.GetValue().label, chip::CharSpan("Espresso", 8))); - VerifyOrReturn(CheckValue("supportedModes[2].mode", iter_0.GetValue().mode, 7)); - VerifyOrReturn(CheckValue("supportedModes[2].semanticTag", iter_0.GetValue().semanticTag, 0UL)); - VerifyOrReturn(CheckNoMoreListItems("supportedModes", iter_0, 3)); - } - - NextTest(); - } - - CHIP_ERROR TestReadCurrentMode_4() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ModeSelectClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_4, OnFailureCallback_4, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_4(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_4(uint8_t currentMode) - { - VerifyOrReturn(CheckValue("currentMode", currentMode, 0)); - - NextTest(); - } - - CHIP_ERROR TestReadStartUpMode_5() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ModeSelectClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_5, OnFailureCallback_5, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_5(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_5(const chip::app::DataModel::Nullable & startUpMode) - { - VerifyOrReturn(CheckValueNonNull("startUpMode", startUpMode)); - VerifyOrReturn(CheckValue("startUpMode.Value()", startUpMode.Value(), 0)); - - NextTest(); - } - - CHIP_ERROR TestReadOnMode_6() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ModeSelectClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_6, OnFailureCallback_6, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_6(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_6(const chip::app::DataModel::Nullable & onMode) - { - VerifyOrReturn(CheckValueNull("onMode", onMode)); - - NextTest(); - } - - CHIP_ERROR TestChangeToSupportedMode_7() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::ModeSelect::Commands::ChangeToMode::Type; - - RequestType request; - request.newMode = 4; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_7(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_7(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_7(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_7() { NextTest(); } - - CHIP_ERROR TestVerifyCurrentModeChange_8() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ModeSelectClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_8, OnFailureCallback_8, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_8(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_8(uint8_t currentMode) - { - VerifyOrReturn(CheckValue("currentMode", currentMode, 4)); - - currentModeBeforeToggle = currentMode; - NextTest(); - } - - CHIP_ERROR TestChangeToUnsupportedMode_9() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::ModeSelect::Commands::ChangeToMode::Type; - - RequestType request; - request.newMode = 2; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_9(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_9(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_9(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_COMMAND)); - NextTest(); - } - - void OnSuccessResponse_9() { ThrowSuccessResponse(); } - - CHIP_ERROR TestToggleOnOff_10() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::OnOff::Commands::Off::Type; - - RequestType request; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_10(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_10(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_10(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_10() { NextTest(); } - - CHIP_ERROR TestToggleOnOff_11() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::OnOff::Commands::On::Type; - - RequestType request; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_11(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_11(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_11(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_11() { NextTest(); } - - CHIP_ERROR TestVerifyCurrentModeDoesNotChangeWhenOnModeIsNull_12() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ModeSelectClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_12, OnFailureCallback_12, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_12(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_12(uint8_t currentMode) - { - VerifyOrReturn(CheckValue("currentMode", currentMode, currentModeBeforeToggle)); - - NextTest(); - } - - CHIP_ERROR TestChangeToUnsupportedOnMode_13() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ModeSelectClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::DataModel::Nullable onModeArgument; - onModeArgument.SetNonNull(); - onModeArgument.Value() = 2; - - ReturnErrorOnFailure(cluster.WriteAttribute( - onModeArgument, this, OnSuccessCallback_13, OnFailureCallback_13)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_13(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_COMMAND)); - NextTest(); - } - - void OnSuccessResponse_13() { ThrowSuccessResponse(); } - - CHIP_ERROR TestChangeOnMode_14() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ModeSelectClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::DataModel::Nullable onModeArgument; - onModeArgument.SetNonNull(); - onModeArgument.Value() = 7; - - ReturnErrorOnFailure(cluster.WriteAttribute( - onModeArgument, this, OnSuccessCallback_14, OnFailureCallback_14)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_14(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_14() { NextTest(); } - - CHIP_ERROR TestVerifyOnMode_15() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ModeSelectClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_15, OnFailureCallback_15, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_15(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_15(const chip::app::DataModel::Nullable & onMode) - { - VerifyOrReturn(CheckValueNonNull("onMode", onMode)); - VerifyOrReturn(CheckValue("onMode.Value()", onMode.Value(), 7)); - - OnModeValue = onMode; - NextTest(); - } - - CHIP_ERROR TestToggleOnOff_16() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::OnOff::Commands::Off::Type; - - RequestType request; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_16(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_16(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_16(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_16() { NextTest(); } - - CHIP_ERROR TestToggleOnOff_17() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::OnOff::Commands::On::Type; - - RequestType request; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_17(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_17(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_17(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_17() { NextTest(); } - - CHIP_ERROR TestVerifyCurrentModeChangesIfOnModeIsNotNull_18() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ModeSelectClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_18, OnFailureCallback_18, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_18(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_18(uint8_t currentMode) - { - VerifyOrReturn(CheckValue("currentMode", currentMode, OnModeValue)); - - NextTest(); - } - - CHIP_ERROR TestChangeToUnsupportedStartUpMode_19() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ModeSelectClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::DataModel::Nullable startUpModeArgument; - startUpModeArgument.SetNonNull(); - startUpModeArgument.Value() = 2; - - ReturnErrorOnFailure(cluster.WriteAttribute( - startUpModeArgument, this, OnSuccessCallback_19, OnFailureCallback_19)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_19(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_COMMAND)); - NextTest(); - } - - void OnSuccessResponse_19() { ThrowSuccessResponse(); } - - CHIP_ERROR TestChangeToSupportedStartUpMode_20() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ModeSelectClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::DataModel::Nullable startUpModeArgument; - startUpModeArgument.SetNonNull(); - startUpModeArgument.Value() = 7; - - ReturnErrorOnFailure(cluster.WriteAttribute( - startUpModeArgument, this, OnSuccessCallback_20, OnFailureCallback_20)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_20(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_20() { NextTest(); } - - CHIP_ERROR TestVerifyStartUpModeChange_21() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ModeSelectClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_21, OnFailureCallback_21, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_21(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_21(const chip::app::DataModel::Nullable & startUpMode) - { - VerifyOrReturn(CheckValueNonNull("startUpMode", startUpMode)); - VerifyOrReturn(CheckValue("startUpMode.Value()", startUpMode.Value(), 7)); - - NextTest(); - } - - CHIP_ERROR TestChangeCurrentModeToAnotherValue_22() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::ModeSelect::Commands::ChangeToMode::Type; - - RequestType request; - request.newMode = 0; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_22(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_22(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_22(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_22() { NextTest(); } - - CHIP_ERROR TestChangeOnMode_23() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ModeSelectClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::DataModel::Nullable onModeArgument; - onModeArgument.SetNonNull(); - onModeArgument.Value() = 4; - - ReturnErrorOnFailure(cluster.WriteAttribute( - onModeArgument, this, OnSuccessCallback_23, OnFailureCallback_23)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_23(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_23() { NextTest(); } - - CHIP_ERROR TestSetStartUpOnOff_24() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::OnOffClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::DataModel::Nullable startUpOnOffArgument; - startUpOnOffArgument.SetNonNull(); - startUpOnOffArgument.Value() = static_cast(1); - - ReturnErrorOnFailure(cluster.WriteAttribute( - startUpOnOffArgument, this, OnSuccessCallback_24, OnFailureCallback_24)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_24(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_24() { NextTest(); } - - CHIP_ERROR TestRebootTargetDevice_25() - { - SetIdentity(kIdentityAlpha); - return Reboot(mDiscriminator.HasValue() ? mDiscriminator.Value() : 3840U); - } - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_26() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestVerifyCurrentModeChangeBasedOnOnModeAsItOverwritesStartUpMode_27() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ModeSelectClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_27, OnFailureCallback_27, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_27(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_27(uint8_t currentMode) - { - VerifyOrReturn(CheckValue("currentMode", currentMode, 4)); - - NextTest(); - } - - CHIP_ERROR TestChangeOnModeToNull_28() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ModeSelectClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::DataModel::Nullable onModeArgument; - onModeArgument.SetNull(); - - ReturnErrorOnFailure(cluster.WriteAttribute( - onModeArgument, this, OnSuccessCallback_28, OnFailureCallback_28)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_28(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_28() { NextTest(); } - - CHIP_ERROR TestRebootTargetDevice_29() - { - SetIdentity(kIdentityAlpha); - return Reboot(mDiscriminator.HasValue() ? mDiscriminator.Value() : 3840U); - } - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_30() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestVerifyCurrentModeChangeBasedOnNewStartUpMode_31() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ModeSelectClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_31, OnFailureCallback_31, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_31(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_31(uint8_t currentMode) - { - VerifyOrReturn(CheckValue("currentMode", currentMode, 7)); - - NextTest(); - } -}; - -class TestSystemCommandsSuite : public TestCommand -{ -public: - TestSystemCommandsSuite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("TestSystemCommands", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~TestSystemCommandsSuite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: TestSystemCommands\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: TestSystemCommands\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Stop the accessory\n"); - err = TestStopTheAccessory_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Start the accessory with no command line options\n"); - err = TestStartTheAccessoryWithNoCommandLineOptions_2(); - break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Stop the accessory\n"); - err = TestStopTheAccessory_3(); - break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Start the accessory with only discriminator command line option\n"); - err = TestStartTheAccessoryWithOnlyDiscriminatorCommandLineOption_4(); - break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Stop the accessory\n"); - err = TestStopTheAccessory_5(); - break; - case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : Start the accessory with discriminator and port command line option\n"); - err = TestStartTheAccessoryWithDiscriminatorAndPortCommandLineOption_6(); - break; - case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : Stop the accessory\n"); - err = TestStopTheAccessory_7(); - break; - case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : Start the accessory with all command line options\n"); - err = TestStartTheAccessoryWithAllCommandLineOptions_8(); - break; - case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : Reboot the accessory with no command line options\n"); - err = TestRebootTheAccessoryWithNoCommandLineOptions_9(); - break; - case 10: - ChipLogProgress(chipTool, " ***** Test Step 10 : Reboot the accessory with only discriminator command line option\n"); - err = TestRebootTheAccessoryWithOnlyDiscriminatorCommandLineOption_10(); - break; - case 11: - ChipLogProgress(chipTool, - " ***** Test Step 11 : Reboot the accessory with discriminator and port command line option\n"); - err = TestRebootTheAccessoryWithDiscriminatorAndPortCommandLineOption_11(); - break; - case 12: - ChipLogProgress(chipTool, " ***** Test Step 12 : Reboot the accessory with all command line options\n"); - err = TestRebootTheAccessoryWithAllCommandLineOptions_12(); - break; - case 13: - ChipLogProgress(chipTool, " ***** Test Step 13 : Factory Reset the accessory\n"); - err = TestFactoryResetTheAccessory_13(); - break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 14; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 1: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 2: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 3: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 4: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 5: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 6: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 7: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 8: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 9: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 10: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 11: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 12: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 13: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestStopTheAccessory_1() - { - SetIdentity(kIdentityAlpha); - return Stop(); - } - - CHIP_ERROR TestStartTheAccessoryWithNoCommandLineOptions_2() - { - SetIdentity(kIdentityAlpha); - return Start(); - } - - CHIP_ERROR TestStopTheAccessory_3() - { - SetIdentity(kIdentityAlpha); - return Stop(); - } - - CHIP_ERROR TestStartTheAccessoryWithOnlyDiscriminatorCommandLineOption_4() - { - SetIdentity(kIdentityAlpha); - return Start(1111); - } - - CHIP_ERROR TestStopTheAccessory_5() - { - SetIdentity(kIdentityAlpha); - return Stop(); - } - - CHIP_ERROR TestStartTheAccessoryWithDiscriminatorAndPortCommandLineOption_6() - { - SetIdentity(kIdentityAlpha); - return Start(1111, 5560); - } - - CHIP_ERROR TestStopTheAccessory_7() - { - SetIdentity(kIdentityAlpha); - return Stop(); - } - - CHIP_ERROR TestStartTheAccessoryWithAllCommandLineOptions_8() - { - SetIdentity(kIdentityAlpha); - return Start(1111, 5560, "/tmp/chip_kvs_test"); - } - - CHIP_ERROR TestRebootTheAccessoryWithNoCommandLineOptions_9() - { - SetIdentity(kIdentityAlpha); - return Reboot(); - } - - CHIP_ERROR TestRebootTheAccessoryWithOnlyDiscriminatorCommandLineOption_10() - { - SetIdentity(kIdentityAlpha); - return Reboot(2222); - } - - CHIP_ERROR TestRebootTheAccessoryWithDiscriminatorAndPortCommandLineOption_11() - { - SetIdentity(kIdentityAlpha); - return Reboot(2222, 5565); - } - - CHIP_ERROR TestRebootTheAccessoryWithAllCommandLineOptions_12() - { - SetIdentity(kIdentityAlpha); - return Reboot(2222, 5565, "/tmp/chip_kvs_test"); - } - - CHIP_ERROR TestFactoryResetTheAccessory_13() - { - SetIdentity(kIdentityAlpha); - return FactoryReset(); - } -}; - -class TestBindingSuite : public TestCommand -{ -public: - TestBindingSuite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("TestBinding", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~TestBindingSuite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: TestBinding\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: TestBinding\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Write empty binding table\n"); - err = TestWriteEmptyBindingTable_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Read empty binding table\n"); - err = TestReadEmptyBindingTable_2(); - break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Write invalid binding table\n"); - err = TestWriteInvalidBindingTable_3(); - break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Write binding table (endpoint 1)\n"); - err = TestWriteBindingTableEndpoint1_4(); - break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Read binding table (endpoint 1)\n"); - err = TestReadBindingTableEndpoint1_5(); - break; - case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : Write binding table (endpoint 0)\n"); - err = TestWriteBindingTableEndpoint0_6(); - break; - case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : Read binding table (endpoint 0)\n"); - err = TestReadBindingTableEndpoint0_7(); - break; - case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : Verify endpoint 1 not changed\n"); - err = TestVerifyEndpoint1NotChanged_8(); - break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 9; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - static void OnFailureCallback_1(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_1(error); - } - - static void OnSuccessCallback_1(void * context) { (static_cast(context))->OnSuccessResponse_1(); } - - static void OnFailureCallback_2(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_2(error); - } - - static void OnSuccessCallback_2( - void * context, - const chip::app::DataModel::DecodableList & binding) - { - (static_cast(context))->OnSuccessResponse_2(binding); - } - - static void OnFailureCallback_3(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_3(error); - } - - static void OnSuccessCallback_3(void * context) { (static_cast(context))->OnSuccessResponse_3(); } - - static void OnFailureCallback_4(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_4(error); - } - - static void OnSuccessCallback_4(void * context) { (static_cast(context))->OnSuccessResponse_4(); } - - static void OnFailureCallback_5(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_5(error); - } - - static void OnSuccessCallback_5( - void * context, - const chip::app::DataModel::DecodableList & binding) - { - (static_cast(context))->OnSuccessResponse_5(binding); - } - - static void OnFailureCallback_6(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_6(error); - } - - static void OnSuccessCallback_6(void * context) { (static_cast(context))->OnSuccessResponse_6(); } - - static void OnFailureCallback_7(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_7(error); - } - - static void OnSuccessCallback_7( - void * context, - const chip::app::DataModel::DecodableList & binding) - { - (static_cast(context))->OnSuccessResponse_7(binding); - } - - static void OnFailureCallback_8(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_8(error); - } - - static void OnSuccessCallback_8( - void * context, - const chip::app::DataModel::DecodableList & binding) - { - (static_cast(context))->OnSuccessResponse_8(binding); - } - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestWriteEmptyBindingTable_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::BindingClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ListFreer listFreer; - chip::app::DataModel::List bindingArgument; - - bindingArgument = chip::app::DataModel::List(); - - ReturnErrorOnFailure(cluster.WriteAttribute( - bindingArgument, this, OnSuccessCallback_1, OnFailureCallback_1)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_1() { NextTest(); } - - CHIP_ERROR TestReadEmptyBindingTable_2() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::BindingClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_2, OnFailureCallback_2, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_2(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_2( - const chip::app::DataModel::DecodableList & binding) - { - { - auto iter_0 = binding.begin(); - VerifyOrReturn(CheckNoMoreListItems("binding", iter_0, 0)); - } - - NextTest(); - } - - CHIP_ERROR TestWriteInvalidBindingTable_3() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::BindingClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ListFreer listFreer; - chip::app::DataModel::List bindingArgument; - - { - auto * listHolder_0 = new ListHolder(2); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].fabricIndex = 0; - - listHolder_0->mList[1].node.Emplace(); - listHolder_0->mList[1].node.Value() = 1ULL; - listHolder_0->mList[1].group.Emplace(); - listHolder_0->mList[1].group.Value() = 1U; - listHolder_0->mList[1].endpoint.Emplace(); - listHolder_0->mList[1].endpoint.Value() = 1U; - listHolder_0->mList[1].cluster.Emplace(); - listHolder_0->mList[1].cluster.Value() = 6UL; - listHolder_0->mList[1].fabricIndex = 0; - - bindingArgument = - chip::app::DataModel::List(listHolder_0->mList, 2); - } - - ReturnErrorOnFailure(cluster.WriteAttribute( - bindingArgument, this, OnSuccessCallback_3, OnFailureCallback_3)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_3(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - NextTest(); - } - - void OnSuccessResponse_3() { ThrowSuccessResponse(); } - - CHIP_ERROR TestWriteBindingTableEndpoint1_4() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::BindingClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ListFreer listFreer; - chip::app::DataModel::List bindingArgument; - - { - auto * listHolder_0 = new ListHolder(3); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].group.Emplace(); - listHolder_0->mList[0].group.Value() = 1U; - listHolder_0->mList[0].fabricIndex = 0; - - listHolder_0->mList[1].node.Emplace(); - listHolder_0->mList[1].node.Value() = 1ULL; - listHolder_0->mList[1].endpoint.Emplace(); - listHolder_0->mList[1].endpoint.Value() = 1U; - listHolder_0->mList[1].cluster.Emplace(); - listHolder_0->mList[1].cluster.Value() = 6UL; - listHolder_0->mList[1].fabricIndex = 0; - - listHolder_0->mList[2].node.Emplace(); - listHolder_0->mList[2].node.Value() = 2ULL; - listHolder_0->mList[2].endpoint.Emplace(); - listHolder_0->mList[2].endpoint.Value() = 1U; - listHolder_0->mList[2].fabricIndex = 0; - - bindingArgument = - chip::app::DataModel::List(listHolder_0->mList, 3); - } - - ReturnErrorOnFailure(cluster.WriteAttribute( - bindingArgument, this, OnSuccessCallback_4, OnFailureCallback_4)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_4(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_4() { NextTest(); } - - CHIP_ERROR TestReadBindingTableEndpoint1_5() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::BindingClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_5, OnFailureCallback_5, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_5(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_5( - const chip::app::DataModel::DecodableList & binding) - { - { - auto iter_0 = binding.begin(); - VerifyOrReturn(CheckNextListItemDecodes("binding", iter_0, 0)); - VerifyOrReturn(CheckValuePresent("binding[0].group", iter_0.GetValue().group)); - VerifyOrReturn(CheckValue("binding[0].group.Value()", iter_0.GetValue().group.Value(), 1U)); - VerifyOrReturn(CheckValue("binding[0].fabricIndex", iter_0.GetValue().fabricIndex, 1)); - VerifyOrReturn(CheckNextListItemDecodes("binding", iter_0, 1)); - VerifyOrReturn(CheckValuePresent("binding[1].node", iter_0.GetValue().node)); - VerifyOrReturn(CheckValue("binding[1].node.Value()", iter_0.GetValue().node.Value(), 1ULL)); - VerifyOrReturn(CheckValuePresent("binding[1].endpoint", iter_0.GetValue().endpoint)); - VerifyOrReturn(CheckValue("binding[1].endpoint.Value()", iter_0.GetValue().endpoint.Value(), 1U)); - VerifyOrReturn(CheckValuePresent("binding[1].cluster", iter_0.GetValue().cluster)); - VerifyOrReturn(CheckValue("binding[1].cluster.Value()", iter_0.GetValue().cluster.Value(), 6UL)); - VerifyOrReturn(CheckValue("binding[1].fabricIndex", iter_0.GetValue().fabricIndex, 1)); - VerifyOrReturn(CheckNextListItemDecodes("binding", iter_0, 2)); - VerifyOrReturn(CheckValuePresent("binding[2].node", iter_0.GetValue().node)); - VerifyOrReturn(CheckValue("binding[2].node.Value()", iter_0.GetValue().node.Value(), 2ULL)); - VerifyOrReturn(CheckValuePresent("binding[2].endpoint", iter_0.GetValue().endpoint)); - VerifyOrReturn(CheckValue("binding[2].endpoint.Value()", iter_0.GetValue().endpoint.Value(), 1U)); - VerifyOrReturn(CheckValue("binding[2].fabricIndex", iter_0.GetValue().fabricIndex, 1)); - VerifyOrReturn(CheckNoMoreListItems("binding", iter_0, 3)); - } - - NextTest(); - } - - CHIP_ERROR TestWriteBindingTableEndpoint0_6() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::BindingClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ListFreer listFreer; - chip::app::DataModel::List bindingArgument; - - { - auto * listHolder_0 = new ListHolder(1); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].node.Emplace(); - listHolder_0->mList[0].node.Value() = 3ULL; - listHolder_0->mList[0].endpoint.Emplace(); - listHolder_0->mList[0].endpoint.Value() = 1U; - listHolder_0->mList[0].fabricIndex = 0; - - bindingArgument = - chip::app::DataModel::List(listHolder_0->mList, 1); - } - - ReturnErrorOnFailure(cluster.WriteAttribute( - bindingArgument, this, OnSuccessCallback_6, OnFailureCallback_6)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_6(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_6() { NextTest(); } - - CHIP_ERROR TestReadBindingTableEndpoint0_7() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::BindingClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_7, OnFailureCallback_7, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_7(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_7( - const chip::app::DataModel::DecodableList & binding) - { - { - auto iter_0 = binding.begin(); - VerifyOrReturn(CheckNextListItemDecodes("binding", iter_0, 0)); - VerifyOrReturn(CheckValuePresent("binding[0].node", iter_0.GetValue().node)); - VerifyOrReturn(CheckValue("binding[0].node.Value()", iter_0.GetValue().node.Value(), 3ULL)); - VerifyOrReturn(CheckValuePresent("binding[0].endpoint", iter_0.GetValue().endpoint)); - VerifyOrReturn(CheckValue("binding[0].endpoint.Value()", iter_0.GetValue().endpoint.Value(), 1U)); - VerifyOrReturn(CheckValue("binding[0].fabricIndex", iter_0.GetValue().fabricIndex, 1)); - VerifyOrReturn(CheckNoMoreListItems("binding", iter_0, 1)); - } - - NextTest(); - } - - CHIP_ERROR TestVerifyEndpoint1NotChanged_8() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::BindingClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_8, OnFailureCallback_8, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_8(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_8( - const chip::app::DataModel::DecodableList & binding) - { - { - auto iter_0 = binding.begin(); - VerifyOrReturn(CheckNextListItemDecodes("binding", iter_0, 0)); - VerifyOrReturn(CheckValuePresent("binding[0].group", iter_0.GetValue().group)); - VerifyOrReturn(CheckValue("binding[0].group.Value()", iter_0.GetValue().group.Value(), 1U)); - VerifyOrReturn(CheckValue("binding[0].fabricIndex", iter_0.GetValue().fabricIndex, 1)); - VerifyOrReturn(CheckNextListItemDecodes("binding", iter_0, 1)); - VerifyOrReturn(CheckValuePresent("binding[1].node", iter_0.GetValue().node)); - VerifyOrReturn(CheckValue("binding[1].node.Value()", iter_0.GetValue().node.Value(), 1ULL)); - VerifyOrReturn(CheckValuePresent("binding[1].endpoint", iter_0.GetValue().endpoint)); - VerifyOrReturn(CheckValue("binding[1].endpoint.Value()", iter_0.GetValue().endpoint.Value(), 1U)); - VerifyOrReturn(CheckValuePresent("binding[1].cluster", iter_0.GetValue().cluster)); - VerifyOrReturn(CheckValue("binding[1].cluster.Value()", iter_0.GetValue().cluster.Value(), 6UL)); - VerifyOrReturn(CheckValue("binding[1].fabricIndex", iter_0.GetValue().fabricIndex, 1)); - VerifyOrReturn(CheckNextListItemDecodes("binding", iter_0, 2)); - VerifyOrReturn(CheckValuePresent("binding[2].node", iter_0.GetValue().node)); - VerifyOrReturn(CheckValue("binding[2].node.Value()", iter_0.GetValue().node.Value(), 2ULL)); - VerifyOrReturn(CheckValuePresent("binding[2].endpoint", iter_0.GetValue().endpoint)); - VerifyOrReturn(CheckValue("binding[2].endpoint.Value()", iter_0.GetValue().endpoint.Value(), 1U)); - VerifyOrReturn(CheckValue("binding[2].fabricIndex", iter_0.GetValue().fabricIndex, 1)); - VerifyOrReturn(CheckNoMoreListItems("binding", iter_0, 3)); - } - - NextTest(); - } -}; - -class TestUserLabelClusterSuite : public TestCommand -{ -public: - TestUserLabelClusterSuite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("TestUserLabelCluster", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("discriminator", 0, UINT16_MAX, &mDiscriminator); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~TestUserLabelClusterSuite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: TestUserLabelCluster\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: TestUserLabelCluster\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Clear User Label List\n"); - err = TestClearUserLabelList_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Read User Label List\n"); - err = TestReadUserLabelList_2(); - break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Write User Label List\n"); - err = TestWriteUserLabelList_3(); - break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Reboot target device\n"); - err = TestRebootTargetDevice_4(); - break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_5(); - break; - case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : Verify\n"); - err = TestVerify_6(); - break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 7; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mDiscriminator; - chip::Optional mTimeout; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 4: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 5: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - static void OnFailureCallback_1(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_1(error); - } - - static void OnSuccessCallback_1(void * context) { (static_cast(context))->OnSuccessResponse_1(); } - - static void OnFailureCallback_2(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_2(error); - } - - static void OnSuccessCallback_2( - void * context, - const chip::app::DataModel::DecodableList & labelList) - { - (static_cast(context))->OnSuccessResponse_2(labelList); - } - - static void OnFailureCallback_3(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_3(error); - } - - static void OnSuccessCallback_3(void * context) { (static_cast(context))->OnSuccessResponse_3(); } - - static void OnFailureCallback_6(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_6(error); - } - - static void OnSuccessCallback_6( - void * context, - const chip::app::DataModel::DecodableList & labelList) - { - (static_cast(context))->OnSuccessResponse_6(labelList); - } - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestClearUserLabelList_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::UserLabelClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ListFreer listFreer; - chip::app::DataModel::List labelListArgument; - - labelListArgument = chip::app::DataModel::List(); - - ReturnErrorOnFailure(cluster.WriteAttribute( - labelListArgument, this, OnSuccessCallback_1, OnFailureCallback_1)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_1() { NextTest(); } - - CHIP_ERROR TestReadUserLabelList_2() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::UserLabelClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_2, OnFailureCallback_2, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_2(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_2( - const chip::app::DataModel::DecodableList & labelList) - { - { - auto iter_0 = labelList.begin(); - VerifyOrReturn(CheckNoMoreListItems("labelList", iter_0, 0)); - } - - NextTest(); - } - - CHIP_ERROR TestWriteUserLabelList_3() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::UserLabelClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ListFreer listFreer; - chip::app::DataModel::List labelListArgument; - - { - auto * listHolder_0 = new ListHolder(4); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].label = chip::Span("roomgarbage: not in length on purpose", 4); - listHolder_0->mList[0].value = chip::Span("bedroom 2garbage: not in length on purpose", 9); - - listHolder_0->mList[1].label = chip::Span("orientationgarbage: not in length on purpose", 11); - listHolder_0->mList[1].value = chip::Span("Northgarbage: not in length on purpose", 5); - - listHolder_0->mList[2].label = chip::Span("floorgarbage: not in length on purpose", 5); - listHolder_0->mList[2].value = chip::Span("5garbage: not in length on purpose", 1); - - listHolder_0->mList[3].label = chip::Span("directiongarbage: not in length on purpose", 9); - listHolder_0->mList[3].value = chip::Span("upgarbage: not in length on purpose", 2); - - labelListArgument = - chip::app::DataModel::List(listHolder_0->mList, 4); - } - - ReturnErrorOnFailure(cluster.WriteAttribute( - labelListArgument, this, OnSuccessCallback_3, OnFailureCallback_3)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_3(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_3() { NextTest(); } - - CHIP_ERROR TestRebootTargetDevice_4() - { - SetIdentity(kIdentityAlpha); - return Reboot(mDiscriminator.HasValue() ? mDiscriminator.Value() : 3840U); - } - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_5() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestVerify_6() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::UserLabelClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_6, OnFailureCallback_6, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_6(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_6( - const chip::app::DataModel::DecodableList & labelList) - { - { - auto iter_0 = labelList.begin(); - VerifyOrReturn(CheckNextListItemDecodes("labelList", iter_0, 0)); - VerifyOrReturn(CheckValueAsString("labelList[0].label", iter_0.GetValue().label, chip::CharSpan("room", 4))); - VerifyOrReturn(CheckValueAsString("labelList[0].value", iter_0.GetValue().value, chip::CharSpan("bedroom 2", 9))); - VerifyOrReturn(CheckNextListItemDecodes("labelList", iter_0, 1)); - VerifyOrReturn(CheckValueAsString("labelList[1].label", iter_0.GetValue().label, chip::CharSpan("orientation", 11))); - VerifyOrReturn(CheckValueAsString("labelList[1].value", iter_0.GetValue().value, chip::CharSpan("North", 5))); - VerifyOrReturn(CheckNextListItemDecodes("labelList", iter_0, 2)); - VerifyOrReturn(CheckValueAsString("labelList[2].label", iter_0.GetValue().label, chip::CharSpan("floor", 5))); - VerifyOrReturn(CheckValueAsString("labelList[2].value", iter_0.GetValue().value, chip::CharSpan("5", 1))); - VerifyOrReturn(CheckNextListItemDecodes("labelList", iter_0, 3)); - VerifyOrReturn(CheckValueAsString("labelList[3].label", iter_0.GetValue().label, chip::CharSpan("direction", 9))); - VerifyOrReturn(CheckValueAsString("labelList[3].value", iter_0.GetValue().value, chip::CharSpan("up", 2))); - VerifyOrReturn(CheckNoMoreListItems("labelList", iter_0, 4)); - } - - NextTest(); - } -}; - -class TestArmFailSafeSuite : public TestCommand -{ -public: - TestArmFailSafeSuite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("TestArmFailSafe", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("discriminator", 0, UINT16_MAX, &mDiscriminator); - AddArgument("payload", &mPayload); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~TestArmFailSafeSuite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: TestArmFailSafe\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: TestArmFailSafe\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Reboot target device\n"); - err = TestRebootTargetDevice_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Wait for the alpha device to be retrieved \n"); - err = TestWaitForTheAlphaDeviceToBeRetrieved_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Query fabrics list\n"); - err = TestQueryFabricsList_2(); - break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : ArmFailSafe on target device with timeout 0\n"); - err = TestArmFailSafeOnTargetDeviceWithTimeout0_3(); - break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Reads NodeLabel mandatory attribute of target device\n"); - err = TestReadsNodeLabelMandatoryAttributeOfTargetDevice_4(); - break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 5; - - chip::Optional mNodeId; - chip::Optional mEndpoint; - chip::Optional mDiscriminator; - chip::Optional mPayload; - chip::Optional mTimeout; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 1: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - static void OnFailureCallback_2(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_2(error); - } - - static void - OnSuccessCallback_2(void * context, - const chip::app::DataModel::DecodableList< - chip::app::Clusters::OperationalCredentials::Structs::FabricDescriptor::DecodableType> & fabrics) - { - (static_cast(context))->OnSuccessResponse_2(fabrics); - } - - static void OnFailureCallback_4(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_4(error); - } - - static void OnSuccessCallback_4(void * context, chip::CharSpan nodeLabel) - { - (static_cast(context))->OnSuccessResponse_4(nodeLabel); - } - - // - // Tests methods - // - - CHIP_ERROR TestRebootTargetDevice_0() - { - SetIdentity(kIdentityAlpha); - return Reboot(mDiscriminator.HasValue() ? mDiscriminator.Value() : 3840U); - } - - CHIP_ERROR TestWaitForTheAlphaDeviceToBeRetrieved_1() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestQueryFabricsList_2() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::OperationalCredentialsClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_2, OnFailureCallback_2, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_2(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_2(const chip::app::DataModel::DecodableList< - chip::app::Clusters::OperationalCredentials::Structs::FabricDescriptor::DecodableType> & fabrics) - { - { - auto iter_0 = fabrics.begin(); - VerifyOrReturn(CheckNextListItemDecodes("fabrics", iter_0, 0)); - VerifyOrReturn(CheckValueAsString("fabrics[0].label", iter_0.GetValue().label, chip::CharSpan("", 0))); - VerifyOrReturn(CheckNoMoreListItems("fabrics", iter_0, 1)); - } - VerifyOrReturn(CheckConstraintType("fabrics", "", "list")); - NextTest(); - } - - CHIP_ERROR TestArmFailSafeOnTargetDeviceWithTimeout0_3() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - using RequestType = chip::app::Clusters::GeneralCommissioning::Commands::ArmFailSafe::Type; - - RequestType request; - request.expiryLengthSeconds = 0U; - request.breadcrumb = 0ULL; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_3(data.errorCode, data.debugText); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_3(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_3(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_3(chip::app::Clusters::GeneralCommissioning::CommissioningError errorCode, chip::CharSpan debugText) - { - VerifyOrReturn(CheckValue("errorCode", errorCode, 0)); - - NextTest(); - } - - CHIP_ERROR TestReadsNodeLabelMandatoryAttributeOfTargetDevice_4() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::BasicClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_4, OnFailureCallback_4, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_4(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_4(chip::CharSpan nodeLabel) - { - VerifyOrReturn(CheckValueAsString("nodeLabel", nodeLabel, chip::CharSpan("", 0))); - - NextTest(); - } -}; - -class TestMultiAdminSuite : public TestCommand -{ -public: - TestMultiAdminSuite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("TestMultiAdmin", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("nodeIdForDuplicateCommissioning", 0, UINT64_MAX, &mNodeIdForDuplicateCommissioning); - AddArgument("nodeId2", 0, UINT64_MAX, &mNodeId2); - AddArgument("nodeId3", 0, UINT64_MAX, &mNodeId3); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("discriminator", 0, UINT16_MAX, &mDiscriminator); - AddArgument("payload", &mPayload); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~TestMultiAdminSuite() - { - if (readFromAlphaBuffer != nullptr) - { - chip::Platform::MemoryFree(readFromAlphaBuffer); - readFromAlphaBuffer = nullptr; - } - } - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: TestMultiAdmin\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: TestMultiAdmin\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Reboot target device\n"); - err = TestRebootTargetDevice_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Wait for the commissioned device to be retrieved for alpha\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrievedForAlpha_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Commission from alpha when the commissioning window is not opened\n"); - err = TestCommissionFromAlphaWhenTheCommissioningWindowIsNotOpened_2(); - break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Open Commissioning Window from alpha\n"); - err = TestOpenCommissioningWindowFromAlpha_3(); - break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Commission from alpha again\n"); - err = TestCommissionFromAlphaAgain_4(); - break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Check that we just have the one fabric and did not add a new one\n"); - err = TestCheckThatWeJustHaveTheOneFabricAndDidNotAddANewOne_5(); - break; - case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : Close Commissioning Window after failed commissioning\n"); - err = TestCloseCommissioningWindowAfterFailedCommissioning_6(); - break; - case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : Open Commissioning Window from alpha again\n"); - err = TestOpenCommissioningWindowFromAlphaAgain_7(); - break; - case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : Commission from beta\n"); - err = TestCommissionFromBeta_8(); - break; - case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : Wait for the commissioned device to be retrieved for beta\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrievedForBeta_9(); - break; - case 10: - ChipLogProgress(chipTool, " ***** Test Step 10 : Open Commissioning Window from beta\n"); - err = TestOpenCommissioningWindowFromBeta_10(); - break; - case 11: - ChipLogProgress(chipTool, " ***** Test Step 11 : Commission from gamma\n"); - err = TestCommissionFromGamma_11(); - break; - case 12: - ChipLogProgress(chipTool, " ***** Test Step 12 : Wait for the commissioned device to be retrieved for gamma\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrievedForGamma_12(); - break; - case 13: - ChipLogProgress(chipTool, " ***** Test Step 13 : read the mandatory attribute: NodeLabel from alpha\n"); - err = TestReadTheMandatoryAttributeNodeLabelFromAlpha_13(); - break; - case 14: - ChipLogProgress(chipTool, " ***** Test Step 14 : write the mandatory attribute NodeLabel from beta\n"); - err = TestWriteTheMandatoryAttributeNodeLabelFromBeta_14(); - break; - case 15: - ChipLogProgress(chipTool, " ***** Test Step 15 : read the mandatory attribute: NodeLabel from gamma\n"); - err = TestReadTheMandatoryAttributeNodeLabelFromGamma_15(); - break; - case 16: - ChipLogProgress(chipTool, " ***** Test Step 16 : write the mandatory attribute NodeLabel back to default\n"); - err = TestWriteTheMandatoryAttributeNodeLabelBackToDefault_16(); - break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 17; - - chip::Optional mNodeId; - chip::Optional mNodeIdForDuplicateCommissioning; - chip::Optional mNodeId2; - chip::Optional mNodeId3; - chip::Optional mEndpoint; - chip::Optional mDiscriminator; - chip::Optional mPayload; - chip::Optional mTimeout; - - char * readFromAlphaBuffer = nullptr; - chip::CharSpan readFromAlpha; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 1: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 2: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); - shouldContinue = true; - break; - case 4: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); - VerifyOrReturn(CheckValue("clusterStatus", status.mClusterStatus.HasValue(), true)); - VerifyOrReturn(CheckValue("clusterStatus", status.mClusterStatus.Value(), 9)); - shouldContinue = true; - break; - case 8: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 9: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 11: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 12: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - static void OnFailureCallback_5(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_5(error); - } - - static void - OnSuccessCallback_5(void * context, - const chip::app::DataModel::DecodableList< - chip::app::Clusters::OperationalCredentials::Structs::FabricDescriptor::DecodableType> & fabrics) - { - (static_cast(context))->OnSuccessResponse_5(fabrics); - } - - static void OnFailureCallback_13(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_13(error); - } - - static void OnSuccessCallback_13(void * context, chip::CharSpan nodeLabel) - { - (static_cast(context))->OnSuccessResponse_13(nodeLabel); - } - - static void OnFailureCallback_14(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_14(error); - } - - static void OnSuccessCallback_14(void * context) { (static_cast(context))->OnSuccessResponse_14(); } - - static void OnFailureCallback_15(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_15(error); - } - - static void OnSuccessCallback_15(void * context, chip::CharSpan nodeLabel) - { - (static_cast(context))->OnSuccessResponse_15(nodeLabel); - } - - static void OnFailureCallback_16(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_16(error); - } - - static void OnSuccessCallback_16(void * context) { (static_cast(context))->OnSuccessResponse_16(); } - - // - // Tests methods - // - - CHIP_ERROR TestRebootTargetDevice_0() - { - SetIdentity(kIdentityAlpha); - return Reboot(mDiscriminator.HasValue() ? mDiscriminator.Value() : 3840U); - } - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrievedForAlpha_1() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestCommissionFromAlphaWhenTheCommissioningWindowIsNotOpened_2() - { - SetIdentity(kIdentityAlpha); - return PairWithQRCode(mNodeIdForDuplicateCommissioning.HasValue() ? mNodeIdForDuplicateCommissioning.Value() : 17ULL, - mPayload.HasValue() ? mPayload.Value() : chip::CharSpan::fromCharString("MT:-24J0AFN00KA0648G00")); - } - - CHIP_ERROR TestOpenCommissioningWindowFromAlpha_3() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - using RequestType = chip::app::Clusters::AdministratorCommissioning::Commands::OpenBasicCommissioningWindow::Type; - - RequestType request; - request.commissioningTimeout = 180U; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_3(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_3(error); - }; - - ReturnErrorOnFailure( - chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request, 10000)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_3(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_3() { NextTest(); } - - CHIP_ERROR TestCommissionFromAlphaAgain_4() - { - SetIdentity(kIdentityAlpha); - return PairWithQRCode(mNodeIdForDuplicateCommissioning.HasValue() ? mNodeIdForDuplicateCommissioning.Value() : 17ULL, - mPayload.HasValue() ? mPayload.Value() : chip::CharSpan::fromCharString("MT:-24J0AFN00KA0648G00")); - } - - CHIP_ERROR TestCheckThatWeJustHaveTheOneFabricAndDidNotAddANewOne_5() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::OperationalCredentialsClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_5, OnFailureCallback_5, false)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_5(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_5(const chip::app::DataModel::DecodableList< - chip::app::Clusters::OperationalCredentials::Structs::FabricDescriptor::DecodableType> & fabrics) - { - { - auto iter_0 = fabrics.begin(); - VerifyOrReturn(CheckNextListItemDecodes("fabrics", iter_0, 0)); - VerifyOrReturn(CheckNoMoreListItems("fabrics", iter_0, 1)); - } - - NextTest(); - } - - CHIP_ERROR TestCloseCommissioningWindowAfterFailedCommissioning_6() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - using RequestType = chip::app::Clusters::AdministratorCommissioning::Commands::RevokeCommissioning::Type; - - RequestType request; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_6(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_6(error); - }; - - ReturnErrorOnFailure( - chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request, 10000)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_6(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_6() { NextTest(); } - - CHIP_ERROR TestOpenCommissioningWindowFromAlphaAgain_7() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - using RequestType = chip::app::Clusters::AdministratorCommissioning::Commands::OpenBasicCommissioningWindow::Type; - - RequestType request; - request.commissioningTimeout = 180U; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_7(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_7(error); - }; - - ReturnErrorOnFailure( - chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request, 10000)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_7(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_7() { NextTest(); } - - CHIP_ERROR TestCommissionFromBeta_8() - { - SetIdentity(kIdentityBeta); - return PairWithQRCode(mNodeId2.HasValue() ? mNodeId2.Value() : 51966ULL, - mPayload.HasValue() ? mPayload.Value() : chip::CharSpan::fromCharString("MT:-24J0AFN00KA0648G00")); - } - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrievedForBeta_9() - { - SetIdentity(kIdentityBeta); - return WaitForCommissionee(mNodeId2.HasValue() ? mNodeId2.Value() : 51966ULL); - } - - CHIP_ERROR TestOpenCommissioningWindowFromBeta_10() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - using RequestType = chip::app::Clusters::AdministratorCommissioning::Commands::OpenBasicCommissioningWindow::Type; - - RequestType request; - request.commissioningTimeout = 180U; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_10(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_10(error); - }; - - ReturnErrorOnFailure( - chip::Controller::InvokeCommand(mDevices[kIdentityBeta], this, success, failure, endpoint, request, 10000)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_10(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_10() { NextTest(); } - - CHIP_ERROR TestCommissionFromGamma_11() - { - SetIdentity(kIdentityGamma); - return PairWithQRCode(mNodeId3.HasValue() ? mNodeId3.Value() : 12586990ULL, - mPayload.HasValue() ? mPayload.Value() : chip::CharSpan::fromCharString("MT:-24J0AFN00KA0648G00")); - } - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrievedForGamma_12() - { - SetIdentity(kIdentityGamma); - return WaitForCommissionee(mNodeId3.HasValue() ? mNodeId3.Value() : 12586990ULL); - } - - CHIP_ERROR TestReadTheMandatoryAttributeNodeLabelFromAlpha_13() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::BasicClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_13, OnFailureCallback_13, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_13(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_13(chip::CharSpan nodeLabel) - { - VerifyOrReturn(CheckValueAsString("nodeLabel", nodeLabel, chip::CharSpan("", 0))); - - if (readFromAlphaBuffer != nullptr) - { - chip::Platform::MemoryFree(readFromAlphaBuffer); - } - readFromAlphaBuffer = static_cast(chip::Platform::MemoryAlloc(nodeLabel.size())); - memcpy(readFromAlphaBuffer, nodeLabel.data(), nodeLabel.size()); - readFromAlpha = chip::CharSpan(readFromAlphaBuffer, nodeLabel.size()); - NextTest(); - } - - CHIP_ERROR TestWriteTheMandatoryAttributeNodeLabelFromBeta_14() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::BasicClusterTest cluster; - cluster.Associate(mDevices[kIdentityBeta], endpoint); - - chip::CharSpan nodeLabelArgument; - nodeLabelArgument = chip::Span("written from betagarbage: not in length on purpose", 17); - - ReturnErrorOnFailure(cluster.WriteAttribute( - nodeLabelArgument, this, OnSuccessCallback_14, OnFailureCallback_14)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_14(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_14() { NextTest(); } - - CHIP_ERROR TestReadTheMandatoryAttributeNodeLabelFromGamma_15() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::BasicClusterTest cluster; - cluster.Associate(mDevices[kIdentityGamma], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_15, OnFailureCallback_15, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_15(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_15(chip::CharSpan nodeLabel) - { - VerifyOrReturn(CheckConstraintNotValue("nodeLabel", nodeLabel, readFromAlpha)); - - NextTest(); - } - - CHIP_ERROR TestWriteTheMandatoryAttributeNodeLabelBackToDefault_16() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::BasicClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::CharSpan nodeLabelArgument; - nodeLabelArgument = readFromAlpha; - - ReturnErrorOnFailure(cluster.WriteAttribute( - nodeLabelArgument, this, OnSuccessCallback_16, OnFailureCallback_16)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_16(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_16() { NextTest(); } -}; - -class Test_TC_SWDIAG_1_1Suite : public TestCommand -{ -public: - Test_TC_SWDIAG_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_SWDIAG_1_1", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_SWDIAG_1_1Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_SWDIAG_1_1\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_SWDIAG_1_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Reads a list of ThreadMetrics struct non-global attribute from DUT.\n"); - if (ShouldSkip("A_THREADMETRICS")) - { - NextTest(); - return; - } - err = TestReadsAListOfThreadMetricsStructNonGlobalAttributeFromDut_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Reads CurrentHeapFree non-global attribute value from DUT\n"); - err = TestReadsCurrentHeapFreeNonGlobalAttributeValueFromDut_2(); - break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Reads CurrentHeapUsed non-global attribute value from DUT\n"); - if (ShouldSkip("A_CURRENTHEAPUSED")) - { - NextTest(); - return; - } - err = TestReadsCurrentHeapUsedNonGlobalAttributeValueFromDut_3(); - break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Reads CurrentHeapHighWaterMark non-global attribute value from DUT\n"); - if (ShouldSkip("A_CURRENTHEAPHIGHWATERMARK")) - { - NextTest(); - return; - } - err = TestReadsCurrentHeapHighWaterMarkNonGlobalAttributeValueFromDut_4(); - break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 5; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - static void OnFailureCallback_1(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_1(error); - } - - static void OnSuccessCallback_1( - void * context, - const chip::app::DataModel::DecodableList & - threadMetrics) - { - (static_cast(context))->OnSuccessResponse_1(threadMetrics); - } - - static void OnFailureCallback_2(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_2(error); - } - - static void OnSuccessCallback_2(void * context, uint64_t currentHeapFree) - { - (static_cast(context))->OnSuccessResponse_2(currentHeapFree); - } - - static void OnFailureCallback_3(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_3(error); - } - - static void OnSuccessCallback_3(void * context, uint64_t currentHeapUsed) - { - (static_cast(context))->OnSuccessResponse_3(currentHeapUsed); - } - - static void OnFailureCallback_4(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_4(error); - } - - static void OnSuccessCallback_4(void * context, uint64_t currentHeapHighWatermark) - { - (static_cast(context))->OnSuccessResponse_4(currentHeapHighWatermark); - } - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestReadsAListOfThreadMetricsStructNonGlobalAttributeFromDut_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::SoftwareDiagnosticsClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_1, OnFailureCallback_1, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_1( - const chip::app::DataModel::DecodableList & - threadMetrics) - { - VerifyOrReturn(CheckConstraintType("threadMetrics", "", "list")); - NextTest(); - } - - CHIP_ERROR TestReadsCurrentHeapFreeNonGlobalAttributeValueFromDut_2() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::SoftwareDiagnosticsClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_2, OnFailureCallback_2, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_2(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() - : ThrowFailureResponse(error); - } - - void OnSuccessResponse_2(uint64_t currentHeapFree) - { - VerifyOrReturn(CheckConstraintType("currentHeapFree", "", "uint64")); - NextTest(); - } - - CHIP_ERROR TestReadsCurrentHeapUsedNonGlobalAttributeValueFromDut_3() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::SoftwareDiagnosticsClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_3, OnFailureCallback_3, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_3(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() - : ThrowFailureResponse(error); - } - - void OnSuccessResponse_3(uint64_t currentHeapUsed) - { - VerifyOrReturn(CheckConstraintType("currentHeapUsed", "", "uint64")); - NextTest(); - } - - CHIP_ERROR TestReadsCurrentHeapHighWaterMarkNonGlobalAttributeValueFromDut_4() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::SoftwareDiagnosticsClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_4, OnFailureCallback_4, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_4(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() - : ThrowFailureResponse(error); - } - - void OnSuccessResponse_4(uint64_t currentHeapHighWatermark) - { - VerifyOrReturn(CheckConstraintType("currentHeapHighWatermark", "", "uint64")); - NextTest(); - } -}; - -class Test_TC_SWDIAG_2_1Suite : public TestCommand -{ -public: - Test_TC_SWDIAG_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_SWDIAG_2_1", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_SWDIAG_2_1Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_SWDIAG_2_1\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_SWDIAG_2_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - // - // Tests methods - // -}; - -class Test_TC_SWDIAG_3_1Suite : public TestCommand -{ -public: - Test_TC_SWDIAG_3_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_SWDIAG_3_1", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_SWDIAG_3_1Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_SWDIAG_3_1\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_SWDIAG_3_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Sends ResetWatermarks to DUT\n"); - if (ShouldSkip("CR_RESETWATERMARKS")) - { - NextTest(); - return; - } - err = TestSendsResetWatermarksToDut_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Reads CurrentHeapUsed attribute value from DUT\n"); - if (ShouldSkip("A_CURRENTHEAPUSED")) - { - NextTest(); - return; - } - err = TestReadsCurrentHeapUsedAttributeValueFromDut_2(); - break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Reads CurrentHeapHighWaterMark attribute value from DUT\n"); - if (ShouldSkip("A_CURRENTHEAPHIGHWATERMARK")) - { - NextTest(); - return; - } - err = TestReadsCurrentHeapHighWaterMarkAttributeValueFromDut_3(); - break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 4; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - static void OnFailureCallback_2(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_2(error); - } - - static void OnSuccessCallback_2(void * context, uint64_t currentHeapUsed) - { - (static_cast(context))->OnSuccessResponse_2(currentHeapUsed); - } - - static void OnFailureCallback_3(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_3(error); - } - - static void OnSuccessCallback_3(void * context, uint64_t currentHeapHighWatermark) - { - (static_cast(context))->OnSuccessResponse_3(currentHeapHighWatermark); - } - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestSendsResetWatermarksToDut_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - using RequestType = chip::app::Clusters::SoftwareDiagnostics::Commands::ResetWatermarks::Type; - - RequestType request; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_1(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_1(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_1() { NextTest(); } - - CHIP_ERROR TestReadsCurrentHeapUsedAttributeValueFromDut_2() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::SoftwareDiagnosticsClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_2, OnFailureCallback_2, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_2(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() - : ThrowFailureResponse(error); - } - - void OnSuccessResponse_2(uint64_t currentHeapUsed) - { - VerifyOrReturn(CheckConstraintType("currentHeapUsed", "", "uint64")); - NextTest(); - } - - CHIP_ERROR TestReadsCurrentHeapHighWaterMarkAttributeValueFromDut_3() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::SoftwareDiagnosticsClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_3, OnFailureCallback_3, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_3(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() - : ThrowFailureResponse(error); - } - - void OnSuccessResponse_3(uint64_t currentHeapHighWatermark) - { - VerifyOrReturn(CheckConstraintType("currentHeapHighWatermark", "", "uint64")); - NextTest(); - } -}; - -class TestSubscribe_OnOffSuite : public TestCommand -{ -public: - TestSubscribe_OnOffSuite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("TestSubscribe_OnOff", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~TestSubscribe_OnOffSuite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: TestSubscribe_OnOff\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: TestSubscribe_OnOff\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Set OnOff Attribute to false\n"); - err = TestSetOnOffAttributeToFalse_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Report: Subscribe OnOff Attribute\n"); - err = TestReportSubscribeOnOffAttribute_2(); - break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Subscribe OnOff Attribute\n"); - err = TestSubscribeOnOffAttribute_3(); - break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Turn On the light to see attribute change\n"); - err = TestTurnOnTheLightToSeeAttributeChange_4(); - break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Check for attribute report\n"); - err = TestCheckForAttributeReport_5(); - break; - case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : Turn Off the light to see attribute change\n"); - err = TestTurnOffTheLightToSeeAttributeChange_6(); - break; - case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : Check for attribute report\n"); - err = TestCheckForAttributeReport_7(); - break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 8; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - typedef void (*Test_TestSubscribe_OnOff_OnOff_ReportCallback)(void * context, bool value); - Test_TestSubscribe_OnOff_OnOff_ReportCallback mTest_TestSubscribe_OnOff_OnOff_Reported = nullptr; - - static void OnFailureCallback_2(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_2(error); - } - - static void OnSuccessCallback_2(void * context, bool onOff) - { - (static_cast(context))->OnSuccessResponse_2(onOff); - } - - bool mReceivedReport_2 = false; - - static void OnFailureCallback_3(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_3(error); - } - - static void OnSuccessCallback_3(void * context, bool onOff) - { - (static_cast(context))->OnSuccessResponse_3(onOff); - } - - static void OnSubscriptionEstablished_3(void * context) - { - (static_cast(context))->OnSubscriptionEstablishedResponse_3(); - } - - static void OnFailureCallback_5(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_5(error); - } - - static void OnSuccessCallback_5(void * context, bool onOff) - { - (static_cast(context))->OnSuccessResponse_5(onOff); - } - - bool mReceivedReport_5 = false; - - static void OnFailureCallback_7(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_7(error); - } - - static void OnSuccessCallback_7(void * context, bool onOff) - { - (static_cast(context))->OnSuccessResponse_7(onOff); - } - - bool mReceivedReport_7 = false; - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestSetOnOffAttributeToFalse_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::OnOff::Commands::Off::Type; - - RequestType request; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_1(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_1(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_1() { NextTest(); } - - CHIP_ERROR TestReportSubscribeOnOffAttribute_2() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::OnOffClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - mTest_TestSubscribe_OnOff_OnOff_Reported = OnSuccessCallback_2; - return WaitForMs(0); - } - - void OnFailureResponse_2(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_2(bool onOff) - { - mReceivedReport_2 = true; - VerifyOrReturn(CheckValue("onOff", onOff, false)); - } - - CHIP_ERROR TestSubscribeOnOffAttribute_3() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::OnOffClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - uint16_t minIntervalArgument; - minIntervalArgument = 2U; - uint16_t maxIntervalArgument; - maxIntervalArgument = 5U; - - ReturnErrorOnFailure(cluster.SubscribeAttribute( - this, OnSuccessCallback_3, OnFailureCallback_3, minIntervalArgument, maxIntervalArgument, OnSubscriptionEstablished_3, - true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_3(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_3(bool value) - { - if (mTest_TestSubscribe_OnOff_OnOff_Reported) - { - auto callback = mTest_TestSubscribe_OnOff_OnOff_Reported; - mTest_TestSubscribe_OnOff_OnOff_Reported = nullptr; - callback(this, value); - } - } - - void OnSubscriptionEstablishedResponse_3() - { - VerifyOrReturn(mReceivedReport_2, Exit("Initial report not received!")); - NextTest(); - } - - CHIP_ERROR TestTurnOnTheLightToSeeAttributeChange_4() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::OnOff::Commands::On::Type; - - RequestType request; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_4(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_4(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_4(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_4() { NextTest(); } - - CHIP_ERROR TestCheckForAttributeReport_5() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::OnOffClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - mTest_TestSubscribe_OnOff_OnOff_Reported = OnSuccessCallback_5; - return CHIP_NO_ERROR; - } - - void OnFailureResponse_5(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_5(bool onOff) - { - mReceivedReport_5 = true; - VerifyOrReturn(CheckValue("onOff", onOff, true)); - - NextTest(); - } - - CHIP_ERROR TestTurnOffTheLightToSeeAttributeChange_6() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::OnOff::Commands::Off::Type; - - RequestType request; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_6(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_6(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_6(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_6() { NextTest(); } - - CHIP_ERROR TestCheckForAttributeReport_7() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::OnOffClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - mTest_TestSubscribe_OnOff_OnOff_Reported = OnSuccessCallback_7; - return CHIP_NO_ERROR; - } - - void OnFailureResponse_7(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_7(bool onOff) - { - mReceivedReport_7 = true; - VerifyOrReturn(CheckValue("onOff", onOff, false)); - - NextTest(); - } -}; - -class DL_UsersAndCredentialsSuite : public TestCommand -{ -public: - DL_UsersAndCredentialsSuite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("DL_UsersAndCredentials", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~DL_UsersAndCredentialsSuite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: DL_UsersAndCredentials\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: DL_UsersAndCredentials\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Read available user slot and verify response fields\n"); - err = TestReadAvailableUserSlotAndVerifyResponseFields_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Get number of supported users and verify default value\n"); - err = TestGetNumberOfSupportedUsersAndVerifyDefaultValue_2(); - break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Read fails for user with index 0\n"); - err = TestReadFailsForUserWithIndex0_3(); - break; - case 4: - ChipLogProgress(chipTool, - " ***** Test Step 4 : Read fails for user with index greater than Number Of Users Supported\n"); - err = TestReadFailsForUserWithIndexGreaterThanNumberOfUsersSupported_4(); - break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Create new user with default parameters\n"); - err = TestCreateNewUserWithDefaultParameters_5(); - break; - case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : Read the user back and verify its fields\n"); - err = TestReadTheUserBackAndVerifyItsFields_6(); - break; - case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : Set user at the occupied index fails with appropriate response\n"); - err = TestSetUserAtTheOccupiedIndexFailsWithAppropriateResponse_7(); - break; - case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : Modify userName for existing user\n"); - err = TestModifyUserNameForExistingUser_8(); - break; - case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : Read the modified user back and verify its fields\n"); - err = TestReadTheModifiedUserBackAndVerifyItsFields_9(); - break; - case 10: - ChipLogProgress(chipTool, " ***** Test Step 10 : Modify userUniqueId for existing user\n"); - err = TestModifyUserUniqueIdForExistingUser_10(); - break; - case 11: - ChipLogProgress(chipTool, " ***** Test Step 11 : Read the modified user back and verify its fields\n"); - err = TestReadTheModifiedUserBackAndVerifyItsFields_11(); - break; - case 12: - ChipLogProgress(chipTool, " ***** Test Step 12 : Modify userStatus for existing user\n"); - err = TestModifyUserStatusForExistingUser_12(); - break; - case 13: - ChipLogProgress(chipTool, " ***** Test Step 13 : Read the modified user back and verify its fields\n"); - err = TestReadTheModifiedUserBackAndVerifyItsFields_13(); - break; - case 14: - ChipLogProgress(chipTool, " ***** Test Step 14 : Modify userType for existing user\n"); - err = TestModifyUserTypeForExistingUser_14(); - break; - case 15: - ChipLogProgress(chipTool, " ***** Test Step 15 : Read the modified user back and verify its fields\n"); - err = TestReadTheModifiedUserBackAndVerifyItsFields_15(); - break; - case 16: - ChipLogProgress(chipTool, " ***** Test Step 16 : Modify credentialRule for existing user\n"); - err = TestModifyCredentialRuleForExistingUser_16(); - break; - case 17: - ChipLogProgress(chipTool, " ***** Test Step 17 : Read the modified user back and verify its fields\n"); - err = TestReadTheModifiedUserBackAndVerifyItsFields_17(); - break; - case 18: - ChipLogProgress(chipTool, " ***** Test Step 18 : Modify all fields for existing user\n"); - err = TestModifyAllFieldsForExistingUser_18(); - break; - case 19: - ChipLogProgress(chipTool, " ***** Test Step 19 : Read the modified user back and verify its fields\n"); - err = TestReadTheModifiedUserBackAndVerifyItsFields_19(); - break; - case 20: - ChipLogProgress(chipTool, " ***** Test Step 20 : Add another user with non-default fields\n"); - err = TestAddAnotherUserWithNonDefaultFields_20(); - break; - case 21: - ChipLogProgress(chipTool, " ***** Test Step 21 : Read the new user back and verify its fields\n"); - err = TestReadTheNewUserBackAndVerifyItsFields_21(); - break; - case 22: - ChipLogProgress(chipTool, " ***** Test Step 22 : Create user in the last slot\n"); - err = TestCreateUserInTheLastSlot_22(); - break; - case 23: - ChipLogProgress(chipTool, " ***** Test Step 23 : Read the last user back and verify its fields\n"); - err = TestReadTheLastUserBackAndVerifyItsFields_23(); - break; - case 24: - ChipLogProgress(chipTool, " ***** Test Step 24 : User creation in the 0 slot fails\n"); - err = TestUserCreationInThe0SlotFails_24(); - break; - case 25: - ChipLogProgress(chipTool, " ***** Test Step 25 : User creation in the out-of-bounds slot fails\n"); - err = TestUserCreationInTheOutOfBoundsSlotFails_25(); - break; - case 26: - ChipLogProgress(chipTool, " ***** Test Step 26 : Clear first user\n"); - err = TestClearFirstUser_26(); - break; - case 27: - ChipLogProgress(chipTool, " ***** Test Step 27 : Read cleared user and verify it is available\n"); - err = TestReadClearedUserAndVerifyItIsAvailable_27(); - break; - case 28: - ChipLogProgress(chipTool, " ***** Test Step 28 : Create new user in the cleared slot\n"); - err = TestCreateNewUserInTheClearedSlot_28(); - break; - case 29: - ChipLogProgress(chipTool, " ***** Test Step 29 : Read the user in the previously cleared slot and verify its fields\n"); - err = TestReadTheUserInThePreviouslyClearedSlotAndVerifyItsFields_29(); - break; - case 30: - ChipLogProgress(chipTool, " ***** Test Step 30 : Clear user with index 0 fails\n"); - err = TestClearUserWithIndex0Fails_30(); - break; - case 31: - ChipLogProgress(chipTool, " ***** Test Step 31 : Clear user with out-of-bounds index fails\n"); - err = TestClearUserWithOutOfBoundsIndexFails_31(); - break; - case 32: - ChipLogProgress(chipTool, " ***** Test Step 32 : Clear all users\n"); - err = TestClearAllUsers_32(); - break; - case 33: - ChipLogProgress(chipTool, " ***** Test Step 33 : Read first cleared user and verify it is available\n"); - err = TestReadFirstClearedUserAndVerifyItIsAvailable_33(); - break; - case 34: - ChipLogProgress(chipTool, " ***** Test Step 34 : Read last cleared user and verify it is available\n"); - err = TestReadLastClearedUserAndVerifyItIsAvailable_34(); - break; - case 35: - ChipLogProgress(chipTool, " ***** Test Step 35 : Get number of supported PIN credentials and verify default value\n"); - err = TestGetNumberOfSupportedPinCredentialsAndVerifyDefaultValue_35(); - break; - case 36: - ChipLogProgress(chipTool, " ***** Test Step 36 : Check that PIN credential does not exist\n"); - err = TestCheckThatPinCredentialDoesNotExist_36(); - break; - case 37: - ChipLogProgress(chipTool, " ***** Test Step 37 : Reading PIN credential with index 0 fails\n"); - err = TestReadingPinCredentialWithIndex0Fails_37(); - break; - case 38: - ChipLogProgress(chipTool, " ***** Test Step 38 : Reading PIN credential with out-of-bounds index fails\n"); - err = TestReadingPinCredentialWithOutOfBoundsIndexFails_38(); - break; - case 39: - ChipLogProgress(chipTool, " ***** Test Step 39 : Create new PIN credential and user\n"); - err = TestCreateNewPinCredentialAndUser_39(); - break; - case 40: - ChipLogProgress(chipTool, " ***** Test Step 40 : Verify created user\n"); - err = TestVerifyCreatedUser_40(); - break; - case 41: - ChipLogProgress(chipTool, " ***** Test Step 41 : Verify created PIN credential\n"); - err = TestVerifyCreatedPinCredential_41(); - break; - case 42: - ChipLogProgress(chipTool, " ***** Test Step 42 : Create new PIN credential and user with index 0 fails\n"); - err = TestCreateNewPinCredentialAndUserWithIndex0Fails_42(); - break; - case 43: - ChipLogProgress(chipTool, " ***** Test Step 43 : Create new PIN credential and user with out-of-bounds index fails\n"); - err = TestCreateNewPinCredentialAndUserWithOutOfBoundsIndexFails_43(); - break; - case 44: - ChipLogProgress(chipTool, " ***** Test Step 44 : Get number of supported RFID credentials and verify default value\n"); - err = TestGetNumberOfSupportedRfidCredentialsAndVerifyDefaultValue_44(); - break; - case 45: - ChipLogProgress(chipTool, " ***** Test Step 45 : Reading RFID credential with index 0 fails\n"); - err = TestReadingRfidCredentialWithIndex0Fails_45(); - break; - case 46: - ChipLogProgress(chipTool, " ***** Test Step 46 : Reading RFID credential with out-of-bounds index fails\n"); - err = TestReadingRfidCredentialWithOutOfBoundsIndexFails_46(); - break; - case 47: - ChipLogProgress(chipTool, " ***** Test Step 47 : Check that RFID credential does not exist\n"); - err = TestCheckThatRfidCredentialDoesNotExist_47(); - break; - case 48: - ChipLogProgress(chipTool, " ***** Test Step 48 : Create new RFID credential and add it to existing user\n"); - err = TestCreateNewRfidCredentialAndAddItToExistingUser_48(); - break; - case 49: - ChipLogProgress(chipTool, " ***** Test Step 49 : Verify modified user\n"); - err = TestVerifyModifiedUser_49(); - break; - case 50: - ChipLogProgress(chipTool, " ***** Test Step 50 : Verify created credential\n"); - err = TestVerifyCreatedCredential_50(); - break; - case 51: - ChipLogProgress(chipTool, " ***** Test Step 51 : Create new RFID credential and user with index 0 fails\n"); - err = TestCreateNewRfidCredentialAndUserWithIndex0Fails_51(); - break; - case 52: - ChipLogProgress(chipTool, " ***** Test Step 52 : Create new RFID credential and user with out-of-bounds index fails\n"); - err = TestCreateNewRfidCredentialAndUserWithOutOfBoundsIndexFails_52(); - break; - case 53: - ChipLogProgress(chipTool, " ***** Test Step 53 : Create new PIN credential and try to add it to existing user\n"); - err = TestCreateNewPinCredentialAndTryToAddItToExistingUser_53(); - break; - case 54: - ChipLogProgress(chipTool, " ***** Test Step 54 : Create new credential and try to add it to 0 user\n"); - err = TestCreateNewCredentialAndTryToAddItTo0User_54(); - break; - case 55: - ChipLogProgress(chipTool, " ***** Test Step 55 : Create new credential and try to add it to out-of-bounds user\n"); - err = TestCreateNewCredentialAndTryToAddItToOutOfBoundsUser_55(); - break; - case 56: - ChipLogProgress(chipTool, " ***** Test Step 56 : Create new PIN with too short data\n"); - err = TestCreateNewPinWithTooShortData_56(); - break; - case 57: - ChipLogProgress(chipTool, " ***** Test Step 57 : Create new PIN with too long data\n"); - err = TestCreateNewPinWithTooLongData_57(); - break; - case 58: - ChipLogProgress(chipTool, " ***** Test Step 58 : Create new RFID with too short data\n"); - err = TestCreateNewRfidWithTooShortData_58(); - break; - case 59: - ChipLogProgress(chipTool, " ***** Test Step 59 : Create new PIN with Programming user type fails\n"); - err = TestCreateNewPinWithProgrammingUserTypeFails_59(); - break; - case 60: - ChipLogProgress(chipTool, " ***** Test Step 60 : Create new RFID with too short data\n"); - err = TestCreateNewRfidWithTooShortData_60(); - break; - case 61: - ChipLogProgress(chipTool, " ***** Test Step 61 : Create new PIN credential with data the would cause duplicate\n"); - err = TestCreateNewPinCredentialWithDataTheWouldCauseDuplicate_61(); - break; - case 62: - ChipLogProgress(chipTool, " ***** Test Step 62 : Create new RFID credential with data the would cause duplicate\n"); - err = TestCreateNewRfidCredentialWithDataTheWouldCauseDuplicate_62(); - break; - case 63: - ChipLogProgress(chipTool, " ***** Test Step 63 : Modify credentialData of existing PIN credential\n"); - err = TestModifyCredentialDataOfExistingPinCredential_63(); - break; - case 64: - ChipLogProgress(chipTool, - " ***** Test Step 64 : Verify that credential was changed by creating new credential with old data\n"); - err = TestVerifyThatCredentialWasChangedByCreatingNewCredentialWithOldData_64(); - break; - case 65: - ChipLogProgress(chipTool, - " ***** Test Step 65 : Verify that credential was changed by creating new credential with new data\n"); - err = TestVerifyThatCredentialWasChangedByCreatingNewCredentialWithNewData_65(); - break; - case 66: - ChipLogProgress(chipTool, " ***** Test Step 66 : Clear first PIN credential\n"); - err = TestClearFirstPinCredential_66(); - break; - case 67: - ChipLogProgress(chipTool, " ***** Test Step 67 : Read back the credential and make sure it is deleted\n"); - err = TestReadBackTheCredentialAndMakeSureItIsDeleted_67(); - break; - case 68: - ChipLogProgress(chipTool, " ***** Test Step 68 : Read the user back and make sure PIN credential is deleted\n"); - err = TestReadTheUserBackAndMakeSurePinCredentialIsDeleted_68(); - break; - case 69: - ChipLogProgress(chipTool, " ***** Test Step 69 : Clear the second PIN credential\n"); - err = TestClearTheSecondPinCredential_69(); - break; - case 70: - ChipLogProgress(chipTool, " ***** Test Step 70 : Read back the credential and make sure it is deleted\n"); - err = TestReadBackTheCredentialAndMakeSureItIsDeleted_70(); - break; - case 71: - ChipLogProgress(chipTool, " ***** Test Step 71 : Read the user back and make sure related user is deleted\n"); - err = TestReadTheUserBackAndMakeSureRelatedUserIsDeleted_71(); - break; - case 72: - ChipLogProgress(chipTool, " ***** Test Step 72 : Create new RFID credential with user\n"); - err = TestCreateNewRfidCredentialWithUser_72(); - break; - case 73: - ChipLogProgress(chipTool, " ***** Test Step 73 : Clear all the RFID credentials\n"); - err = TestClearAllTheRfidCredentials_73(); - break; - case 74: - ChipLogProgress(chipTool, " ***** Test Step 74 : Read back the fist RFID credential and make sure it is deleted\n"); - err = TestReadBackTheFistRfidCredentialAndMakeSureItIsDeleted_74(); - break; - case 75: - ChipLogProgress(chipTool, " ***** Test Step 75 : Read back the second RFID credential and make sure it is deleted\n"); - err = TestReadBackTheSecondRfidCredentialAndMakeSureItIsDeleted_75(); - break; - case 76: - ChipLogProgress(chipTool, - " ***** Test Step 76 : Read the user related with first RFID back and make sure it is deleted\n"); - err = TestReadTheUserRelatedWithFirstRfidBackAndMakeSureItIsDeleted_76(); - break; - case 77: - ChipLogProgress(chipTool, - " ***** Test Step 77 : Read the user related with second RFID back and make sure it is deleted\n"); - err = TestReadTheUserRelatedWithSecondRfidBackAndMakeSureItIsDeleted_77(); - break; - case 78: - ChipLogProgress(chipTool, " ***** Test Step 78 : Create new PIN credential with user\n"); - err = TestCreateNewPinCredentialWithUser_78(); - break; - case 79: - ChipLogProgress(chipTool, " ***** Test Step 79 : Create new RFID credential with user\n"); - err = TestCreateNewRfidCredentialWithUser_79(); - break; - case 80: - ChipLogProgress(chipTool, " ***** Test Step 80 : Create another RFID credential with user\n"); - err = TestCreateAnotherRfidCredentialWithUser_80(); - break; - case 81: - ChipLogProgress(chipTool, " ***** Test Step 81 : Clear all the credentials\n"); - err = TestClearAllTheCredentials_81(); - break; - case 82: - ChipLogProgress(chipTool, " ***** Test Step 82 : Read back the first PIN credential and make sure it is deleted\n"); - err = TestReadBackTheFirstPinCredentialAndMakeSureItIsDeleted_82(); - break; - case 83: - ChipLogProgress(chipTool, " ***** Test Step 83 : Read back the first RFID credential and make sure it is deleted\n"); - err = TestReadBackTheFirstRfidCredentialAndMakeSureItIsDeleted_83(); - break; - case 84: - ChipLogProgress(chipTool, " ***** Test Step 84 : Read back the second PIN credential and make sure it is deleted\n"); - err = TestReadBackTheSecondPinCredentialAndMakeSureItIsDeleted_84(); - break; - case 85: - ChipLogProgress(chipTool, - " ***** Test Step 85 : Read the user related with first PIN back and make sure it is deleted\n"); - err = TestReadTheUserRelatedWithFirstPinBackAndMakeSureItIsDeleted_85(); - break; - case 86: - ChipLogProgress(chipTool, - " ***** Test Step 86 : Read the user related with first RFID back and make sure it is deleted\n"); - err = TestReadTheUserRelatedWithFirstRfidBackAndMakeSureItIsDeleted_86(); - break; - case 87: - ChipLogProgress(chipTool, - " ***** Test Step 87 : Read the user related with second PIN back and make sure it is deleted\n"); - err = TestReadTheUserRelatedWithSecondPinBackAndMakeSureItIsDeleted_87(); - break; - case 88: - ChipLogProgress(chipTool, " ***** Test Step 88 : Create new Programming PIN credential with invalid index\n"); - err = TestCreateNewProgrammingPinCredentialWithInvalidIndex_88(); - break; - case 89: - ChipLogProgress(chipTool, " ***** Test Step 89 : Create new Programming PIN credential with valid index\n"); - err = TestCreateNewProgrammingPinCredentialWithValidIndex_89(); - break; - case 90: - ChipLogProgress(chipTool, " ***** Test Step 90 : Verify created user\n"); - err = TestVerifyCreatedUser_90(); - break; - case 91: - ChipLogProgress(chipTool, " ***** Test Step 91 : Verify created programming PIN credential\n"); - err = TestVerifyCreatedProgrammingPinCredential_91(); - break; - case 92: - ChipLogProgress(chipTool, " ***** Test Step 92 : Modify the Programming PIN credential\n"); - err = TestModifyTheProgrammingPinCredential_92(); - break; - case 93: - ChipLogProgress(chipTool, " ***** Test Step 93 : Clearing Programming PIN fails\n"); - err = TestClearingProgrammingPinFails_93(); - break; - case 94: - ChipLogProgress(chipTool, " ***** Test Step 94 : Clearing Programming PIN with invalid index fails\n"); - err = TestClearingProgrammingPinWithInvalidIndexFails_94(); - break; - case 95: - ChipLogProgress(chipTool, " ***** Test Step 95 : Clearing PIN credential with zero index fails\n"); - err = TestClearingPinCredentialWithZeroIndexFails_95(); - break; - case 96: - ChipLogProgress(chipTool, " ***** Test Step 96 : Clearing PIN credential with out-of-bound index fails\n"); - err = TestClearingPinCredentialWithOutOfBoundIndexFails_96(); - break; - case 97: - ChipLogProgress(chipTool, " ***** Test Step 97 : Clearing RFID credential with zero index fails\n"); - err = TestClearingRfidCredentialWithZeroIndexFails_97(); - break; - case 98: - ChipLogProgress(chipTool, " ***** Test Step 98 : Clearing RFID credential with out-of-bound index fails\n"); - err = TestClearingRfidCredentialWithOutOfBoundIndexFails_98(); - break; - case 99: - ChipLogProgress(chipTool, " ***** Test Step 99 : Clear the Programming PIN user\n"); - err = TestClearTheProgrammingPinUser_99(); - break; - case 100: - ChipLogProgress(chipTool, " ***** Test Step 100 : Make sure Programming PIN user is deleted\n"); - err = TestMakeSureProgrammingPinUserIsDeleted_100(); - break; - case 101: - ChipLogProgress(chipTool, " ***** Test Step 101 : Make sure programming PIN credential is deleted\n"); - err = TestMakeSureProgrammingPinCredentialIsDeleted_101(); - break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 102; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - uint16_t NumberOfTotalUsersSupported; - uint16_t NumberOfPINUsersSupported; - uint16_t NumberOfRFIDUsersSupported; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - static void OnFailureCallback_2(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_2(error); - } - - static void OnSuccessCallback_2(void * context, uint16_t numberOfTotalUsersSupported) - { - (static_cast(context))->OnSuccessResponse_2(numberOfTotalUsersSupported); - } - - static void OnFailureCallback_35(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_35(error); - } - - static void OnSuccessCallback_35(void * context, uint16_t numberOfPINUsersSupported) - { - (static_cast(context))->OnSuccessResponse_35(numberOfPINUsersSupported); - } - - static void OnFailureCallback_44(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_44(error); - } - - static void OnSuccessCallback_44(void * context, uint16_t numberOfRFIDUsersSupported) - { - (static_cast(context))->OnSuccessResponse_44(numberOfRFIDUsersSupported); - } - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestReadAvailableUserSlotAndVerifyResponseFields_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::GetUser::Type; - - RequestType request; - request.userIndex = 1U; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context)) - ->OnSuccessResponse_1(data.userIndex, data.userName, data.userUniqueId, data.userStatus, data.userType, - data.credentialRule, data.credentials, data.creatorFabricIndex, data.lastModifiedFabricIndex, - data.nextUserIndex); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_1(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_1( - uint16_t userIndex, const chip::app::DataModel::Nullable & userName, - const chip::app::DataModel::Nullable & userUniqueId, - const chip::app::DataModel::Nullable & userStatus, - const chip::app::DataModel::Nullable & userType, - const chip::app::DataModel::Nullable & credentialRule, - const chip::app::DataModel::Nullable< - chip::app::DataModel::DecodableList> & credentials, - const chip::app::DataModel::Nullable & creatorFabricIndex, - const chip::app::DataModel::Nullable & lastModifiedFabricIndex, - const chip::app::DataModel::Nullable & nextUserIndex) - { - VerifyOrReturn(CheckValue("userIndex", userIndex, 1U)); - - VerifyOrReturn(CheckValueNull("userName", userName)); - - VerifyOrReturn(CheckValueNull("userUniqueId", userUniqueId)); - - VerifyOrReturn(CheckValueNull("userStatus", userStatus)); - - VerifyOrReturn(CheckValueNull("userType", userType)); - - VerifyOrReturn(CheckValueNull("credentialRule", credentialRule)); - - VerifyOrReturn(CheckValueNull("credentials", credentials)); - - VerifyOrReturn(CheckValueNull("creatorFabricIndex", creatorFabricIndex)); - - VerifyOrReturn(CheckValueNull("lastModifiedFabricIndex", lastModifiedFabricIndex)); - - VerifyOrReturn(CheckValueNonNull("nextUserIndex", nextUserIndex)); - VerifyOrReturn(CheckValue("nextUserIndex.Value()", nextUserIndex.Value(), 2U)); - - NextTest(); - } - - CHIP_ERROR TestGetNumberOfSupportedUsersAndVerifyDefaultValue_2() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::DoorLockClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_2, OnFailureCallback_2, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_2(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_2(uint16_t numberOfTotalUsersSupported) - { - VerifyOrReturn(CheckValue("numberOfTotalUsersSupported", numberOfTotalUsersSupported, 10U)); - - NumberOfTotalUsersSupported = numberOfTotalUsersSupported; - NextTest(); - } - - CHIP_ERROR TestReadFailsForUserWithIndex0_3() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::GetUser::Type; - - RequestType request; - request.userIndex = 0U; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context)) - ->OnSuccessResponse_3(data.userIndex, data.userName, data.userUniqueId, data.userStatus, data.userType, - data.credentialRule, data.credentials, data.creatorFabricIndex, data.lastModifiedFabricIndex, - data.nextUserIndex); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_3(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_3(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_COMMAND)); - NextTest(); - } - - void OnSuccessResponse_3( - uint16_t userIndex, const chip::app::DataModel::Nullable & userName, - const chip::app::DataModel::Nullable & userUniqueId, - const chip::app::DataModel::Nullable & userStatus, - const chip::app::DataModel::Nullable & userType, - const chip::app::DataModel::Nullable & credentialRule, - const chip::app::DataModel::Nullable< - chip::app::DataModel::DecodableList> & credentials, - const chip::app::DataModel::Nullable & creatorFabricIndex, - const chip::app::DataModel::Nullable & lastModifiedFabricIndex, - const chip::app::DataModel::Nullable & nextUserIndex) - { - ThrowSuccessResponse(); - } - - CHIP_ERROR TestReadFailsForUserWithIndexGreaterThanNumberOfUsersSupported_4() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::GetUser::Type; - - RequestType request; - request.userIndex = static_cast(NumberOfTotalUsersSupported + 1); - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context)) - ->OnSuccessResponse_4(data.userIndex, data.userName, data.userUniqueId, data.userStatus, data.userType, - data.credentialRule, data.credentials, data.creatorFabricIndex, data.lastModifiedFabricIndex, - data.nextUserIndex); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_4(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_4(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_COMMAND)); - NextTest(); - } - - void OnSuccessResponse_4( - uint16_t userIndex, const chip::app::DataModel::Nullable & userName, - const chip::app::DataModel::Nullable & userUniqueId, - const chip::app::DataModel::Nullable & userStatus, - const chip::app::DataModel::Nullable & userType, - const chip::app::DataModel::Nullable & credentialRule, - const chip::app::DataModel::Nullable< - chip::app::DataModel::DecodableList> & credentials, - const chip::app::DataModel::Nullable & creatorFabricIndex, - const chip::app::DataModel::Nullable & lastModifiedFabricIndex, - const chip::app::DataModel::Nullable & nextUserIndex) - { - ThrowSuccessResponse(); - } - - CHIP_ERROR TestCreateNewUserWithDefaultParameters_5() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::SetUser::Type; - - RequestType request; - request.operationType = static_cast(0); - request.userIndex = 1U; - request.userName.SetNull(); - request.userUniqueId.SetNull(); - request.userStatus.SetNull(); - request.userType.SetNull(); - request.credentialRule.SetNull(); - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_5(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_5(error); - }; - - ReturnErrorOnFailure( - chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request, 10000)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_5(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_5() { NextTest(); } - - CHIP_ERROR TestReadTheUserBackAndVerifyItsFields_6() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::GetUser::Type; - - RequestType request; - request.userIndex = 1U; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context)) - ->OnSuccessResponse_6(data.userIndex, data.userName, data.userUniqueId, data.userStatus, data.userType, - data.credentialRule, data.credentials, data.creatorFabricIndex, data.lastModifiedFabricIndex, - data.nextUserIndex); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_6(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_6(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_6( - uint16_t userIndex, const chip::app::DataModel::Nullable & userName, - const chip::app::DataModel::Nullable & userUniqueId, - const chip::app::DataModel::Nullable & userStatus, - const chip::app::DataModel::Nullable & userType, - const chip::app::DataModel::Nullable & credentialRule, - const chip::app::DataModel::Nullable< - chip::app::DataModel::DecodableList> & credentials, - const chip::app::DataModel::Nullable & creatorFabricIndex, - const chip::app::DataModel::Nullable & lastModifiedFabricIndex, - const chip::app::DataModel::Nullable & nextUserIndex) - { - VerifyOrReturn(CheckValue("userIndex", userIndex, 1U)); - - VerifyOrReturn(CheckValueNonNull("userName", userName)); - VerifyOrReturn(CheckValueAsString("userName.Value()", userName.Value(), chip::CharSpan("", 0))); - - VerifyOrReturn(CheckValueNull("userUniqueId", userUniqueId)); - - VerifyOrReturn(CheckValueNonNull("userStatus", userStatus)); - VerifyOrReturn(CheckValue("userStatus.Value()", userStatus.Value(), 1)); - - VerifyOrReturn(CheckValueNonNull("userType", userType)); - VerifyOrReturn(CheckValue("userType.Value()", userType.Value(), 0)); - - VerifyOrReturn(CheckValueNonNull("credentialRule", credentialRule)); - VerifyOrReturn(CheckValue("credentialRule.Value()", credentialRule.Value(), 0)); - - VerifyOrReturn(CheckValueNull("credentials", credentials)); - - VerifyOrReturn(CheckValueNonNull("creatorFabricIndex", creatorFabricIndex)); - VerifyOrReturn(CheckValue("creatorFabricIndex.Value()", creatorFabricIndex.Value(), 1)); - - VerifyOrReturn(CheckValueNonNull("lastModifiedFabricIndex", lastModifiedFabricIndex)); - VerifyOrReturn(CheckValue("lastModifiedFabricIndex.Value()", lastModifiedFabricIndex.Value(), 1)); - - VerifyOrReturn(CheckValueNonNull("nextUserIndex", nextUserIndex)); - VerifyOrReturn(CheckValue("nextUserIndex.Value()", nextUserIndex.Value(), 2U)); - - NextTest(); - } - - CHIP_ERROR TestSetUserAtTheOccupiedIndexFailsWithAppropriateResponse_7() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::SetUser::Type; - - RequestType request; - request.operationType = static_cast(0); - request.userIndex = 1U; - request.userName.SetNull(); - request.userUniqueId.SetNull(); - request.userStatus.SetNull(); - request.userType.SetNull(); - request.credentialRule.SetNull(); - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_7(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_7(error); - }; - - ReturnErrorOnFailure( - chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request, 10000)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_7(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 1)); - NextTest(); - } - - void OnSuccessResponse_7() { ThrowSuccessResponse(); } - - CHIP_ERROR TestModifyUserNameForExistingUser_8() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::SetUser::Type; - - RequestType request; - request.operationType = static_cast(2); - request.userIndex = 1U; - request.userName.SetNonNull(); - request.userName.Value() = chip::Span("new_usergarbage: not in length on purpose", 8); - request.userUniqueId.SetNull(); - request.userStatus.SetNull(); - request.userType.SetNull(); - request.credentialRule.SetNull(); - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_8(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_8(error); - }; - - ReturnErrorOnFailure( - chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request, 10000)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_8(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_8() { NextTest(); } - - CHIP_ERROR TestReadTheModifiedUserBackAndVerifyItsFields_9() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::GetUser::Type; - - RequestType request; - request.userIndex = 1U; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context)) - ->OnSuccessResponse_9(data.userIndex, data.userName, data.userUniqueId, data.userStatus, data.userType, - data.credentialRule, data.credentials, data.creatorFabricIndex, data.lastModifiedFabricIndex, - data.nextUserIndex); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_9(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_9(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_9( - uint16_t userIndex, const chip::app::DataModel::Nullable & userName, - const chip::app::DataModel::Nullable & userUniqueId, - const chip::app::DataModel::Nullable & userStatus, - const chip::app::DataModel::Nullable & userType, - const chip::app::DataModel::Nullable & credentialRule, - const chip::app::DataModel::Nullable< - chip::app::DataModel::DecodableList> & credentials, - const chip::app::DataModel::Nullable & creatorFabricIndex, - const chip::app::DataModel::Nullable & lastModifiedFabricIndex, - const chip::app::DataModel::Nullable & nextUserIndex) - { - VerifyOrReturn(CheckValue("userIndex", userIndex, 1U)); - - VerifyOrReturn(CheckValueNonNull("userName", userName)); - VerifyOrReturn(CheckValueAsString("userName.Value()", userName.Value(), chip::CharSpan("new_user", 8))); - - VerifyOrReturn(CheckValueNull("userUniqueId", userUniqueId)); - - VerifyOrReturn(CheckValueNonNull("userStatus", userStatus)); - VerifyOrReturn(CheckValue("userStatus.Value()", userStatus.Value(), 1)); - - VerifyOrReturn(CheckValueNonNull("userType", userType)); - VerifyOrReturn(CheckValue("userType.Value()", userType.Value(), 0)); - - VerifyOrReturn(CheckValueNonNull("credentialRule", credentialRule)); - VerifyOrReturn(CheckValue("credentialRule.Value()", credentialRule.Value(), 0)); - - VerifyOrReturn(CheckValueNull("credentials", credentials)); - - VerifyOrReturn(CheckValueNonNull("creatorFabricIndex", creatorFabricIndex)); - VerifyOrReturn(CheckValue("creatorFabricIndex.Value()", creatorFabricIndex.Value(), 1)); - - VerifyOrReturn(CheckValueNonNull("lastModifiedFabricIndex", lastModifiedFabricIndex)); - VerifyOrReturn(CheckValue("lastModifiedFabricIndex.Value()", lastModifiedFabricIndex.Value(), 1)); - - VerifyOrReturn(CheckValueNonNull("nextUserIndex", nextUserIndex)); - VerifyOrReturn(CheckValue("nextUserIndex.Value()", nextUserIndex.Value(), 2U)); - - NextTest(); - } - - CHIP_ERROR TestModifyUserUniqueIdForExistingUser_10() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::SetUser::Type; - - RequestType request; - request.operationType = static_cast(2); - request.userIndex = 1U; - request.userName.SetNull(); - request.userUniqueId.SetNonNull(); - request.userUniqueId.Value() = 305441741UL; - request.userStatus.SetNull(); - request.userType.SetNull(); - request.credentialRule.SetNull(); - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_10(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_10(error); - }; - - ReturnErrorOnFailure( - chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request, 10000)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_10(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_10() { NextTest(); } - - CHIP_ERROR TestReadTheModifiedUserBackAndVerifyItsFields_11() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::GetUser::Type; - - RequestType request; - request.userIndex = 1U; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context)) - ->OnSuccessResponse_11(data.userIndex, data.userName, data.userUniqueId, data.userStatus, data.userType, - data.credentialRule, data.credentials, data.creatorFabricIndex, data.lastModifiedFabricIndex, - data.nextUserIndex); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_11(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_11(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_11( - uint16_t userIndex, const chip::app::DataModel::Nullable & userName, - const chip::app::DataModel::Nullable & userUniqueId, - const chip::app::DataModel::Nullable & userStatus, - const chip::app::DataModel::Nullable & userType, - const chip::app::DataModel::Nullable & credentialRule, - const chip::app::DataModel::Nullable< - chip::app::DataModel::DecodableList> & credentials, - const chip::app::DataModel::Nullable & creatorFabricIndex, - const chip::app::DataModel::Nullable & lastModifiedFabricIndex, - const chip::app::DataModel::Nullable & nextUserIndex) - { - VerifyOrReturn(CheckValue("userIndex", userIndex, 1U)); - - VerifyOrReturn(CheckValueNonNull("userName", userName)); - VerifyOrReturn(CheckValueAsString("userName.Value()", userName.Value(), chip::CharSpan("new_user", 8))); - - VerifyOrReturn(CheckValueNonNull("userUniqueId", userUniqueId)); - VerifyOrReturn(CheckValue("userUniqueId.Value()", userUniqueId.Value(), 305441741UL)); - - VerifyOrReturn(CheckValueNonNull("userStatus", userStatus)); - VerifyOrReturn(CheckValue("userStatus.Value()", userStatus.Value(), 1)); - - VerifyOrReturn(CheckValueNonNull("userType", userType)); - VerifyOrReturn(CheckValue("userType.Value()", userType.Value(), 0)); - - VerifyOrReturn(CheckValueNonNull("credentialRule", credentialRule)); - VerifyOrReturn(CheckValue("credentialRule.Value()", credentialRule.Value(), 0)); - - VerifyOrReturn(CheckValueNull("credentials", credentials)); - - VerifyOrReturn(CheckValueNonNull("creatorFabricIndex", creatorFabricIndex)); - VerifyOrReturn(CheckValue("creatorFabricIndex.Value()", creatorFabricIndex.Value(), 1)); - - VerifyOrReturn(CheckValueNonNull("lastModifiedFabricIndex", lastModifiedFabricIndex)); - VerifyOrReturn(CheckValue("lastModifiedFabricIndex.Value()", lastModifiedFabricIndex.Value(), 1)); - - VerifyOrReturn(CheckValueNonNull("nextUserIndex", nextUserIndex)); - VerifyOrReturn(CheckValue("nextUserIndex.Value()", nextUserIndex.Value(), 2U)); - - NextTest(); - } - - CHIP_ERROR TestModifyUserStatusForExistingUser_12() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::SetUser::Type; - - RequestType request; - request.operationType = static_cast(2); - request.userIndex = 1U; - request.userName.SetNull(); - request.userUniqueId.SetNull(); - request.userStatus.SetNonNull(); - request.userStatus.Value() = static_cast(3); - request.userType.SetNull(); - request.credentialRule.SetNull(); - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_12(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_12(error); - }; - - ReturnErrorOnFailure( - chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request, 10000)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_12(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_12() { NextTest(); } - - CHIP_ERROR TestReadTheModifiedUserBackAndVerifyItsFields_13() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::GetUser::Type; - - RequestType request; - request.userIndex = 1U; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context)) - ->OnSuccessResponse_13(data.userIndex, data.userName, data.userUniqueId, data.userStatus, data.userType, - data.credentialRule, data.credentials, data.creatorFabricIndex, data.lastModifiedFabricIndex, - data.nextUserIndex); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_13(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_13(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_13( - uint16_t userIndex, const chip::app::DataModel::Nullable & userName, - const chip::app::DataModel::Nullable & userUniqueId, - const chip::app::DataModel::Nullable & userStatus, - const chip::app::DataModel::Nullable & userType, - const chip::app::DataModel::Nullable & credentialRule, - const chip::app::DataModel::Nullable< - chip::app::DataModel::DecodableList> & credentials, - const chip::app::DataModel::Nullable & creatorFabricIndex, - const chip::app::DataModel::Nullable & lastModifiedFabricIndex, - const chip::app::DataModel::Nullable & nextUserIndex) - { - VerifyOrReturn(CheckValue("userIndex", userIndex, 1U)); - - VerifyOrReturn(CheckValueNonNull("userName", userName)); - VerifyOrReturn(CheckValueAsString("userName.Value()", userName.Value(), chip::CharSpan("new_user", 8))); - - VerifyOrReturn(CheckValueNonNull("userUniqueId", userUniqueId)); - VerifyOrReturn(CheckValue("userUniqueId.Value()", userUniqueId.Value(), 305441741UL)); - - VerifyOrReturn(CheckValueNonNull("userStatus", userStatus)); - VerifyOrReturn(CheckValue("userStatus.Value()", userStatus.Value(), 3)); - - VerifyOrReturn(CheckValueNonNull("userType", userType)); - VerifyOrReturn(CheckValue("userType.Value()", userType.Value(), 0)); - - VerifyOrReturn(CheckValueNonNull("credentialRule", credentialRule)); - VerifyOrReturn(CheckValue("credentialRule.Value()", credentialRule.Value(), 0)); - - VerifyOrReturn(CheckValueNull("credentials", credentials)); - - VerifyOrReturn(CheckValueNonNull("creatorFabricIndex", creatorFabricIndex)); - VerifyOrReturn(CheckValue("creatorFabricIndex.Value()", creatorFabricIndex.Value(), 1)); - - VerifyOrReturn(CheckValueNonNull("lastModifiedFabricIndex", lastModifiedFabricIndex)); - VerifyOrReturn(CheckValue("lastModifiedFabricIndex.Value()", lastModifiedFabricIndex.Value(), 1)); - - VerifyOrReturn(CheckValueNonNull("nextUserIndex", nextUserIndex)); - VerifyOrReturn(CheckValue("nextUserIndex.Value()", nextUserIndex.Value(), 2U)); - - NextTest(); - } - - CHIP_ERROR TestModifyUserTypeForExistingUser_14() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::SetUser::Type; - - RequestType request; - request.operationType = static_cast(2); - request.userIndex = 1U; - request.userName.SetNull(); - request.userUniqueId.SetNull(); - request.userStatus.SetNull(); - request.userType.SetNonNull(); - request.userType.Value() = static_cast(6); - request.credentialRule.SetNull(); - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_14(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_14(error); - }; - - ReturnErrorOnFailure( - chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request, 10000)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_14(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_14() { NextTest(); } - - CHIP_ERROR TestReadTheModifiedUserBackAndVerifyItsFields_15() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::GetUser::Type; - - RequestType request; - request.userIndex = 1U; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context)) - ->OnSuccessResponse_15(data.userIndex, data.userName, data.userUniqueId, data.userStatus, data.userType, - data.credentialRule, data.credentials, data.creatorFabricIndex, data.lastModifiedFabricIndex, - data.nextUserIndex); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_15(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_15(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_15( - uint16_t userIndex, const chip::app::DataModel::Nullable & userName, - const chip::app::DataModel::Nullable & userUniqueId, - const chip::app::DataModel::Nullable & userStatus, - const chip::app::DataModel::Nullable & userType, - const chip::app::DataModel::Nullable & credentialRule, - const chip::app::DataModel::Nullable< - chip::app::DataModel::DecodableList> & credentials, - const chip::app::DataModel::Nullable & creatorFabricIndex, - const chip::app::DataModel::Nullable & lastModifiedFabricIndex, - const chip::app::DataModel::Nullable & nextUserIndex) - { - VerifyOrReturn(CheckValue("userIndex", userIndex, 1U)); - - VerifyOrReturn(CheckValueNonNull("userName", userName)); - VerifyOrReturn(CheckValueAsString("userName.Value()", userName.Value(), chip::CharSpan("new_user", 8))); - - VerifyOrReturn(CheckValueNonNull("userUniqueId", userUniqueId)); - VerifyOrReturn(CheckValue("userUniqueId.Value()", userUniqueId.Value(), 305441741UL)); - - VerifyOrReturn(CheckValueNonNull("userStatus", userStatus)); - VerifyOrReturn(CheckValue("userStatus.Value()", userStatus.Value(), 3)); - - VerifyOrReturn(CheckValueNonNull("userType", userType)); - VerifyOrReturn(CheckValue("userType.Value()", userType.Value(), 6)); - - VerifyOrReturn(CheckValueNonNull("credentialRule", credentialRule)); - VerifyOrReturn(CheckValue("credentialRule.Value()", credentialRule.Value(), 0)); - - VerifyOrReturn(CheckValueNull("credentials", credentials)); - - VerifyOrReturn(CheckValueNonNull("creatorFabricIndex", creatorFabricIndex)); - VerifyOrReturn(CheckValue("creatorFabricIndex.Value()", creatorFabricIndex.Value(), 1)); - - VerifyOrReturn(CheckValueNonNull("lastModifiedFabricIndex", lastModifiedFabricIndex)); - VerifyOrReturn(CheckValue("lastModifiedFabricIndex.Value()", lastModifiedFabricIndex.Value(), 1)); - - VerifyOrReturn(CheckValueNonNull("nextUserIndex", nextUserIndex)); - VerifyOrReturn(CheckValue("nextUserIndex.Value()", nextUserIndex.Value(), 2U)); - - NextTest(); - } - - CHIP_ERROR TestModifyCredentialRuleForExistingUser_16() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::SetUser::Type; - - RequestType request; - request.operationType = static_cast(2); - request.userIndex = 1U; - request.userName.SetNull(); - request.userUniqueId.SetNull(); - request.userStatus.SetNull(); - request.userType.SetNull(); - request.credentialRule.SetNonNull(); - request.credentialRule.Value() = static_cast(2); - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_16(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_16(error); - }; - - ReturnErrorOnFailure( - chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request, 10000)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_16(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_16() { NextTest(); } - - CHIP_ERROR TestReadTheModifiedUserBackAndVerifyItsFields_17() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::GetUser::Type; - - RequestType request; - request.userIndex = 1U; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context)) - ->OnSuccessResponse_17(data.userIndex, data.userName, data.userUniqueId, data.userStatus, data.userType, - data.credentialRule, data.credentials, data.creatorFabricIndex, data.lastModifiedFabricIndex, - data.nextUserIndex); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_17(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_17(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_17( - uint16_t userIndex, const chip::app::DataModel::Nullable & userName, - const chip::app::DataModel::Nullable & userUniqueId, - const chip::app::DataModel::Nullable & userStatus, - const chip::app::DataModel::Nullable & userType, - const chip::app::DataModel::Nullable & credentialRule, - const chip::app::DataModel::Nullable< - chip::app::DataModel::DecodableList> & credentials, - const chip::app::DataModel::Nullable & creatorFabricIndex, - const chip::app::DataModel::Nullable & lastModifiedFabricIndex, - const chip::app::DataModel::Nullable & nextUserIndex) - { - VerifyOrReturn(CheckValue("userIndex", userIndex, 1U)); - - VerifyOrReturn(CheckValueNonNull("userName", userName)); - VerifyOrReturn(CheckValueAsString("userName.Value()", userName.Value(), chip::CharSpan("new_user", 8))); - - VerifyOrReturn(CheckValueNonNull("userUniqueId", userUniqueId)); - VerifyOrReturn(CheckValue("userUniqueId.Value()", userUniqueId.Value(), 305441741UL)); - - VerifyOrReturn(CheckValueNonNull("userStatus", userStatus)); - VerifyOrReturn(CheckValue("userStatus.Value()", userStatus.Value(), 3)); - - VerifyOrReturn(CheckValueNonNull("userType", userType)); - VerifyOrReturn(CheckValue("userType.Value()", userType.Value(), 6)); - - VerifyOrReturn(CheckValueNonNull("credentialRule", credentialRule)); - VerifyOrReturn(CheckValue("credentialRule.Value()", credentialRule.Value(), 2)); - - VerifyOrReturn(CheckValueNull("credentials", credentials)); - - VerifyOrReturn(CheckValueNonNull("creatorFabricIndex", creatorFabricIndex)); - VerifyOrReturn(CheckValue("creatorFabricIndex.Value()", creatorFabricIndex.Value(), 1)); - - VerifyOrReturn(CheckValueNonNull("lastModifiedFabricIndex", lastModifiedFabricIndex)); - VerifyOrReturn(CheckValue("lastModifiedFabricIndex.Value()", lastModifiedFabricIndex.Value(), 1)); - - VerifyOrReturn(CheckValueNonNull("nextUserIndex", nextUserIndex)); - VerifyOrReturn(CheckValue("nextUserIndex.Value()", nextUserIndex.Value(), 2U)); - - NextTest(); - } - - CHIP_ERROR TestModifyAllFieldsForExistingUser_18() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::SetUser::Type; - - RequestType request; - request.operationType = static_cast(2); - request.userIndex = 1U; - request.userName.SetNonNull(); - request.userName.Value() = chip::Span("test_usergarbage: not in length on purpose", 9); - request.userUniqueId.SetNonNull(); - request.userUniqueId.Value() = 466460832UL; - request.userStatus.SetNonNull(); - request.userStatus.Value() = static_cast(1); - request.userType.SetNonNull(); - request.userType.Value() = static_cast(0); - request.credentialRule.SetNonNull(); - request.credentialRule.Value() = static_cast(1); - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_18(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_18(error); - }; - - ReturnErrorOnFailure( - chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request, 10000)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_18(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_18() { NextTest(); } - - CHIP_ERROR TestReadTheModifiedUserBackAndVerifyItsFields_19() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::GetUser::Type; - - RequestType request; - request.userIndex = 1U; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context)) - ->OnSuccessResponse_19(data.userIndex, data.userName, data.userUniqueId, data.userStatus, data.userType, - data.credentialRule, data.credentials, data.creatorFabricIndex, data.lastModifiedFabricIndex, - data.nextUserIndex); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_19(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_19(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_19( - uint16_t userIndex, const chip::app::DataModel::Nullable & userName, - const chip::app::DataModel::Nullable & userUniqueId, - const chip::app::DataModel::Nullable & userStatus, - const chip::app::DataModel::Nullable & userType, - const chip::app::DataModel::Nullable & credentialRule, - const chip::app::DataModel::Nullable< - chip::app::DataModel::DecodableList> & credentials, - const chip::app::DataModel::Nullable & creatorFabricIndex, - const chip::app::DataModel::Nullable & lastModifiedFabricIndex, - const chip::app::DataModel::Nullable & nextUserIndex) - { - VerifyOrReturn(CheckValue("userIndex", userIndex, 1U)); - - VerifyOrReturn(CheckValueNonNull("userName", userName)); - VerifyOrReturn(CheckValueAsString("userName.Value()", userName.Value(), chip::CharSpan("test_user", 9))); - - VerifyOrReturn(CheckValueNonNull("userUniqueId", userUniqueId)); - VerifyOrReturn(CheckValue("userUniqueId.Value()", userUniqueId.Value(), 466460832UL)); - - VerifyOrReturn(CheckValueNonNull("userStatus", userStatus)); - VerifyOrReturn(CheckValue("userStatus.Value()", userStatus.Value(), 1)); - - VerifyOrReturn(CheckValueNonNull("userType", userType)); - VerifyOrReturn(CheckValue("userType.Value()", userType.Value(), 0)); - - VerifyOrReturn(CheckValueNonNull("credentialRule", credentialRule)); - VerifyOrReturn(CheckValue("credentialRule.Value()", credentialRule.Value(), 1)); - - VerifyOrReturn(CheckValueNull("credentials", credentials)); - - VerifyOrReturn(CheckValueNonNull("creatorFabricIndex", creatorFabricIndex)); - VerifyOrReturn(CheckValue("creatorFabricIndex.Value()", creatorFabricIndex.Value(), 1)); - - VerifyOrReturn(CheckValueNonNull("lastModifiedFabricIndex", lastModifiedFabricIndex)); - VerifyOrReturn(CheckValue("lastModifiedFabricIndex.Value()", lastModifiedFabricIndex.Value(), 1)); - - VerifyOrReturn(CheckValueNonNull("nextUserIndex", nextUserIndex)); - VerifyOrReturn(CheckValue("nextUserIndex.Value()", nextUserIndex.Value(), 2U)); - - NextTest(); - } - - CHIP_ERROR TestAddAnotherUserWithNonDefaultFields_20() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::SetUser::Type; - - RequestType request; - request.operationType = static_cast(0); - request.userIndex = 2U; - request.userName.SetNonNull(); - request.userName.Value() = chip::Span("test_user2garbage: not in length on purpose", 10); - request.userUniqueId.SetNonNull(); - request.userUniqueId.Value() = 12648430UL; - request.userStatus.SetNonNull(); - request.userStatus.Value() = static_cast(1); - request.userType.SetNonNull(); - request.userType.Value() = static_cast(1); - request.credentialRule.SetNonNull(); - request.credentialRule.Value() = static_cast(2); - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_20(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_20(error); - }; - - ReturnErrorOnFailure( - chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request, 10000)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_20(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_20() { NextTest(); } - - CHIP_ERROR TestReadTheNewUserBackAndVerifyItsFields_21() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::GetUser::Type; - - RequestType request; - request.userIndex = 2U; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context)) - ->OnSuccessResponse_21(data.userIndex, data.userName, data.userUniqueId, data.userStatus, data.userType, - data.credentialRule, data.credentials, data.creatorFabricIndex, data.lastModifiedFabricIndex, - data.nextUserIndex); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_21(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_21(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_21( - uint16_t userIndex, const chip::app::DataModel::Nullable & userName, - const chip::app::DataModel::Nullable & userUniqueId, - const chip::app::DataModel::Nullable & userStatus, - const chip::app::DataModel::Nullable & userType, - const chip::app::DataModel::Nullable & credentialRule, - const chip::app::DataModel::Nullable< - chip::app::DataModel::DecodableList> & credentials, - const chip::app::DataModel::Nullable & creatorFabricIndex, - const chip::app::DataModel::Nullable & lastModifiedFabricIndex, - const chip::app::DataModel::Nullable & nextUserIndex) - { - VerifyOrReturn(CheckValue("userIndex", userIndex, 2U)); - - VerifyOrReturn(CheckValueNonNull("userName", userName)); - VerifyOrReturn(CheckValueAsString("userName.Value()", userName.Value(), chip::CharSpan("test_user2", 10))); - - VerifyOrReturn(CheckValueNonNull("userUniqueId", userUniqueId)); - VerifyOrReturn(CheckValue("userUniqueId.Value()", userUniqueId.Value(), 12648430UL)); - - VerifyOrReturn(CheckValueNonNull("userStatus", userStatus)); - VerifyOrReturn(CheckValue("userStatus.Value()", userStatus.Value(), 1)); - - VerifyOrReturn(CheckValueNonNull("userType", userType)); - VerifyOrReturn(CheckValue("userType.Value()", userType.Value(), 1)); - - VerifyOrReturn(CheckValueNonNull("credentialRule", credentialRule)); - VerifyOrReturn(CheckValue("credentialRule.Value()", credentialRule.Value(), 2)); - - VerifyOrReturn(CheckValueNull("credentials", credentials)); - - VerifyOrReturn(CheckValueNonNull("creatorFabricIndex", creatorFabricIndex)); - VerifyOrReturn(CheckValue("creatorFabricIndex.Value()", creatorFabricIndex.Value(), 1)); - - VerifyOrReturn(CheckValueNonNull("lastModifiedFabricIndex", lastModifiedFabricIndex)); - VerifyOrReturn(CheckValue("lastModifiedFabricIndex.Value()", lastModifiedFabricIndex.Value(), 1)); - - VerifyOrReturn(CheckValueNonNull("nextUserIndex", nextUserIndex)); - VerifyOrReturn(CheckValue("nextUserIndex.Value()", nextUserIndex.Value(), 3U)); - - NextTest(); - } - - CHIP_ERROR TestCreateUserInTheLastSlot_22() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::SetUser::Type; - - RequestType request; - request.operationType = static_cast(0); - request.userIndex = NumberOfTotalUsersSupported; - request.userName.SetNonNull(); - request.userName.Value() = chip::Span("last_usergarbage: not in length on purpose", 9); - request.userUniqueId.SetNull(); - request.userStatus.SetNull(); - request.userType.SetNull(); - request.credentialRule.SetNull(); - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_22(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_22(error); - }; - - ReturnErrorOnFailure( - chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request, 10000)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_22(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_22() { NextTest(); } - - CHIP_ERROR TestReadTheLastUserBackAndVerifyItsFields_23() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::GetUser::Type; - - RequestType request; - request.userIndex = NumberOfTotalUsersSupported; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context)) - ->OnSuccessResponse_23(data.userIndex, data.userName, data.userUniqueId, data.userStatus, data.userType, - data.credentialRule, data.credentials, data.creatorFabricIndex, data.lastModifiedFabricIndex, - data.nextUserIndex); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_23(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_23(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_23( - uint16_t userIndex, const chip::app::DataModel::Nullable & userName, - const chip::app::DataModel::Nullable & userUniqueId, - const chip::app::DataModel::Nullable & userStatus, - const chip::app::DataModel::Nullable & userType, - const chip::app::DataModel::Nullable & credentialRule, - const chip::app::DataModel::Nullable< - chip::app::DataModel::DecodableList> & credentials, - const chip::app::DataModel::Nullable & creatorFabricIndex, - const chip::app::DataModel::Nullable & lastModifiedFabricIndex, - const chip::app::DataModel::Nullable & nextUserIndex) - { - VerifyOrReturn(CheckValue("userIndex", userIndex, NumberOfTotalUsersSupported)); - - VerifyOrReturn(CheckValueNonNull("userName", userName)); - VerifyOrReturn(CheckValueAsString("userName.Value()", userName.Value(), chip::CharSpan("last_user", 9))); - - VerifyOrReturn(CheckValueNull("userUniqueId", userUniqueId)); - - VerifyOrReturn(CheckValueNonNull("userStatus", userStatus)); - VerifyOrReturn(CheckValue("userStatus.Value()", userStatus.Value(), 1)); - - VerifyOrReturn(CheckValueNonNull("userType", userType)); - VerifyOrReturn(CheckValue("userType.Value()", userType.Value(), 0)); - - VerifyOrReturn(CheckValueNonNull("credentialRule", credentialRule)); - VerifyOrReturn(CheckValue("credentialRule.Value()", credentialRule.Value(), 0)); - - VerifyOrReturn(CheckValueNull("credentials", credentials)); - - VerifyOrReturn(CheckValueNonNull("creatorFabricIndex", creatorFabricIndex)); - VerifyOrReturn(CheckValue("creatorFabricIndex.Value()", creatorFabricIndex.Value(), 1)); - - VerifyOrReturn(CheckValueNonNull("lastModifiedFabricIndex", lastModifiedFabricIndex)); - VerifyOrReturn(CheckValue("lastModifiedFabricIndex.Value()", lastModifiedFabricIndex.Value(), 1)); - - VerifyOrReturn(CheckValueNull("nextUserIndex", nextUserIndex)); - - NextTest(); - } - - CHIP_ERROR TestUserCreationInThe0SlotFails_24() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::SetUser::Type; - - RequestType request; - request.operationType = static_cast(0); - request.userIndex = 0U; - request.userName.SetNull(); - request.userUniqueId.SetNull(); - request.userStatus.SetNull(); - request.userType.SetNull(); - request.credentialRule.SetNull(); - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_24(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_24(error); - }; - - ReturnErrorOnFailure( - chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request, 10000)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_24(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_COMMAND)); - NextTest(); - } - - void OnSuccessResponse_24() { ThrowSuccessResponse(); } - - CHIP_ERROR TestUserCreationInTheOutOfBoundsSlotFails_25() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::SetUser::Type; - - RequestType request; - request.operationType = static_cast(0); - request.userIndex = static_cast(NumberOfTotalUsersSupported + 1); - request.userName.SetNull(); - request.userUniqueId.SetNull(); - request.userStatus.SetNull(); - request.userType.SetNull(); - request.credentialRule.SetNull(); - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_25(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_25(error); - }; - - ReturnErrorOnFailure( - chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request, 10000)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_25(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_COMMAND)); - NextTest(); - } - - void OnSuccessResponse_25() { ThrowSuccessResponse(); } - - CHIP_ERROR TestClearFirstUser_26() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::ClearUser::Type; - - RequestType request; - request.userIndex = 1U; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_26(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_26(error); - }; - - ReturnErrorOnFailure( - chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request, 10000)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_26(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_26() { NextTest(); } - - CHIP_ERROR TestReadClearedUserAndVerifyItIsAvailable_27() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::GetUser::Type; - - RequestType request; - request.userIndex = 1U; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context)) - ->OnSuccessResponse_27(data.userIndex, data.userName, data.userUniqueId, data.userStatus, data.userType, - data.credentialRule, data.credentials, data.creatorFabricIndex, data.lastModifiedFabricIndex, - data.nextUserIndex); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_27(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_27(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_27( - uint16_t userIndex, const chip::app::DataModel::Nullable & userName, - const chip::app::DataModel::Nullable & userUniqueId, - const chip::app::DataModel::Nullable & userStatus, - const chip::app::DataModel::Nullable & userType, - const chip::app::DataModel::Nullable & credentialRule, - const chip::app::DataModel::Nullable< - chip::app::DataModel::DecodableList> & credentials, - const chip::app::DataModel::Nullable & creatorFabricIndex, - const chip::app::DataModel::Nullable & lastModifiedFabricIndex, - const chip::app::DataModel::Nullable & nextUserIndex) - { - VerifyOrReturn(CheckValue("userIndex", userIndex, 1U)); - - VerifyOrReturn(CheckValueNull("userName", userName)); - - VerifyOrReturn(CheckValueNull("userUniqueId", userUniqueId)); - - VerifyOrReturn(CheckValueNull("userStatus", userStatus)); - - VerifyOrReturn(CheckValueNull("userType", userType)); - - VerifyOrReturn(CheckValueNull("credentialRule", credentialRule)); - - VerifyOrReturn(CheckValueNull("credentials", credentials)); - - VerifyOrReturn(CheckValueNull("creatorFabricIndex", creatorFabricIndex)); - - VerifyOrReturn(CheckValueNull("lastModifiedFabricIndex", lastModifiedFabricIndex)); - - VerifyOrReturn(CheckValueNonNull("nextUserIndex", nextUserIndex)); - VerifyOrReturn(CheckValue("nextUserIndex.Value()", nextUserIndex.Value(), 3U)); - - NextTest(); - } - - CHIP_ERROR TestCreateNewUserInTheClearedSlot_28() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::SetUser::Type; - - RequestType request; - request.operationType = static_cast(0); - request.userIndex = 1U; - request.userName.SetNull(); - request.userUniqueId.SetNull(); - request.userStatus.SetNull(); - request.userType.SetNull(); - request.credentialRule.SetNull(); - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_28(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_28(error); - }; - - ReturnErrorOnFailure( - chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request, 10000)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_28(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_28() { NextTest(); } - - CHIP_ERROR TestReadTheUserInThePreviouslyClearedSlotAndVerifyItsFields_29() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::GetUser::Type; - - RequestType request; - request.userIndex = 1U; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context)) - ->OnSuccessResponse_29(data.userIndex, data.userName, data.userUniqueId, data.userStatus, data.userType, - data.credentialRule, data.credentials, data.creatorFabricIndex, data.lastModifiedFabricIndex, - data.nextUserIndex); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_29(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_29(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_29( - uint16_t userIndex, const chip::app::DataModel::Nullable & userName, - const chip::app::DataModel::Nullable & userUniqueId, - const chip::app::DataModel::Nullable & userStatus, - const chip::app::DataModel::Nullable & userType, - const chip::app::DataModel::Nullable & credentialRule, - const chip::app::DataModel::Nullable< - chip::app::DataModel::DecodableList> & credentials, - const chip::app::DataModel::Nullable & creatorFabricIndex, - const chip::app::DataModel::Nullable & lastModifiedFabricIndex, - const chip::app::DataModel::Nullable & nextUserIndex) - { - VerifyOrReturn(CheckValue("userIndex", userIndex, 1U)); - - VerifyOrReturn(CheckValueNonNull("userName", userName)); - VerifyOrReturn(CheckValueAsString("userName.Value()", userName.Value(), chip::CharSpan("", 0))); - - VerifyOrReturn(CheckValueNull("userUniqueId", userUniqueId)); - - VerifyOrReturn(CheckValueNonNull("userStatus", userStatus)); - VerifyOrReturn(CheckValue("userStatus.Value()", userStatus.Value(), 1)); - - VerifyOrReturn(CheckValueNonNull("userType", userType)); - VerifyOrReturn(CheckValue("userType.Value()", userType.Value(), 0)); - - VerifyOrReturn(CheckValueNonNull("credentialRule", credentialRule)); - VerifyOrReturn(CheckValue("credentialRule.Value()", credentialRule.Value(), 0)); - - VerifyOrReturn(CheckValueNull("credentials", credentials)); - - VerifyOrReturn(CheckValueNonNull("creatorFabricIndex", creatorFabricIndex)); - VerifyOrReturn(CheckValue("creatorFabricIndex.Value()", creatorFabricIndex.Value(), 1)); - - VerifyOrReturn(CheckValueNonNull("lastModifiedFabricIndex", lastModifiedFabricIndex)); - VerifyOrReturn(CheckValue("lastModifiedFabricIndex.Value()", lastModifiedFabricIndex.Value(), 1)); - - VerifyOrReturn(CheckValueNonNull("nextUserIndex", nextUserIndex)); - VerifyOrReturn(CheckValue("nextUserIndex.Value()", nextUserIndex.Value(), 3U)); - - NextTest(); - } - - CHIP_ERROR TestClearUserWithIndex0Fails_30() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::ClearUser::Type; - - RequestType request; - request.userIndex = 0U; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_30(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_30(error); - }; - - ReturnErrorOnFailure( - chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request, 10000)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_30(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_COMMAND)); - NextTest(); - } - - void OnSuccessResponse_30() { ThrowSuccessResponse(); } - - CHIP_ERROR TestClearUserWithOutOfBoundsIndexFails_31() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::ClearUser::Type; - - RequestType request; - request.userIndex = static_cast(NumberOfTotalUsersSupported + 1); - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_31(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_31(error); - }; - - ReturnErrorOnFailure( - chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request, 10000)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_31(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_COMMAND)); - NextTest(); - } - - void OnSuccessResponse_31() { ThrowSuccessResponse(); } - - CHIP_ERROR TestClearAllUsers_32() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::ClearUser::Type; - - RequestType request; - request.userIndex = 65534U; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_32(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_32(error); - }; - - ReturnErrorOnFailure( - chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request, 10000)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_32(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_32() { NextTest(); } - - CHIP_ERROR TestReadFirstClearedUserAndVerifyItIsAvailable_33() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::GetUser::Type; - - RequestType request; - request.userIndex = 2U; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context)) - ->OnSuccessResponse_33(data.userIndex, data.userName, data.userUniqueId, data.userStatus, data.userType, - data.credentialRule, data.credentials, data.creatorFabricIndex, data.lastModifiedFabricIndex, - data.nextUserIndex); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_33(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_33(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_33( - uint16_t userIndex, const chip::app::DataModel::Nullable & userName, - const chip::app::DataModel::Nullable & userUniqueId, - const chip::app::DataModel::Nullable & userStatus, - const chip::app::DataModel::Nullable & userType, - const chip::app::DataModel::Nullable & credentialRule, - const chip::app::DataModel::Nullable< - chip::app::DataModel::DecodableList> & credentials, - const chip::app::DataModel::Nullable & creatorFabricIndex, - const chip::app::DataModel::Nullable & lastModifiedFabricIndex, - const chip::app::DataModel::Nullable & nextUserIndex) - { - VerifyOrReturn(CheckValue("userIndex", userIndex, 2U)); - - VerifyOrReturn(CheckValueNull("userName", userName)); - - VerifyOrReturn(CheckValueNull("userUniqueId", userUniqueId)); - - VerifyOrReturn(CheckValueNull("userStatus", userStatus)); - - VerifyOrReturn(CheckValueNull("userType", userType)); - - VerifyOrReturn(CheckValueNull("credentialRule", credentialRule)); - - VerifyOrReturn(CheckValueNull("credentials", credentials)); - - VerifyOrReturn(CheckValueNull("creatorFabricIndex", creatorFabricIndex)); - - VerifyOrReturn(CheckValueNull("lastModifiedFabricIndex", lastModifiedFabricIndex)); - - VerifyOrReturn(CheckValueNonNull("nextUserIndex", nextUserIndex)); - VerifyOrReturn(CheckValue("nextUserIndex.Value()", nextUserIndex.Value(), 3U)); - - NextTest(); - } - - CHIP_ERROR TestReadLastClearedUserAndVerifyItIsAvailable_34() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::GetUser::Type; - - RequestType request; - request.userIndex = NumberOfTotalUsersSupported; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context)) - ->OnSuccessResponse_34(data.userIndex, data.userName, data.userUniqueId, data.userStatus, data.userType, - data.credentialRule, data.credentials, data.creatorFabricIndex, data.lastModifiedFabricIndex, - data.nextUserIndex); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_34(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_34(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_34( - uint16_t userIndex, const chip::app::DataModel::Nullable & userName, - const chip::app::DataModel::Nullable & userUniqueId, - const chip::app::DataModel::Nullable & userStatus, - const chip::app::DataModel::Nullable & userType, - const chip::app::DataModel::Nullable & credentialRule, - const chip::app::DataModel::Nullable< - chip::app::DataModel::DecodableList> & credentials, - const chip::app::DataModel::Nullable & creatorFabricIndex, - const chip::app::DataModel::Nullable & lastModifiedFabricIndex, - const chip::app::DataModel::Nullable & nextUserIndex) - { - VerifyOrReturn(CheckValue("userIndex", userIndex, NumberOfTotalUsersSupported)); - - VerifyOrReturn(CheckValueNull("userName", userName)); - - VerifyOrReturn(CheckValueNull("userUniqueId", userUniqueId)); - - VerifyOrReturn(CheckValueNull("userStatus", userStatus)); - - VerifyOrReturn(CheckValueNull("userType", userType)); - - VerifyOrReturn(CheckValueNull("credentialRule", credentialRule)); - - VerifyOrReturn(CheckValueNull("credentials", credentials)); - - VerifyOrReturn(CheckValueNull("creatorFabricIndex", creatorFabricIndex)); - - VerifyOrReturn(CheckValueNull("lastModifiedFabricIndex", lastModifiedFabricIndex)); - - VerifyOrReturn(CheckValueNull("nextUserIndex", nextUserIndex)); - - NextTest(); - } - - CHIP_ERROR TestGetNumberOfSupportedPinCredentialsAndVerifyDefaultValue_35() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::DoorLockClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_35, OnFailureCallback_35, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_35(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_35(uint16_t numberOfPINUsersSupported) - { - VerifyOrReturn(CheckValue("numberOfPINUsersSupported", numberOfPINUsersSupported, 10U)); - - NumberOfPINUsersSupported = numberOfPINUsersSupported; - NextTest(); - } - - CHIP_ERROR TestCheckThatPinCredentialDoesNotExist_36() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::GetCredentialStatus::Type; - - RequestType request; - - request.credential.credentialType = static_cast(1); - request.credential.credentialIndex = 1U; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context)) - ->OnSuccessResponse_36(data.credentialExists, data.userIndex, data.nextCredentialIndex); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_36(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_36(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_36(bool credentialExists, const chip::app::DataModel::Nullable & userIndex, - const chip::app::DataModel::Nullable & nextCredentialIndex) - { - VerifyOrReturn(CheckValue("credentialExists", credentialExists, false)); - - VerifyOrReturn(CheckValueNull("userIndex", userIndex)); - - VerifyOrReturn(CheckValueNonNull("nextCredentialIndex", nextCredentialIndex)); - VerifyOrReturn(CheckValue("nextCredentialIndex.Value()", nextCredentialIndex.Value(), 2U)); - - NextTest(); - } - - CHIP_ERROR TestReadingPinCredentialWithIndex0Fails_37() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::GetCredentialStatus::Type; - - RequestType request; - - request.credential.credentialType = static_cast(1); - request.credential.credentialIndex = 0U; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context)) - ->OnSuccessResponse_37(data.credentialExists, data.userIndex, data.nextCredentialIndex); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_37(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_37(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_COMMAND)); - NextTest(); - } - - void OnSuccessResponse_37(bool credentialExists, const chip::app::DataModel::Nullable & userIndex, - const chip::app::DataModel::Nullable & nextCredentialIndex) - { - ThrowSuccessResponse(); - } - - CHIP_ERROR TestReadingPinCredentialWithOutOfBoundsIndexFails_38() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::GetCredentialStatus::Type; - - RequestType request; - - request.credential.credentialType = static_cast(1); - request.credential.credentialIndex = static_cast(NumberOfPINUsersSupported + 1); - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context)) - ->OnSuccessResponse_38(data.credentialExists, data.userIndex, data.nextCredentialIndex); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_38(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_38(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_COMMAND)); - NextTest(); - } - - void OnSuccessResponse_38(bool credentialExists, const chip::app::DataModel::Nullable & userIndex, - const chip::app::DataModel::Nullable & nextCredentialIndex) - { - ThrowSuccessResponse(); - } - - CHIP_ERROR TestCreateNewPinCredentialAndUser_39() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::SetCredential::Type; - - RequestType request; - request.operationType = static_cast(0); - - request.credential.credentialType = static_cast(1); - request.credential.credentialIndex = 1U; - - request.credentialData = chip::ByteSpan(chip::Uint8::from_const_char("000000garbage: not in length on purpose"), 6); - request.userIndex.SetNull(); - request.userStatus.SetNull(); - request.userType.SetNull(); - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context)) - ->OnSuccessResponse_39(data.status, data.userIndex, data.nextCredentialIndex); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_39(error); - }; - - ReturnErrorOnFailure( - chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request, 10000)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_39(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_39(chip::app::Clusters::DoorLock::DlStatus status, - const chip::app::DataModel::Nullable & userIndex, - const chip::app::DataModel::Nullable & nextCredentialIndex) - { - VerifyOrReturn(CheckValue("status", status, 0)); - - VerifyOrReturn(CheckValueNonNull("userIndex", userIndex)); - VerifyOrReturn(CheckValue("userIndex.Value()", userIndex.Value(), 1U)); - - VerifyOrReturn(CheckValueNonNull("nextCredentialIndex", nextCredentialIndex)); - VerifyOrReturn(CheckValue("nextCredentialIndex.Value()", nextCredentialIndex.Value(), 2U)); - - NextTest(); - } - - CHIP_ERROR TestVerifyCreatedUser_40() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::GetUser::Type; - - RequestType request; - request.userIndex = 1U; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context)) - ->OnSuccessResponse_40(data.userIndex, data.userName, data.userUniqueId, data.userStatus, data.userType, - data.credentialRule, data.credentials, data.creatorFabricIndex, data.lastModifiedFabricIndex, - data.nextUserIndex); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_40(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_40(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_40( - uint16_t userIndex, const chip::app::DataModel::Nullable & userName, - const chip::app::DataModel::Nullable & userUniqueId, - const chip::app::DataModel::Nullable & userStatus, - const chip::app::DataModel::Nullable & userType, - const chip::app::DataModel::Nullable & credentialRule, - const chip::app::DataModel::Nullable< - chip::app::DataModel::DecodableList> & credentials, - const chip::app::DataModel::Nullable & creatorFabricIndex, - const chip::app::DataModel::Nullable & lastModifiedFabricIndex, - const chip::app::DataModel::Nullable & nextUserIndex) - { - VerifyOrReturn(CheckValue("userIndex", userIndex, 1U)); - - VerifyOrReturn(CheckValueNonNull("userName", userName)); - VerifyOrReturn(CheckValueAsString("userName.Value()", userName.Value(), chip::CharSpan("", 0))); - - VerifyOrReturn(CheckValueNull("userUniqueId", userUniqueId)); - - VerifyOrReturn(CheckValueNonNull("userStatus", userStatus)); - VerifyOrReturn(CheckValue("userStatus.Value()", userStatus.Value(), 1)); - - VerifyOrReturn(CheckValueNonNull("userType", userType)); - VerifyOrReturn(CheckValue("userType.Value()", userType.Value(), 0)); - - VerifyOrReturn(CheckValueNonNull("credentialRule", credentialRule)); - VerifyOrReturn(CheckValue("credentialRule.Value()", credentialRule.Value(), 0)); - - VerifyOrReturn(CheckValueNonNull("credentials", credentials)); - { - auto iter_1 = credentials.Value().begin(); - VerifyOrReturn(CheckNextListItemDecodes("credentials.Value()", iter_1, 0)); - VerifyOrReturn(CheckValue("credentials.Value()[0].credentialType", iter_1.GetValue().credentialType, 1)); - VerifyOrReturn(CheckValue("credentials.Value()[0].credentialIndex", iter_1.GetValue().credentialIndex, 1U)); - VerifyOrReturn(CheckNoMoreListItems("credentials.Value()", iter_1, 1)); - } - - VerifyOrReturn(CheckValueNonNull("creatorFabricIndex", creatorFabricIndex)); - VerifyOrReturn(CheckValue("creatorFabricIndex.Value()", creatorFabricIndex.Value(), 1)); - - VerifyOrReturn(CheckValueNonNull("lastModifiedFabricIndex", lastModifiedFabricIndex)); - VerifyOrReturn(CheckValue("lastModifiedFabricIndex.Value()", lastModifiedFabricIndex.Value(), 1)); - - VerifyOrReturn(CheckValueNonNull("nextUserIndex", nextUserIndex)); - VerifyOrReturn(CheckValue("nextUserIndex.Value()", nextUserIndex.Value(), 2U)); - - NextTest(); - } - - CHIP_ERROR TestVerifyCreatedPinCredential_41() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::GetCredentialStatus::Type; - - RequestType request; - - request.credential.credentialType = static_cast(1); - request.credential.credentialIndex = 1U; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context)) - ->OnSuccessResponse_41(data.credentialExists, data.userIndex, data.nextCredentialIndex); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_41(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_41(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_41(bool credentialExists, const chip::app::DataModel::Nullable & userIndex, - const chip::app::DataModel::Nullable & nextCredentialIndex) - { - VerifyOrReturn(CheckValue("credentialExists", credentialExists, true)); - - VerifyOrReturn(CheckValueNonNull("userIndex", userIndex)); - VerifyOrReturn(CheckValue("userIndex.Value()", userIndex.Value(), 1U)); - - VerifyOrReturn(CheckValueNonNull("nextCredentialIndex", nextCredentialIndex)); - VerifyOrReturn(CheckValue("nextCredentialIndex.Value()", nextCredentialIndex.Value(), 2U)); - - NextTest(); - } - - CHIP_ERROR TestCreateNewPinCredentialAndUserWithIndex0Fails_42() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::SetCredential::Type; - - RequestType request; - request.operationType = static_cast(0); - - request.credential.credentialType = static_cast(1); - request.credential.credentialIndex = 0U; - - request.credentialData = chip::ByteSpan(chip::Uint8::from_const_char("123456garbage: not in length on purpose"), 6); - request.userIndex.SetNull(); - request.userStatus.SetNull(); - request.userType.SetNull(); - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context)) - ->OnSuccessResponse_42(data.status, data.userIndex, data.nextCredentialIndex); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_42(error); - }; - - ReturnErrorOnFailure( - chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request, 10000)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_42(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_42(chip::app::Clusters::DoorLock::DlStatus status, - const chip::app::DataModel::Nullable & userIndex, - const chip::app::DataModel::Nullable & nextCredentialIndex) - { - VerifyOrReturn(CheckValue("status", status, 133)); - - VerifyOrReturn(CheckValueNull("userIndex", userIndex)); - - VerifyOrReturn(CheckValueNonNull("nextCredentialIndex", nextCredentialIndex)); - VerifyOrReturn(CheckValue("nextCredentialIndex.Value()", nextCredentialIndex.Value(), 2U)); - - NextTest(); - } - - CHIP_ERROR TestCreateNewPinCredentialAndUserWithOutOfBoundsIndexFails_43() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::SetCredential::Type; - - RequestType request; - request.operationType = static_cast(0); - - request.credential.credentialType = static_cast(1); - request.credential.credentialIndex = static_cast(NumberOfPINUsersSupported + 1); - - request.credentialData = chip::ByteSpan(chip::Uint8::from_const_char("123456garbage: not in length on purpose"), 6); - request.userIndex.SetNull(); - request.userStatus.SetNull(); - request.userType.SetNull(); - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context)) - ->OnSuccessResponse_43(data.status, data.userIndex, data.nextCredentialIndex); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_43(error); - }; - - ReturnErrorOnFailure( - chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request, 10000)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_43(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_43(chip::app::Clusters::DoorLock::DlStatus status, - const chip::app::DataModel::Nullable & userIndex, - const chip::app::DataModel::Nullable & nextCredentialIndex) - { - VerifyOrReturn(CheckValue("status", status, 133)); - - VerifyOrReturn(CheckValueNull("userIndex", userIndex)); - - VerifyOrReturn(CheckValueNull("nextCredentialIndex", nextCredentialIndex)); - - NextTest(); - } - - CHIP_ERROR TestGetNumberOfSupportedRfidCredentialsAndVerifyDefaultValue_44() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::DoorLockClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_44, OnFailureCallback_44, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_44(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_44(uint16_t numberOfRFIDUsersSupported) - { - VerifyOrReturn(CheckValue("numberOfRFIDUsersSupported", numberOfRFIDUsersSupported, 10U)); - - NumberOfRFIDUsersSupported = numberOfRFIDUsersSupported; - NextTest(); - } - - CHIP_ERROR TestReadingRfidCredentialWithIndex0Fails_45() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::GetCredentialStatus::Type; - - RequestType request; - - request.credential.credentialType = static_cast(2); - request.credential.credentialIndex = 0U; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context)) - ->OnSuccessResponse_45(data.credentialExists, data.userIndex, data.nextCredentialIndex); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_45(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_45(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_COMMAND)); - NextTest(); - } - - void OnSuccessResponse_45(bool credentialExists, const chip::app::DataModel::Nullable & userIndex, - const chip::app::DataModel::Nullable & nextCredentialIndex) - { - ThrowSuccessResponse(); - } - - CHIP_ERROR TestReadingRfidCredentialWithOutOfBoundsIndexFails_46() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::GetCredentialStatus::Type; - - RequestType request; - - request.credential.credentialType = static_cast(2); - request.credential.credentialIndex = static_cast(NumberOfRFIDUsersSupported + 1); - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context)) - ->OnSuccessResponse_46(data.credentialExists, data.userIndex, data.nextCredentialIndex); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_46(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_46(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_COMMAND)); - NextTest(); - } - - void OnSuccessResponse_46(bool credentialExists, const chip::app::DataModel::Nullable & userIndex, - const chip::app::DataModel::Nullable & nextCredentialIndex) - { - ThrowSuccessResponse(); - } - - CHIP_ERROR TestCheckThatRfidCredentialDoesNotExist_47() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::GetCredentialStatus::Type; - - RequestType request; - - request.credential.credentialType = static_cast(2); - request.credential.credentialIndex = 2U; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context)) - ->OnSuccessResponse_47(data.credentialExists, data.userIndex, data.nextCredentialIndex); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_47(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_47(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_47(bool credentialExists, const chip::app::DataModel::Nullable & userIndex, - const chip::app::DataModel::Nullable & nextCredentialIndex) - { - VerifyOrReturn(CheckValue("credentialExists", credentialExists, false)); - - VerifyOrReturn(CheckValueNull("userIndex", userIndex)); - - VerifyOrReturn(CheckValueNonNull("nextCredentialIndex", nextCredentialIndex)); - VerifyOrReturn(CheckValue("nextCredentialIndex.Value()", nextCredentialIndex.Value(), 3U)); - - NextTest(); - } - - CHIP_ERROR TestCreateNewRfidCredentialAndAddItToExistingUser_48() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::SetCredential::Type; - - RequestType request; - request.operationType = static_cast(0); - - request.credential.credentialType = static_cast(2); - request.credential.credentialIndex = 2U; - - request.credentialData = - chip::ByteSpan(chip::Uint8::from_const_char("rfid_data_123456garbage: not in length on purpose"), 16); - request.userIndex.SetNonNull(); - request.userIndex.Value() = 1U; - request.userStatus.SetNull(); - request.userType.SetNull(); - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context)) - ->OnSuccessResponse_48(data.status, data.userIndex, data.nextCredentialIndex); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_48(error); - }; - - ReturnErrorOnFailure( - chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request, 10000)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_48(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_48(chip::app::Clusters::DoorLock::DlStatus status, - const chip::app::DataModel::Nullable & userIndex, - const chip::app::DataModel::Nullable & nextCredentialIndex) - { - VerifyOrReturn(CheckValue("status", status, 0)); - - VerifyOrReturn(CheckValueNull("userIndex", userIndex)); - - VerifyOrReturn(CheckValueNonNull("nextCredentialIndex", nextCredentialIndex)); - VerifyOrReturn(CheckValue("nextCredentialIndex.Value()", nextCredentialIndex.Value(), 3U)); - - NextTest(); - } - - CHIP_ERROR TestVerifyModifiedUser_49() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::GetUser::Type; - - RequestType request; - request.userIndex = 1U; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context)) - ->OnSuccessResponse_49(data.userIndex, data.userName, data.userUniqueId, data.userStatus, data.userType, - data.credentialRule, data.credentials, data.creatorFabricIndex, data.lastModifiedFabricIndex, - data.nextUserIndex); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_49(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_49(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_49( - uint16_t userIndex, const chip::app::DataModel::Nullable & userName, - const chip::app::DataModel::Nullable & userUniqueId, - const chip::app::DataModel::Nullable & userStatus, - const chip::app::DataModel::Nullable & userType, - const chip::app::DataModel::Nullable & credentialRule, - const chip::app::DataModel::Nullable< - chip::app::DataModel::DecodableList> & credentials, - const chip::app::DataModel::Nullable & creatorFabricIndex, - const chip::app::DataModel::Nullable & lastModifiedFabricIndex, - const chip::app::DataModel::Nullable & nextUserIndex) - { - VerifyOrReturn(CheckValue("userIndex", userIndex, 1U)); - - VerifyOrReturn(CheckValueNonNull("userName", userName)); - VerifyOrReturn(CheckValueAsString("userName.Value()", userName.Value(), chip::CharSpan("", 0))); - - VerifyOrReturn(CheckValueNull("userUniqueId", userUniqueId)); - - VerifyOrReturn(CheckValueNonNull("userStatus", userStatus)); - VerifyOrReturn(CheckValue("userStatus.Value()", userStatus.Value(), 1)); - - VerifyOrReturn(CheckValueNonNull("userType", userType)); - VerifyOrReturn(CheckValue("userType.Value()", userType.Value(), 0)); - - VerifyOrReturn(CheckValueNonNull("credentialRule", credentialRule)); - VerifyOrReturn(CheckValue("credentialRule.Value()", credentialRule.Value(), 0)); - - VerifyOrReturn(CheckValueNonNull("credentials", credentials)); - { - auto iter_1 = credentials.Value().begin(); - VerifyOrReturn(CheckNextListItemDecodes("credentials.Value()", iter_1, 0)); - VerifyOrReturn(CheckValue("credentials.Value()[0].credentialType", iter_1.GetValue().credentialType, 1)); - VerifyOrReturn(CheckValue("credentials.Value()[0].credentialIndex", iter_1.GetValue().credentialIndex, 1U)); - VerifyOrReturn(CheckNextListItemDecodes("credentials.Value()", iter_1, 1)); - VerifyOrReturn(CheckValue("credentials.Value()[1].credentialType", iter_1.GetValue().credentialType, 2)); - VerifyOrReturn(CheckValue("credentials.Value()[1].credentialIndex", iter_1.GetValue().credentialIndex, 2U)); - VerifyOrReturn(CheckNoMoreListItems("credentials.Value()", iter_1, 2)); - } - - VerifyOrReturn(CheckValueNonNull("creatorFabricIndex", creatorFabricIndex)); - VerifyOrReturn(CheckValue("creatorFabricIndex.Value()", creatorFabricIndex.Value(), 1)); - - VerifyOrReturn(CheckValueNonNull("lastModifiedFabricIndex", lastModifiedFabricIndex)); - VerifyOrReturn(CheckValue("lastModifiedFabricIndex.Value()", lastModifiedFabricIndex.Value(), 1)); - - VerifyOrReturn(CheckValueNonNull("nextUserIndex", nextUserIndex)); - VerifyOrReturn(CheckValue("nextUserIndex.Value()", nextUserIndex.Value(), 2U)); - - NextTest(); - } - - CHIP_ERROR TestVerifyCreatedCredential_50() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::GetCredentialStatus::Type; - - RequestType request; - - request.credential.credentialType = static_cast(2); - request.credential.credentialIndex = 2U; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context)) - ->OnSuccessResponse_50(data.credentialExists, data.userIndex, data.nextCredentialIndex); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_50(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_50(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_50(bool credentialExists, const chip::app::DataModel::Nullable & userIndex, - const chip::app::DataModel::Nullable & nextCredentialIndex) - { - VerifyOrReturn(CheckValue("credentialExists", credentialExists, true)); - - VerifyOrReturn(CheckValueNonNull("userIndex", userIndex)); - VerifyOrReturn(CheckValue("userIndex.Value()", userIndex.Value(), 1U)); - - VerifyOrReturn(CheckValueNonNull("nextCredentialIndex", nextCredentialIndex)); - VerifyOrReturn(CheckValue("nextCredentialIndex.Value()", nextCredentialIndex.Value(), 3U)); - - NextTest(); - } - - CHIP_ERROR TestCreateNewRfidCredentialAndUserWithIndex0Fails_51() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::SetCredential::Type; - - RequestType request; - request.operationType = static_cast(0); - - request.credential.credentialType = static_cast(2); - request.credential.credentialIndex = 0U; - - request.credentialData = - chip::ByteSpan(chip::Uint8::from_const_char("new_rfid_data_fieldgarbage: not in length on purpose"), 19); - request.userIndex.SetNull(); - request.userStatus.SetNull(); - request.userType.SetNull(); - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context)) - ->OnSuccessResponse_51(data.status, data.userIndex, data.nextCredentialIndex); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_51(error); - }; - - ReturnErrorOnFailure( - chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request, 10000)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_51(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_51(chip::app::Clusters::DoorLock::DlStatus status, - const chip::app::DataModel::Nullable & userIndex, - const chip::app::DataModel::Nullable & nextCredentialIndex) - { - VerifyOrReturn(CheckValue("status", status, 133)); - - VerifyOrReturn(CheckValueNull("userIndex", userIndex)); - - VerifyOrReturn(CheckValueNonNull("nextCredentialIndex", nextCredentialIndex)); - VerifyOrReturn(CheckValue("nextCredentialIndex.Value()", nextCredentialIndex.Value(), 3U)); - - NextTest(); - } - - CHIP_ERROR TestCreateNewRfidCredentialAndUserWithOutOfBoundsIndexFails_52() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::SetCredential::Type; - - RequestType request; - request.operationType = static_cast(0); - - request.credential.credentialType = static_cast(2); - request.credential.credentialIndex = static_cast(NumberOfRFIDUsersSupported + 1); - - request.credentialData = - chip::ByteSpan(chip::Uint8::from_const_char("new_rfid_data_fieldgarbage: not in length on purpose"), 19); - request.userIndex.SetNull(); - request.userStatus.SetNull(); - request.userType.SetNull(); - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context)) - ->OnSuccessResponse_52(data.status, data.userIndex, data.nextCredentialIndex); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_52(error); - }; - - ReturnErrorOnFailure( - chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request, 10000)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_52(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_52(chip::app::Clusters::DoorLock::DlStatus status, - const chip::app::DataModel::Nullable & userIndex, - const chip::app::DataModel::Nullable & nextCredentialIndex) - { - VerifyOrReturn(CheckValue("status", status, 133)); - - VerifyOrReturn(CheckValueNull("userIndex", userIndex)); - - VerifyOrReturn(CheckValueNull("nextCredentialIndex", nextCredentialIndex)); - - NextTest(); - } - - CHIP_ERROR TestCreateNewPinCredentialAndTryToAddItToExistingUser_53() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::SetCredential::Type; - - RequestType request; - request.operationType = static_cast(0); - - request.credential.credentialType = static_cast(1); - request.credential.credentialIndex = 3U; - - request.credentialData = chip::ByteSpan(chip::Uint8::from_const_char("123465garbage: not in length on purpose"), 6); - request.userIndex.SetNonNull(); - request.userIndex.Value() = 1U; - request.userStatus.SetNull(); - request.userType.SetNull(); - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context)) - ->OnSuccessResponse_53(data.status, data.userIndex, data.nextCredentialIndex); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_53(error); - }; - - ReturnErrorOnFailure( - chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request, 10000)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_53(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_53(chip::app::Clusters::DoorLock::DlStatus status, - const chip::app::DataModel::Nullable & userIndex, - const chip::app::DataModel::Nullable & nextCredentialIndex) - { - VerifyOrReturn(CheckValue("status", status, 3)); - - VerifyOrReturn(CheckValueNull("userIndex", userIndex)); - - VerifyOrReturn(CheckValueNonNull("nextCredentialIndex", nextCredentialIndex)); - VerifyOrReturn(CheckValue("nextCredentialIndex.Value()", nextCredentialIndex.Value(), 4U)); - - NextTest(); - } - - CHIP_ERROR TestCreateNewCredentialAndTryToAddItTo0User_54() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::SetCredential::Type; - - RequestType request; - request.operationType = static_cast(0); - - request.credential.credentialType = static_cast(1); - request.credential.credentialIndex = 3U; - - request.credentialData = chip::ByteSpan(chip::Uint8::from_const_char("123465garbage: not in length on purpose"), 6); - request.userIndex.SetNonNull(); - request.userIndex.Value() = 0U; - request.userStatus.SetNull(); - request.userType.SetNull(); - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context)) - ->OnSuccessResponse_54(data.status, data.userIndex, data.nextCredentialIndex); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_54(error); - }; - - ReturnErrorOnFailure( - chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request, 10000)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_54(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_54(chip::app::Clusters::DoorLock::DlStatus status, - const chip::app::DataModel::Nullable & userIndex, - const chip::app::DataModel::Nullable & nextCredentialIndex) - { - VerifyOrReturn(CheckValue("status", status, 133)); - - VerifyOrReturn(CheckValueNull("userIndex", userIndex)); - - VerifyOrReturn(CheckValueNonNull("nextCredentialIndex", nextCredentialIndex)); - VerifyOrReturn(CheckValue("nextCredentialIndex.Value()", nextCredentialIndex.Value(), 4U)); - - NextTest(); - } - - CHIP_ERROR TestCreateNewCredentialAndTryToAddItToOutOfBoundsUser_55() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::SetCredential::Type; - - RequestType request; - request.operationType = static_cast(0); - - request.credential.credentialType = static_cast(1); - request.credential.credentialIndex = 3U; - - request.credentialData = chip::ByteSpan(chip::Uint8::from_const_char("123465garbage: not in length on purpose"), 6); - request.userIndex.SetNonNull(); - request.userIndex.Value() = static_cast(NumberOfTotalUsersSupported + 1); - request.userStatus.SetNull(); - request.userType.SetNull(); - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context)) - ->OnSuccessResponse_55(data.status, data.userIndex, data.nextCredentialIndex); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_55(error); - }; - - ReturnErrorOnFailure( - chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request, 10000)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_55(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_55(chip::app::Clusters::DoorLock::DlStatus status, - const chip::app::DataModel::Nullable & userIndex, - const chip::app::DataModel::Nullable & nextCredentialIndex) - { - VerifyOrReturn(CheckValue("status", status, 133)); - - VerifyOrReturn(CheckValueNull("userIndex", userIndex)); - - VerifyOrReturn(CheckValueNonNull("nextCredentialIndex", nextCredentialIndex)); - VerifyOrReturn(CheckValue("nextCredentialIndex.Value()", nextCredentialIndex.Value(), 4U)); - - NextTest(); - } - - CHIP_ERROR TestCreateNewPinWithTooShortData_56() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::SetCredential::Type; - - RequestType request; - request.operationType = static_cast(0); - - request.credential.credentialType = static_cast(1); - request.credential.credentialIndex = 3U; - - request.credentialData = chip::ByteSpan(chip::Uint8::from_const_char("12345garbage: not in length on purpose"), 5); - request.userIndex.SetNonNull(); - request.userIndex.Value() = 0U; - request.userStatus.SetNull(); - request.userType.SetNull(); - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context)) - ->OnSuccessResponse_56(data.status, data.userIndex, data.nextCredentialIndex); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_56(error); - }; - - ReturnErrorOnFailure( - chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request, 10000)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_56(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_56(chip::app::Clusters::DoorLock::DlStatus status, - const chip::app::DataModel::Nullable & userIndex, - const chip::app::DataModel::Nullable & nextCredentialIndex) - { - VerifyOrReturn(CheckValue("status", status, 133)); - - VerifyOrReturn(CheckValueNull("userIndex", userIndex)); - - VerifyOrReturn(CheckValueNonNull("nextCredentialIndex", nextCredentialIndex)); - VerifyOrReturn(CheckValue("nextCredentialIndex.Value()", nextCredentialIndex.Value(), 4U)); - - NextTest(); - } - - CHIP_ERROR TestCreateNewPinWithTooLongData_57() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::SetCredential::Type; - - RequestType request; - request.operationType = static_cast(0); - - request.credential.credentialType = static_cast(1); - request.credential.credentialIndex = 3U; - - request.credentialData = chip::ByteSpan(chip::Uint8::from_const_char("123456789garbage: not in length on purpose"), 9); - request.userIndex.SetNonNull(); - request.userIndex.Value() = 0U; - request.userStatus.SetNull(); - request.userType.SetNull(); - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context)) - ->OnSuccessResponse_57(data.status, data.userIndex, data.nextCredentialIndex); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_57(error); - }; - - ReturnErrorOnFailure( - chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request, 10000)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_57(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_57(chip::app::Clusters::DoorLock::DlStatus status, - const chip::app::DataModel::Nullable & userIndex, - const chip::app::DataModel::Nullable & nextCredentialIndex) - { - VerifyOrReturn(CheckValue("status", status, 133)); - - VerifyOrReturn(CheckValueNull("userIndex", userIndex)); - - VerifyOrReturn(CheckValueNonNull("nextCredentialIndex", nextCredentialIndex)); - VerifyOrReturn(CheckValue("nextCredentialIndex.Value()", nextCredentialIndex.Value(), 4U)); - - NextTest(); - } - - CHIP_ERROR TestCreateNewRfidWithTooShortData_58() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::SetCredential::Type; - - RequestType request; - request.operationType = static_cast(0); - - request.credential.credentialType = static_cast(2); - request.credential.credentialIndex = 3U; - - request.credentialData = chip::ByteSpan(chip::Uint8::from_const_char("rfid_datagarbage: not in length on purpose"), 9); - request.userIndex.SetNonNull(); - request.userIndex.Value() = 0U; - request.userStatus.SetNull(); - request.userType.SetNull(); - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context)) - ->OnSuccessResponse_58(data.status, data.userIndex, data.nextCredentialIndex); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_58(error); - }; - - ReturnErrorOnFailure( - chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request, 10000)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_58(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_58(chip::app::Clusters::DoorLock::DlStatus status, - const chip::app::DataModel::Nullable & userIndex, - const chip::app::DataModel::Nullable & nextCredentialIndex) - { - VerifyOrReturn(CheckValue("status", status, 133)); - - VerifyOrReturn(CheckValueNull("userIndex", userIndex)); - - VerifyOrReturn(CheckValueNonNull("nextCredentialIndex", nextCredentialIndex)); - VerifyOrReturn(CheckValue("nextCredentialIndex.Value()", nextCredentialIndex.Value(), 4U)); - - NextTest(); - } - - CHIP_ERROR TestCreateNewPinWithProgrammingUserTypeFails_59() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::SetCredential::Type; - - RequestType request; - request.operationType = static_cast(0); - - request.credential.credentialType = static_cast(1); - request.credential.credentialIndex = 3U; - - request.credentialData = chip::ByteSpan(chip::Uint8::from_const_char("123456garbage: not in length on purpose"), 6); - request.userIndex.SetNonNull(); - request.userIndex.Value() = 0U; - request.userStatus.SetNull(); - request.userType.SetNonNull(); - request.userType.Value() = static_cast(3); - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context)) - ->OnSuccessResponse_59(data.status, data.userIndex, data.nextCredentialIndex); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_59(error); - }; - - ReturnErrorOnFailure( - chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request, 10000)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_59(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_59(chip::app::Clusters::DoorLock::DlStatus status, - const chip::app::DataModel::Nullable & userIndex, - const chip::app::DataModel::Nullable & nextCredentialIndex) - { - VerifyOrReturn(CheckValue("status", status, 133)); - - VerifyOrReturn(CheckValueNull("userIndex", userIndex)); - - VerifyOrReturn(CheckValueNonNull("nextCredentialIndex", nextCredentialIndex)); - VerifyOrReturn(CheckValue("nextCredentialIndex.Value()", nextCredentialIndex.Value(), 4U)); - - NextTest(); - } - - CHIP_ERROR TestCreateNewRfidWithTooShortData_60() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::SetCredential::Type; - - RequestType request; - request.operationType = static_cast(0); - - request.credential.credentialType = static_cast(2); - request.credential.credentialIndex = 3U; - - request.credentialData = chip::ByteSpan( - chip::Uint8::from_const_char("very_long_rfid_data_to_test_boundariesgarbage: not in length on purpose"), 38); - request.userIndex.SetNonNull(); - request.userIndex.Value() = 0U; - request.userStatus.SetNull(); - request.userType.SetNull(); - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context)) - ->OnSuccessResponse_60(data.status, data.userIndex, data.nextCredentialIndex); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_60(error); - }; - - ReturnErrorOnFailure( - chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request, 10000)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_60(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_60(chip::app::Clusters::DoorLock::DlStatus status, - const chip::app::DataModel::Nullable & userIndex, - const chip::app::DataModel::Nullable & nextCredentialIndex) - { - VerifyOrReturn(CheckValue("status", status, 133)); - - VerifyOrReturn(CheckValueNull("userIndex", userIndex)); - - VerifyOrReturn(CheckValueNonNull("nextCredentialIndex", nextCredentialIndex)); - VerifyOrReturn(CheckValue("nextCredentialIndex.Value()", nextCredentialIndex.Value(), 4U)); - - NextTest(); - } - - CHIP_ERROR TestCreateNewPinCredentialWithDataTheWouldCauseDuplicate_61() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::SetCredential::Type; - - RequestType request; - request.operationType = static_cast(0); - - request.credential.credentialType = static_cast(1); - request.credential.credentialIndex = 4U; - - request.credentialData = chip::ByteSpan(chip::Uint8::from_const_char("000000garbage: not in length on purpose"), 6); - request.userIndex.SetNull(); - request.userStatus.SetNull(); - request.userType.SetNull(); - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context)) - ->OnSuccessResponse_61(data.status, data.userIndex, data.nextCredentialIndex); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_61(error); - }; - - ReturnErrorOnFailure( - chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request, 10000)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_61(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_61(chip::app::Clusters::DoorLock::DlStatus status, - const chip::app::DataModel::Nullable & userIndex, - const chip::app::DataModel::Nullable & nextCredentialIndex) - { - VerifyOrReturn(CheckValue("status", status, 2)); - - VerifyOrReturn(CheckValueNull("userIndex", userIndex)); - - VerifyOrReturn(CheckValueNonNull("nextCredentialIndex", nextCredentialIndex)); - VerifyOrReturn(CheckValue("nextCredentialIndex.Value()", nextCredentialIndex.Value(), 5U)); - - NextTest(); - } - - CHIP_ERROR TestCreateNewRfidCredentialWithDataTheWouldCauseDuplicate_62() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::SetCredential::Type; - - RequestType request; - request.operationType = static_cast(0); - - request.credential.credentialType = static_cast(2); - request.credential.credentialIndex = 4U; - - request.credentialData = - chip::ByteSpan(chip::Uint8::from_const_char("rfid_data_123456garbage: not in length on purpose"), 16); - request.userIndex.SetNull(); - request.userStatus.SetNull(); - request.userType.SetNull(); - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context)) - ->OnSuccessResponse_62(data.status, data.userIndex, data.nextCredentialIndex); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_62(error); - }; - - ReturnErrorOnFailure( - chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request, 10000)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_62(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_62(chip::app::Clusters::DoorLock::DlStatus status, - const chip::app::DataModel::Nullable & userIndex, - const chip::app::DataModel::Nullable & nextCredentialIndex) - { - VerifyOrReturn(CheckValue("status", status, 2)); - - VerifyOrReturn(CheckValueNull("userIndex", userIndex)); - - VerifyOrReturn(CheckValueNonNull("nextCredentialIndex", nextCredentialIndex)); - VerifyOrReturn(CheckValue("nextCredentialIndex.Value()", nextCredentialIndex.Value(), 5U)); - - NextTest(); - } - - CHIP_ERROR TestModifyCredentialDataOfExistingPinCredential_63() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::SetCredential::Type; - - RequestType request; - request.operationType = static_cast(2); - - request.credential.credentialType = static_cast(1); - request.credential.credentialIndex = 1U; - - request.credentialData = chip::ByteSpan(chip::Uint8::from_const_char("123456garbage: not in length on purpose"), 6); - request.userIndex.SetNonNull(); - request.userIndex.Value() = 1U; - request.userStatus.SetNull(); - request.userType.SetNull(); - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context)) - ->OnSuccessResponse_63(data.status, data.userIndex, data.nextCredentialIndex); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_63(error); - }; - - ReturnErrorOnFailure( - chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request, 10000)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_63(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_63(chip::app::Clusters::DoorLock::DlStatus status, - const chip::app::DataModel::Nullable & userIndex, - const chip::app::DataModel::Nullable & nextCredentialIndex) - { - VerifyOrReturn(CheckValue("status", status, 0)); - - VerifyOrReturn(CheckValueNull("userIndex", userIndex)); - - VerifyOrReturn(CheckValueNonNull("nextCredentialIndex", nextCredentialIndex)); - VerifyOrReturn(CheckValue("nextCredentialIndex.Value()", nextCredentialIndex.Value(), 3U)); - - NextTest(); - } - - CHIP_ERROR TestVerifyThatCredentialWasChangedByCreatingNewCredentialWithOldData_64() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::SetCredential::Type; - - RequestType request; - request.operationType = static_cast(0); - - request.credential.credentialType = static_cast(1); - request.credential.credentialIndex = 3U; - - request.credentialData = chip::ByteSpan(chip::Uint8::from_const_char("000000garbage: not in length on purpose"), 6); - request.userIndex.SetNull(); - request.userStatus.SetNull(); - request.userType.SetNull(); - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context)) - ->OnSuccessResponse_64(data.status, data.userIndex, data.nextCredentialIndex); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_64(error); - }; - - ReturnErrorOnFailure( - chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request, 10000)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_64(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_64(chip::app::Clusters::DoorLock::DlStatus status, - const chip::app::DataModel::Nullable & userIndex, - const chip::app::DataModel::Nullable & nextCredentialIndex) - { - VerifyOrReturn(CheckValue("status", status, 0)); - - VerifyOrReturn(CheckValueNonNull("userIndex", userIndex)); - VerifyOrReturn(CheckValue("userIndex.Value()", userIndex.Value(), 2U)); - - VerifyOrReturn(CheckValueNonNull("nextCredentialIndex", nextCredentialIndex)); - VerifyOrReturn(CheckValue("nextCredentialIndex.Value()", nextCredentialIndex.Value(), 4U)); - - NextTest(); - } - - CHIP_ERROR TestVerifyThatCredentialWasChangedByCreatingNewCredentialWithNewData_65() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::SetCredential::Type; - - RequestType request; - request.operationType = static_cast(0); - - request.credential.credentialType = static_cast(1); - request.credential.credentialIndex = 4U; - - request.credentialData = chip::ByteSpan(chip::Uint8::from_const_char("123456garbage: not in length on purpose"), 6); - request.userIndex.SetNull(); - request.userStatus.SetNull(); - request.userType.SetNull(); - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context)) - ->OnSuccessResponse_65(data.status, data.userIndex, data.nextCredentialIndex); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_65(error); - }; - - ReturnErrorOnFailure( - chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request, 10000)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_65(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_65(chip::app::Clusters::DoorLock::DlStatus status, - const chip::app::DataModel::Nullable & userIndex, - const chip::app::DataModel::Nullable & nextCredentialIndex) - { - VerifyOrReturn(CheckValue("status", status, 2)); - - VerifyOrReturn(CheckValueNull("userIndex", userIndex)); - - VerifyOrReturn(CheckValueNonNull("nextCredentialIndex", nextCredentialIndex)); - VerifyOrReturn(CheckValue("nextCredentialIndex.Value()", nextCredentialIndex.Value(), 5U)); - - NextTest(); - } - - CHIP_ERROR TestClearFirstPinCredential_66() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::ClearCredential::Type; - - RequestType request; - request.credential.SetNonNull(); - - request.credential.Value().credentialType = static_cast(1); - request.credential.Value().credentialIndex = 1U; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_66(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_66(error); - }; - - ReturnErrorOnFailure( - chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request, 10000)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_66(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_66() { NextTest(); } - - CHIP_ERROR TestReadBackTheCredentialAndMakeSureItIsDeleted_67() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::GetCredentialStatus::Type; - - RequestType request; - - request.credential.credentialType = static_cast(1); - request.credential.credentialIndex = 1U; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context)) - ->OnSuccessResponse_67(data.credentialExists, data.userIndex, data.nextCredentialIndex); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_67(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_67(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_67(bool credentialExists, const chip::app::DataModel::Nullable & userIndex, - const chip::app::DataModel::Nullable & nextCredentialIndex) - { - VerifyOrReturn(CheckValue("credentialExists", credentialExists, false)); - - VerifyOrReturn(CheckValueNull("userIndex", userIndex)); - - VerifyOrReturn(CheckValueNonNull("nextCredentialIndex", nextCredentialIndex)); - VerifyOrReturn(CheckValue("nextCredentialIndex.Value()", nextCredentialIndex.Value(), 4U)); - - NextTest(); - } - - CHIP_ERROR TestReadTheUserBackAndMakeSurePinCredentialIsDeleted_68() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::GetUser::Type; - - RequestType request; - request.userIndex = 1U; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context)) - ->OnSuccessResponse_68(data.userIndex, data.userName, data.userUniqueId, data.userStatus, data.userType, - data.credentialRule, data.credentials, data.creatorFabricIndex, data.lastModifiedFabricIndex, - data.nextUserIndex); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_68(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_68(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_68( - uint16_t userIndex, const chip::app::DataModel::Nullable & userName, - const chip::app::DataModel::Nullable & userUniqueId, - const chip::app::DataModel::Nullable & userStatus, - const chip::app::DataModel::Nullable & userType, - const chip::app::DataModel::Nullable & credentialRule, - const chip::app::DataModel::Nullable< - chip::app::DataModel::DecodableList> & credentials, - const chip::app::DataModel::Nullable & creatorFabricIndex, - const chip::app::DataModel::Nullable & lastModifiedFabricIndex, - const chip::app::DataModel::Nullable & nextUserIndex) - { - VerifyOrReturn(CheckValue("userIndex", userIndex, 1U)); - - VerifyOrReturn(CheckValueNonNull("userName", userName)); - VerifyOrReturn(CheckValueAsString("userName.Value()", userName.Value(), chip::CharSpan("", 0))); - - VerifyOrReturn(CheckValueNull("userUniqueId", userUniqueId)); - - VerifyOrReturn(CheckValueNonNull("userStatus", userStatus)); - VerifyOrReturn(CheckValue("userStatus.Value()", userStatus.Value(), 1)); - - VerifyOrReturn(CheckValueNonNull("userType", userType)); - VerifyOrReturn(CheckValue("userType.Value()", userType.Value(), 0)); - - VerifyOrReturn(CheckValueNonNull("credentialRule", credentialRule)); - VerifyOrReturn(CheckValue("credentialRule.Value()", credentialRule.Value(), 0)); - - VerifyOrReturn(CheckValueNonNull("credentials", credentials)); - { - auto iter_1 = credentials.Value().begin(); - VerifyOrReturn(CheckNextListItemDecodes("credentials.Value()", iter_1, 0)); - VerifyOrReturn(CheckValue("credentials.Value()[0].credentialType", iter_1.GetValue().credentialType, 2)); - VerifyOrReturn(CheckValue("credentials.Value()[0].credentialIndex", iter_1.GetValue().credentialIndex, 2U)); - VerifyOrReturn(CheckNoMoreListItems("credentials.Value()", iter_1, 1)); - } - - VerifyOrReturn(CheckValueNonNull("creatorFabricIndex", creatorFabricIndex)); - VerifyOrReturn(CheckValue("creatorFabricIndex.Value()", creatorFabricIndex.Value(), 1)); - - VerifyOrReturn(CheckValueNonNull("lastModifiedFabricIndex", lastModifiedFabricIndex)); - VerifyOrReturn(CheckValue("lastModifiedFabricIndex.Value()", lastModifiedFabricIndex.Value(), 1)); - - VerifyOrReturn(CheckValueNonNull("nextUserIndex", nextUserIndex)); - VerifyOrReturn(CheckValue("nextUserIndex.Value()", nextUserIndex.Value(), 3U)); - - NextTest(); - } - - CHIP_ERROR TestClearTheSecondPinCredential_69() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::ClearCredential::Type; - - RequestType request; - request.credential.SetNonNull(); - - request.credential.Value().credentialType = static_cast(1); - request.credential.Value().credentialIndex = 3U; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_69(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_69(error); - }; - - ReturnErrorOnFailure( - chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request, 10000)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_69(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_69() { NextTest(); } - - CHIP_ERROR TestReadBackTheCredentialAndMakeSureItIsDeleted_70() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::GetCredentialStatus::Type; - - RequestType request; - - request.credential.credentialType = static_cast(1); - request.credential.credentialIndex = 3U; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context)) - ->OnSuccessResponse_70(data.credentialExists, data.userIndex, data.nextCredentialIndex); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_70(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_70(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_70(bool credentialExists, const chip::app::DataModel::Nullable & userIndex, - const chip::app::DataModel::Nullable & nextCredentialIndex) - { - VerifyOrReturn(CheckValue("credentialExists", credentialExists, false)); - - VerifyOrReturn(CheckValueNull("userIndex", userIndex)); - - VerifyOrReturn(CheckValueNonNull("nextCredentialIndex", nextCredentialIndex)); - VerifyOrReturn(CheckValue("nextCredentialIndex.Value()", nextCredentialIndex.Value(), 4U)); - - NextTest(); - } - - CHIP_ERROR TestReadTheUserBackAndMakeSureRelatedUserIsDeleted_71() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::GetUser::Type; - - RequestType request; - request.userIndex = 2U; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context)) - ->OnSuccessResponse_71(data.userIndex, data.userName, data.userUniqueId, data.userStatus, data.userType, - data.credentialRule, data.credentials, data.creatorFabricIndex, data.lastModifiedFabricIndex, - data.nextUserIndex); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_71(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_71(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_71( - uint16_t userIndex, const chip::app::DataModel::Nullable & userName, - const chip::app::DataModel::Nullable & userUniqueId, - const chip::app::DataModel::Nullable & userStatus, - const chip::app::DataModel::Nullable & userType, - const chip::app::DataModel::Nullable & credentialRule, - const chip::app::DataModel::Nullable< - chip::app::DataModel::DecodableList> & credentials, - const chip::app::DataModel::Nullable & creatorFabricIndex, - const chip::app::DataModel::Nullable & lastModifiedFabricIndex, - const chip::app::DataModel::Nullable & nextUserIndex) - { - VerifyOrReturn(CheckValue("userIndex", userIndex, 2U)); - - VerifyOrReturn(CheckValueNull("userName", userName)); - - VerifyOrReturn(CheckValueNull("userUniqueId", userUniqueId)); - - VerifyOrReturn(CheckValueNull("userStatus", userStatus)); - - VerifyOrReturn(CheckValueNull("userType", userType)); - - VerifyOrReturn(CheckValueNull("credentialRule", credentialRule)); - - VerifyOrReturn(CheckValueNull("credentials", credentials)); - - VerifyOrReturn(CheckValueNull("creatorFabricIndex", creatorFabricIndex)); - - VerifyOrReturn(CheckValueNull("lastModifiedFabricIndex", lastModifiedFabricIndex)); - - VerifyOrReturn(CheckValueNonNull("nextUserIndex", nextUserIndex)); - VerifyOrReturn(CheckValue("nextUserIndex.Value()", nextUserIndex.Value(), 3U)); - - NextTest(); - } - - CHIP_ERROR TestCreateNewRfidCredentialWithUser_72() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::SetCredential::Type; - - RequestType request; - request.operationType = static_cast(0); - - request.credential.credentialType = static_cast(2); - request.credential.credentialIndex = 1U; - - request.credentialData = - chip::ByteSpan(chip::Uint8::from_const_char("rfid_data_12345garbage: not in length on purpose"), 15); - request.userIndex.SetNull(); - request.userStatus.SetNull(); - request.userType.SetNull(); - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context)) - ->OnSuccessResponse_72(data.status, data.userIndex, data.nextCredentialIndex); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_72(error); - }; - - ReturnErrorOnFailure( - chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request, 10000)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_72(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_72(chip::app::Clusters::DoorLock::DlStatus status, - const chip::app::DataModel::Nullable & userIndex, - const chip::app::DataModel::Nullable & nextCredentialIndex) - { - VerifyOrReturn(CheckValue("status", status, 0)); - - VerifyOrReturn(CheckValueNonNull("userIndex", userIndex)); - VerifyOrReturn(CheckValue("userIndex.Value()", userIndex.Value(), 2U)); - - VerifyOrReturn(CheckValueNonNull("nextCredentialIndex", nextCredentialIndex)); - VerifyOrReturn(CheckValue("nextCredentialIndex.Value()", nextCredentialIndex.Value(), 3U)); - - NextTest(); - } - - CHIP_ERROR TestClearAllTheRfidCredentials_73() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::ClearCredential::Type; - - RequestType request; - request.credential.SetNonNull(); - - request.credential.Value().credentialType = static_cast(2); - request.credential.Value().credentialIndex = 65534U; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_73(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_73(error); - }; - - ReturnErrorOnFailure( - chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request, 10000)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_73(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_73() { NextTest(); } - - CHIP_ERROR TestReadBackTheFistRfidCredentialAndMakeSureItIsDeleted_74() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::GetCredentialStatus::Type; - - RequestType request; - - request.credential.credentialType = static_cast(2); - request.credential.credentialIndex = 1U; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context)) - ->OnSuccessResponse_74(data.credentialExists, data.userIndex, data.nextCredentialIndex); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_74(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_74(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_74(bool credentialExists, const chip::app::DataModel::Nullable & userIndex, - const chip::app::DataModel::Nullable & nextCredentialIndex) - { - VerifyOrReturn(CheckValue("credentialExists", credentialExists, false)); - - VerifyOrReturn(CheckValueNull("userIndex", userIndex)); - - VerifyOrReturn(CheckValueNonNull("nextCredentialIndex", nextCredentialIndex)); - VerifyOrReturn(CheckValue("nextCredentialIndex.Value()", nextCredentialIndex.Value(), 2U)); - - NextTest(); - } - - CHIP_ERROR TestReadBackTheSecondRfidCredentialAndMakeSureItIsDeleted_75() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::GetCredentialStatus::Type; - - RequestType request; - - request.credential.credentialType = static_cast(2); - request.credential.credentialIndex = 2U; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context)) - ->OnSuccessResponse_75(data.credentialExists, data.userIndex, data.nextCredentialIndex); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_75(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_75(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_75(bool credentialExists, const chip::app::DataModel::Nullable & userIndex, - const chip::app::DataModel::Nullable & nextCredentialIndex) - { - VerifyOrReturn(CheckValue("credentialExists", credentialExists, false)); - - VerifyOrReturn(CheckValueNull("userIndex", userIndex)); - - VerifyOrReturn(CheckValueNonNull("nextCredentialIndex", nextCredentialIndex)); - VerifyOrReturn(CheckValue("nextCredentialIndex.Value()", nextCredentialIndex.Value(), 3U)); - - NextTest(); - } - - CHIP_ERROR TestReadTheUserRelatedWithFirstRfidBackAndMakeSureItIsDeleted_76() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::GetUser::Type; - - RequestType request; - request.userIndex = 1U; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context)) - ->OnSuccessResponse_76(data.userIndex, data.userName, data.userUniqueId, data.userStatus, data.userType, - data.credentialRule, data.credentials, data.creatorFabricIndex, data.lastModifiedFabricIndex, - data.nextUserIndex); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_76(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_76(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_76( - uint16_t userIndex, const chip::app::DataModel::Nullable & userName, - const chip::app::DataModel::Nullable & userUniqueId, - const chip::app::DataModel::Nullable & userStatus, - const chip::app::DataModel::Nullable & userType, - const chip::app::DataModel::Nullable & credentialRule, - const chip::app::DataModel::Nullable< - chip::app::DataModel::DecodableList> & credentials, - const chip::app::DataModel::Nullable & creatorFabricIndex, - const chip::app::DataModel::Nullable & lastModifiedFabricIndex, - const chip::app::DataModel::Nullable & nextUserIndex) - { - VerifyOrReturn(CheckValue("userIndex", userIndex, 1U)); - - VerifyOrReturn(CheckValueNull("userName", userName)); - - VerifyOrReturn(CheckValueNull("userUniqueId", userUniqueId)); - - VerifyOrReturn(CheckValueNull("userStatus", userStatus)); - - VerifyOrReturn(CheckValueNull("userType", userType)); - - VerifyOrReturn(CheckValueNull("credentialRule", credentialRule)); - - VerifyOrReturn(CheckValueNull("credentials", credentials)); - - VerifyOrReturn(CheckValueNull("creatorFabricIndex", creatorFabricIndex)); - - VerifyOrReturn(CheckValueNull("lastModifiedFabricIndex", lastModifiedFabricIndex)); - - VerifyOrReturn(CheckValueNonNull("nextUserIndex", nextUserIndex)); - VerifyOrReturn(CheckValue("nextUserIndex.Value()", nextUserIndex.Value(), 2U)); - - NextTest(); - } - - CHIP_ERROR TestReadTheUserRelatedWithSecondRfidBackAndMakeSureItIsDeleted_77() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::GetUser::Type; - - RequestType request; - request.userIndex = 2U; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context)) - ->OnSuccessResponse_77(data.userIndex, data.userName, data.userUniqueId, data.userStatus, data.userType, - data.credentialRule, data.credentials, data.creatorFabricIndex, data.lastModifiedFabricIndex, - data.nextUserIndex); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_77(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_77(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_77( - uint16_t userIndex, const chip::app::DataModel::Nullable & userName, - const chip::app::DataModel::Nullable & userUniqueId, - const chip::app::DataModel::Nullable & userStatus, - const chip::app::DataModel::Nullable & userType, - const chip::app::DataModel::Nullable & credentialRule, - const chip::app::DataModel::Nullable< - chip::app::DataModel::DecodableList> & credentials, - const chip::app::DataModel::Nullable & creatorFabricIndex, - const chip::app::DataModel::Nullable & lastModifiedFabricIndex, - const chip::app::DataModel::Nullable & nextUserIndex) - { - VerifyOrReturn(CheckValue("userIndex", userIndex, 2U)); - - VerifyOrReturn(CheckValueNull("userName", userName)); - - VerifyOrReturn(CheckValueNull("userUniqueId", userUniqueId)); - - VerifyOrReturn(CheckValueNull("userStatus", userStatus)); - - VerifyOrReturn(CheckValueNull("userType", userType)); - - VerifyOrReturn(CheckValueNull("credentialRule", credentialRule)); - - VerifyOrReturn(CheckValueNull("credentials", credentials)); - - VerifyOrReturn(CheckValueNull("creatorFabricIndex", creatorFabricIndex)); - - VerifyOrReturn(CheckValueNull("lastModifiedFabricIndex", lastModifiedFabricIndex)); - - VerifyOrReturn(CheckValueNonNull("nextUserIndex", nextUserIndex)); - VerifyOrReturn(CheckValue("nextUserIndex.Value()", nextUserIndex.Value(), 3U)); - - NextTest(); - } - - CHIP_ERROR TestCreateNewPinCredentialWithUser_78() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::SetCredential::Type; - - RequestType request; - request.operationType = static_cast(0); - - request.credential.credentialType = static_cast(1); - request.credential.credentialIndex = 1U; - - request.credentialData = chip::ByteSpan(chip::Uint8::from_const_char("123456garbage: not in length on purpose"), 6); - request.userIndex.SetNull(); - request.userStatus.SetNull(); - request.userType.SetNull(); - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context)) - ->OnSuccessResponse_78(data.status, data.userIndex, data.nextCredentialIndex); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_78(error); - }; - - ReturnErrorOnFailure( - chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request, 10000)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_78(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_78(chip::app::Clusters::DoorLock::DlStatus status, - const chip::app::DataModel::Nullable & userIndex, - const chip::app::DataModel::Nullable & nextCredentialIndex) - { - VerifyOrReturn(CheckValue("status", status, 0)); - - VerifyOrReturn(CheckValueNonNull("userIndex", userIndex)); - VerifyOrReturn(CheckValue("userIndex.Value()", userIndex.Value(), 1U)); - - VerifyOrReturn(CheckValueNonNull("nextCredentialIndex", nextCredentialIndex)); - VerifyOrReturn(CheckValue("nextCredentialIndex.Value()", nextCredentialIndex.Value(), 2U)); - - NextTest(); - } - - CHIP_ERROR TestCreateNewRfidCredentialWithUser_79() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::SetCredential::Type; - - RequestType request; - request.operationType = static_cast(0); - - request.credential.credentialType = static_cast(2); - request.credential.credentialIndex = 2U; - - request.credentialData = - chip::ByteSpan(chip::Uint8::from_const_char("rfid_data_1234garbage: not in length on purpose"), 14); - request.userIndex.SetNull(); - request.userStatus.SetNull(); - request.userType.SetNull(); - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context)) - ->OnSuccessResponse_79(data.status, data.userIndex, data.nextCredentialIndex); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_79(error); - }; - - ReturnErrorOnFailure( - chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request, 10000)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_79(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_79(chip::app::Clusters::DoorLock::DlStatus status, - const chip::app::DataModel::Nullable & userIndex, - const chip::app::DataModel::Nullable & nextCredentialIndex) - { - VerifyOrReturn(CheckValue("status", status, 0)); - - VerifyOrReturn(CheckValueNonNull("userIndex", userIndex)); - VerifyOrReturn(CheckValue("userIndex.Value()", userIndex.Value(), 2U)); - - VerifyOrReturn(CheckValueNonNull("nextCredentialIndex", nextCredentialIndex)); - VerifyOrReturn(CheckValue("nextCredentialIndex.Value()", nextCredentialIndex.Value(), 3U)); - - NextTest(); - } - - CHIP_ERROR TestCreateAnotherRfidCredentialWithUser_80() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::SetCredential::Type; - - RequestType request; - request.operationType = static_cast(0); - - request.credential.credentialType = static_cast(2); - request.credential.credentialIndex = 6U; - - request.credentialData = - chip::ByteSpan(chip::Uint8::from_const_char("rfid_data_9876garbage: not in length on purpose"), 14); - request.userIndex.SetNull(); - request.userStatus.SetNull(); - request.userType.SetNull(); - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context)) - ->OnSuccessResponse_80(data.status, data.userIndex, data.nextCredentialIndex); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_80(error); - }; - - ReturnErrorOnFailure( - chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request, 10000)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_80(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_80(chip::app::Clusters::DoorLock::DlStatus status, - const chip::app::DataModel::Nullable & userIndex, - const chip::app::DataModel::Nullable & nextCredentialIndex) - { - VerifyOrReturn(CheckValue("status", status, 0)); - - VerifyOrReturn(CheckValueNonNull("userIndex", userIndex)); - VerifyOrReturn(CheckValue("userIndex.Value()", userIndex.Value(), 3U)); - - VerifyOrReturn(CheckValueNonNull("nextCredentialIndex", nextCredentialIndex)); - VerifyOrReturn(CheckValue("nextCredentialIndex.Value()", nextCredentialIndex.Value(), 7U)); - - NextTest(); - } - - CHIP_ERROR TestClearAllTheCredentials_81() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::ClearCredential::Type; - - RequestType request; - request.credential.SetNull(); - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_81(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_81(error); - }; - - ReturnErrorOnFailure( - chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request, 10000)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_81(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_81() { NextTest(); } - - CHIP_ERROR TestReadBackTheFirstPinCredentialAndMakeSureItIsDeleted_82() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::GetCredentialStatus::Type; - - RequestType request; - - request.credential.credentialType = static_cast(1); - request.credential.credentialIndex = 1U; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context)) - ->OnSuccessResponse_82(data.credentialExists, data.userIndex, data.nextCredentialIndex); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_82(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_82(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_82(bool credentialExists, const chip::app::DataModel::Nullable & userIndex, - const chip::app::DataModel::Nullable & nextCredentialIndex) - { - VerifyOrReturn(CheckValue("credentialExists", credentialExists, false)); - - VerifyOrReturn(CheckValueNull("userIndex", userIndex)); - - VerifyOrReturn(CheckValueNonNull("nextCredentialIndex", nextCredentialIndex)); - VerifyOrReturn(CheckValue("nextCredentialIndex.Value()", nextCredentialIndex.Value(), 2U)); - - NextTest(); - } - - CHIP_ERROR TestReadBackTheFirstRfidCredentialAndMakeSureItIsDeleted_83() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::GetCredentialStatus::Type; - - RequestType request; - - request.credential.credentialType = static_cast(2); - request.credential.credentialIndex = 2U; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context)) - ->OnSuccessResponse_83(data.credentialExists, data.userIndex, data.nextCredentialIndex); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_83(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_83(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_83(bool credentialExists, const chip::app::DataModel::Nullable & userIndex, - const chip::app::DataModel::Nullable & nextCredentialIndex) - { - VerifyOrReturn(CheckValue("credentialExists", credentialExists, false)); - - VerifyOrReturn(CheckValueNull("userIndex", userIndex)); - - VerifyOrReturn(CheckValueNonNull("nextCredentialIndex", nextCredentialIndex)); - VerifyOrReturn(CheckValue("nextCredentialIndex.Value()", nextCredentialIndex.Value(), 3U)); - - NextTest(); - } - - CHIP_ERROR TestReadBackTheSecondPinCredentialAndMakeSureItIsDeleted_84() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::GetCredentialStatus::Type; - - RequestType request; - - request.credential.credentialType = static_cast(1); - request.credential.credentialIndex = 6U; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context)) - ->OnSuccessResponse_84(data.credentialExists, data.userIndex, data.nextCredentialIndex); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_84(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_84(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_84(bool credentialExists, const chip::app::DataModel::Nullable & userIndex, - const chip::app::DataModel::Nullable & nextCredentialIndex) - { - VerifyOrReturn(CheckValue("credentialExists", credentialExists, false)); - - VerifyOrReturn(CheckValueNull("userIndex", userIndex)); - - VerifyOrReturn(CheckValueNonNull("nextCredentialIndex", nextCredentialIndex)); - VerifyOrReturn(CheckValue("nextCredentialIndex.Value()", nextCredentialIndex.Value(), 7U)); - - NextTest(); - } - - CHIP_ERROR TestReadTheUserRelatedWithFirstPinBackAndMakeSureItIsDeleted_85() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::GetUser::Type; - - RequestType request; - request.userIndex = 1U; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context)) - ->OnSuccessResponse_85(data.userIndex, data.userName, data.userUniqueId, data.userStatus, data.userType, - data.credentialRule, data.credentials, data.creatorFabricIndex, data.lastModifiedFabricIndex, - data.nextUserIndex); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_85(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_85(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_85( - uint16_t userIndex, const chip::app::DataModel::Nullable & userName, - const chip::app::DataModel::Nullable & userUniqueId, - const chip::app::DataModel::Nullable & userStatus, - const chip::app::DataModel::Nullable & userType, - const chip::app::DataModel::Nullable & credentialRule, - const chip::app::DataModel::Nullable< - chip::app::DataModel::DecodableList> & credentials, - const chip::app::DataModel::Nullable & creatorFabricIndex, - const chip::app::DataModel::Nullable & lastModifiedFabricIndex, - const chip::app::DataModel::Nullable & nextUserIndex) - { - VerifyOrReturn(CheckValue("userIndex", userIndex, 1U)); - - VerifyOrReturn(CheckValueNull("userName", userName)); - - VerifyOrReturn(CheckValueNull("userUniqueId", userUniqueId)); - - VerifyOrReturn(CheckValueNull("userStatus", userStatus)); - - VerifyOrReturn(CheckValueNull("userType", userType)); - - VerifyOrReturn(CheckValueNull("credentialRule", credentialRule)); - - VerifyOrReturn(CheckValueNull("credentials", credentials)); - - VerifyOrReturn(CheckValueNull("creatorFabricIndex", creatorFabricIndex)); - - VerifyOrReturn(CheckValueNull("lastModifiedFabricIndex", lastModifiedFabricIndex)); - - VerifyOrReturn(CheckValueNonNull("nextUserIndex", nextUserIndex)); - VerifyOrReturn(CheckValue("nextUserIndex.Value()", nextUserIndex.Value(), 2U)); - - NextTest(); - } - - CHIP_ERROR TestReadTheUserRelatedWithFirstRfidBackAndMakeSureItIsDeleted_86() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::GetUser::Type; - - RequestType request; - request.userIndex = 2U; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context)) - ->OnSuccessResponse_86(data.userIndex, data.userName, data.userUniqueId, data.userStatus, data.userType, - data.credentialRule, data.credentials, data.creatorFabricIndex, data.lastModifiedFabricIndex, - data.nextUserIndex); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_86(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_86(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_86( - uint16_t userIndex, const chip::app::DataModel::Nullable & userName, - const chip::app::DataModel::Nullable & userUniqueId, - const chip::app::DataModel::Nullable & userStatus, - const chip::app::DataModel::Nullable & userType, - const chip::app::DataModel::Nullable & credentialRule, - const chip::app::DataModel::Nullable< - chip::app::DataModel::DecodableList> & credentials, - const chip::app::DataModel::Nullable & creatorFabricIndex, - const chip::app::DataModel::Nullable & lastModifiedFabricIndex, - const chip::app::DataModel::Nullable & nextUserIndex) - { - VerifyOrReturn(CheckValue("userIndex", userIndex, 2U)); - - VerifyOrReturn(CheckValueNull("userName", userName)); - - VerifyOrReturn(CheckValueNull("userUniqueId", userUniqueId)); - - VerifyOrReturn(CheckValueNull("userStatus", userStatus)); - - VerifyOrReturn(CheckValueNull("userType", userType)); - - VerifyOrReturn(CheckValueNull("credentialRule", credentialRule)); - - VerifyOrReturn(CheckValueNull("credentials", credentials)); - - VerifyOrReturn(CheckValueNull("creatorFabricIndex", creatorFabricIndex)); - - VerifyOrReturn(CheckValueNull("lastModifiedFabricIndex", lastModifiedFabricIndex)); - - VerifyOrReturn(CheckValueNonNull("nextUserIndex", nextUserIndex)); - VerifyOrReturn(CheckValue("nextUserIndex.Value()", nextUserIndex.Value(), 3U)); - - NextTest(); - } - - CHIP_ERROR TestReadTheUserRelatedWithSecondPinBackAndMakeSureItIsDeleted_87() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::GetUser::Type; - - RequestType request; - request.userIndex = 3U; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context)) - ->OnSuccessResponse_87(data.userIndex, data.userName, data.userUniqueId, data.userStatus, data.userType, - data.credentialRule, data.credentials, data.creatorFabricIndex, data.lastModifiedFabricIndex, - data.nextUserIndex); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_87(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_87(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_87( - uint16_t userIndex, const chip::app::DataModel::Nullable & userName, - const chip::app::DataModel::Nullable & userUniqueId, - const chip::app::DataModel::Nullable & userStatus, - const chip::app::DataModel::Nullable & userType, - const chip::app::DataModel::Nullable & credentialRule, - const chip::app::DataModel::Nullable< - chip::app::DataModel::DecodableList> & credentials, - const chip::app::DataModel::Nullable & creatorFabricIndex, - const chip::app::DataModel::Nullable & lastModifiedFabricIndex, - const chip::app::DataModel::Nullable & nextUserIndex) - { - VerifyOrReturn(CheckValue("userIndex", userIndex, 3U)); - - VerifyOrReturn(CheckValueNull("userName", userName)); - - VerifyOrReturn(CheckValueNull("userUniqueId", userUniqueId)); - - VerifyOrReturn(CheckValueNull("userStatus", userStatus)); - - VerifyOrReturn(CheckValueNull("userType", userType)); - - VerifyOrReturn(CheckValueNull("credentialRule", credentialRule)); - - VerifyOrReturn(CheckValueNull("credentials", credentials)); - - VerifyOrReturn(CheckValueNull("creatorFabricIndex", creatorFabricIndex)); - - VerifyOrReturn(CheckValueNull("lastModifiedFabricIndex", lastModifiedFabricIndex)); - - VerifyOrReturn(CheckValueNonNull("nextUserIndex", nextUserIndex)); - VerifyOrReturn(CheckValue("nextUserIndex.Value()", nextUserIndex.Value(), 4U)); - - NextTest(); - } - - CHIP_ERROR TestCreateNewProgrammingPinCredentialWithInvalidIndex_88() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::SetCredential::Type; - - RequestType request; - request.operationType = static_cast(0); - - request.credential.credentialType = static_cast(0); - request.credential.credentialIndex = 1U; - - request.credentialData = chip::ByteSpan(chip::Uint8::from_const_char("123456garbage: not in length on purpose"), 6); - request.userIndex.SetNull(); - request.userStatus.SetNull(); - request.userType.SetNull(); - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context)) - ->OnSuccessResponse_88(data.status, data.userIndex, data.nextCredentialIndex); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_88(error); - }; - - ReturnErrorOnFailure( - chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request, 10000)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_88(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_88(chip::app::Clusters::DoorLock::DlStatus status, - const chip::app::DataModel::Nullable & userIndex, - const chip::app::DataModel::Nullable & nextCredentialIndex) - { - VerifyOrReturn(CheckValue("status", status, 133)); - - VerifyOrReturn(CheckValueNull("userIndex", userIndex)); - - VerifyOrReturn(CheckValueNull("nextCredentialIndex", nextCredentialIndex)); - - NextTest(); - } - - CHIP_ERROR TestCreateNewProgrammingPinCredentialWithValidIndex_89() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::SetCredential::Type; - - RequestType request; - request.operationType = static_cast(0); - - request.credential.credentialType = static_cast(0); - request.credential.credentialIndex = 0U; - - request.credentialData = chip::ByteSpan(chip::Uint8::from_const_char("123456garbage: not in length on purpose"), 6); - request.userIndex.SetNull(); - request.userStatus.SetNull(); - request.userType.SetNull(); - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context)) - ->OnSuccessResponse_89(data.status, data.userIndex, data.nextCredentialIndex); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_89(error); - }; - - ReturnErrorOnFailure( - chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request, 10000)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_89(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_89(chip::app::Clusters::DoorLock::DlStatus status, - const chip::app::DataModel::Nullable & userIndex, - const chip::app::DataModel::Nullable & nextCredentialIndex) - { - VerifyOrReturn(CheckValue("status", status, 0)); - - VerifyOrReturn(CheckValueNonNull("userIndex", userIndex)); - VerifyOrReturn(CheckValue("userIndex.Value()", userIndex.Value(), 1U)); - - VerifyOrReturn(CheckValueNull("nextCredentialIndex", nextCredentialIndex)); - - NextTest(); - } - - CHIP_ERROR TestVerifyCreatedUser_90() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::GetUser::Type; - - RequestType request; - request.userIndex = 1U; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context)) - ->OnSuccessResponse_90(data.userIndex, data.userName, data.userUniqueId, data.userStatus, data.userType, - data.credentialRule, data.credentials, data.creatorFabricIndex, data.lastModifiedFabricIndex, - data.nextUserIndex); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_90(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_90(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_90( - uint16_t userIndex, const chip::app::DataModel::Nullable & userName, - const chip::app::DataModel::Nullable & userUniqueId, - const chip::app::DataModel::Nullable & userStatus, - const chip::app::DataModel::Nullable & userType, - const chip::app::DataModel::Nullable & credentialRule, - const chip::app::DataModel::Nullable< - chip::app::DataModel::DecodableList> & credentials, - const chip::app::DataModel::Nullable & creatorFabricIndex, - const chip::app::DataModel::Nullable & lastModifiedFabricIndex, - const chip::app::DataModel::Nullable & nextUserIndex) - { - VerifyOrReturn(CheckValue("userIndex", userIndex, 1U)); - - VerifyOrReturn(CheckValueNonNull("userName", userName)); - VerifyOrReturn(CheckValueAsString("userName.Value()", userName.Value(), chip::CharSpan("", 0))); - - VerifyOrReturn(CheckValueNull("userUniqueId", userUniqueId)); - - VerifyOrReturn(CheckValueNonNull("userStatus", userStatus)); - VerifyOrReturn(CheckValue("userStatus.Value()", userStatus.Value(), 1)); - - VerifyOrReturn(CheckValueNonNull("userType", userType)); - VerifyOrReturn(CheckValue("userType.Value()", userType.Value(), 0)); - - VerifyOrReturn(CheckValueNonNull("credentialRule", credentialRule)); - VerifyOrReturn(CheckValue("credentialRule.Value()", credentialRule.Value(), 0)); - - VerifyOrReturn(CheckValueNonNull("credentials", credentials)); - { - auto iter_1 = credentials.Value().begin(); - VerifyOrReturn(CheckNextListItemDecodes("credentials.Value()", iter_1, 0)); - VerifyOrReturn(CheckValue("credentials.Value()[0].credentialType", iter_1.GetValue().credentialType, 0)); - VerifyOrReturn(CheckValue("credentials.Value()[0].credentialIndex", iter_1.GetValue().credentialIndex, 0U)); - VerifyOrReturn(CheckNoMoreListItems("credentials.Value()", iter_1, 1)); - } - - VerifyOrReturn(CheckValueNonNull("creatorFabricIndex", creatorFabricIndex)); - VerifyOrReturn(CheckValue("creatorFabricIndex.Value()", creatorFabricIndex.Value(), 1)); - - VerifyOrReturn(CheckValueNonNull("lastModifiedFabricIndex", lastModifiedFabricIndex)); - VerifyOrReturn(CheckValue("lastModifiedFabricIndex.Value()", lastModifiedFabricIndex.Value(), 1)); - - VerifyOrReturn(CheckValueNonNull("nextUserIndex", nextUserIndex)); - VerifyOrReturn(CheckValue("nextUserIndex.Value()", nextUserIndex.Value(), 2U)); - - NextTest(); - } - - CHIP_ERROR TestVerifyCreatedProgrammingPinCredential_91() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::GetCredentialStatus::Type; - - RequestType request; - - request.credential.credentialType = static_cast(0); - request.credential.credentialIndex = 0U; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context)) - ->OnSuccessResponse_91(data.credentialExists, data.userIndex, data.nextCredentialIndex); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_91(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_91(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_91(bool credentialExists, const chip::app::DataModel::Nullable & userIndex, - const chip::app::DataModel::Nullable & nextCredentialIndex) - { - VerifyOrReturn(CheckValue("credentialExists", credentialExists, true)); - - VerifyOrReturn(CheckValueNonNull("userIndex", userIndex)); - VerifyOrReturn(CheckValue("userIndex.Value()", userIndex.Value(), 1U)); - - VerifyOrReturn(CheckValueNull("nextCredentialIndex", nextCredentialIndex)); - - NextTest(); - } - - CHIP_ERROR TestModifyTheProgrammingPinCredential_92() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::SetCredential::Type; - - RequestType request; - request.operationType = static_cast(2); - - request.credential.credentialType = static_cast(0); - request.credential.credentialIndex = 0U; - - request.credentialData = chip::ByteSpan(chip::Uint8::from_const_char("654321garbage: not in length on purpose"), 6); - request.userIndex.SetNull(); - request.userStatus.SetNull(); - request.userType.SetNull(); - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context)) - ->OnSuccessResponse_92(data.status, data.userIndex, data.nextCredentialIndex); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_92(error); - }; - - ReturnErrorOnFailure( - chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request, 10000)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_92(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_92(chip::app::Clusters::DoorLock::DlStatus status, - const chip::app::DataModel::Nullable & userIndex, - const chip::app::DataModel::Nullable & nextCredentialIndex) - { - VerifyOrReturn(CheckValue("status", status, 0)); - - VerifyOrReturn(CheckValueNull("userIndex", userIndex)); - - VerifyOrReturn(CheckValueNull("nextCredentialIndex", nextCredentialIndex)); - - NextTest(); - } - - CHIP_ERROR TestClearingProgrammingPinFails_93() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::ClearCredential::Type; - - RequestType request; - request.credential.SetNonNull(); - - request.credential.Value().credentialType = static_cast(0); - request.credential.Value().credentialIndex = 0U; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_93(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_93(error); - }; - - ReturnErrorOnFailure( - chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request, 10000)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_93(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_COMMAND)); - NextTest(); - } - - void OnSuccessResponse_93() { ThrowSuccessResponse(); } - - CHIP_ERROR TestClearingProgrammingPinWithInvalidIndexFails_94() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::ClearCredential::Type; - - RequestType request; - request.credential.SetNonNull(); - - request.credential.Value().credentialType = static_cast(0); - request.credential.Value().credentialIndex = 1U; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_94(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_94(error); - }; - - ReturnErrorOnFailure( - chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request, 10000)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_94(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_COMMAND)); - NextTest(); - } - - void OnSuccessResponse_94() { ThrowSuccessResponse(); } - - CHIP_ERROR TestClearingPinCredentialWithZeroIndexFails_95() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::ClearCredential::Type; - - RequestType request; - request.credential.SetNonNull(); - - request.credential.Value().credentialType = static_cast(1); - request.credential.Value().credentialIndex = 0U; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_95(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_95(error); - }; - - ReturnErrorOnFailure( - chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request, 10000)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_95(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_COMMAND)); - NextTest(); - } - - void OnSuccessResponse_95() { ThrowSuccessResponse(); } - - CHIP_ERROR TestClearingPinCredentialWithOutOfBoundIndexFails_96() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::ClearCredential::Type; - - RequestType request; - request.credential.SetNonNull(); - - request.credential.Value().credentialType = static_cast(1); - request.credential.Value().credentialIndex = static_cast(NumberOfPINUsersSupported + 1); - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_96(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_96(error); - }; - - ReturnErrorOnFailure( - chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request, 10000)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_96(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_COMMAND)); - NextTest(); - } - - void OnSuccessResponse_96() { ThrowSuccessResponse(); } - - CHIP_ERROR TestClearingRfidCredentialWithZeroIndexFails_97() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::ClearCredential::Type; - - RequestType request; - request.credential.SetNonNull(); - - request.credential.Value().credentialType = static_cast(2); - request.credential.Value().credentialIndex = 0U; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_97(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_97(error); - }; - - ReturnErrorOnFailure( - chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request, 10000)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_97(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_COMMAND)); - NextTest(); - } - - void OnSuccessResponse_97() { ThrowSuccessResponse(); } - - CHIP_ERROR TestClearingRfidCredentialWithOutOfBoundIndexFails_98() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::ClearCredential::Type; - - RequestType request; - request.credential.SetNonNull(); - - request.credential.Value().credentialType = static_cast(2); - request.credential.Value().credentialIndex = static_cast(NumberOfRFIDUsersSupported + 1); - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_98(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_98(error); - }; - - ReturnErrorOnFailure( - chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request, 10000)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_98(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_COMMAND)); - NextTest(); - } - - void OnSuccessResponse_98() { ThrowSuccessResponse(); } - - CHIP_ERROR TestClearTheProgrammingPinUser_99() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::ClearUser::Type; - - RequestType request; - request.userIndex = 1U; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_99(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_99(error); - }; - - ReturnErrorOnFailure( - chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request, 10000)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_99(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_99() { NextTest(); } - - CHIP_ERROR TestMakeSureProgrammingPinUserIsDeleted_100() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::GetUser::Type; - - RequestType request; - request.userIndex = 1U; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context)) - ->OnSuccessResponse_100(data.userIndex, data.userName, data.userUniqueId, data.userStatus, data.userType, - data.credentialRule, data.credentials, data.creatorFabricIndex, - data.lastModifiedFabricIndex, data.nextUserIndex); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_100(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_100(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_100( - uint16_t userIndex, const chip::app::DataModel::Nullable & userName, - const chip::app::DataModel::Nullable & userUniqueId, - const chip::app::DataModel::Nullable & userStatus, - const chip::app::DataModel::Nullable & userType, - const chip::app::DataModel::Nullable & credentialRule, - const chip::app::DataModel::Nullable< - chip::app::DataModel::DecodableList> & credentials, - const chip::app::DataModel::Nullable & creatorFabricIndex, - const chip::app::DataModel::Nullable & lastModifiedFabricIndex, - const chip::app::DataModel::Nullable & nextUserIndex) - { - VerifyOrReturn(CheckValue("userIndex", userIndex, 1U)); - - VerifyOrReturn(CheckValueNull("userName", userName)); - - VerifyOrReturn(CheckValueNull("userUniqueId", userUniqueId)); - - VerifyOrReturn(CheckValueNull("userStatus", userStatus)); - - VerifyOrReturn(CheckValueNull("userType", userType)); - - VerifyOrReturn(CheckValueNull("credentialRule", credentialRule)); - - VerifyOrReturn(CheckValueNull("credentials", credentials)); - - VerifyOrReturn(CheckValueNull("creatorFabricIndex", creatorFabricIndex)); - - VerifyOrReturn(CheckValueNull("lastModifiedFabricIndex", lastModifiedFabricIndex)); - - VerifyOrReturn(CheckValueNonNull("nextUserIndex", nextUserIndex)); - VerifyOrReturn(CheckValue("nextUserIndex.Value()", nextUserIndex.Value(), 2U)); - - NextTest(); - } - - CHIP_ERROR TestMakeSureProgrammingPinCredentialIsDeleted_101() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::GetCredentialStatus::Type; - - RequestType request; - - request.credential.credentialType = static_cast(0); - request.credential.credentialIndex = 0U; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context)) - ->OnSuccessResponse_101(data.credentialExists, data.userIndex, data.nextCredentialIndex); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_101(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_101(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_101(bool credentialExists, const chip::app::DataModel::Nullable & userIndex, - const chip::app::DataModel::Nullable & nextCredentialIndex) - { - VerifyOrReturn(CheckValue("credentialExists", credentialExists, false)); - - VerifyOrReturn(CheckValueNull("userIndex", userIndex)); - - VerifyOrReturn(CheckValueNull("nextCredentialIndex", nextCredentialIndex)); - - NextTest(); - } -}; - -class DL_LockUnlockSuite : public TestCommand -{ -public: - DL_LockUnlockSuite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("DL_LockUnlock", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~DL_LockUnlockSuite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: DL_LockUnlock\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: DL_LockUnlock\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Create new PIN credential and lock/unlock user\n"); - err = TestCreateNewPinCredentialAndLockUnlockUser_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Try to unlock the door with invalid PIN\n"); - err = TestTryToUnlockTheDoorWithInvalidPin_2(); - break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Verify that lock state attribute value is set to Locked\n"); - err = TestVerifyThatLockStateAttributeValueIsSetToLocked_3(); - break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Try to unlock the door with valid PIN\n"); - err = TestTryToUnlockTheDoorWithValidPin_4(); - break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Verify that lock state attribute value is set to Unlocked\n"); - err = TestVerifyThatLockStateAttributeValueIsSetToUnlocked_5(); - break; - case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : Try to lock the door with invalid PIN\n"); - err = TestTryToLockTheDoorWithInvalidPin_6(); - break; - case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : Verify that lock state attribute value is set to Unlocked\n"); - err = TestVerifyThatLockStateAttributeValueIsSetToUnlocked_7(); - break; - case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : Try to unlock the door with valid PIN\n"); - err = TestTryToUnlockTheDoorWithValidPin_8(); - break; - case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : Verify that lock state attribute value is set to Locked\n"); - err = TestVerifyThatLockStateAttributeValueIsSetToLocked_9(); - break; - case 10: - ChipLogProgress(chipTool, " ***** Test Step 10 : Clean the created credential\n"); - err = TestCleanTheCreatedCredential_10(); - break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 11; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - static void OnFailureCallback_3(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_3(error); - } - - static void OnSuccessCallback_3(void * context, - const chip::app::DataModel::Nullable & lockState) - { - (static_cast(context))->OnSuccessResponse_3(lockState); - } - - static void OnFailureCallback_5(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_5(error); - } - - static void OnSuccessCallback_5(void * context, - const chip::app::DataModel::Nullable & lockState) - { - (static_cast(context))->OnSuccessResponse_5(lockState); - } - - static void OnFailureCallback_7(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_7(error); - } - - static void OnSuccessCallback_7(void * context, - const chip::app::DataModel::Nullable & lockState) - { - (static_cast(context))->OnSuccessResponse_7(lockState); - } - - static void OnFailureCallback_9(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_9(error); - } - - static void OnSuccessCallback_9(void * context, - const chip::app::DataModel::Nullable & lockState) - { - (static_cast(context))->OnSuccessResponse_9(lockState); - } - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestCreateNewPinCredentialAndLockUnlockUser_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::SetCredential::Type; - - RequestType request; - request.operationType = static_cast(0); - - request.credential.credentialType = static_cast(1); - request.credential.credentialIndex = 1U; - - request.credentialData = chip::ByteSpan(chip::Uint8::from_const_char("123456garbage: not in length on purpose"), 6); - request.userIndex.SetNull(); - request.userStatus.SetNull(); - request.userType.SetNull(); - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context)) - ->OnSuccessResponse_1(data.status, data.userIndex, data.nextCredentialIndex); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_1(error); - }; - - ReturnErrorOnFailure( - chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request, 10000)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_1(chip::app::Clusters::DoorLock::DlStatus status, - const chip::app::DataModel::Nullable & userIndex, - const chip::app::DataModel::Nullable & nextCredentialIndex) - { - VerifyOrReturn(CheckValue("status", status, 0)); - - VerifyOrReturn(CheckValueNonNull("userIndex", userIndex)); - VerifyOrReturn(CheckValue("userIndex.Value()", userIndex.Value(), 1U)); - - VerifyOrReturn(CheckValueNonNull("nextCredentialIndex", nextCredentialIndex)); - VerifyOrReturn(CheckValue("nextCredentialIndex.Value()", nextCredentialIndex.Value(), 2U)); - - NextTest(); - } - - CHIP_ERROR TestTryToUnlockTheDoorWithInvalidPin_2() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::UnlockDoor::Type; - - RequestType request; - request.pinCode.Emplace(); - request.pinCode.Value() = chip::ByteSpan(chip::Uint8::from_const_char("000000garbage: not in length on purpose"), 6); - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_2(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_2(error); - }; - - ReturnErrorOnFailure( - chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request, 10000)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_2(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); - NextTest(); - } - - void OnSuccessResponse_2() { ThrowSuccessResponse(); } - - CHIP_ERROR TestVerifyThatLockStateAttributeValueIsSetToLocked_3() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::DoorLockClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_3, OnFailureCallback_3, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_3(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_3(const chip::app::DataModel::Nullable & lockState) - { - VerifyOrReturn(CheckValueNonNull("lockState", lockState)); - VerifyOrReturn(CheckValue("lockState.Value()", lockState.Value(), 1)); - - NextTest(); - } - - CHIP_ERROR TestTryToUnlockTheDoorWithValidPin_4() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::UnlockDoor::Type; - - RequestType request; - request.pinCode.Emplace(); - request.pinCode.Value() = chip::ByteSpan(chip::Uint8::from_const_char("123456garbage: not in length on purpose"), 6); - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_4(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_4(error); - }; - - ReturnErrorOnFailure( - chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request, 10000)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_4(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_4() { NextTest(); } - - CHIP_ERROR TestVerifyThatLockStateAttributeValueIsSetToUnlocked_5() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::DoorLockClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_5, OnFailureCallback_5, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_5(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_5(const chip::app::DataModel::Nullable & lockState) - { - VerifyOrReturn(CheckValueNonNull("lockState", lockState)); - VerifyOrReturn(CheckValue("lockState.Value()", lockState.Value(), 2)); - - NextTest(); - } - - CHIP_ERROR TestTryToLockTheDoorWithInvalidPin_6() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::LockDoor::Type; - - RequestType request; - request.pinCode.Emplace(); - request.pinCode.Value() = chip::ByteSpan(chip::Uint8::from_const_char("000000garbage: not in length on purpose"), 6); - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_6(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_6(error); - }; - - ReturnErrorOnFailure( - chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request, 10000)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_6(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); - NextTest(); - } - - void OnSuccessResponse_6() { ThrowSuccessResponse(); } - - CHIP_ERROR TestVerifyThatLockStateAttributeValueIsSetToUnlocked_7() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::DoorLockClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_7, OnFailureCallback_7, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_7(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_7(const chip::app::DataModel::Nullable & lockState) - { - VerifyOrReturn(CheckValueNonNull("lockState", lockState)); - VerifyOrReturn(CheckValue("lockState.Value()", lockState.Value(), 2)); - - NextTest(); - } - - CHIP_ERROR TestTryToUnlockTheDoorWithValidPin_8() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::LockDoor::Type; - - RequestType request; - request.pinCode.Emplace(); - request.pinCode.Value() = chip::ByteSpan(chip::Uint8::from_const_char("123456garbage: not in length on purpose"), 6); - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_8(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_8(error); - }; - - ReturnErrorOnFailure( - chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request, 10000)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_8(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_8() { NextTest(); } - - CHIP_ERROR TestVerifyThatLockStateAttributeValueIsSetToLocked_9() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::DoorLockClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_9, OnFailureCallback_9, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_9(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_9(const chip::app::DataModel::Nullable & lockState) - { - VerifyOrReturn(CheckValueNonNull("lockState", lockState)); - VerifyOrReturn(CheckValue("lockState.Value()", lockState.Value(), 1)); - - NextTest(); - } - - CHIP_ERROR TestCleanTheCreatedCredential_10() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::ClearCredential::Type; - - RequestType request; - request.credential.SetNonNull(); - - request.credential.Value().credentialType = static_cast(1); - request.credential.Value().credentialIndex = 1U; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_10(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_10(error); - }; - - ReturnErrorOnFailure( - chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request, 10000)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_10(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_10() { NextTest(); } -}; - -class DL_SchedulesSuite : public TestCommand -{ -public: - DL_SchedulesSuite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("DL_Schedules", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~DL_SchedulesSuite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: DL_Schedules\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: DL_Schedules\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Create new PIN credential and schedule user\n"); - err = TestCreateNewPinCredentialAndScheduleUser_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Get number of supported users\n"); - err = TestGetNumberOfSupportedUsers_2(); - break; - case 3: - ChipLogProgress(chipTool, - " ***** Test Step 3 : Get Max number of Week Day schedules for user and verify default value\n"); - err = TestGetMaxNumberOfWeekDaySchedulesForUserAndVerifyDefaultValue_3(); - break; - case 4: - ChipLogProgress(chipTool, - " ***** Test Step 4 : Get Max number of Year Day schedules for user and verify default value\n"); - err = TestGetMaxNumberOfYearDaySchedulesForUserAndVerifyDefaultValue_4(); - break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Create Week Day schedule with 0 index\n"); - err = TestCreateWeekDayScheduleWith0Index_5(); - break; - case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : Create Week Day schedule with out-of-bounds index\n"); - err = TestCreateWeekDayScheduleWithOutOfBoundsIndex_6(); - break; - case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : Create Week Day schedule with 0 user index\n"); - err = TestCreateWeekDayScheduleWith0UserIndex_7(); - break; - case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : Create Week Day schedule with out-of-bounds user index\n"); - err = TestCreateWeekDayScheduleWithOutOfBoundsUserIndex_8(); - break; - case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : Create Week Day schedule for non-existing user\n"); - err = TestCreateWeekDayScheduleForNonExistingUser_9(); - break; - case 10: - ChipLogProgress(chipTool, " ***** Test Step 10 : Create Week Day schedule with 0 days mask\n"); - err = TestCreateWeekDayScheduleWith0DaysMask_10(); - break; - case 11: - ChipLogProgress(chipTool, " ***** Test Step 11 : Create Week Day schedule for Sunday and Monday\n"); - err = TestCreateWeekDayScheduleForSundayAndMonday_11(); - break; - case 12: - ChipLogProgress(chipTool, " ***** Test Step 12 : Create Week Day schedule for Sunday Wednesday and Saturday\n"); - err = TestCreateWeekDayScheduleForSundayWednesdayAndSaturday_12(); - break; - case 13: - ChipLogProgress(chipTool, " ***** Test Step 13 : Create Week Day schedule with invalid start hour\n"); - err = TestCreateWeekDayScheduleWithInvalidStartHour_13(); - break; - case 14: - ChipLogProgress(chipTool, " ***** Test Step 14 : Create Week Day schedule with invalid start minute\n"); - err = TestCreateWeekDayScheduleWithInvalidStartMinute_14(); - break; - case 15: - ChipLogProgress(chipTool, " ***** Test Step 15 : Create Week Day schedule with invalid end hour\n"); - err = TestCreateWeekDayScheduleWithInvalidEndHour_15(); - break; - case 16: - ChipLogProgress(chipTool, " ***** Test Step 16 : Create Week Day schedule with invalid end minute\n"); - err = TestCreateWeekDayScheduleWithInvalidEndMinute_16(); - break; - case 17: - ChipLogProgress(chipTool, " ***** Test Step 17 : Create Week Day schedule with start hour later that end hour\n"); - err = TestCreateWeekDayScheduleWithStartHourLaterThatEndHour_17(); - break; - case 18: - ChipLogProgress( - chipTool, - " ***** Test Step 18 : Create Week Day schedule with start minute later that end minute when hours are equal\n"); - err = TestCreateWeekDayScheduleWithStartMinuteLaterThatEndMinuteWhenHoursAreEqual_18(); - break; - case 19: - ChipLogProgress(chipTool, " ***** Test Step 19 : Make sure that previous operations did not create a schedule\n"); - err = TestMakeSureThatPreviousOperationsDidNotCreateASchedule_19(); - break; - case 20: - ChipLogProgress(chipTool, " ***** Test Step 20 : Get Week Day schedule with 0 index\n"); - err = TestGetWeekDayScheduleWith0Index_20(); - break; - case 21: - ChipLogProgress(chipTool, " ***** Test Step 21 : Get Week Day schedule with out-of-bounds index\n"); - err = TestGetWeekDayScheduleWithOutOfBoundsIndex_21(); - break; - case 22: - ChipLogProgress(chipTool, " ***** Test Step 22 : Get Week Day schedule with 0 user index\n"); - err = TestGetWeekDayScheduleWith0UserIndex_22(); - break; - case 23: - ChipLogProgress(chipTool, " ***** Test Step 23 : Get Week Day schedule with out-of-bounds user index\n"); - err = TestGetWeekDayScheduleWithOutOfBoundsUserIndex_23(); - break; - case 24: - ChipLogProgress(chipTool, " ***** Test Step 24 : Get Week Day schedule with non-existing user index\n"); - err = TestGetWeekDayScheduleWithNonExistingUserIndex_24(); - break; - case 25: - ChipLogProgress(chipTool, " ***** Test Step 25 : Create Year Day schedule with 0 index\n"); - err = TestCreateYearDayScheduleWith0Index_25(); - break; - case 26: - ChipLogProgress(chipTool, " ***** Test Step 26 : Create Year Day schedule with out-of-bounds index\n"); - err = TestCreateYearDayScheduleWithOutOfBoundsIndex_26(); - break; - case 27: - ChipLogProgress(chipTool, " ***** Test Step 27 : Create Year Day schedule with 0 user index\n"); - err = TestCreateYearDayScheduleWith0UserIndex_27(); - break; - case 28: - ChipLogProgress(chipTool, " ***** Test Step 28 : Create Year Day schedule with out-of-bounds user index\n"); - err = TestCreateYearDayScheduleWithOutOfBoundsUserIndex_28(); - break; - case 29: - ChipLogProgress(chipTool, " ***** Test Step 29 : Create Year Day schedule for non-existing user\n"); - err = TestCreateYearDayScheduleForNonExistingUser_29(); - break; - case 30: - ChipLogProgress(chipTool, " ***** Test Step 30 : Create Year Day schedule with start hour later that end hour\n"); - err = TestCreateYearDayScheduleWithStartHourLaterThatEndHour_30(); - break; - case 31: - ChipLogProgress(chipTool, " ***** Test Step 31 : Make sure that previous operations did not create a schedule\n"); - err = TestMakeSureThatPreviousOperationsDidNotCreateASchedule_31(); - break; - case 32: - ChipLogProgress(chipTool, " ***** Test Step 32 : Get Year Day schedule with 0 index\n"); - err = TestGetYearDayScheduleWith0Index_32(); - break; - case 33: - ChipLogProgress(chipTool, " ***** Test Step 33 : Get Year Day schedule with out-of-bounds index\n"); - err = TestGetYearDayScheduleWithOutOfBoundsIndex_33(); - break; - case 34: - ChipLogProgress(chipTool, " ***** Test Step 34 : Get Year Day schedule with 0 user index\n"); - err = TestGetYearDayScheduleWith0UserIndex_34(); - break; - case 35: - ChipLogProgress(chipTool, " ***** Test Step 35 : Get Year Day schedule with out-of-bounds user index\n"); - err = TestGetYearDayScheduleWithOutOfBoundsUserIndex_35(); - break; - case 36: - ChipLogProgress(chipTool, " ***** Test Step 36 : Get Year Day schedule with non-existing user index\n"); - err = TestGetYearDayScheduleWithNonExistingUserIndex_36(); - break; - case 37: - ChipLogProgress(chipTool, " ***** Test Step 37 : Create Week Day schedule with valid parameters\n"); - err = TestCreateWeekDayScheduleWithValidParameters_37(); - break; - case 38: - ChipLogProgress(chipTool, " ***** Test Step 38 : Verify created schedule\n"); - err = TestVerifyCreatedSchedule_38(); - break; - case 39: - ChipLogProgress(chipTool, " ***** Test Step 39 : Create Year Day schedule with valid parameters\n"); - err = TestCreateYearDayScheduleWithValidParameters_39(); - break; - case 40: - ChipLogProgress(chipTool, " ***** Test Step 40 : Verify created schedule\n"); - err = TestVerifyCreatedSchedule_40(); - break; - case 41: - ChipLogProgress(chipTool, " ***** Test Step 41 : Clear Week Day schedule with 0 index\n"); - err = TestClearWeekDayScheduleWith0Index_41(); - break; - case 42: - ChipLogProgress(chipTool, " ***** Test Step 42 : Clear Week Day schedule with out-of-bounds index\n"); - err = TestClearWeekDayScheduleWithOutOfBoundsIndex_42(); - break; - case 43: - ChipLogProgress(chipTool, " ***** Test Step 43 : Clear Week Day schedule with 0 user index\n"); - err = TestClearWeekDayScheduleWith0UserIndex_43(); - break; - case 44: - ChipLogProgress(chipTool, " ***** Test Step 44 : Clear Week Day schedule with out-of-bounds user index\n"); - err = TestClearWeekDayScheduleWithOutOfBoundsUserIndex_44(); - break; - case 45: - ChipLogProgress(chipTool, " ***** Test Step 45 : Clear Week Day schedule with non-existing user\n"); - err = TestClearWeekDayScheduleWithNonExistingUser_45(); - break; - case 46: - ChipLogProgress(chipTool, " ***** Test Step 46 : Clear Year Day schedule with 0 index\n"); - err = TestClearYearDayScheduleWith0Index_46(); - break; - case 47: - ChipLogProgress(chipTool, " ***** Test Step 47 : Clear Year Day schedule with out-of-bounds index\n"); - err = TestClearYearDayScheduleWithOutOfBoundsIndex_47(); - break; - case 48: - ChipLogProgress(chipTool, " ***** Test Step 48 : Clear Year Day schedule with 0 user index\n"); - err = TestClearYearDayScheduleWith0UserIndex_48(); - break; - case 49: - ChipLogProgress(chipTool, " ***** Test Step 49 : Clear Year Day schedule with out-of-bounds user index\n"); - err = TestClearYearDayScheduleWithOutOfBoundsUserIndex_49(); - break; - case 50: - ChipLogProgress(chipTool, " ***** Test Step 50 : Clear Year Day schedule with non-existing user\n"); - err = TestClearYearDayScheduleWithNonExistingUser_50(); - break; - case 51: - ChipLogProgress(chipTool, " ***** Test Step 51 : Make sure that week day schedule was not deleted\n"); - err = TestMakeSureThatWeekDayScheduleWasNotDeleted_51(); - break; - case 52: - ChipLogProgress(chipTool, " ***** Test Step 52 : Make sure that year day schedule was not deleted\n"); - err = TestMakeSureThatYearDayScheduleWasNotDeleted_52(); - break; - case 53: - ChipLogProgress(chipTool, " ***** Test Step 53 : Create another Week Day schedule with valid parameters\n"); - err = TestCreateAnotherWeekDayScheduleWithValidParameters_53(); - break; - case 54: - ChipLogProgress(chipTool, " ***** Test Step 54 : Verify created week day schedule\n"); - err = TestVerifyCreatedWeekDaySchedule_54(); - break; - case 55: - ChipLogProgress(chipTool, " ***** Test Step 55 : Create another Year Day schedule with valid parameters\n"); - err = TestCreateAnotherYearDayScheduleWithValidParameters_55(); - break; - case 56: - ChipLogProgress(chipTool, " ***** Test Step 56 : Verify created year day schedule\n"); - err = TestVerifyCreatedYearDaySchedule_56(); - break; - case 57: - ChipLogProgress(chipTool, " ***** Test Step 57 : Clear a single week day schedule for the first user\n"); - err = TestClearASingleWeekDayScheduleForTheFirstUser_57(); - break; - case 58: - ChipLogProgress(chipTool, " ***** Test Step 58 : Verify cleared week day schedule\n"); - err = TestVerifyClearedWeekDaySchedule_58(); - break; - case 59: - ChipLogProgress(chipTool, " ***** Test Step 59 : Clear all remaining week day schedules for the first user\n"); - err = TestClearAllRemainingWeekDaySchedulesForTheFirstUser_59(); - break; - case 60: - ChipLogProgress(chipTool, " ***** Test Step 60 : Verify cleared week schedule\n"); - err = TestVerifyClearedWeekSchedule_60(); - break; - case 61: - ChipLogProgress(chipTool, " ***** Test Step 61 : Make sure that first year day schedule was not deleted\n"); - err = TestMakeSureThatFirstYearDayScheduleWasNotDeleted_61(); - break; - case 62: - ChipLogProgress(chipTool, " ***** Test Step 62 : Make sure that second year day schedule was not deleted\n"); - err = TestMakeSureThatSecondYearDayScheduleWasNotDeleted_62(); - break; - case 63: - ChipLogProgress(chipTool, " ***** Test Step 63 : Create another Week Day schedule with valid parameters\n"); - err = TestCreateAnotherWeekDayScheduleWithValidParameters_63(); - break; - case 64: - ChipLogProgress(chipTool, " ***** Test Step 64 : Clear a single year day schedule for the first user\n"); - err = TestClearASingleYearDayScheduleForTheFirstUser_64(); - break; - case 65: - ChipLogProgress(chipTool, " ***** Test Step 65 : Verify cleared year day schedule\n"); - err = TestVerifyClearedYearDaySchedule_65(); - break; - case 66: - ChipLogProgress(chipTool, " ***** Test Step 66 : Clear all remaining year schedules for the first user\n"); - err = TestClearAllRemainingYearSchedulesForTheFirstUser_66(); - break; - case 67: - ChipLogProgress(chipTool, " ***** Test Step 67 : Verify that second year day schedule was cleared\n"); - err = TestVerifyThatSecondYearDayScheduleWasCleared_67(); - break; - case 68: - ChipLogProgress(chipTool, " ***** Test Step 68 : Verify created week day schedule\n"); - err = TestVerifyCreatedWeekDaySchedule_68(); - break; - case 69: - ChipLogProgress(chipTool, " ***** Test Step 69 : Clear all remaining week day schedules for the first user\n"); - err = TestClearAllRemainingWeekDaySchedulesForTheFirstUser_69(); - break; - case 70: - ChipLogProgress(chipTool, - " ***** Test Step 70 : Create new user without credential so we can add more schedules to it\n"); - err = TestCreateNewUserWithoutCredentialSoWeCanAddMoreSchedulesToIt_70(); - break; - case 71: - ChipLogProgress(chipTool, " ***** Test Step 71 : Create Week Day schedule with valid parameters for first user\n"); - err = TestCreateWeekDayScheduleWithValidParametersForFirstUser_71(); - break; - case 72: - ChipLogProgress(chipTool, " ***** Test Step 72 : Verify created week day schedule for first user\n"); - err = TestVerifyCreatedWeekDayScheduleForFirstUser_72(); - break; - case 73: - ChipLogProgress(chipTool, " ***** Test Step 73 : Create Year Day schedule for first user\n"); - err = TestCreateYearDayScheduleForFirstUser_73(); - break; - case 74: - ChipLogProgress(chipTool, " ***** Test Step 74 : Verify created year day schedule for first\n"); - err = TestVerifyCreatedYearDayScheduleForFirst_74(); - break; - case 75: - ChipLogProgress(chipTool, " ***** Test Step 75 : Create Week Day schedule with valid parameters for second user\n"); - err = TestCreateWeekDayScheduleWithValidParametersForSecondUser_75(); - break; - case 76: - ChipLogProgress(chipTool, " ***** Test Step 76 : Verify created week day schedule for first user\n"); - err = TestVerifyCreatedWeekDayScheduleForFirstUser_76(); - break; - case 77: - ChipLogProgress(chipTool, " ***** Test Step 77 : Create Year Day schedule for second user\n"); - err = TestCreateYearDayScheduleForSecondUser_77(); - break; - case 78: - ChipLogProgress(chipTool, " ***** Test Step 78 : Verify created year day schedule for first\n"); - err = TestVerifyCreatedYearDayScheduleForFirst_78(); - break; - case 79: - ChipLogProgress(chipTool, " ***** Test Step 79 : Cleanup\n"); - err = TestCleanup_79(); - break; - case 80: - ChipLogProgress(chipTool, " ***** Test Step 80 : Make sure clearing first user also cleared week day schedules\n"); - err = TestMakeSureClearingFirstUserAlsoClearedWeekDaySchedules_80(); - break; - case 81: - ChipLogProgress(chipTool, " ***** Test Step 81 : Make sure clearing first user also cleared year day schedules\n"); - err = TestMakeSureClearingFirstUserAlsoClearedYearDaySchedules_81(); - break; - case 82: - ChipLogProgress(chipTool, " ***** Test Step 82 : Make sure clearing second user also cleared week day schedules\n"); - err = TestMakeSureClearingSecondUserAlsoClearedWeekDaySchedules_82(); - break; - case 83: - ChipLogProgress(chipTool, " ***** Test Step 83 : Make sure clearing second user also cleared year day schedules\n"); - err = TestMakeSureClearingSecondUserAlsoClearedYearDaySchedules_83(); - break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 84; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - uint16_t NumberOfTotalUsersSupported; - uint8_t NumberOfWeekDaySchedulesSupportedPerUser; - uint8_t NumberOfYearDaySchedulesSupportedPerUser; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - static void OnFailureCallback_2(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_2(error); - } - - static void OnSuccessCallback_2(void * context, uint16_t numberOfTotalUsersSupported) - { - (static_cast(context))->OnSuccessResponse_2(numberOfTotalUsersSupported); - } - - static void OnFailureCallback_3(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_3(error); - } - - static void OnSuccessCallback_3(void * context, uint8_t numberOfWeekDaySchedulesSupportedPerUser) - { - (static_cast(context))->OnSuccessResponse_3(numberOfWeekDaySchedulesSupportedPerUser); - } - - static void OnFailureCallback_4(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_4(error); - } - - static void OnSuccessCallback_4(void * context, uint8_t numberOfYearDaySchedulesSupportedPerUser) - { - (static_cast(context))->OnSuccessResponse_4(numberOfYearDaySchedulesSupportedPerUser); - } - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestCreateNewPinCredentialAndScheduleUser_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::SetCredential::Type; - - RequestType request; - request.operationType = static_cast(0); - - request.credential.credentialType = static_cast(1); - request.credential.credentialIndex = 1U; - - request.credentialData = chip::ByteSpan(chip::Uint8::from_const_char("123456garbage: not in length on purpose"), 6); - request.userIndex.SetNull(); - request.userStatus.SetNull(); - request.userType.SetNull(); - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_1(data.status, data.userIndex, data.nextCredentialIndex); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_1(error); - }; - - ReturnErrorOnFailure( - chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request, 10000)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_1(chip::app::Clusters::DoorLock::DlStatus status, - const chip::app::DataModel::Nullable & userIndex, - const chip::app::DataModel::Nullable & nextCredentialIndex) - { - VerifyOrReturn(CheckValue("status", status, 0)); - - VerifyOrReturn(CheckValueNonNull("userIndex", userIndex)); - VerifyOrReturn(CheckValue("userIndex.Value()", userIndex.Value(), 1U)); - - VerifyOrReturn(CheckValueNonNull("nextCredentialIndex", nextCredentialIndex)); - VerifyOrReturn(CheckValue("nextCredentialIndex.Value()", nextCredentialIndex.Value(), 2U)); - - NextTest(); - } - - CHIP_ERROR TestGetNumberOfSupportedUsers_2() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::DoorLockClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_2, OnFailureCallback_2, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_2(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_2(uint16_t numberOfTotalUsersSupported) - { - VerifyOrReturn(CheckValue("numberOfTotalUsersSupported", numberOfTotalUsersSupported, 10U)); - - NumberOfTotalUsersSupported = numberOfTotalUsersSupported; - NextTest(); - } - - CHIP_ERROR TestGetMaxNumberOfWeekDaySchedulesForUserAndVerifyDefaultValue_3() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::DoorLockClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_3, OnFailureCallback_3, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_3(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_3(uint8_t numberOfWeekDaySchedulesSupportedPerUser) - { - VerifyOrReturn(CheckValue("numberOfWeekDaySchedulesSupportedPerUser", numberOfWeekDaySchedulesSupportedPerUser, 10)); - - NumberOfWeekDaySchedulesSupportedPerUser = numberOfWeekDaySchedulesSupportedPerUser; - NextTest(); - } - - CHIP_ERROR TestGetMaxNumberOfYearDaySchedulesForUserAndVerifyDefaultValue_4() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::DoorLockClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_4, OnFailureCallback_4, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_4(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_4(uint8_t numberOfYearDaySchedulesSupportedPerUser) - { - VerifyOrReturn(CheckValue("numberOfYearDaySchedulesSupportedPerUser", numberOfYearDaySchedulesSupportedPerUser, 10)); - - NumberOfYearDaySchedulesSupportedPerUser = numberOfYearDaySchedulesSupportedPerUser; - NextTest(); - } - - CHIP_ERROR TestCreateWeekDayScheduleWith0Index_5() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::SetWeekDaySchedule::Type; - - RequestType request; - request.weekDayIndex = 0; - request.userIndex = 1U; - request.daysMask = static_cast>(1); - request.startHour = 15; - request.startMinute = 16; - request.endHour = 18; - request.endMinute = 0; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_5(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_5(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_5(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_FIELD)); - NextTest(); - } - - void OnSuccessResponse_5() { ThrowSuccessResponse(); } - - CHIP_ERROR TestCreateWeekDayScheduleWithOutOfBoundsIndex_6() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::SetWeekDaySchedule::Type; - - RequestType request; - request.weekDayIndex = static_cast(NumberOfWeekDaySchedulesSupportedPerUser + 1); - request.userIndex = 1U; - request.daysMask = static_cast>(1); - request.startHour = 15; - request.startMinute = 16; - request.endHour = 18; - request.endMinute = 0; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_6(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_6(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_6(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_FIELD)); - NextTest(); - } - - void OnSuccessResponse_6() { ThrowSuccessResponse(); } - - CHIP_ERROR TestCreateWeekDayScheduleWith0UserIndex_7() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::SetWeekDaySchedule::Type; - - RequestType request; - request.weekDayIndex = 1; - request.userIndex = 0U; - request.daysMask = static_cast>(1); - request.startHour = 15; - request.startMinute = 16; - request.endHour = 18; - request.endMinute = 0; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_7(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_7(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_7(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_FIELD)); - NextTest(); - } - - void OnSuccessResponse_7() { ThrowSuccessResponse(); } - - CHIP_ERROR TestCreateWeekDayScheduleWithOutOfBoundsUserIndex_8() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::SetWeekDaySchedule::Type; - - RequestType request; - request.weekDayIndex = 1; - request.userIndex = static_cast(NumberOfTotalUsersSupported + 1); - request.daysMask = static_cast>(1); - request.startHour = 15; - request.startMinute = 16; - request.endHour = 18; - request.endMinute = 0; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_8(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_8(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_8(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_FIELD)); - NextTest(); - } - - void OnSuccessResponse_8() { ThrowSuccessResponse(); } - - CHIP_ERROR TestCreateWeekDayScheduleForNonExistingUser_9() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::SetWeekDaySchedule::Type; - - RequestType request; - request.weekDayIndex = 1; - request.userIndex = 2U; - request.daysMask = static_cast>(1); - request.startHour = 15; - request.startMinute = 16; - request.endHour = 18; - request.endMinute = 0; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_9(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_9(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_9(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_NOT_FOUND)); - NextTest(); - } - - void OnSuccessResponse_9() { ThrowSuccessResponse(); } - - CHIP_ERROR TestCreateWeekDayScheduleWith0DaysMask_10() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::SetWeekDaySchedule::Type; - - RequestType request; - request.weekDayIndex = 1; - request.userIndex = 1U; - request.daysMask = static_cast>(0); - request.startHour = 15; - request.startMinute = 16; - request.endHour = 18; - request.endMinute = 0; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_10(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_10(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_10(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_FIELD)); - NextTest(); - } - - void OnSuccessResponse_10() { ThrowSuccessResponse(); } - - CHIP_ERROR TestCreateWeekDayScheduleForSundayAndMonday_11() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::SetWeekDaySchedule::Type; - - RequestType request; - request.weekDayIndex = 1; - request.userIndex = 1U; - request.daysMask = static_cast>(3); - request.startHour = 15; - request.startMinute = 16; - request.endHour = 18; - request.endMinute = 0; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_11(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_11(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_11(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_FIELD)); - NextTest(); - } - - void OnSuccessResponse_11() { ThrowSuccessResponse(); } - - CHIP_ERROR TestCreateWeekDayScheduleForSundayWednesdayAndSaturday_12() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::SetWeekDaySchedule::Type; - - RequestType request; - request.weekDayIndex = 1; - request.userIndex = 1U; - request.daysMask = static_cast>(73); - request.startHour = 15; - request.startMinute = 16; - request.endHour = 18; - request.endMinute = 0; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_12(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_12(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_12(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_FIELD)); - NextTest(); - } - - void OnSuccessResponse_12() { ThrowSuccessResponse(); } - - CHIP_ERROR TestCreateWeekDayScheduleWithInvalidStartHour_13() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::SetWeekDaySchedule::Type; - - RequestType request; - request.weekDayIndex = 1; - request.userIndex = 1U; - request.daysMask = static_cast>(1); - request.startHour = 24; - request.startMinute = 16; - request.endHour = 18; - request.endMinute = 0; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_13(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_13(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_13(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_FIELD)); - NextTest(); - } - - void OnSuccessResponse_13() { ThrowSuccessResponse(); } - - CHIP_ERROR TestCreateWeekDayScheduleWithInvalidStartMinute_14() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::SetWeekDaySchedule::Type; - - RequestType request; - request.weekDayIndex = 1; - request.userIndex = 1U; - request.daysMask = static_cast>(1); - request.startHour = 15; - request.startMinute = 60; - request.endHour = 18; - request.endMinute = 0; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_14(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_14(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_14(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_FIELD)); - NextTest(); - } - - void OnSuccessResponse_14() { ThrowSuccessResponse(); } - - CHIP_ERROR TestCreateWeekDayScheduleWithInvalidEndHour_15() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::SetWeekDaySchedule::Type; - - RequestType request; - request.weekDayIndex = 1; - request.userIndex = 1U; - request.daysMask = static_cast>(1); - request.startHour = 15; - request.startMinute = 16; - request.endHour = 24; - request.endMinute = 0; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_15(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_15(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_15(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_FIELD)); - NextTest(); - } - - void OnSuccessResponse_15() { ThrowSuccessResponse(); } - - CHIP_ERROR TestCreateWeekDayScheduleWithInvalidEndMinute_16() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::SetWeekDaySchedule::Type; - - RequestType request; - request.weekDayIndex = 1; - request.userIndex = 1U; - request.daysMask = static_cast>(1); - request.startHour = 15; - request.startMinute = 16; - request.endHour = 18; - request.endMinute = 60; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_16(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_16(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_16(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_FIELD)); - NextTest(); - } - - void OnSuccessResponse_16() { ThrowSuccessResponse(); } - - CHIP_ERROR TestCreateWeekDayScheduleWithStartHourLaterThatEndHour_17() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::SetWeekDaySchedule::Type; - - RequestType request; - request.weekDayIndex = 1; - request.userIndex = 1U; - request.daysMask = static_cast>(1); - request.startHour = 19; - request.startMinute = 16; - request.endHour = 18; - request.endMinute = 0; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_17(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_17(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_17(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_FIELD)); - NextTest(); - } - - void OnSuccessResponse_17() { ThrowSuccessResponse(); } - - CHIP_ERROR TestCreateWeekDayScheduleWithStartMinuteLaterThatEndMinuteWhenHoursAreEqual_18() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::SetWeekDaySchedule::Type; - - RequestType request; - request.weekDayIndex = 1; - request.userIndex = 1U; - request.daysMask = static_cast>(1); - request.startHour = 15; - request.startMinute = 50; - request.endHour = 15; - request.endMinute = 49; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_18(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_18(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_18(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_FIELD)); - NextTest(); - } - - void OnSuccessResponse_18() { ThrowSuccessResponse(); } - - CHIP_ERROR TestMakeSureThatPreviousOperationsDidNotCreateASchedule_19() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::GetWeekDaySchedule::Type; - - RequestType request; - request.weekDayIndex = 1; - request.userIndex = 1U; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context)) - ->OnSuccessResponse_19(data.weekDayIndex, data.userIndex, data.status, data.daysMask, data.startHour, - data.startMinute, data.endHour, data.endMinute); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_19(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_19(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_19(uint8_t weekDayIndex, uint16_t userIndex, chip::app::Clusters::DoorLock::DlStatus status, - const chip::Optional> & daysMask, - const chip::Optional & startHour, const chip::Optional & startMinute, - const chip::Optional & endHour, const chip::Optional & endMinute) - { - VerifyOrReturn(CheckValue("weekDayIndex", weekDayIndex, 1)); - - VerifyOrReturn(CheckValue("userIndex", userIndex, 1U)); - - VerifyOrReturn(CheckValue("status", status, 139)); - - NextTest(); - } - - CHIP_ERROR TestGetWeekDayScheduleWith0Index_20() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::GetWeekDaySchedule::Type; - - RequestType request; - request.weekDayIndex = 0; - request.userIndex = 1U; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context)) - ->OnSuccessResponse_20(data.weekDayIndex, data.userIndex, data.status, data.daysMask, data.startHour, - data.startMinute, data.endHour, data.endMinute); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_20(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_20(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_20(uint8_t weekDayIndex, uint16_t userIndex, chip::app::Clusters::DoorLock::DlStatus status, - const chip::Optional> & daysMask, - const chip::Optional & startHour, const chip::Optional & startMinute, - const chip::Optional & endHour, const chip::Optional & endMinute) - { - VerifyOrReturn(CheckValue("weekDayIndex", weekDayIndex, 0)); - - VerifyOrReturn(CheckValue("userIndex", userIndex, 1U)); - - VerifyOrReturn(CheckValue("status", status, 133)); - - NextTest(); - } - - CHIP_ERROR TestGetWeekDayScheduleWithOutOfBoundsIndex_21() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::GetWeekDaySchedule::Type; - - RequestType request; - request.weekDayIndex = static_cast(NumberOfWeekDaySchedulesSupportedPerUser + 1); - request.userIndex = 1U; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context)) - ->OnSuccessResponse_21(data.weekDayIndex, data.userIndex, data.status, data.daysMask, data.startHour, - data.startMinute, data.endHour, data.endMinute); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_21(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_21(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_21(uint8_t weekDayIndex, uint16_t userIndex, chip::app::Clusters::DoorLock::DlStatus status, - const chip::Optional> & daysMask, - const chip::Optional & startHour, const chip::Optional & startMinute, - const chip::Optional & endHour, const chip::Optional & endMinute) - { - VerifyOrReturn( - CheckValue("weekDayIndex", weekDayIndex, static_cast(NumberOfWeekDaySchedulesSupportedPerUser + 1))); - - VerifyOrReturn(CheckValue("userIndex", userIndex, 1U)); - - VerifyOrReturn(CheckValue("status", status, 133)); - - NextTest(); - } - - CHIP_ERROR TestGetWeekDayScheduleWith0UserIndex_22() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::GetWeekDaySchedule::Type; - - RequestType request; - request.weekDayIndex = 1; - request.userIndex = 0U; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context)) - ->OnSuccessResponse_22(data.weekDayIndex, data.userIndex, data.status, data.daysMask, data.startHour, - data.startMinute, data.endHour, data.endMinute); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_22(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_22(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_22(uint8_t weekDayIndex, uint16_t userIndex, chip::app::Clusters::DoorLock::DlStatus status, - const chip::Optional> & daysMask, - const chip::Optional & startHour, const chip::Optional & startMinute, - const chip::Optional & endHour, const chip::Optional & endMinute) - { - VerifyOrReturn(CheckValue("weekDayIndex", weekDayIndex, 1)); - - VerifyOrReturn(CheckValue("userIndex", userIndex, 0U)); - - VerifyOrReturn(CheckValue("status", status, 133)); - - NextTest(); - } - - CHIP_ERROR TestGetWeekDayScheduleWithOutOfBoundsUserIndex_23() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::GetWeekDaySchedule::Type; - - RequestType request; - request.weekDayIndex = 1; - request.userIndex = static_cast(NumberOfTotalUsersSupported + 1); - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context)) - ->OnSuccessResponse_23(data.weekDayIndex, data.userIndex, data.status, data.daysMask, data.startHour, - data.startMinute, data.endHour, data.endMinute); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_23(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_23(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_23(uint8_t weekDayIndex, uint16_t userIndex, chip::app::Clusters::DoorLock::DlStatus status, - const chip::Optional> & daysMask, - const chip::Optional & startHour, const chip::Optional & startMinute, - const chip::Optional & endHour, const chip::Optional & endMinute) - { - VerifyOrReturn(CheckValue("weekDayIndex", weekDayIndex, 1)); - - VerifyOrReturn(CheckValue("userIndex", userIndex, static_cast(NumberOfTotalUsersSupported + 1))); - - VerifyOrReturn(CheckValue("status", status, 133)); - - NextTest(); - } - - CHIP_ERROR TestGetWeekDayScheduleWithNonExistingUserIndex_24() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::GetWeekDaySchedule::Type; - - RequestType request; - request.weekDayIndex = 1; - request.userIndex = 2U; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context)) - ->OnSuccessResponse_24(data.weekDayIndex, data.userIndex, data.status, data.daysMask, data.startHour, - data.startMinute, data.endHour, data.endMinute); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_24(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_24(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_24(uint8_t weekDayIndex, uint16_t userIndex, chip::app::Clusters::DoorLock::DlStatus status, - const chip::Optional> & daysMask, - const chip::Optional & startHour, const chip::Optional & startMinute, - const chip::Optional & endHour, const chip::Optional & endMinute) - { - VerifyOrReturn(CheckValue("weekDayIndex", weekDayIndex, 1)); - - VerifyOrReturn(CheckValue("userIndex", userIndex, 2U)); - - VerifyOrReturn(CheckValue("status", status, 139)); - - NextTest(); - } - - CHIP_ERROR TestCreateYearDayScheduleWith0Index_25() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::SetYearDaySchedule::Type; - - RequestType request; - request.yearDayIndex = 0; - request.userIndex = 1U; - request.localStartTime = 12345UL; - request.localEndTime = 12345689UL; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_25(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_25(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_25(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_FIELD)); - NextTest(); - } - - void OnSuccessResponse_25() { ThrowSuccessResponse(); } - - CHIP_ERROR TestCreateYearDayScheduleWithOutOfBoundsIndex_26() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::SetYearDaySchedule::Type; - - RequestType request; - request.yearDayIndex = static_cast(NumberOfYearDaySchedulesSupportedPerUser + 1); - request.userIndex = 1U; - request.localStartTime = 12345UL; - request.localEndTime = 12345689UL; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_26(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_26(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_26(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_FIELD)); - NextTest(); - } - - void OnSuccessResponse_26() { ThrowSuccessResponse(); } - - CHIP_ERROR TestCreateYearDayScheduleWith0UserIndex_27() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::SetYearDaySchedule::Type; - - RequestType request; - request.yearDayIndex = 1; - request.userIndex = 0U; - request.localStartTime = 12345UL; - request.localEndTime = 12345689UL; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_27(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_27(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_27(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_FIELD)); - NextTest(); - } - - void OnSuccessResponse_27() { ThrowSuccessResponse(); } - - CHIP_ERROR TestCreateYearDayScheduleWithOutOfBoundsUserIndex_28() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::SetYearDaySchedule::Type; - - RequestType request; - request.yearDayIndex = 1; - request.userIndex = static_cast(NumberOfTotalUsersSupported + 1); - request.localStartTime = 12345UL; - request.localEndTime = 12345689UL; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_28(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_28(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_28(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_FIELD)); - NextTest(); - } - - void OnSuccessResponse_28() { ThrowSuccessResponse(); } - - CHIP_ERROR TestCreateYearDayScheduleForNonExistingUser_29() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::SetYearDaySchedule::Type; - - RequestType request; - request.yearDayIndex = 1; - request.userIndex = 2U; - request.localStartTime = 12345UL; - request.localEndTime = 12345689UL; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_29(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_29(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_29(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_NOT_FOUND)); - NextTest(); - } - - void OnSuccessResponse_29() { ThrowSuccessResponse(); } - - CHIP_ERROR TestCreateYearDayScheduleWithStartHourLaterThatEndHour_30() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::SetYearDaySchedule::Type; - - RequestType request; - request.yearDayIndex = 1; - request.userIndex = 1U; - request.localStartTime = 12345689UL; - request.localEndTime = 12345688UL; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_30(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_30(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_30(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_FIELD)); - NextTest(); - } - - void OnSuccessResponse_30() { ThrowSuccessResponse(); } - - CHIP_ERROR TestMakeSureThatPreviousOperationsDidNotCreateASchedule_31() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::GetYearDaySchedule::Type; - - RequestType request; - request.yearDayIndex = 1; - request.userIndex = 1U; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context)) - ->OnSuccessResponse_31(data.yearDayIndex, data.userIndex, data.status, data.localStartTime, data.localEndTime); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_31(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_31(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_31(uint8_t yearDayIndex, uint16_t userIndex, chip::app::Clusters::DoorLock::DlStatus status, - const chip::Optional & localStartTime, const chip::Optional & localEndTime) - { - VerifyOrReturn(CheckValue("yearDayIndex", yearDayIndex, 1)); - - VerifyOrReturn(CheckValue("userIndex", userIndex, 1U)); - - VerifyOrReturn(CheckValue("status", status, 139)); - - NextTest(); - } - - CHIP_ERROR TestGetYearDayScheduleWith0Index_32() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::GetYearDaySchedule::Type; - - RequestType request; - request.yearDayIndex = 0; - request.userIndex = 1U; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context)) - ->OnSuccessResponse_32(data.yearDayIndex, data.userIndex, data.status, data.localStartTime, data.localEndTime); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_32(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_32(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_32(uint8_t yearDayIndex, uint16_t userIndex, chip::app::Clusters::DoorLock::DlStatus status, - const chip::Optional & localStartTime, const chip::Optional & localEndTime) - { - VerifyOrReturn(CheckValue("yearDayIndex", yearDayIndex, 0)); - - VerifyOrReturn(CheckValue("userIndex", userIndex, 1U)); - - VerifyOrReturn(CheckValue("status", status, 133)); - - NextTest(); - } - - CHIP_ERROR TestGetYearDayScheduleWithOutOfBoundsIndex_33() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::GetYearDaySchedule::Type; - - RequestType request; - request.yearDayIndex = static_cast(NumberOfYearDaySchedulesSupportedPerUser + 1); - request.userIndex = 1U; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context)) - ->OnSuccessResponse_33(data.yearDayIndex, data.userIndex, data.status, data.localStartTime, data.localEndTime); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_33(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_33(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_33(uint8_t yearDayIndex, uint16_t userIndex, chip::app::Clusters::DoorLock::DlStatus status, - const chip::Optional & localStartTime, const chip::Optional & localEndTime) - { - VerifyOrReturn( - CheckValue("yearDayIndex", yearDayIndex, static_cast(NumberOfYearDaySchedulesSupportedPerUser + 1))); - - VerifyOrReturn(CheckValue("userIndex", userIndex, 1U)); - - VerifyOrReturn(CheckValue("status", status, 133)); - - NextTest(); - } - - CHIP_ERROR TestGetYearDayScheduleWith0UserIndex_34() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::GetYearDaySchedule::Type; - - RequestType request; - request.yearDayIndex = 1; - request.userIndex = 0U; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context)) - ->OnSuccessResponse_34(data.yearDayIndex, data.userIndex, data.status, data.localStartTime, data.localEndTime); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_34(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_34(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_34(uint8_t yearDayIndex, uint16_t userIndex, chip::app::Clusters::DoorLock::DlStatus status, - const chip::Optional & localStartTime, const chip::Optional & localEndTime) - { - VerifyOrReturn(CheckValue("yearDayIndex", yearDayIndex, 1)); - - VerifyOrReturn(CheckValue("userIndex", userIndex, 0U)); - - VerifyOrReturn(CheckValue("status", status, 133)); - - NextTest(); - } - - CHIP_ERROR TestGetYearDayScheduleWithOutOfBoundsUserIndex_35() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::GetYearDaySchedule::Type; - - RequestType request; - request.yearDayIndex = 1; - request.userIndex = static_cast(NumberOfTotalUsersSupported + 1); - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context)) - ->OnSuccessResponse_35(data.yearDayIndex, data.userIndex, data.status, data.localStartTime, data.localEndTime); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_35(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_35(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_35(uint8_t yearDayIndex, uint16_t userIndex, chip::app::Clusters::DoorLock::DlStatus status, - const chip::Optional & localStartTime, const chip::Optional & localEndTime) - { - VerifyOrReturn(CheckValue("yearDayIndex", yearDayIndex, 1)); - - VerifyOrReturn(CheckValue("userIndex", userIndex, static_cast(NumberOfTotalUsersSupported + 1))); - - VerifyOrReturn(CheckValue("status", status, 133)); - - NextTest(); - } - - CHIP_ERROR TestGetYearDayScheduleWithNonExistingUserIndex_36() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::GetYearDaySchedule::Type; - - RequestType request; - request.yearDayIndex = 1; - request.userIndex = 2U; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context)) - ->OnSuccessResponse_36(data.yearDayIndex, data.userIndex, data.status, data.localStartTime, data.localEndTime); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_36(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_36(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_36(uint8_t yearDayIndex, uint16_t userIndex, chip::app::Clusters::DoorLock::DlStatus status, - const chip::Optional & localStartTime, const chip::Optional & localEndTime) - { - VerifyOrReturn(CheckValue("yearDayIndex", yearDayIndex, 1)); - - VerifyOrReturn(CheckValue("userIndex", userIndex, 2U)); - - VerifyOrReturn(CheckValue("status", status, 139)); - - NextTest(); - } - - CHIP_ERROR TestCreateWeekDayScheduleWithValidParameters_37() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::SetWeekDaySchedule::Type; - - RequestType request; - request.weekDayIndex = 1; - request.userIndex = 1U; - request.daysMask = static_cast>(1); - request.startHour = 15; - request.startMinute = 16; - request.endHour = 18; - request.endMinute = 0; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_37(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_37(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_37(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_37() { NextTest(); } - - CHIP_ERROR TestVerifyCreatedSchedule_38() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::GetWeekDaySchedule::Type; - - RequestType request; - request.weekDayIndex = 1; - request.userIndex = 1U; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context)) - ->OnSuccessResponse_38(data.weekDayIndex, data.userIndex, data.status, data.daysMask, data.startHour, - data.startMinute, data.endHour, data.endMinute); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_38(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_38(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_38(uint8_t weekDayIndex, uint16_t userIndex, chip::app::Clusters::DoorLock::DlStatus status, - const chip::Optional> & daysMask, - const chip::Optional & startHour, const chip::Optional & startMinute, - const chip::Optional & endHour, const chip::Optional & endMinute) - { - VerifyOrReturn(CheckValue("weekDayIndex", weekDayIndex, 1)); - - VerifyOrReturn(CheckValue("userIndex", userIndex, 1U)); - - VerifyOrReturn(CheckValue("status", status, 0)); - - VerifyOrReturn(CheckValuePresent("daysMask", daysMask)); - VerifyOrReturn(CheckValue("daysMask.Value()", daysMask.Value(), 1)); - - VerifyOrReturn(CheckValuePresent("startHour", startHour)); - VerifyOrReturn(CheckValue("startHour.Value()", startHour.Value(), 15)); - - VerifyOrReturn(CheckValuePresent("startMinute", startMinute)); - VerifyOrReturn(CheckValue("startMinute.Value()", startMinute.Value(), 16)); - - VerifyOrReturn(CheckValuePresent("endHour", endHour)); - VerifyOrReturn(CheckValue("endHour.Value()", endHour.Value(), 18)); - - VerifyOrReturn(CheckValuePresent("endMinute", endMinute)); - VerifyOrReturn(CheckValue("endMinute.Value()", endMinute.Value(), 0)); - - NextTest(); - } - - CHIP_ERROR TestCreateYearDayScheduleWithValidParameters_39() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::SetYearDaySchedule::Type; - - RequestType request; - request.yearDayIndex = 1; - request.userIndex = 1U; - request.localStartTime = 12345UL; - request.localEndTime = 12345689UL; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_39(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_39(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_39(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_39() { NextTest(); } - - CHIP_ERROR TestVerifyCreatedSchedule_40() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::GetYearDaySchedule::Type; - - RequestType request; - request.yearDayIndex = 1; - request.userIndex = 1U; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context)) - ->OnSuccessResponse_40(data.yearDayIndex, data.userIndex, data.status, data.localStartTime, data.localEndTime); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_40(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_40(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_40(uint8_t yearDayIndex, uint16_t userIndex, chip::app::Clusters::DoorLock::DlStatus status, - const chip::Optional & localStartTime, const chip::Optional & localEndTime) - { - VerifyOrReturn(CheckValue("yearDayIndex", yearDayIndex, 1)); - - VerifyOrReturn(CheckValue("userIndex", userIndex, 1U)); - - VerifyOrReturn(CheckValue("status", status, 0)); - - VerifyOrReturn(CheckValuePresent("localStartTime", localStartTime)); - VerifyOrReturn(CheckValue("localStartTime.Value()", localStartTime.Value(), 12345UL)); - - VerifyOrReturn(CheckValuePresent("localEndTime", localEndTime)); - VerifyOrReturn(CheckValue("localEndTime.Value()", localEndTime.Value(), 12345689UL)); - - NextTest(); - } - - CHIP_ERROR TestClearWeekDayScheduleWith0Index_41() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::ClearWeekDaySchedule::Type; - - RequestType request; - request.weekDayIndex = 0; - request.userIndex = 1U; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_41(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_41(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_41(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_FIELD)); - NextTest(); - } - - void OnSuccessResponse_41() { ThrowSuccessResponse(); } - - CHIP_ERROR TestClearWeekDayScheduleWithOutOfBoundsIndex_42() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::ClearWeekDaySchedule::Type; - - RequestType request; - request.weekDayIndex = static_cast(NumberOfWeekDaySchedulesSupportedPerUser + 1); - request.userIndex = 1U; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_42(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_42(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_42(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_FIELD)); - NextTest(); - } - - void OnSuccessResponse_42() { ThrowSuccessResponse(); } - - CHIP_ERROR TestClearWeekDayScheduleWith0UserIndex_43() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::ClearWeekDaySchedule::Type; - - RequestType request; - request.weekDayIndex = 1; - request.userIndex = 0U; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_43(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_43(error); - }; + case 479: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 480: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::TestCluster::Structs::SimpleStruct::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("structAttr.a", value.a, 5)); + VerifyOrReturn(CheckValue("structAttr.b", value.b, true)); + VerifyOrReturn(CheckValue("structAttr.c", value.c, 2)); + VerifyOrReturn(CheckValueAsString("structAttr.d", value.d, chip::ByteSpan(chip::Uint8::from_const_char("abc"), 3))); + VerifyOrReturn(CheckValueAsString("structAttr.e", value.e, chip::CharSpan("", 0))); + VerifyOrReturn(CheckValue("structAttr.f", value.f, 17)); + VerifyOrReturn(CheckValue("structAttr.g", value.g, 1.5f)); + VerifyOrReturn(CheckValue("structAttr.h", value.h, 3.14159265358979)); + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } } - void OnFailureResponse_43(CHIP_ERROR error) + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_FIELD)); - NextTest(); - } - - void OnSuccessResponse_43() { ThrowSuccessResponse(); } + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "Send Test Command"); + chip::app::Clusters::TestCluster::Commands::Test::Type value; + return SendCommand(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Commands::Test::Id, value); + } + case 2: { + LogStep(2, "Send Test Not Handled Command"); + chip::app::Clusters::TestCluster::Commands::TestNotHandled::Type value; + return SendCommand(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Commands::TestNotHandled::Id, value); + } + case 3: { + LogStep(3, "Send Test Specific Command"); + chip::app::Clusters::TestCluster::Commands::TestSpecific::Type value; + return SendCommand(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Commands::TestSpecific::Id, value); + } + case 4: { + LogStep(4, "Send Test Add Arguments Command"); + chip::app::Clusters::TestCluster::Commands::TestAddArguments::Type value; + value.arg1 = 3; + value.arg2 = 17; + return SendCommand(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Commands::TestAddArguments::Id, value); + } + case 5: { + LogStep(5, "Send failing Test Add Arguments Command"); + chip::app::Clusters::TestCluster::Commands::TestAddArguments::Type value; + value.arg1 = 250; + value.arg2 = 6; + return SendCommand(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Commands::TestAddArguments::Id, value); + } + case 6: { + LogStep(6, "Read attribute BOOLEAN Default Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Boolean::Id); + } + case 7: { + LogStep(7, "Write attribute BOOLEAN True"); + bool value; + value = 1; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Boolean::Id, value); + } + case 8: { + LogStep(8, "Read attribute BOOLEAN True"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Boolean::Id); + } + case 9: { + LogStep(9, "Write attribute BOOLEAN False"); + bool value; + value = 0; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Boolean::Id, value); + } + case 10: { + LogStep(10, "Read attribute BOOLEAN False"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Boolean::Id); + } + case 11: { + LogStep(11, "Read attribute BITMAP8 Default Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Bitmap8::Id); + } + case 12: { + LogStep(12, "Write attribute BITMAP8 Max Value"); + chip::BitFlags value; + value = static_cast>(255); + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Bitmap8::Id, value); + } + case 13: { + LogStep(13, "Read attribute BITMAP8 Max Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Bitmap8::Id); + } + case 14: { + LogStep(14, "Write attribute BITMAP8 Min Value"); + chip::BitFlags value; + value = static_cast>(0); + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Bitmap8::Id, value); + } + case 15: { + LogStep(15, "Read attribute BITMAP8 Min Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Bitmap8::Id); + } + case 16: { + LogStep(16, "Read attribute BITMAP16 Default Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Bitmap16::Id); + } + case 17: { + LogStep(17, "Write attribute BITMAP16 Max Value"); + chip::BitFlags value; + value = static_cast>(65535U); + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Bitmap16::Id, value); + } + case 18: { + LogStep(18, "Read attribute BITMAP16 Max Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Bitmap16::Id); + } + case 19: { + LogStep(19, "Write attribute BITMAP16 Min Value"); + chip::BitFlags value; + value = static_cast>(0U); + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Bitmap16::Id, value); + } + case 20: { + LogStep(20, "Read attribute BITMAP16 Min Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Bitmap16::Id); + } + case 21: { + LogStep(21, "Read attribute BITMAP32 Default Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Bitmap32::Id); + } + case 22: { + LogStep(22, "Write attribute BITMAP32 Max Value"); + chip::BitFlags value; + value = static_cast>(4294967295UL); + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Bitmap32::Id, value); + } + case 23: { + LogStep(23, "Read attribute BITMAP32 Max Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Bitmap32::Id); + } + case 24: { + LogStep(24, "Write attribute BITMAP32 Min Value"); + chip::BitFlags value; + value = static_cast>(0UL); + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Bitmap32::Id, value); + } + case 25: { + LogStep(25, "Read attribute BITMAP32 Min Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Bitmap32::Id); + } + case 26: { + LogStep(26, "Read attribute BITMAP64 Default Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Bitmap64::Id); + } + case 27: { + LogStep(27, "Write attribute BITMAP64 Max Value"); + chip::BitFlags value; + value = static_cast>(18446744073709551615ULL); + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Bitmap64::Id, value); + } + case 28: { + LogStep(28, "Read attribute BITMAP64 Max Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Bitmap64::Id); + } + case 29: { + LogStep(29, "Write attribute BITMAP64 Min Value"); + chip::BitFlags value; + value = static_cast>(0ULL); + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Bitmap64::Id, value); + } + case 30: { + LogStep(30, "Read attribute BITMAP64 Min Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Bitmap64::Id); + } + case 31: { + LogStep(31, "Read attribute INT8U Default Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Int8u::Id); + } + case 32: { + LogStep(32, "Write attribute INT8U Max Value"); + uint8_t value; + value = 255; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Int8u::Id, value); + } + case 33: { + LogStep(33, "Read attribute INT8U Max Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Int8u::Id); + } + case 34: { + LogStep(34, "Write attribute INT8U Min Value"); + uint8_t value; + value = 0; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Int8u::Id, value); + } + case 35: { + LogStep(35, "Read attribute INT8U Min Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Int8u::Id); + } + case 36: { + LogStep(36, "Read attribute INT16U Default Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Int16u::Id); + } + case 37: { + LogStep(37, "Write attribute INT16U Max Value"); + uint16_t value; + value = 65535U; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Int16u::Id, value); + } + case 38: { + LogStep(38, "Read attribute INT16U Max Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Int16u::Id); + } + case 39: { + LogStep(39, "Write attribute INT16U Min Value"); + uint16_t value; + value = 0U; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Int16u::Id, value); + } + case 40: { + LogStep(40, "Read attribute INT16U Min Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Int16u::Id); + } + case 41: { + LogStep(41, "Read attribute INT32U Default Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Int32u::Id); + } + case 42: { + LogStep(42, "Write attribute INT32U Max Value"); + uint32_t value; + value = 4294967295UL; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Int32u::Id, value); + } + case 43: { + LogStep(43, "Read attribute INT32U Max Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Int32u::Id); + } + case 44: { + LogStep(44, "Write attribute INT32U Min Value"); + uint32_t value; + value = 0UL; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Int32u::Id, value); + } + case 45: { + LogStep(45, "Read attribute INT32U Min Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Int32u::Id); + } + case 46: { + LogStep(46, "Read attribute INT64U Default Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Int64u::Id); + } + case 47: { + LogStep(47, "Write attribute INT64U Max Value"); + uint64_t value; + value = 18446744073709551615ULL; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Int64u::Id, value); + } + case 48: { + LogStep(48, "Read attribute INT64U Max Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Int64u::Id); + } + case 49: { + LogStep(49, "Write attribute INT64U Min Value"); + uint64_t value; + value = 0ULL; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Int64u::Id, value); + } + case 50: { + LogStep(50, "Read attribute INT64U Min Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Int64u::Id); + } + case 51: { + LogStep(51, "Read attribute INT8S Default Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Int8s::Id); + } + case 52: { + LogStep(52, "Write attribute INT8S Max Value"); + int8_t value; + value = 127; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Int8s::Id, value); + } + case 53: { + LogStep(53, "Read attribute INT8S Max Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Int8s::Id); + } + case 54: { + LogStep(54, "Write attribute INT8S Min Value"); + int8_t value; + value = -128; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Int8s::Id, value); + } + case 55: { + LogStep(55, "Read attribute INT8S Min Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Int8s::Id); + } + case 56: { + LogStep(56, "Write attribute INT8S Default Value"); + int8_t value; + value = 0; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Int8s::Id, value); + } + case 57: { + LogStep(57, "Read attribute INT8S Default Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Int8s::Id); + } + case 58: { + LogStep(58, "Read attribute INT16S Default Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Int16s::Id); + } + case 59: { + LogStep(59, "Write attribute INT16S Max Value"); + int16_t value; + value = 32767; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Int16s::Id, value); + } + case 60: { + LogStep(60, "Read attribute INT16S Max Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Int16s::Id); + } + case 61: { + LogStep(61, "Write attribute INT16S Min Value"); + int16_t value; + value = -32768; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Int16s::Id, value); + } + case 62: { + LogStep(62, "Read attribute INT16S Min Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Int16s::Id); + } + case 63: { + LogStep(63, "Write attribute INT16S Default Value"); + int16_t value; + value = 0; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Int16s::Id, value); + } + case 64: { + LogStep(64, "Read attribute INT16S Default Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Int16s::Id); + } + case 65: { + LogStep(65, "Read attribute INT32S Default Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Int32s::Id); + } + case 66: { + LogStep(66, "Write attribute INT32S Max Value"); + int32_t value; + value = 2147483647L; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Int32s::Id, value); + } + case 67: { + LogStep(67, "Read attribute INT32S Max Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Int32s::Id); + } + case 68: { + LogStep(68, "Write attribute INT32S Min Value"); + int32_t value; + value = -2147483648L; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Int32s::Id, value); + } + case 69: { + LogStep(69, "Read attribute INT32S Min Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Int32s::Id); + } + case 70: { + LogStep(70, "Write attribute INT32S Default Value"); + int32_t value; + value = 0L; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Int32s::Id, value); + } + case 71: { + LogStep(71, "Read attribute INT32S Default Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Int32s::Id); + } + case 72: { + LogStep(72, "Read attribute INT64S Default Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Int64s::Id); + } + case 73: { + LogStep(73, "Write attribute INT64S Max Value"); + int64_t value; + value = 9223372036854775807LL; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Int64s::Id, value); + } + case 74: { + LogStep(74, "Read attribute INT64S Max Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Int64s::Id); + } + case 75: { + LogStep(75, "Write attribute INT64S Min Value"); + int64_t value; + value = -9223372036854775807LL; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Int64s::Id, value); + } + case 76: { + LogStep(76, "Read attribute INT64S Min Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Int64s::Id); + } + case 77: { + LogStep(77, "Write attribute INT64S Default Value"); + int64_t value; + value = 0LL; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Int64s::Id, value); + } + case 78: { + LogStep(78, "Read attribute INT64S Default Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Int64s::Id); + } + case 79: { + LogStep(79, "Read attribute SINGLE Default Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::FloatSingle::Id); + } + case 80: { + LogStep(80, "Write attribute SINGLE medium Value"); + float value; + value = 0.1f; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::FloatSingle::Id, value); + } + case 81: { + LogStep(81, "Read attribute SINGLE medium Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::FloatSingle::Id); + } + case 82: { + LogStep(82, "Write attribute SINGLE large Value"); + float value; + value = 17000000000.0f; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::FloatSingle::Id, value); + } + case 83: { + LogStep(83, "Read attribute SINGLE large Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::FloatSingle::Id); + } + case 84: { + LogStep(84, "Write attribute SINGLE small Value"); + float value; + value = 1.7e-10f; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::FloatSingle::Id, value); + } + case 85: { + LogStep(85, "Read attribute SINGLE small Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::FloatSingle::Id); + } + case 86: { + LogStep(86, "Write attribute SINGLE Default Value"); + float value; + value = 0.0f; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::FloatSingle::Id, value); + } + case 87: { + LogStep(87, "Read attribute SINGLE Default Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::FloatSingle::Id); + } + case 88: { + LogStep(88, "Read attribute DOUBLE Default Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::FloatDouble::Id); + } + case 89: { + LogStep(89, "Write attribute DOUBLE medium Value"); + double value; + value = 0.1234567890123; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::FloatDouble::Id, value); + } + case 90: { + LogStep(90, "Read attribute DOUBLE medium Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::FloatDouble::Id); + } + case 91: { + LogStep(91, "Write attribute DOUBLE large Value"); + double value; + value = 1.7e+200; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::FloatDouble::Id, value); + } + case 92: { + LogStep(92, "Read attribute DOUBLE large Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::FloatDouble::Id); + } + case 93: { + LogStep(93, "Write attribute DOUBLE small Value"); + double value; + value = 1.7e-200; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::FloatDouble::Id, value); + } + case 94: { + LogStep(94, "Read attribute DOUBLE small Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::FloatDouble::Id); + } + case 95: { + LogStep(95, "Write attribute DOUBLE Default Value"); + double value; + value = 0; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::FloatDouble::Id, value); + } + case 96: { + LogStep(96, "Read attribute DOUBLE Default Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::FloatDouble::Id); + } + case 97: { + LogStep(97, "Read attribute ENUM8 Default Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Enum8::Id); + } + case 98: { + LogStep(98, "Write attribute ENUM8 Max Value"); + uint8_t value; + value = 255; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Enum8::Id, value); + } + case 99: { + LogStep(99, "Read attribute ENUM8 Max Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Enum8::Id); + } + case 100: { + LogStep(100, "Write attribute ENUM8 Min Value"); + uint8_t value; + value = 0; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Enum8::Id, value); + } + case 101: { + LogStep(101, "Read attribute ENUM8 Min Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Enum8::Id); + } + case 102: { + LogStep(102, "Read attribute ENUM16 Default Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Enum16::Id); + } + case 103: { + LogStep(103, "Write attribute ENUM16 Max Value"); + uint16_t value; + value = 65535U; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Enum16::Id, value); + } + case 104: { + LogStep(104, "Read attribute ENUM16 Max Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Enum16::Id); + } + case 105: { + LogStep(105, "Write attribute ENUM16 Min Value"); + uint16_t value; + value = 0U; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Enum16::Id, value); + } + case 106: { + LogStep(106, "Read attribute ENUM16 Min Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Enum16::Id); + } + case 107: { + LogStep(107, "Read attribute OCTET_STRING Default Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::OctetString::Id); + } + case 108: { + LogStep(108, "Write attribute OCTET_STRING with embedded null"); + chip::ByteSpan value; + value = chip::ByteSpan(chip::Uint8::from_const_char("Tes\000ti\000nggarbage: not in length on purpose"), 9); + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::OctetString::Id, value); + } + case 109: { + LogStep(109, "Read attribute OCTET_STRING with embedded null"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::OctetString::Id); + } + case 110: { + LogStep(110, "Write attribute OCTET_STRING with weird chars"); + chip::ByteSpan value; + value = chip::ByteSpan(chip::Uint8::from_const_char("\015\012\377\042\240garbage: not in length on purpose"), 5); + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::OctetString::Id, value); + } + case 111: { + LogStep(111, "Read attribute OCTET_STRING with weird chars"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::OctetString::Id); + } + case 112: { + LogStep(112, "Write attribute OCTET_STRING"); + chip::ByteSpan value; + value = chip::ByteSpan(chip::Uint8::from_const_char("TestValuegarbage: not in length on purpose"), 9); + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::OctetString::Id, value); + } + case 113: { + LogStep(113, "Read attribute OCTET_STRING"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::OctetString::Id); + } + case 114: { + LogStep(114, "Write attribute OCTET_STRING"); + chip::ByteSpan value; + value = chip::ByteSpan(chip::Uint8::from_const_char("TestValueLongerThan10garbage: not in length on purpose"), 21); + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::OctetString::Id, value); + } + case 115: { + LogStep(115, "Read attribute OCTET_STRING"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::OctetString::Id); + } + case 116: { + LogStep(116, "Write attribute OCTET_STRING"); + chip::ByteSpan value; + value = chip::ByteSpan(chip::Uint8::from_const_char("garbage: not in length on purpose"), 0); + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::OctetString::Id, value); + } + case 117: { + LogStep(117, "Read attribute LONG_OCTET_STRING Default Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::LongOctetString::Id); + } + case 118: { + LogStep(118, "Write attribute LONG_OCTET_STRING"); + chip::ByteSpan value; + value = chip::ByteSpan( + chip::Uint8::from_const_char("1111111111111111111111111111111111111111111111111111111111111111111111111111111111111" + "1111111111111111111111111111111111111111111111111111111111111111111111111111111111111" + "1111111111111111111111111111111111111111111111111111111111111111111111111111111111111" + "111111111111111111111111111111111111111111111garbage: not in length on purpose"), + 300); + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::LongOctetString::Id, + value); + } + case 119: { + LogStep(119, "Read attribute LONG_OCTET_STRING"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::LongOctetString::Id); + } + case 120: { + LogStep(120, "Write attribute LONG_OCTET_STRING"); + chip::ByteSpan value; + value = chip::ByteSpan(chip::Uint8::from_const_char("garbage: not in length on purpose"), 0); + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::LongOctetString::Id, + value); + } + case 121: { + LogStep(121, "Read attribute CHAR_STRING Default Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::CharString::Id); + } + case 122: { + LogStep(122, "Write attribute CHAR_STRING"); + chip::CharSpan value; + value = chip::Span("☉T☉garbage: not in length on purpose", 7); + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::CharString::Id, value); + } + case 123: { + LogStep(123, "Read attribute CHAR_STRING"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::CharString::Id); + } + case 124: { + LogStep(124, "Write attribute CHAR_STRING - Value too long"); + chip::CharSpan value; + value = chip::Span("☉TestValueLongerThan10☉garbage: not in length on purpose", 27); + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::CharString::Id, value); + } + case 125: { + LogStep(125, "Read attribute CHAR_STRING"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::CharString::Id); + } + case 126: { + LogStep(126, "Write attribute CHAR_STRING - Empty"); + chip::CharSpan value; + value = chip::Span("garbage: not in length on purpose", 0); + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::CharString::Id, value); + } + case 127: { + LogStep(127, "Read attribute LONG_CHAR_STRING Default Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::LongCharString::Id); + } + case 128: { + LogStep(128, "Write attribute LONG_CHAR_STRING"); + chip::CharSpan value; + value = chip::Span( + "☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉" + "☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉" + "☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉garbage: not in length on purpose", + 900); + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::LongCharString::Id, + value); + } + case 129: { + LogStep(129, "Read attribute LONG_CHAR_STRING"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::LongCharString::Id); + } + case 130: { + LogStep(130, "Write attribute LONG_CHAR_STRING"); + chip::CharSpan value; + value = chip::Span("garbage: not in length on purpose", 0); + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::LongCharString::Id, + value); + } + case 131: { + LogStep(131, "Read attribute LIST_LONG_OCTET_STRING (for chunked read)"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::ListLongOctetString::Id); + } + case 132: { + LogStep(132, "Write attribute LIST_LONG_OCTET_STRING (for chunked write)"); + ListFreer listFreer; + chip::app::DataModel::List value; + + { + auto * listHolder_0 = new ListHolder(5); + listFreer.add(listHolder_0); + listHolder_0->mList[0] = chip::ByteSpan( + chip::Uint8::from_const_char( + "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789" + "abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123" + "456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcd" + "ef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef01234567" + "89abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdefgarbage: not in " + "length on purpose"), + 512); + listHolder_0->mList[1] = chip::ByteSpan( + chip::Uint8::from_const_char( + "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789" + "abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123" + "456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcd" + "ef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef01234567" + "89abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdefgarbage: not in " + "length on purpose"), + 512); + listHolder_0->mList[2] = chip::ByteSpan( + chip::Uint8::from_const_char( + "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789" + "abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123" + "456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcd" + "ef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef01234567" + "89abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdefgarbage: not in " + "length on purpose"), + 512); + listHolder_0->mList[3] = chip::ByteSpan( + chip::Uint8::from_const_char( + "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789" + "abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123" + "456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcd" + "ef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef01234567" + "89abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdefgarbage: not in " + "length on purpose"), + 512); + listHolder_0->mList[4] = chip::ByteSpan( + chip::Uint8::from_const_char( + "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789" + "abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123" + "456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcd" + "ef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef01234567" + "89abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdefgarbage: not in " + "length on purpose"), + 512); + value = chip::app::DataModel::List(listHolder_0->mList, 5); + } + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::ListLongOctetString::Id, + value); + } + case 133: { + LogStep(133, "Read attribute LIST_LONG_OCTET_STRING (for chunked read)"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::ListLongOctetString::Id); + } + case 134: { + LogStep(134, "Read attribute EPOCH_US Default Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::EpochUs::Id); + } + case 135: { + LogStep(135, "Write attribute EPOCH_US Max Value"); + uint64_t value; + value = 18446744073709551615ULL; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::EpochUs::Id, value); + } + case 136: { + LogStep(136, "Read attribute EPOCH_US Max Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::EpochUs::Id); + } + case 137: { + LogStep(137, "Write attribute EPOCH_US Min Value"); + uint64_t value; + value = 0ULL; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::EpochUs::Id, value); + } + case 138: { + LogStep(138, "Read attribute EPOCH_US Min Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::EpochUs::Id); + } + case 139: { + LogStep(139, "Read attribute EPOCH_S Default Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::EpochS::Id); + } + case 140: { + LogStep(140, "Write attribute EPOCH_S Max Value"); + uint32_t value; + value = 4294967295UL; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::EpochS::Id, value); + } + case 141: { + LogStep(141, "Read attribute EPOCH_S Max Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::EpochS::Id); + } + case 142: { + LogStep(142, "Write attribute EPOCH_S Min Value"); + uint32_t value; + value = 0UL; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::EpochS::Id, value); + } + case 143: { + LogStep(143, "Read attribute EPOCH_S Min Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::EpochS::Id); + } + case 144: { + LogStep(144, "Read attribute UNSUPPORTED"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Unsupported::Id); + } + case 145: { + LogStep(145, "Writeattribute UNSUPPORTED"); + bool value; + value = 0; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Unsupported::Id, value); + } + case 146: { + LogStep(146, "Send Test Command to unsupported endpoint"); + chip::app::Clusters::TestCluster::Commands::Test::Type value; + return SendCommand(kIdentityAlpha, GetEndpoint(200), TestCluster::Id, TestCluster::Commands::Test::Id, value); + } + case 147: { + LogStep(147, "Send Test Command to unsupported cluster"); + chip::app::Clusters::TestCluster::Commands::Test::Type value; + return SendCommand(kIdentityAlpha, GetEndpoint(0), TestCluster::Id, TestCluster::Commands::Test::Id, value); + } + case 148: { + LogStep(148, "Read attribute vendor_id Default Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::VendorId::Id); + } + case 149: { + LogStep(149, "Write attribute vendor_id"); + chip::VendorId value; + value = static_cast(17); + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::VendorId::Id, value); + } + case 150: { + LogStep(150, "Read attribute vendor_id"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::VendorId::Id); + } + case 151: { + LogStep(151, "Restore attribute vendor_id"); + chip::VendorId value; + value = static_cast(0); + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::VendorId::Id, value); + } + case 152: { + LogStep(152, "Send a command with a vendor_id and enum"); + chip::app::Clusters::TestCluster::Commands::TestEnumsRequest::Type value; + value.arg1 = static_cast(20003); + value.arg2 = static_cast(101); + return SendCommand(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Commands::TestEnumsRequest::Id, value); + } + case 153: { + LogStep(153, "Send Test Command With Struct Argument and arg1.b is true"); + chip::app::Clusters::TestCluster::Commands::TestStructArgumentRequest::Type value; + + value.arg1.a = 0; + value.arg1.b = true; + value.arg1.c = static_cast(2); + value.arg1.d = chip::ByteSpan(chip::Uint8::from_const_char("octet_stringgarbage: not in length on purpose"), 12); + value.arg1.e = chip::Span("char_stringgarbage: not in length on purpose", 11); + value.arg1.f = static_cast>(1); + value.arg1.g = 0.0f; + value.arg1.h = 0; + + return SendCommand(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, + TestCluster::Commands::TestStructArgumentRequest::Id, value); + } + case 154: { + LogStep(154, "Send Test Command With Struct Argument and arg1.b is false"); + chip::app::Clusters::TestCluster::Commands::TestStructArgumentRequest::Type value; + + value.arg1.a = 0; + value.arg1.b = false; + value.arg1.c = static_cast(2); + value.arg1.d = chip::ByteSpan(chip::Uint8::from_const_char("octet_stringgarbage: not in length on purpose"), 12); + value.arg1.e = chip::Span("char_stringgarbage: not in length on purpose", 11); + value.arg1.f = static_cast>(1); + value.arg1.g = 0.0f; + value.arg1.h = 0; + + return SendCommand(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, + TestCluster::Commands::TestStructArgumentRequest::Id, value); + } + case 155: { + LogStep(155, "Send Test Command With Nested Struct Argument and arg1.c.b is true"); + chip::app::Clusters::TestCluster::Commands::TestNestedStructArgumentRequest::Type value; + + value.arg1.a = 0; + value.arg1.b = true; + + value.arg1.c.a = 0; + value.arg1.c.b = true; + value.arg1.c.c = static_cast(2); + value.arg1.c.d = chip::ByteSpan(chip::Uint8::from_const_char("octet_stringgarbage: not in length on purpose"), 12); + value.arg1.c.e = chip::Span("char_stringgarbage: not in length on purpose", 11); + value.arg1.c.f = static_cast>(1); + value.arg1.c.g = 0.0f; + value.arg1.c.h = 0; + + return SendCommand(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, + TestCluster::Commands::TestNestedStructArgumentRequest::Id, value); + } + case 156: { + LogStep(156, "Send Test Command With Nested Struct Argument arg1.c.b is false"); + chip::app::Clusters::TestCluster::Commands::TestNestedStructArgumentRequest::Type value; + + value.arg1.a = 0; + value.arg1.b = true; + + value.arg1.c.a = 0; + value.arg1.c.b = false; + value.arg1.c.c = static_cast(2); + value.arg1.c.d = chip::ByteSpan(chip::Uint8::from_const_char("octet_stringgarbage: not in length on purpose"), 12); + value.arg1.c.e = chip::Span("char_stringgarbage: not in length on purpose", 11); + value.arg1.c.f = static_cast>(1); + value.arg1.c.g = 0.0f; + value.arg1.c.h = 0; + + return SendCommand(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, + TestCluster::Commands::TestNestedStructArgumentRequest::Id, value); + } + case 157: { + LogStep(157, "Send Test Command With Nested Struct List Argument and all fields b of arg1.d are true"); + ListFreer listFreer; + chip::app::Clusters::TestCluster::Commands::TestNestedStructListArgumentRequest::Type value; + + value.arg1.a = 0; + value.arg1.b = true; + + value.arg1.c.a = 0; + value.arg1.c.b = true; + value.arg1.c.c = static_cast(2); + value.arg1.c.d = chip::ByteSpan(chip::Uint8::from_const_char("octet_stringgarbage: not in length on purpose"), 12); + value.arg1.c.e = chip::Span("char_stringgarbage: not in length on purpose", 11); + value.arg1.c.f = static_cast>(1); + value.arg1.c.g = 0.0f; + value.arg1.c.h = 0; + + { + auto * listHolder_1 = new ListHolder(2); + listFreer.add(listHolder_1); + + listHolder_1->mList[0].a = 1; + listHolder_1->mList[0].b = true; + listHolder_1->mList[0].c = static_cast(3); + listHolder_1->mList[0].d = + chip::ByteSpan(chip::Uint8::from_const_char("nested_octet_stringgarbage: not in length on purpose"), 19); + listHolder_1->mList[0].e = chip::Span("nested_char_stringgarbage: not in length on purpose", 18); + listHolder_1->mList[0].f = static_cast>(1); + listHolder_1->mList[0].g = 0.0f; + listHolder_1->mList[0].h = 0; + + listHolder_1->mList[1].a = 2; + listHolder_1->mList[1].b = true; + listHolder_1->mList[1].c = static_cast(3); + listHolder_1->mList[1].d = + chip::ByteSpan(chip::Uint8::from_const_char("nested_octet_stringgarbage: not in length on purpose"), 19); + listHolder_1->mList[1].e = chip::Span("nested_char_stringgarbage: not in length on purpose", 18); + listHolder_1->mList[1].f = static_cast>(1); + listHolder_1->mList[1].g = 0.0f; + listHolder_1->mList[1].h = 0; - CHIP_ERROR TestClearWeekDayScheduleWithOutOfBoundsUserIndex_44() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::ClearWeekDaySchedule::Type; + value.arg1.d = chip::app::DataModel::List( + listHolder_1->mList, 2); + } - RequestType request; - request.weekDayIndex = 1; - request.userIndex = static_cast(NumberOfTotalUsersSupported + 1); + { + auto * listHolder_1 = new ListHolder(3); + listFreer.add(listHolder_1); + listHolder_1->mList[0] = 1UL; + listHolder_1->mList[1] = 2UL; + listHolder_1->mList[2] = 3UL; + value.arg1.e = chip::app::DataModel::List(listHolder_1->mList, 3); + } - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_44(); - }; + { + auto * listHolder_1 = new ListHolder(3); + listFreer.add(listHolder_1); + listHolder_1->mList[0] = + chip::ByteSpan(chip::Uint8::from_const_char("octet_string_1garbage: not in length on purpose"), 14); + listHolder_1->mList[1] = + chip::ByteSpan(chip::Uint8::from_const_char("octect_string_2garbage: not in length on purpose"), 15); + listHolder_1->mList[2] = + chip::ByteSpan(chip::Uint8::from_const_char("octet_string_3garbage: not in length on purpose"), 14); + value.arg1.f = chip::app::DataModel::List(listHolder_1->mList, 3); + } - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_44(error); - }; + { + auto * listHolder_1 = new ListHolder(2); + listFreer.add(listHolder_1); + listHolder_1->mList[0] = 0; + listHolder_1->mList[1] = 255; + value.arg1.g = chip::app::DataModel::List(listHolder_1->mList, 2); + } - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } + return SendCommand(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, + TestCluster::Commands::TestNestedStructListArgumentRequest::Id, value); + } + case 158: { + LogStep(158, "Send Test Command With Nested Struct List Argument and some fields b of arg1.d are false"); + ListFreer listFreer; + chip::app::Clusters::TestCluster::Commands::TestNestedStructListArgumentRequest::Type value; - void OnFailureResponse_44(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_FIELD)); - NextTest(); - } + value.arg1.a = 0; + value.arg1.b = true; - void OnSuccessResponse_44() { ThrowSuccessResponse(); } + value.arg1.c.a = 0; + value.arg1.c.b = true; + value.arg1.c.c = static_cast(2); + value.arg1.c.d = chip::ByteSpan(chip::Uint8::from_const_char("octet_stringgarbage: not in length on purpose"), 12); + value.arg1.c.e = chip::Span("char_stringgarbage: not in length on purpose", 11); + value.arg1.c.f = static_cast>(1); + value.arg1.c.g = 0.0f; + value.arg1.c.h = 0; - CHIP_ERROR TestClearWeekDayScheduleWithNonExistingUser_45() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::ClearWeekDaySchedule::Type; + { + auto * listHolder_1 = new ListHolder(2); + listFreer.add(listHolder_1); - RequestType request; - request.weekDayIndex = 1; - request.userIndex = 2U; + listHolder_1->mList[0].a = 1; + listHolder_1->mList[0].b = true; + listHolder_1->mList[0].c = static_cast(3); + listHolder_1->mList[0].d = + chip::ByteSpan(chip::Uint8::from_const_char("nested_octet_stringgarbage: not in length on purpose"), 19); + listHolder_1->mList[0].e = chip::Span("nested_char_stringgarbage: not in length on purpose", 18); + listHolder_1->mList[0].f = static_cast>(1); + listHolder_1->mList[0].g = 0.0f; + listHolder_1->mList[0].h = 0; + + listHolder_1->mList[1].a = 2; + listHolder_1->mList[1].b = false; + listHolder_1->mList[1].c = static_cast(3); + listHolder_1->mList[1].d = + chip::ByteSpan(chip::Uint8::from_const_char("nested_octet_stringgarbage: not in length on purpose"), 19); + listHolder_1->mList[1].e = chip::Span("nested_char_stringgarbage: not in length on purpose", 18); + listHolder_1->mList[1].f = static_cast>(1); + listHolder_1->mList[1].g = 0.0f; + listHolder_1->mList[1].h = 0; - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_45(); - }; + value.arg1.d = chip::app::DataModel::List( + listHolder_1->mList, 2); + } - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_45(error); - }; + { + auto * listHolder_1 = new ListHolder(3); + listFreer.add(listHolder_1); + listHolder_1->mList[0] = 1UL; + listHolder_1->mList[1] = 2UL; + listHolder_1->mList[2] = 3UL; + value.arg1.e = chip::app::DataModel::List(listHolder_1->mList, 3); + } - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } + { + auto * listHolder_1 = new ListHolder(3); + listFreer.add(listHolder_1); + listHolder_1->mList[0] = + chip::ByteSpan(chip::Uint8::from_const_char("octet_string_1garbage: not in length on purpose"), 14); + listHolder_1->mList[1] = + chip::ByteSpan(chip::Uint8::from_const_char("octect_string_2garbage: not in length on purpose"), 15); + listHolder_1->mList[2] = + chip::ByteSpan(chip::Uint8::from_const_char("octet_string_3garbage: not in length on purpose"), 14); + value.arg1.f = chip::app::DataModel::List(listHolder_1->mList, 3); + } + + { + auto * listHolder_1 = new ListHolder(2); + listFreer.add(listHolder_1); + listHolder_1->mList[0] = 0; + listHolder_1->mList[1] = 255; + value.arg1.g = chip::app::DataModel::List(listHolder_1->mList, 2); + } + + return SendCommand(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, + TestCluster::Commands::TestNestedStructListArgumentRequest::Id, value); + } + case 159: { + LogStep(159, "Send Test Command With Struct Argument and see what we get back"); + chip::app::Clusters::TestCluster::Commands::SimpleStructEchoRequest::Type value; + + value.arg1.a = 17; + value.arg1.b = false; + value.arg1.c = static_cast(2); + value.arg1.d = chip::ByteSpan(chip::Uint8::from_const_char("octet_stringgarbage: not in length on purpose"), 12); + value.arg1.e = chip::Span("char_stringgarbage: not in length on purpose", 11); + value.arg1.f = static_cast>(1); + value.arg1.g = 0.1f; + value.arg1.h = 0.1; + + return SendCommand(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Commands::SimpleStructEchoRequest::Id, + value); + } + case 160: { + LogStep(160, "Send Test Command With List of INT8U and none of them is set to 0"); + ListFreer listFreer; + chip::app::Clusters::TestCluster::Commands::TestListInt8UArgumentRequest::Type value; + + { + auto * listHolder_0 = new ListHolder(9); + listFreer.add(listHolder_0); + listHolder_0->mList[0] = 1; + listHolder_0->mList[1] = 2; + listHolder_0->mList[2] = 3; + listHolder_0->mList[3] = 4; + listHolder_0->mList[4] = 5; + listHolder_0->mList[5] = 6; + listHolder_0->mList[6] = 7; + listHolder_0->mList[7] = 8; + listHolder_0->mList[8] = 9; + value.arg1 = chip::app::DataModel::List(listHolder_0->mList, 9); + } + return SendCommand(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, + TestCluster::Commands::TestListInt8UArgumentRequest::Id, value); + } + case 161: { + LogStep(161, "Send Test Command With List of INT8U and one of them is set to 0"); + ListFreer listFreer; + chip::app::Clusters::TestCluster::Commands::TestListInt8UArgumentRequest::Type value; + + { + auto * listHolder_0 = new ListHolder(10); + listFreer.add(listHolder_0); + listHolder_0->mList[0] = 1; + listHolder_0->mList[1] = 2; + listHolder_0->mList[2] = 3; + listHolder_0->mList[3] = 4; + listHolder_0->mList[4] = 5; + listHolder_0->mList[5] = 6; + listHolder_0->mList[6] = 7; + listHolder_0->mList[7] = 8; + listHolder_0->mList[8] = 9; + listHolder_0->mList[9] = 0; + value.arg1 = chip::app::DataModel::List(listHolder_0->mList, 10); + } + return SendCommand(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, + TestCluster::Commands::TestListInt8UArgumentRequest::Id, value); + } + case 162: { + LogStep(162, "Send Test Command With List of INT8U and get it reversed"); + ListFreer listFreer; + chip::app::Clusters::TestCluster::Commands::TestListInt8UReverseRequest::Type value; + + { + auto * listHolder_0 = new ListHolder(9); + listFreer.add(listHolder_0); + listHolder_0->mList[0] = 1; + listHolder_0->mList[1] = 2; + listHolder_0->mList[2] = 3; + listHolder_0->mList[3] = 4; + listHolder_0->mList[4] = 5; + listHolder_0->mList[5] = 6; + listHolder_0->mList[6] = 7; + listHolder_0->mList[7] = 8; + listHolder_0->mList[8] = 9; + value.arg1 = chip::app::DataModel::List(listHolder_0->mList, 9); + } + return SendCommand(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, + TestCluster::Commands::TestListInt8UReverseRequest::Id, value); + } + case 163: { + LogStep(163, "Send Test Command With empty List of INT8U and get an empty list back"); + ListFreer listFreer; + chip::app::Clusters::TestCluster::Commands::TestListInt8UReverseRequest::Type value; + + value.arg1 = chip::app::DataModel::List(); + return SendCommand(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, + TestCluster::Commands::TestListInt8UReverseRequest::Id, value); + } + case 164: { + LogStep(164, "Send Test Command With List of Struct Argument and arg1.b of first item is true"); + ListFreer listFreer; + chip::app::Clusters::TestCluster::Commands::TestListStructArgumentRequest::Type value; + + { + auto * listHolder_0 = new ListHolder(2); + listFreer.add(listHolder_0); + + listHolder_0->mList[0].a = 0; + listHolder_0->mList[0].b = true; + listHolder_0->mList[0].c = static_cast(2); + listHolder_0->mList[0].d = + chip::ByteSpan(chip::Uint8::from_const_char("first_octet_stringgarbage: not in length on purpose"), 18); + listHolder_0->mList[0].e = chip::Span("first_char_stringgarbage: not in length on purpose", 17); + listHolder_0->mList[0].f = static_cast>(1); + listHolder_0->mList[0].g = 0.0f; + listHolder_0->mList[0].h = 0; + + listHolder_0->mList[1].a = 1; + listHolder_0->mList[1].b = true; + listHolder_0->mList[1].c = static_cast(3); + listHolder_0->mList[1].d = + chip::ByteSpan(chip::Uint8::from_const_char("second_octet_stringgarbage: not in length on purpose"), 19); + listHolder_0->mList[1].e = chip::Span("second_char_stringgarbage: not in length on purpose", 18); + listHolder_0->mList[1].f = static_cast>(1); + listHolder_0->mList[1].g = 0.0f; + listHolder_0->mList[1].h = 0; + + value.arg1 = chip::app::DataModel::List( + listHolder_0->mList, 2); + } + return SendCommand(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, + TestCluster::Commands::TestListStructArgumentRequest::Id, value); + } + case 165: { + LogStep(165, "Send Test Command With List of Struct Argument and arg1.b of first item is false"); + ListFreer listFreer; + chip::app::Clusters::TestCluster::Commands::TestListStructArgumentRequest::Type value; - void OnFailureResponse_45(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_NOT_FOUND)); - NextTest(); - } + { + auto * listHolder_0 = new ListHolder(2); + listFreer.add(listHolder_0); - void OnSuccessResponse_45() { ThrowSuccessResponse(); } + listHolder_0->mList[0].a = 1; + listHolder_0->mList[0].b = true; + listHolder_0->mList[0].c = static_cast(3); + listHolder_0->mList[0].d = + chip::ByteSpan(chip::Uint8::from_const_char("second_octet_stringgarbage: not in length on purpose"), 19); + listHolder_0->mList[0].e = chip::Span("second_char_stringgarbage: not in length on purpose", 18); + listHolder_0->mList[0].f = static_cast>(1); + listHolder_0->mList[0].g = 0.0f; + listHolder_0->mList[0].h = 0; + + listHolder_0->mList[1].a = 0; + listHolder_0->mList[1].b = false; + listHolder_0->mList[1].c = static_cast(2); + listHolder_0->mList[1].d = + chip::ByteSpan(chip::Uint8::from_const_char("first_octet_stringgarbage: not in length on purpose"), 18); + listHolder_0->mList[1].e = chip::Span("first_char_stringgarbage: not in length on purpose", 17); + listHolder_0->mList[1].f = static_cast>(1); + listHolder_0->mList[1].g = 0.0f; + listHolder_0->mList[1].h = 0; + + value.arg1 = chip::app::DataModel::List( + listHolder_0->mList, 2); + } + return SendCommand(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, + TestCluster::Commands::TestListStructArgumentRequest::Id, value); + } + case 166: { + LogStep(166, + "Send Test Command With List of Nested Struct List Argument and all fields b of elements of arg1.d are true"); + ListFreer listFreer; + chip::app::Clusters::TestCluster::Commands::TestListNestedStructListArgumentRequest::Type value; - CHIP_ERROR TestClearYearDayScheduleWith0Index_46() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::ClearYearDaySchedule::Type; + { + auto * listHolder_0 = new ListHolder(1); + listFreer.add(listHolder_0); - RequestType request; - request.yearDayIndex = 0; - request.userIndex = 1U; + listHolder_0->mList[0].a = 0; + listHolder_0->mList[0].b = true; - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_46(); - }; + listHolder_0->mList[0].c.a = 0; + listHolder_0->mList[0].c.b = true; + listHolder_0->mList[0].c.c = static_cast(2); + listHolder_0->mList[0].c.d = + chip::ByteSpan(chip::Uint8::from_const_char("octet_stringgarbage: not in length on purpose"), 12); + listHolder_0->mList[0].c.e = chip::Span("char_stringgarbage: not in length on purpose", 11); + listHolder_0->mList[0].c.f = static_cast>(1); + listHolder_0->mList[0].c.g = 0.0f; + listHolder_0->mList[0].c.h = 0; - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_46(error); - }; + { + auto * listHolder_2 = new ListHolder(2); + listFreer.add(listHolder_2); + + listHolder_2->mList[0].a = 1; + listHolder_2->mList[0].b = true; + listHolder_2->mList[0].c = static_cast(3); + listHolder_2->mList[0].d = + chip::ByteSpan(chip::Uint8::from_const_char("nested_octet_stringgarbage: not in length on purpose"), 19); + listHolder_2->mList[0].e = chip::Span("nested_char_stringgarbage: not in length on purpose", 18); + listHolder_2->mList[0].f = static_cast>(1); + listHolder_2->mList[0].g = 0.0f; + listHolder_2->mList[0].h = 0; + + listHolder_2->mList[1].a = 2; + listHolder_2->mList[1].b = true; + listHolder_2->mList[1].c = static_cast(3); + listHolder_2->mList[1].d = + chip::ByteSpan(chip::Uint8::from_const_char("nested_octet_stringgarbage: not in length on purpose"), 19); + listHolder_2->mList[1].e = chip::Span("nested_char_stringgarbage: not in length on purpose", 18); + listHolder_2->mList[1].f = static_cast>(1); + listHolder_2->mList[1].g = 0.0f; + listHolder_2->mList[1].h = 0; + + listHolder_0->mList[0].d = + chip::app::DataModel::List( + listHolder_2->mList, 2); + } - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } + { + auto * listHolder_2 = new ListHolder(3); + listFreer.add(listHolder_2); + listHolder_2->mList[0] = 1UL; + listHolder_2->mList[1] = 2UL; + listHolder_2->mList[2] = 3UL; + listHolder_0->mList[0].e = chip::app::DataModel::List(listHolder_2->mList, 3); + } - void OnFailureResponse_46(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_FIELD)); - NextTest(); - } + { + auto * listHolder_2 = new ListHolder(3); + listFreer.add(listHolder_2); + listHolder_2->mList[0] = + chip::ByteSpan(chip::Uint8::from_const_char("octet_string_1garbage: not in length on purpose"), 14); + listHolder_2->mList[1] = + chip::ByteSpan(chip::Uint8::from_const_char("octect_string_2garbage: not in length on purpose"), 15); + listHolder_2->mList[2] = + chip::ByteSpan(chip::Uint8::from_const_char("octet_string_3garbage: not in length on purpose"), 14); + listHolder_0->mList[0].f = chip::app::DataModel::List(listHolder_2->mList, 3); + } - void OnSuccessResponse_46() { ThrowSuccessResponse(); } + { + auto * listHolder_2 = new ListHolder(2); + listFreer.add(listHolder_2); + listHolder_2->mList[0] = 0; + listHolder_2->mList[1] = 255; + listHolder_0->mList[0].g = chip::app::DataModel::List(listHolder_2->mList, 2); + } - CHIP_ERROR TestClearYearDayScheduleWithOutOfBoundsIndex_47() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::ClearYearDaySchedule::Type; + value.arg1 = chip::app::DataModel::List( + listHolder_0->mList, 1); + } + return SendCommand(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, + TestCluster::Commands::TestListNestedStructListArgumentRequest::Id, value); + } + case 167: { + LogStep(167, "Send Test Command With Nested Struct List Argument and some fields b of elements of arg1.d are false"); + ListFreer listFreer; + chip::app::Clusters::TestCluster::Commands::TestListNestedStructListArgumentRequest::Type value; - RequestType request; - request.yearDayIndex = static_cast(NumberOfYearDaySchedulesSupportedPerUser + 1); - request.userIndex = 1U; + { + auto * listHolder_0 = new ListHolder(1); + listFreer.add(listHolder_0); - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_47(); - }; + listHolder_0->mList[0].a = 0; + listHolder_0->mList[0].b = true; - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_47(error); - }; + listHolder_0->mList[0].c.a = 0; + listHolder_0->mList[0].c.b = true; + listHolder_0->mList[0].c.c = static_cast(2); + listHolder_0->mList[0].c.d = + chip::ByteSpan(chip::Uint8::from_const_char("octet_stringgarbage: not in length on purpose"), 12); + listHolder_0->mList[0].c.e = chip::Span("char_stringgarbage: not in length on purpose", 11); + listHolder_0->mList[0].c.f = static_cast>(1); + listHolder_0->mList[0].c.g = 0.0f; + listHolder_0->mList[0].c.h = 0; - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } + { + auto * listHolder_2 = new ListHolder(2); + listFreer.add(listHolder_2); + + listHolder_2->mList[0].a = 1; + listHolder_2->mList[0].b = true; + listHolder_2->mList[0].c = static_cast(3); + listHolder_2->mList[0].d = + chip::ByteSpan(chip::Uint8::from_const_char("nested_octet_stringgarbage: not in length on purpose"), 19); + listHolder_2->mList[0].e = chip::Span("nested_char_stringgarbage: not in length on purpose", 18); + listHolder_2->mList[0].f = static_cast>(1); + listHolder_2->mList[0].g = 0.0f; + listHolder_2->mList[0].h = 0; + + listHolder_2->mList[1].a = 2; + listHolder_2->mList[1].b = false; + listHolder_2->mList[1].c = static_cast(3); + listHolder_2->mList[1].d = + chip::ByteSpan(chip::Uint8::from_const_char("nested_octet_stringgarbage: not in length on purpose"), 19); + listHolder_2->mList[1].e = chip::Span("nested_char_stringgarbage: not in length on purpose", 18); + listHolder_2->mList[1].f = static_cast>(1); + listHolder_2->mList[1].g = 0.0f; + listHolder_2->mList[1].h = 0; + + listHolder_0->mList[0].d = + chip::app::DataModel::List( + listHolder_2->mList, 2); + } - void OnFailureResponse_47(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_FIELD)); - NextTest(); - } + { + auto * listHolder_2 = new ListHolder(3); + listFreer.add(listHolder_2); + listHolder_2->mList[0] = 1UL; + listHolder_2->mList[1] = 2UL; + listHolder_2->mList[2] = 3UL; + listHolder_0->mList[0].e = chip::app::DataModel::List(listHolder_2->mList, 3); + } - void OnSuccessResponse_47() { ThrowSuccessResponse(); } + { + auto * listHolder_2 = new ListHolder(3); + listFreer.add(listHolder_2); + listHolder_2->mList[0] = + chip::ByteSpan(chip::Uint8::from_const_char("octet_string_1garbage: not in length on purpose"), 14); + listHolder_2->mList[1] = + chip::ByteSpan(chip::Uint8::from_const_char("octect_string_2garbage: not in length on purpose"), 15); + listHolder_2->mList[2] = + chip::ByteSpan(chip::Uint8::from_const_char("octet_string_3garbage: not in length on purpose"), 14); + listHolder_0->mList[0].f = chip::app::DataModel::List(listHolder_2->mList, 3); + } - CHIP_ERROR TestClearYearDayScheduleWith0UserIndex_48() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::ClearYearDaySchedule::Type; + { + auto * listHolder_2 = new ListHolder(2); + listFreer.add(listHolder_2); + listHolder_2->mList[0] = 0; + listHolder_2->mList[1] = 255; + listHolder_0->mList[0].g = chip::app::DataModel::List(listHolder_2->mList, 2); + } - RequestType request; - request.yearDayIndex = 1; - request.userIndex = 0U; + value.arg1 = chip::app::DataModel::List( + listHolder_0->mList, 1); + } + return SendCommand(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, + TestCluster::Commands::TestListNestedStructListArgumentRequest::Id, value); + } + case 168: { + LogStep(168, "Write attribute LIST With List of INT8U and none of them is set to 0"); + ListFreer listFreer; + chip::app::DataModel::List value; - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_48(); - }; + { + auto * listHolder_0 = new ListHolder(4); + listFreer.add(listHolder_0); + listHolder_0->mList[0] = 1; + listHolder_0->mList[1] = 2; + listHolder_0->mList[2] = 3; + listHolder_0->mList[3] = 4; + value = chip::app::DataModel::List(listHolder_0->mList, 4); + } + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::ListInt8u::Id, value); + } + case 169: { + LogStep(169, "Read attribute LIST With List of INT8U"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::ListInt8u::Id); + } + case 170: { + LogStep(170, "Write attribute LIST With List of OCTET_STRING"); + ListFreer listFreer; + chip::app::DataModel::List value; - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_48(error); - }; + { + auto * listHolder_0 = new ListHolder(4); + listFreer.add(listHolder_0); + listHolder_0->mList[0] = chip::ByteSpan(chip::Uint8::from_const_char("Test0garbage: not in length on purpose"), 5); + listHolder_0->mList[1] = chip::ByteSpan(chip::Uint8::from_const_char("Test1garbage: not in length on purpose"), 5); + listHolder_0->mList[2] = chip::ByteSpan(chip::Uint8::from_const_char("Test2garbage: not in length on purpose"), 5); + listHolder_0->mList[3] = chip::ByteSpan(chip::Uint8::from_const_char("Test3garbage: not in length on purpose"), 5); + value = chip::app::DataModel::List(listHolder_0->mList, 4); + } + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::ListOctetString::Id, + value); + } + case 171: { + LogStep(171, "Read attribute LIST With List of OCTET_STRING"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::ListOctetString::Id); + } + case 172: { + LogStep(172, "Write attribute LIST With List of LIST_STRUCT_OCTET_STRING"); + ListFreer listFreer; + chip::app::DataModel::List value; - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } + { + auto * listHolder_0 = new ListHolder(4); + listFreer.add(listHolder_0); - void OnFailureResponse_48(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_FIELD)); - NextTest(); - } + listHolder_0->mList[0].fabricIndex = 0ULL; + listHolder_0->mList[0].operationalCert = + chip::ByteSpan(chip::Uint8::from_const_char("Test0garbage: not in length on purpose"), 5); - void OnSuccessResponse_48() { ThrowSuccessResponse(); } + listHolder_0->mList[1].fabricIndex = 1ULL; + listHolder_0->mList[1].operationalCert = + chip::ByteSpan(chip::Uint8::from_const_char("Test1garbage: not in length on purpose"), 5); - CHIP_ERROR TestClearYearDayScheduleWithOutOfBoundsUserIndex_49() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::ClearYearDaySchedule::Type; + listHolder_0->mList[2].fabricIndex = 2ULL; + listHolder_0->mList[2].operationalCert = + chip::ByteSpan(chip::Uint8::from_const_char("Test2garbage: not in length on purpose"), 5); - RequestType request; - request.yearDayIndex = 1; - request.userIndex = static_cast(NumberOfTotalUsersSupported + 1); + listHolder_0->mList[3].fabricIndex = 3ULL; + listHolder_0->mList[3].operationalCert = + chip::ByteSpan(chip::Uint8::from_const_char("Test3garbage: not in length on purpose"), 5); - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_49(); - }; + value = chip::app::DataModel::List( + listHolder_0->mList, 4); + } + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, + TestCluster::Attributes::ListStructOctetString::Id, value); + } + case 173: { + LogStep(173, "Read attribute LIST With List of LIST_STRUCT_OCTET_STRING"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, + TestCluster::Attributes::ListStructOctetString::Id); + } + case 174: { + LogStep(174, "Send Test Command with optional arg set."); + chip::app::Clusters::TestCluster::Commands::TestNullableOptionalRequest::Type value; + value.arg1.Emplace(); + value.arg1.Value().SetNonNull(); + value.arg1.Value().Value() = 5; + return SendCommand(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, + TestCluster::Commands::TestNullableOptionalRequest::Id, value); + } + case 175: { + LogStep(175, "Send Test Command without its optional arg."); + chip::app::Clusters::TestCluster::Commands::TestNullableOptionalRequest::Type value; + return SendCommand(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, + TestCluster::Commands::TestNullableOptionalRequest::Id, value); + } + case 176: { + LogStep(176, "Read list of structs containing nullables and optionals"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, + TestCluster::Attributes::ListNullablesAndOptionalsStruct::Id); + } + case 177: { + LogStep(177, "Write list of structs containing nullables and optionals"); + ListFreer listFreer; + chip::app::DataModel::List value; + + { + auto * listHolder_0 = + new ListHolder(1); + listFreer.add(listHolder_0); + + listHolder_0->mList[0].nullableInt.SetNull(); + listHolder_0->mList[0].nullableString.SetNull(); + listHolder_0->mList[0].nullableStruct.SetNull(); + listHolder_0->mList[0].nullableList.SetNonNull(); - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_49(error); - }; + { + auto * listHolder_3 = new ListHolder(2); + listFreer.add(listHolder_3); + listHolder_3->mList[0] = static_cast(1); + listHolder_3->mList[1] = static_cast(2); + listHolder_0->mList[0].nullableList.Value() = + chip::app::DataModel::List(listHolder_3->mList, 2); + } - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + value = chip::app::DataModel::List( + listHolder_0->mList, 1); + } + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, + TestCluster::Attributes::ListNullablesAndOptionalsStruct::Id, value); + } + case 178: { + LogStep(178, "Read list of structs containing nullables and optionals after writing"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, + TestCluster::Attributes::ListNullablesAndOptionalsStruct::Id); + } + case 179: { + LogStep(179, "Write attribute NULLABLE_BOOLEAN null"); + chip::app::DataModel::Nullable value; + value.SetNull(); + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableBoolean::Id, + value); + } + case 180: { + LogStep(180, "Read attribute NULLABLE_BOOLEAN null"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableBoolean::Id); + } + case 181: { + LogStep(181, "Write attribute NULLABLE_BOOLEAN True"); + chip::app::DataModel::Nullable value; + value.SetNonNull(); + value.Value() = true; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableBoolean::Id, + value); + } + case 182: { + LogStep(182, "Read attribute NULLABLE_BOOLEAN True"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableBoolean::Id); + } + case 183: { + LogStep(183, "Write attribute NULLABLE_BITMAP8 Max Value"); + chip::app::DataModel::Nullable> value; + value.SetNonNull(); + value.Value() = static_cast>(254); + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableBitmap8::Id, + value); + } + case 184: { + LogStep(184, "Read attribute NULLABLE_BITMAP8 Max Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableBitmap8::Id); + } + case 185: { + LogStep(185, "Write attribute NULLABLE_BITMAP8 Invalid Value"); + chip::app::DataModel::Nullable> value; + value.SetNonNull(); + value.Value() = static_cast>(255); + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableBitmap8::Id, + value); + } + case 186: { + LogStep(186, "Read attribute NULLABLE_BITMAP8 unchanged Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableBitmap8::Id); + } + case 187: { + LogStep(187, "Write attribute NULLABLE_BITMAP8 null Value"); + chip::app::DataModel::Nullable> value; + value.SetNull(); + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableBitmap8::Id, + value); + } + case 188: { + LogStep(188, "Read attribute NULLABLE_BITMAP8 null Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableBitmap8::Id); + } + case 189: { + LogStep(189, "Write attribute NULLABLE_BITMAP16 Max Value"); + chip::app::DataModel::Nullable> value; + value.SetNonNull(); + value.Value() = static_cast>(65534U); + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableBitmap16::Id, + value); + } + case 190: { + LogStep(190, "Read attribute NULLABLE_BITMAP16 Max Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableBitmap16::Id); + } + case 191: { + LogStep(191, "Write attribute NULLABLE_BITMAP16 Invalid Value"); + chip::app::DataModel::Nullable> value; + value.SetNonNull(); + value.Value() = static_cast>(65535U); + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableBitmap16::Id, + value); + } + case 192: { + LogStep(192, "Read attribute NULLABLE_BITMAP16 unchanged Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableBitmap16::Id); + } + case 193: { + LogStep(193, "Write attribute NULLABLE_BITMAP16 null Value"); + chip::app::DataModel::Nullable> value; + value.SetNull(); + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableBitmap16::Id, + value); + } + case 194: { + LogStep(194, "Read attribute NULLABLE_BITMAP16 null Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableBitmap16::Id); + } + case 195: { + LogStep(195, "Write attribute NULLABLE_BITMAP32 Max Value"); + chip::app::DataModel::Nullable> value; + value.SetNonNull(); + value.Value() = static_cast>(4294967294UL); + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableBitmap32::Id, + value); + } + case 196: { + LogStep(196, "Read attribute NULLABLE_BITMAP32 Max Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableBitmap32::Id); + } + case 197: { + LogStep(197, "Write attribute NULLABLE_BITMAP32 Invalid Value"); + chip::app::DataModel::Nullable> value; + value.SetNonNull(); + value.Value() = static_cast>(4294967295UL); + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableBitmap32::Id, + value); + } + case 198: { + LogStep(198, "Read attribute NULLABLE_BITMAP32 unchanged Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableBitmap32::Id); + } + case 199: { + LogStep(199, "Write attribute NULLABLE_BITMAP32 null Value"); + chip::app::DataModel::Nullable> value; + value.SetNull(); + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableBitmap32::Id, + value); + } + case 200: { + LogStep(200, "Read attribute NULLABLE_BITMAP32 null Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableBitmap32::Id); + } + case 201: { + LogStep(201, "Write attribute NULLABLE_BITMAP64 Max Value"); + chip::app::DataModel::Nullable> value; + value.SetNonNull(); + value.Value() = static_cast>(18446744073709551614ULL); + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableBitmap64::Id, + value); + } + case 202: { + LogStep(202, "Read attribute NULLABLE_BITMAP64 Max Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableBitmap64::Id); + } + case 203: { + LogStep(203, "Write attribute NULLABLE_BITMAP64 Invalid Value"); + chip::app::DataModel::Nullable> value; + value.SetNonNull(); + value.Value() = static_cast>(18446744073709551615ULL); + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableBitmap64::Id, + value); + } + case 204: { + LogStep(204, "Read attribute NULLABLE_BITMAP64 unchanged Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableBitmap64::Id); + } + case 205: { + LogStep(205, "Write attribute NULLABLE_BITMAP64 null Value"); + chip::app::DataModel::Nullable> value; + value.SetNull(); + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableBitmap64::Id, + value); + } + case 206: { + LogStep(206, "Read attribute NULLABLE_BITMAP64 null Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableBitmap64::Id); + } + case 207: { + LogStep(207, "Write attribute NULLABLE_INT8U Min Value"); + chip::app::DataModel::Nullable value; + value.SetNonNull(); + value.Value() = 0; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableInt8u::Id, + value); + } + case 208: { + LogStep(208, "Read attribute NULLABLE_INT8U Min Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableInt8u::Id); + } + case 209: { + LogStep(209, "Write attribute NULLABLE_INT8U Max Value"); + chip::app::DataModel::Nullable value; + value.SetNonNull(); + value.Value() = 254; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableInt8u::Id, + value); + } + case 210: { + LogStep(210, "Read attribute NULLABLE_INT8U Max Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableInt8u::Id); + } + case 211: { + LogStep(211, "Write attribute NULLABLE_INT8U Invalid Value"); + chip::app::DataModel::Nullable value; + value.SetNonNull(); + value.Value() = 255; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableInt8u::Id, + value); + } + case 212: { + LogStep(212, "Read attribute NULLABLE_INT8U unchanged Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableInt8u::Id); + } + case 213: { + LogStep(213, "Read attribute NULLABLE_INT8U unchanged Value with constraint"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableInt8u::Id); + } + case 214: { + LogStep(214, "Write attribute NULLABLE_INT8U null Value"); + chip::app::DataModel::Nullable value; + value.SetNull(); + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableInt8u::Id, + value); + } + case 215: { + LogStep(215, "Read attribute NULLABLE_INT8U null Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableInt8u::Id); + } + case 216: { + LogStep(216, "Read attribute NULLABLE_INT8U null Value & range"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableInt8u::Id); + } + case 217: { + LogStep(217, "Read attribute NULLABLE_INT8U null Value & not"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableInt8u::Id); + } + case 218: { + LogStep(218, "Write attribute NULLABLE_INT8U Value"); + chip::app::DataModel::Nullable value; + value.SetNonNull(); + value.Value() = 128; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableInt8u::Id, + value); + } + case 219: { + LogStep(219, "Read attribute NULLABLE_INT8U Value in range"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableInt8u::Id); + } + case 220: { + LogStep(220, "Read attribute NULLABLE_INT8U notValue OK"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableInt8u::Id); + } + case 221: { + LogStep(221, "Write attribute NULLABLE_INT16U Min Value"); + chip::app::DataModel::Nullable value; + value.SetNonNull(); + value.Value() = 0U; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableInt16u::Id, + value); + } + case 222: { + LogStep(222, "Read attribute NULLABLE_INT16U Min Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableInt16u::Id); + } + case 223: { + LogStep(223, "Write attribute NULLABLE_INT16U Max Value"); + chip::app::DataModel::Nullable value; + value.SetNonNull(); + value.Value() = 65534U; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableInt16u::Id, + value); + } + case 224: { + LogStep(224, "Read attribute NULLABLE_INT16U Max Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableInt16u::Id); + } + case 225: { + LogStep(225, "Write attribute NULLABLE_INT16U Invalid Value"); + chip::app::DataModel::Nullable value; + value.SetNonNull(); + value.Value() = 65535U; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableInt16u::Id, + value); + } + case 226: { + LogStep(226, "Read attribute NULLABLE_INT16U unchanged Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableInt16u::Id); + } + case 227: { + LogStep(227, "Write attribute NULLABLE_INT16U null Value"); + chip::app::DataModel::Nullable value; + value.SetNull(); + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableInt16u::Id, + value); + } + case 228: { + LogStep(228, "Read attribute NULLABLE_INT16U null Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableInt16u::Id); + } + case 229: { + LogStep(229, "Read attribute NULLABLE_INT16U null Value & range"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableInt16u::Id); + } + case 230: { + LogStep(230, "Read attribute NULLABLE_INT16U null Value & not"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableInt16u::Id); + } + case 231: { + LogStep(231, "Write attribute NULLABLE_INT16U Value"); + chip::app::DataModel::Nullable value; + value.SetNonNull(); + value.Value() = 32000U; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableInt16u::Id, + value); + } + case 232: { + LogStep(232, "Read attribute NULLABLE_INT16U Value in range"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableInt16u::Id); + } + case 233: { + LogStep(233, "Read attribute NULLABLE_INT16U notValue OK"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableInt16u::Id); + } + case 234: { + LogStep(234, "Write attribute NULLABLE_INT32U Min Value"); + chip::app::DataModel::Nullable value; + value.SetNonNull(); + value.Value() = 0UL; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableInt32u::Id, + value); + } + case 235: { + LogStep(235, "Read attribute NULLABLE_INT32U Min Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableInt32u::Id); + } + case 236: { + LogStep(236, "Write attribute NULLABLE_INT32U Max Value"); + chip::app::DataModel::Nullable value; + value.SetNonNull(); + value.Value() = 4294967294UL; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableInt32u::Id, + value); + } + case 237: { + LogStep(237, "Read attribute NULLABLE_INT32U Max Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableInt32u::Id); + } + case 238: { + LogStep(238, "Write attribute NULLABLE_INT32U Invalid Value"); + chip::app::DataModel::Nullable value; + value.SetNonNull(); + value.Value() = 4294967295UL; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableInt32u::Id, + value); + } + case 239: { + LogStep(239, "Read attribute NULLABLE_INT32U unchanged Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableInt32u::Id); + } + case 240: { + LogStep(240, "Write attribute NULLABLE_INT32U null Value"); + chip::app::DataModel::Nullable value; + value.SetNull(); + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableInt32u::Id, + value); + } + case 241: { + LogStep(241, "Read attribute NULLABLE_INT32U null Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableInt32u::Id); + } + case 242: { + LogStep(242, "Read attribute NULLABLE_INT32U null Value & range"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableInt32u::Id); + } + case 243: { + LogStep(243, "Read attribute NULLABLE_INT32U null Value & not"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableInt32u::Id); + } + case 244: { + LogStep(244, "Write attribute NULLABLE_INT32U Value"); + chip::app::DataModel::Nullable value; + value.SetNonNull(); + value.Value() = 2147483647UL; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableInt32u::Id, + value); + } + case 245: { + LogStep(245, "Read attribute NULLABLE_INT32U Value in range"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableInt32u::Id); + } + case 246: { + LogStep(246, "Read attribute NULLABLE_INT32U notValue OK"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableInt32u::Id); + } + case 247: { + LogStep(247, "Write attribute NULLABLE_INT64U Min Value"); + chip::app::DataModel::Nullable value; + value.SetNonNull(); + value.Value() = 0ULL; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableInt64u::Id, + value); + } + case 248: { + LogStep(248, "Read attribute NULLABLE_INT64U Min Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableInt64u::Id); + } + case 249: { + LogStep(249, "Write attribute NULLABLE_INT64U Max Value"); + chip::app::DataModel::Nullable value; + value.SetNonNull(); + value.Value() = 18446744073709551614ULL; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableInt64u::Id, + value); + } + case 250: { + LogStep(250, "Read attribute NULLABLE_INT64U Max Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableInt64u::Id); + } + case 251: { + LogStep(251, "Write attribute NULLABLE_INT64U Invalid Value"); + chip::app::DataModel::Nullable value; + value.SetNonNull(); + value.Value() = 18446744073709551615ULL; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableInt64u::Id, + value); + } + case 252: { + LogStep(252, "Read attribute NULLABLE_INT64U unchanged Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableInt64u::Id); + } + case 253: { + LogStep(253, "Write attribute NULLABLE_INT64U null Value"); + chip::app::DataModel::Nullable value; + value.SetNull(); + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableInt64u::Id, + value); + } + case 254: { + LogStep(254, "Read attribute NULLABLE_INT64U null Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableInt64u::Id); + } + case 255: { + LogStep(255, "Read attribute NULLABLE_INT64U null Value & range"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableInt64u::Id); + } + case 256: { + LogStep(256, "Read attribute NULLABLE_INT64U null Value & not"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableInt64u::Id); + } + case 257: { + LogStep(257, "Write attribute NULLABLE_INT64U Value"); + chip::app::DataModel::Nullable value; + value.SetNonNull(); + value.Value() = 18000000000000000000ULL; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableInt64u::Id, + value); + } + case 258: { + LogStep(258, "Read attribute NULLABLE_INT64U Value in range"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableInt64u::Id); + } + case 259: { + LogStep(259, "Read attribute NULLABLE_INT64U notValue OK"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableInt64u::Id); + } + case 260: { + LogStep(260, "Write attribute NULLABLE_INT8S Min Value"); + chip::app::DataModel::Nullable value; + value.SetNonNull(); + value.Value() = -127; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableInt8s::Id, + value); + } + case 261: { + LogStep(261, "Read attribute NULLABLE_INT8S Min Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableInt8s::Id); + } + case 262: { + LogStep(262, "Write attribute NULLABLE_INT8S Invalid Value"); + chip::app::DataModel::Nullable value; + value.SetNonNull(); + value.Value() = -128; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableInt8s::Id, + value); + } + case 263: { + LogStep(263, "Read attribute NULLABLE_INT8S unchanged Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableInt8s::Id); + } + case 264: { + LogStep(264, "Write attribute NULLABLE_INT8S null Value"); + chip::app::DataModel::Nullable value; + value.SetNull(); + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableInt8s::Id, + value); + } + case 265: { + LogStep(265, "Read attribute NULLABLE_INT8S null Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableInt8s::Id); + } + case 266: { + LogStep(266, "Read attribute NULLABLE_INT8S null Value & range"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableInt8s::Id); + } + case 267: { + LogStep(267, "Read attribute NULLABLE_INT8S null Value & not"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableInt8s::Id); + } + case 268: { + LogStep(268, "Write attribute NULLABLE_INT8S Value"); + chip::app::DataModel::Nullable value; + value.SetNonNull(); + value.Value() = -127; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableInt8s::Id, + value); + } + case 269: { + LogStep(269, "Read attribute NULLABLE_INT8S Value in range"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableInt8s::Id); + } + case 270: { + LogStep(270, "Read attribute NULLABLE_INT8S notValue OK"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableInt8s::Id); + } + case 271: { + LogStep(271, "Write attribute NULLABLE_INT16S Min Value"); + chip::app::DataModel::Nullable value; + value.SetNonNull(); + value.Value() = -32767; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableInt16s::Id, + value); + } + case 272: { + LogStep(272, "Read attribute NULLABLE_INT16S Min Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableInt16s::Id); + } + case 273: { + LogStep(273, "Write attribute NULLABLE_INT16S Invalid Value"); + chip::app::DataModel::Nullable value; + value.SetNonNull(); + value.Value() = -32768; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableInt16s::Id, + value); + } + case 274: { + LogStep(274, "Read attribute NULLABLE_INT16S unchanged Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableInt16s::Id); + } + case 275: { + LogStep(275, "Write attribute NULLABLE_INT16S null Value"); + chip::app::DataModel::Nullable value; + value.SetNull(); + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableInt16s::Id, + value); + } + case 276: { + LogStep(276, "Read attribute NULLABLE_INT16S null Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableInt16s::Id); + } + case 277: { + LogStep(277, "Read attribute NULLABLE_INT16S null Value & range"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableInt16s::Id); + } + case 278: { + LogStep(278, "Read attribute NULLABLE_INT16S null Value & not"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableInt16s::Id); + } + case 279: { + LogStep(279, "Write attribute NULLABLE_INT16S Value"); + chip::app::DataModel::Nullable value; + value.SetNonNull(); + value.Value() = -32767; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableInt16s::Id, + value); + } + case 280: { + LogStep(280, "Read attribute NULLABLE_INT16S Value in range"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableInt16s::Id); + } + case 281: { + LogStep(281, "Read attribute NULLABLE_INT16S notValue OK"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableInt16s::Id); + } + case 282: { + LogStep(282, "Write attribute NULLABLE_INT32S Min Value"); + chip::app::DataModel::Nullable value; + value.SetNonNull(); + value.Value() = -2147483647L; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableInt32s::Id, + value); + } + case 283: { + LogStep(283, "Read attribute NULLABLE_INT32S Min Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableInt32s::Id); + } + case 284: { + LogStep(284, "Write attribute NULLABLE_INT32S Invalid Value"); + chip::app::DataModel::Nullable value; + value.SetNonNull(); + value.Value() = -2147483648L; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableInt32s::Id, + value); + } + case 285: { + LogStep(285, "Read attribute NULLABLE_INT32S unchanged Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableInt32s::Id); + } + case 286: { + LogStep(286, "Write attribute NULLABLE_INT32S null Value"); + chip::app::DataModel::Nullable value; + value.SetNull(); + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableInt32s::Id, + value); + } + case 287: { + LogStep(287, "Read attribute NULLABLE_INT32S null Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableInt32s::Id); + } + case 288: { + LogStep(288, "Read attribute NULLABLE_INT32S null Value & range"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableInt32s::Id); + } + case 289: { + LogStep(289, "Read attribute NULLABLE_INT32S null Value & not"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableInt32s::Id); + } + case 290: { + LogStep(290, "Write attribute NULLABLE_INT32S Value"); + chip::app::DataModel::Nullable value; + value.SetNonNull(); + value.Value() = -2147483647L; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableInt32s::Id, + value); + } + case 291: { + LogStep(291, "Read attribute NULLABLE_INT32S Value in range"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableInt32s::Id); + } + case 292: { + LogStep(292, "Read attribute NULLABLE_INT32S notValue OK"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableInt32s::Id); + } + case 293: { + LogStep(293, "Write attribute NULLABLE_INT64S Min Value"); + chip::app::DataModel::Nullable value; + value.SetNonNull(); + value.Value() = -9223372036854775807LL; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableInt64s::Id, + value); + } + case 294: { + LogStep(294, "Read attribute NULLABLE_INT64S Min Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableInt64s::Id); + } + case 295: { + LogStep(295, "Write attribute NULLABLE_INT64S Invalid Value"); + chip::app::DataModel::Nullable value; + value.SetNonNull(); + value.Value() = -9223372036854775807LL - 1; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableInt64s::Id, + value); + } + case 296: { + LogStep(296, "Read attribute NULLABLE_INT64S unchanged Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableInt64s::Id); + } + case 297: { + LogStep(297, "Write attribute NULLABLE_INT64S null Value"); + chip::app::DataModel::Nullable value; + value.SetNull(); + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableInt64s::Id, + value); + } + case 298: { + LogStep(298, "Read attribute NULLABLE_INT64S null Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableInt64s::Id); + } + case 299: { + LogStep(299, "Read attribute NULLABLE_INT64S null Value & range"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableInt64s::Id); + } + case 300: { + LogStep(300, "Read attribute NULLABLE_INT64S null Value & not"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableInt64s::Id); + } + case 301: { + LogStep(301, "Write attribute NULLABLE_INT64S Value"); + chip::app::DataModel::Nullable value; + value.SetNonNull(); + value.Value() = -9223372036854775807LL; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableInt64s::Id, + value); + } + case 302: { + LogStep(302, "Read attribute NULLABLE_INT64S Value in range"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableInt64s::Id); + } + case 303: { + LogStep(303, "Read attribute NULLABLE_INT64S notValue OK"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableInt64s::Id); + } + case 304: { + LogStep(304, "Write attribute NULLABLE_SINGLE medium Value"); + chip::app::DataModel::Nullable value; + value.SetNonNull(); + value.Value() = 0.1f; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableFloatSingle::Id, + value); + } + case 305: { + LogStep(305, "Read attribute NULLABLE_SINGLE medium Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableFloatSingle::Id); + } + case 306: { + LogStep(306, "Write attribute NULLABLE_SINGLE largest Value"); + chip::app::DataModel::Nullable value; + value.SetNonNull(); + value.Value() = INFINITY; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableFloatSingle::Id, + value); + } + case 307: { + LogStep(307, "Read attribute NULLABLE_SINGLE largest Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableFloatSingle::Id); + } + case 308: { + LogStep(308, "Write attribute NULLABLE_SINGLE smallest Value"); + chip::app::DataModel::Nullable value; + value.SetNonNull(); + value.Value() = -INFINITY; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableFloatSingle::Id, + value); + } + case 309: { + LogStep(309, "Read attribute NULLABLE_SINGLE smallest Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableFloatSingle::Id); + } + case 310: { + LogStep(310, "Write attribute NULLABLE_SINGLE null Value"); + chip::app::DataModel::Nullable value; + value.SetNull(); + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableFloatSingle::Id, + value); + } + case 311: { + LogStep(311, "Read attribute NULLABLE_SINGLE null Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableFloatSingle::Id); + } + case 312: { + LogStep(312, "Write attribute NULLABLE_SINGLE 0 Value"); + chip::app::DataModel::Nullable value; + value.SetNonNull(); + value.Value() = 0.0f; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableFloatSingle::Id, + value); + } + case 313: { + LogStep(313, "Read attribute NULLABLE_SINGLE 0 Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableFloatSingle::Id); + } + case 314: { + LogStep(314, "Write attribute NULLABLE_DOUBLE medium Value"); + chip::app::DataModel::Nullable value; + value.SetNonNull(); + value.Value() = 0.1234567890123; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableFloatDouble::Id, + value); + } + case 315: { + LogStep(315, "Read attribute NULLABLE_DOUBLE medium Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableFloatDouble::Id); + } + case 316: { + LogStep(316, "Write attribute NULLABLE_DOUBLE largest Value"); + chip::app::DataModel::Nullable value; + value.SetNonNull(); + value.Value() = INFINITY; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableFloatDouble::Id, + value); + } + case 317: { + LogStep(317, "Read attribute NULLABLE_DOUBLE largest Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableFloatDouble::Id); + } + case 318: { + LogStep(318, "Write attribute NULLABLE_DOUBLE smallest Value"); + chip::app::DataModel::Nullable value; + value.SetNonNull(); + value.Value() = -INFINITY; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableFloatDouble::Id, + value); + } + case 319: { + LogStep(319, "Read attribute NULLABLE_DOUBLE smallest Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableFloatDouble::Id); + } + case 320: { + LogStep(320, "Write attribute NULLABLE_DOUBLE null Value"); + chip::app::DataModel::Nullable value; + value.SetNull(); + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableFloatDouble::Id, + value); + } + case 321: { + LogStep(321, "Read attribute NULLABLE_DOUBLE null Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableFloatDouble::Id); + } + case 322: { + LogStep(322, "Write attribute NULLABLE_DOUBLE 0 Value"); + chip::app::DataModel::Nullable value; + value.SetNonNull(); + value.Value() = 0; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableFloatDouble::Id, + value); + } + case 323: { + LogStep(323, "Read attribute NULLABLE_DOUBLE 0 Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableFloatDouble::Id); + } + case 324: { + LogStep(324, "Write attribute NULLABLE_ENUM8 Min Value"); + chip::app::DataModel::Nullable value; + value.SetNonNull(); + value.Value() = 0; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableEnum8::Id, + value); + } + case 325: { + LogStep(325, "Read attribute NULLABLE_ENUM8 Min Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableEnum8::Id); + } + case 326: { + LogStep(326, "Write attribute NULLABLE_ENUM8 Max Value"); + chip::app::DataModel::Nullable value; + value.SetNonNull(); + value.Value() = 254; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableEnum8::Id, + value); + } + case 327: { + LogStep(327, "Read attribute NULLABLE_ENUM8 Max Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableEnum8::Id); + } + case 328: { + LogStep(328, "Write attribute NULLABLE_ENUM8 Invalid Value"); + chip::app::DataModel::Nullable value; + value.SetNonNull(); + value.Value() = 255; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableEnum8::Id, + value); + } + case 329: { + LogStep(329, "Read attribute NULLABLE_ENUM8 unchanged Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableEnum8::Id); + } + case 330: { + LogStep(330, "Write attribute NULLABLE_ENUM8 null Value"); + chip::app::DataModel::Nullable value; + value.SetNull(); + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableEnum8::Id, + value); + } + case 331: { + LogStep(331, "Read attribute NULLABLE_ENUM8 null Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableEnum8::Id); + } + case 332: { + LogStep(332, "Write attribute NULLABLE_ENUM16 Min Value"); + chip::app::DataModel::Nullable value; + value.SetNonNull(); + value.Value() = 0U; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableEnum16::Id, + value); + } + case 333: { + LogStep(333, "Read attribute NULLABLE_ENUM16 Min Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableEnum16::Id); + } + case 334: { + LogStep(334, "Write attribute NULLABLE_ENUM16 Max Value"); + chip::app::DataModel::Nullable value; + value.SetNonNull(); + value.Value() = 65534U; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableEnum16::Id, + value); + } + case 335: { + LogStep(335, "Read attribute NULLABLE_ENUM16 Max Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableEnum16::Id); + } + case 336: { + LogStep(336, "Write attribute NULLABLE_ENUM16 Invalid Value"); + chip::app::DataModel::Nullable value; + value.SetNonNull(); + value.Value() = 65535U; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableEnum16::Id, + value); + } + case 337: { + LogStep(337, "Read attribute NULLABLE_ENUM16 unchanged Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableEnum16::Id); + } + case 338: { + LogStep(338, "Write attribute NULLABLE_ENUM16 null Value"); + chip::app::DataModel::Nullable value; + value.SetNull(); + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableEnum16::Id, + value); + } + case 339: { + LogStep(339, "Read attribute NULLABLE_ENUM16 null Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableEnum16::Id); + } + case 340: { + LogStep(340, "Write attribute NULLABLE_SIMPLE_ENUM Min Value"); + chip::app::DataModel::Nullable value; + value.SetNonNull(); + value.Value() = static_cast(0); + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableEnumAttr::Id, + value); + } + case 341: { + LogStep(341, "Read attribute NULLABLE_SIMPLE_ENUM Min Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableEnumAttr::Id); + } + case 342: { + LogStep(342, "Write attribute NULLABLE_SIMPLE_ENUM Max Value"); + chip::app::DataModel::Nullable value; + value.SetNonNull(); + value.Value() = static_cast(254); + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableEnumAttr::Id, + value); + } + case 343: { + LogStep(343, "Read attribute NULLABLE_SIMPLE_ENUM Max Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableEnumAttr::Id); + } + case 344: { + LogStep(344, "Write attribute NULLABLE_SIMPLE_ENUM Invalid Value"); + chip::app::DataModel::Nullable value; + value.SetNonNull(); + value.Value() = static_cast(255); + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableEnumAttr::Id, + value); + } + case 345: { + LogStep(345, "Read attribute NULLABLE_SIMPLE_ENUM unchanged Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableEnumAttr::Id); + } + case 346: { + LogStep(346, "Write attribute NULLABLE_SIMPLE_ENUM null Value"); + chip::app::DataModel::Nullable value; + value.SetNull(); + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableEnumAttr::Id, + value); + } + case 347: { + LogStep(347, "Read attribute NULLABLE_SIMPLE_ENUM null Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableEnumAttr::Id); + } + case 348: { + LogStep(348, "Read attribute NULLABLE_OCTET_STRING Default Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableOctetString::Id); + } + case 349: { + LogStep(349, "Write attribute NULLABLE_OCTET_STRING"); + chip::app::DataModel::Nullable value; + value.SetNonNull(); + value.Value() = chip::ByteSpan(chip::Uint8::from_const_char("TestValuegarbage: not in length on purpose"), 9); + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableOctetString::Id, + value); + } + case 350: { + LogStep(350, "Read attribute NULLABLE_OCTET_STRING"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableOctetString::Id); + } + case 351: { + LogStep(351, "Write attribute NULLABLE_OCTET_STRING"); + chip::app::DataModel::Nullable value; + value.SetNull(); + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableOctetString::Id, + value); + } + case 352: { + LogStep(352, "Read attribute NULLABLE_OCTET_STRING"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableOctetString::Id); + } + case 353: { + LogStep(353, "Write attribute NULLABLE_OCTET_STRING"); + chip::app::DataModel::Nullable value; + value.SetNonNull(); + value.Value() = chip::ByteSpan(chip::Uint8::from_const_char("garbage: not in length on purpose"), 0); + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableOctetString::Id, + value); + } + case 354: { + LogStep(354, "Read attribute NULLABLE_OCTET_STRING"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableOctetString::Id); + } + case 355: { + LogStep(355, "Read attribute NULLABLE_CHAR_STRING Default Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableCharString::Id); + } + case 356: { + LogStep(356, "Write attribute NULLABLE_CHAR_STRING"); + chip::app::DataModel::Nullable value; + value.SetNonNull(); + value.Value() = chip::Span("☉T☉garbage: not in length on purpose", 7); + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableCharString::Id, + value); + } + case 357: { + LogStep(357, "Read attribute NULLABLE_CHAR_STRING"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableCharString::Id); + } + case 358: { + LogStep(358, "Write attribute NULLABLE_CHAR_STRING - Value too long"); + chip::app::DataModel::Nullable value; + value.SetNull(); + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableCharString::Id, + value); + } + case 359: { + LogStep(359, "Read attribute NULLABLE_CHAR_STRING"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableCharString::Id); + } + case 360: { + LogStep(360, "Write attribute NULLABLE_CHAR_STRING - Empty"); + chip::app::DataModel::Nullable value; + value.SetNonNull(); + value.Value() = chip::Span("garbage: not in length on purpose", 0); + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableCharString::Id, + value); + } + case 361: { + LogStep(361, "Read attribute NULLABLE_CHAR_STRING"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::NullableCharString::Id); + } + case 362: { + LogStep(362, "Read attribute from nonexistent endpoint."); + return ReadAttribute(kIdentityAlpha, GetEndpoint(200), TestCluster::Id, TestCluster::Attributes::ListInt8u::Id); + } + case 363: { + LogStep(363, "Read attribute from nonexistent cluster."); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), TestCluster::Id, TestCluster::Attributes::ListInt8u::Id); + } + case 364: { + LogStep(364, "Send a command that takes an optional parameter but do not set it."); + chip::app::Clusters::TestCluster::Commands::TestSimpleOptionalArgumentRequest::Type value; + return SendCommand(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, + TestCluster::Commands::TestSimpleOptionalArgumentRequest::Id, value); + } + case 365: { + LogStep(365, "Send a command that takes an optional parameter but do not set it."); + chip::app::Clusters::TestCluster::Commands::TestSimpleOptionalArgumentRequest::Type value; + value.arg1.Emplace(); + value.arg1.Value() = 1; + return SendCommand(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, + TestCluster::Commands::TestSimpleOptionalArgumentRequest::Id, value); + } + case 366: { + LogStep(366, "Subscribe to list attribute"); + return SubscribeAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::ListInt8u::Id, 2, + 5); + } + case 367: { + LogStep(367, "Write subscribed-to list attribute"); + ListFreer listFreer; + chip::app::DataModel::List value; + + { + auto * listHolder_0 = new ListHolder(4); + listFreer.add(listHolder_0); + listHolder_0->mList[0] = 5; + listHolder_0->mList[1] = 6; + listHolder_0->mList[2] = 7; + listHolder_0->mList[3] = 8; + value = chip::app::DataModel::List(listHolder_0->mList, 4); + } + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::ListInt8u::Id, value); + } + case 368: { + LogStep(368, "Check for list attribute report"); + return WaitForReport(); + } + case 369: { + LogStep(369, "Read range-restricted unsigned 8-bit integer"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, + TestCluster::Attributes::RangeRestrictedInt8u::Id); + } + case 370: { + LogStep(370, "Write min value to a range-restricted unsigned 8-bit integer"); + uint8_t value; + value = 0; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, + TestCluster::Attributes::RangeRestrictedInt8u::Id, value); + } + case 371: { + LogStep(371, "Write just-below-range value to a range-restricted unsigned 8-bit integer"); + uint8_t value; + value = 19; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, + TestCluster::Attributes::RangeRestrictedInt8u::Id, value); + } + case 372: { + LogStep(372, "Write just-above-range value to a range-restricted unsigned 8-bit integer"); + uint8_t value; + value = 101; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, + TestCluster::Attributes::RangeRestrictedInt8u::Id, value); + } + case 373: { + LogStep(373, "Write max value to a range-restricted unsigned 8-bit integer"); + uint8_t value; + value = 255; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, + TestCluster::Attributes::RangeRestrictedInt8u::Id, value); + } + case 374: { + LogStep(374, "Verify range-restricted unsigned 8-bit integer value has not changed"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, + TestCluster::Attributes::RangeRestrictedInt8u::Id); + } + case 375: { + LogStep(375, "Write min valid value to a range-restricted unsigned 8-bit integer"); + uint8_t value; + value = 20; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, + TestCluster::Attributes::RangeRestrictedInt8u::Id, value); + } + case 376: { + LogStep(376, "Verify range-restricted unsigned 8-bit integer value is at min valid"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, + TestCluster::Attributes::RangeRestrictedInt8u::Id); + } + case 377: { + LogStep(377, "Write max valid value to a range-restricted unsigned 8-bit integer"); + uint8_t value; + value = 100; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, + TestCluster::Attributes::RangeRestrictedInt8u::Id, value); + } + case 378: { + LogStep(378, "Verify range-restricted unsigned 8-bit integer value is at max valid"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, + TestCluster::Attributes::RangeRestrictedInt8u::Id); + } + case 379: { + LogStep(379, "Write middle valid value to a range-restricted unsigned 8-bit integer"); + uint8_t value; + value = 50; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, + TestCluster::Attributes::RangeRestrictedInt8u::Id, value); + } + case 380: { + LogStep(380, "Verify range-restricted unsigned 8-bit integer value is at mid valid"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, + TestCluster::Attributes::RangeRestrictedInt8u::Id); + } + case 381: { + LogStep(381, "Read range-restricted unsigned 16-bit integer"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, + TestCluster::Attributes::RangeRestrictedInt16u::Id); + } + case 382: { + LogStep(382, "Write min value to a range-restricted unsigned 16-bit integer"); + uint16_t value; + value = 0U; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, + TestCluster::Attributes::RangeRestrictedInt16u::Id, value); + } + case 383: { + LogStep(383, "Write just-below-range value to a range-restricted unsigned 16-bit integer"); + uint16_t value; + value = 99U; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, + TestCluster::Attributes::RangeRestrictedInt16u::Id, value); + } + case 384: { + LogStep(384, "Write just-above-range value to a range-restricted unsigned 16-bit integer"); + uint16_t value; + value = 1001U; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, + TestCluster::Attributes::RangeRestrictedInt16u::Id, value); + } + case 385: { + LogStep(385, "Write max value to a range-restricted unsigned 16-bit integer"); + uint16_t value; + value = 65535U; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, + TestCluster::Attributes::RangeRestrictedInt16u::Id, value); + } + case 386: { + LogStep(386, "Verify range-restricted unsigned 16-bit integer value has not changed"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, + TestCluster::Attributes::RangeRestrictedInt16u::Id); + } + case 387: { + LogStep(387, "Write min valid value to a range-restricted unsigned 16-bit integer"); + uint16_t value; + value = 100U; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, + TestCluster::Attributes::RangeRestrictedInt16u::Id, value); + } + case 388: { + LogStep(388, "Verify range-restricted unsigned 16-bit integer value is at min valid"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, + TestCluster::Attributes::RangeRestrictedInt16u::Id); + } + case 389: { + LogStep(389, "Write max valid value to a range-restricted unsigned 16-bit integer"); + uint16_t value; + value = 1000U; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, + TestCluster::Attributes::RangeRestrictedInt16u::Id, value); + } + case 390: { + LogStep(390, "Verify range-restricted unsigned 16-bit integer value is at max valid"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, + TestCluster::Attributes::RangeRestrictedInt16u::Id); + } + case 391: { + LogStep(391, "Write middle valid value to a range-restricted unsigned 16-bit integer"); + uint16_t value; + value = 500U; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, + TestCluster::Attributes::RangeRestrictedInt16u::Id, value); + } + case 392: { + LogStep(392, "Verify range-restricted unsigned 16-bit integer value is at mid valid"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, + TestCluster::Attributes::RangeRestrictedInt16u::Id); + } + case 393: { + LogStep(393, "Read range-restricted signed 8-bit integer"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, + TestCluster::Attributes::RangeRestrictedInt8s::Id); + } + case 394: { + LogStep(394, "Write min value to a range-restricted signed 8-bit integer"); + int8_t value; + value = -128; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, + TestCluster::Attributes::RangeRestrictedInt8s::Id, value); + } + case 395: { + LogStep(395, "Write just-below-range value to a range-restricted signed 8-bit integer"); + int8_t value; + value = -41; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, + TestCluster::Attributes::RangeRestrictedInt8s::Id, value); + } + case 396: { + LogStep(396, "Write just-above-range value to a range-restricted signed 8-bit integer"); + int8_t value; + value = 51; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, + TestCluster::Attributes::RangeRestrictedInt8s::Id, value); + } + case 397: { + LogStep(397, "Write max value to a range-restricted signed 8-bit integer"); + int8_t value; + value = 127; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, + TestCluster::Attributes::RangeRestrictedInt8s::Id, value); + } + case 398: { + LogStep(398, "Verify range-restricted signed 8-bit integer value has not changed"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, + TestCluster::Attributes::RangeRestrictedInt8s::Id); + } + case 399: { + LogStep(399, "Write min valid value to a range-restricted signed 8-bit integer"); + int8_t value; + value = -40; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, + TestCluster::Attributes::RangeRestrictedInt8s::Id, value); + } + case 400: { + LogStep(400, "Verify range-restricted signed 8-bit integer value is at min valid"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, + TestCluster::Attributes::RangeRestrictedInt8s::Id); + } + case 401: { + LogStep(401, "Write max valid value to a range-restricted signed 8-bit integer"); + int8_t value; + value = 50; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, + TestCluster::Attributes::RangeRestrictedInt8s::Id, value); + } + case 402: { + LogStep(402, "Verify range-restricted signed 8-bit integer value is at max valid"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, + TestCluster::Attributes::RangeRestrictedInt8s::Id); + } + case 403: { + LogStep(403, "Write middle valid value to a range-restricted signed 8-bit integer"); + int8_t value; + value = 6; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, + TestCluster::Attributes::RangeRestrictedInt8s::Id, value); + } + case 404: { + LogStep(404, "Verify range-restricted signed 8-bit integer value is at mid valid"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, + TestCluster::Attributes::RangeRestrictedInt8s::Id); + } + case 405: { + LogStep(405, "Read range-restricted signed 16-bit integer"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, + TestCluster::Attributes::RangeRestrictedInt16s::Id); + } + case 406: { + LogStep(406, "Write min value to a range-restricted signed 16-bit integer"); + int16_t value; + value = -32768; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, + TestCluster::Attributes::RangeRestrictedInt16s::Id, value); + } + case 407: { + LogStep(407, "Write just-below-range value to a range-restricted signed 16-bit integer"); + int16_t value; + value = -151; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, + TestCluster::Attributes::RangeRestrictedInt16s::Id, value); + } + case 408: { + LogStep(408, "Write just-above-range value to a range-restricted signed 16-bit integer"); + int16_t value; + value = 201; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, + TestCluster::Attributes::RangeRestrictedInt16s::Id, value); + } + case 409: { + LogStep(409, "Write max value to a range-restricted signed 16-bit integer"); + int16_t value; + value = 32767; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, + TestCluster::Attributes::RangeRestrictedInt16s::Id, value); + } + case 410: { + LogStep(410, "Verify range-restricted signed 16-bit integer value has not changed"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, + TestCluster::Attributes::RangeRestrictedInt16s::Id); + } + case 411: { + LogStep(411, "Write min valid value to a range-restricted signed 16-bit integer"); + int16_t value; + value = -150; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, + TestCluster::Attributes::RangeRestrictedInt16s::Id, value); + } + case 412: { + LogStep(412, "Verify range-restricted signed 16-bit integer value is at min valid"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, + TestCluster::Attributes::RangeRestrictedInt16s::Id); + } + case 413: { + LogStep(413, "Write max valid value to a range-restricted signed 16-bit integer"); + int16_t value; + value = 200; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, + TestCluster::Attributes::RangeRestrictedInt16s::Id, value); + } + case 414: { + LogStep(414, "Verify range-restricted signed 16-bit integer value is at max valid"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, + TestCluster::Attributes::RangeRestrictedInt16s::Id); + } + case 415: { + LogStep(415, "Write middle valid value to a range-restricted signed 16-bit integer"); + int16_t value; + value = 7; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, + TestCluster::Attributes::RangeRestrictedInt16s::Id, value); + } + case 416: { + LogStep(416, "Verify range-restricted signed 16-bit integer value is at mid valid"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, + TestCluster::Attributes::RangeRestrictedInt16s::Id); + } + case 417: { + LogStep(417, "Read nullable range-restricted unsigned 8-bit integer"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, + TestCluster::Attributes::NullableRangeRestrictedInt8u::Id); + } + case 418: { + LogStep(418, "Write min value to a nullable range-restricted unsigned 8-bit integer"); + chip::app::DataModel::Nullable value; + value.SetNonNull(); + value.Value() = 0; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, + TestCluster::Attributes::NullableRangeRestrictedInt8u::Id, value); + } + case 419: { + LogStep(419, "Write just-below-range value to a nullable range-restricted unsigned 8-bit integer"); + chip::app::DataModel::Nullable value; + value.SetNonNull(); + value.Value() = 19; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, + TestCluster::Attributes::NullableRangeRestrictedInt8u::Id, value); + } + case 420: { + LogStep(420, "Write just-above-range value to a nullable range-restricted unsigned 8-bit integer"); + chip::app::DataModel::Nullable value; + value.SetNonNull(); + value.Value() = 101; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, + TestCluster::Attributes::NullableRangeRestrictedInt8u::Id, value); + } + case 421: { + LogStep(421, "Write max value to a nullable range-restricted unsigned 8-bit integer"); + chip::app::DataModel::Nullable value; + value.SetNonNull(); + value.Value() = 254; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, + TestCluster::Attributes::NullableRangeRestrictedInt8u::Id, value); + } + case 422: { + LogStep(422, "Verify nullable range-restricted unsigned 8-bit integer value has not changed"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, + TestCluster::Attributes::NullableRangeRestrictedInt8u::Id); + } + case 423: { + LogStep(423, "Write min valid value to a nullable range-restricted unsigned 8-bit integer"); + chip::app::DataModel::Nullable value; + value.SetNonNull(); + value.Value() = 20; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, + TestCluster::Attributes::NullableRangeRestrictedInt8u::Id, value); + } + case 424: { + LogStep(424, "Verify nullable range-restricted unsigned 8-bit integer value is at min valid"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, + TestCluster::Attributes::NullableRangeRestrictedInt8u::Id); + } + case 425: { + LogStep(425, "Write max valid value to a nullable range-restricted unsigned 8-bit integer"); + chip::app::DataModel::Nullable value; + value.SetNonNull(); + value.Value() = 100; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, + TestCluster::Attributes::NullableRangeRestrictedInt8u::Id, value); + } + case 426: { + LogStep(426, "Verify nullable range-restricted unsigned 8-bit integer value is at max valid"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, + TestCluster::Attributes::NullableRangeRestrictedInt8u::Id); + } + case 427: { + LogStep(427, "Write middle valid value to a nullable range-restricted unsigned 8-bit integer"); + chip::app::DataModel::Nullable value; + value.SetNonNull(); + value.Value() = 50; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, + TestCluster::Attributes::NullableRangeRestrictedInt8u::Id, value); + } + case 428: { + LogStep(428, "Verify nullable range-restricted unsigned 8-bit integer value is at mid valid"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, + TestCluster::Attributes::NullableRangeRestrictedInt8u::Id); + } + case 429: { + LogStep(429, "Write null value to a nullable range-restricted unsigned 8-bit integer"); + chip::app::DataModel::Nullable value; + value.SetNull(); + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, + TestCluster::Attributes::NullableRangeRestrictedInt8u::Id, value); + } + case 430: { + LogStep(430, "Verify nullable range-restricted unsigned 8-bit integer value is null"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, + TestCluster::Attributes::NullableRangeRestrictedInt8u::Id); + } + case 431: { + LogStep(431, "Read nullable range-restricted unsigned 16-bit integer"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, + TestCluster::Attributes::NullableRangeRestrictedInt16u::Id); + } + case 432: { + LogStep(432, "Write min value to a nullable range-restricted unsigned 16-bit integer"); + chip::app::DataModel::Nullable value; + value.SetNonNull(); + value.Value() = 0U; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, + TestCluster::Attributes::NullableRangeRestrictedInt16u::Id, value); + } + case 433: { + LogStep(433, "Write just-below-range value to a nullable range-restricted unsigned 16-bit integer"); + chip::app::DataModel::Nullable value; + value.SetNonNull(); + value.Value() = 99U; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, + TestCluster::Attributes::NullableRangeRestrictedInt16u::Id, value); + } + case 434: { + LogStep(434, "Write just-above-range value to a nullable range-restricted unsigned 16-bit integer"); + chip::app::DataModel::Nullable value; + value.SetNonNull(); + value.Value() = 1001U; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, + TestCluster::Attributes::NullableRangeRestrictedInt16u::Id, value); + } + case 435: { + LogStep(435, "Write max value to a nullable range-restricted unsigned 16-bit integer"); + chip::app::DataModel::Nullable value; + value.SetNonNull(); + value.Value() = 65534U; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, + TestCluster::Attributes::NullableRangeRestrictedInt16u::Id, value); + } + case 436: { + LogStep(436, "Verify nullable range-restricted unsigned 16-bit integer value has not changed"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, + TestCluster::Attributes::NullableRangeRestrictedInt16u::Id); + } + case 437: { + LogStep(437, "Write min valid value to a nullable range-restricted unsigned 16-bit integer"); + chip::app::DataModel::Nullable value; + value.SetNonNull(); + value.Value() = 100U; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, + TestCluster::Attributes::NullableRangeRestrictedInt16u::Id, value); + } + case 438: { + LogStep(438, "Verify nullable range-restricted unsigned 16-bit integer value is at min valid"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, + TestCluster::Attributes::NullableRangeRestrictedInt16u::Id); + } + case 439: { + LogStep(439, "Write max valid value to a nullable range-restricted unsigned 16-bit integer"); + chip::app::DataModel::Nullable value; + value.SetNonNull(); + value.Value() = 1000U; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, + TestCluster::Attributes::NullableRangeRestrictedInt16u::Id, value); + } + case 440: { + LogStep(440, "Verify nullable range-restricted unsigned 16-bit integer value is at max valid"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, + TestCluster::Attributes::NullableRangeRestrictedInt16u::Id); + } + case 441: { + LogStep(441, "Write middle valid value to a nullable range-restricted unsigned 16-bit integer"); + chip::app::DataModel::Nullable value; + value.SetNonNull(); + value.Value() = 500U; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, + TestCluster::Attributes::NullableRangeRestrictedInt16u::Id, value); + } + case 442: { + LogStep(442, "Verify nullable range-restricted unsigned 16-bit integer value is at mid valid"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, + TestCluster::Attributes::NullableRangeRestrictedInt16u::Id); + } + case 443: { + LogStep(443, "Write null value to a nullable range-restricted unsigned 16-bit integer"); + chip::app::DataModel::Nullable value; + value.SetNull(); + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, + TestCluster::Attributes::NullableRangeRestrictedInt16u::Id, value); + } + case 444: { + LogStep(444, "Verify nullable range-restricted unsigned 16-bit integer value is null"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, + TestCluster::Attributes::NullableRangeRestrictedInt16u::Id); + } + case 445: { + LogStep(445, "Read nullable range-restricted signed 8-bit integer"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, + TestCluster::Attributes::NullableRangeRestrictedInt8s::Id); + } + case 446: { + LogStep(446, "Write min value to a nullable range-restricted signed 8-bit integer"); + chip::app::DataModel::Nullable value; + value.SetNonNull(); + value.Value() = -127; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, + TestCluster::Attributes::NullableRangeRestrictedInt8s::Id, value); + } + case 447: { + LogStep(447, "Write just-below-range value to a nullable range-restricted signed 8-bit integer"); + chip::app::DataModel::Nullable value; + value.SetNonNull(); + value.Value() = -41; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, + TestCluster::Attributes::NullableRangeRestrictedInt8s::Id, value); + } + case 448: { + LogStep(448, "Write just-above-range value to a nullable range-restricted signed 8-bit integer"); + chip::app::DataModel::Nullable value; + value.SetNonNull(); + value.Value() = 51; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, + TestCluster::Attributes::NullableRangeRestrictedInt8s::Id, value); + } + case 449: { + LogStep(449, "Write max value to a nullable range-restricted signed 8-bit integer"); + chip::app::DataModel::Nullable value; + value.SetNonNull(); + value.Value() = 127; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, + TestCluster::Attributes::NullableRangeRestrictedInt8s::Id, value); + } + case 450: { + LogStep(450, "Verify nullable range-restricted signed 8-bit integer value has not changed"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, + TestCluster::Attributes::NullableRangeRestrictedInt8s::Id); + } + case 451: { + LogStep(451, "Write min valid value to a nullable range-restricted signed 8-bit integer"); + chip::app::DataModel::Nullable value; + value.SetNonNull(); + value.Value() = -40; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, + TestCluster::Attributes::NullableRangeRestrictedInt8s::Id, value); + } + case 452: { + LogStep(452, "Verify nullable range-restricted signed 8-bit integer value is at min valid"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, + TestCluster::Attributes::NullableRangeRestrictedInt8s::Id); + } + case 453: { + LogStep(453, "Write max valid value to a nullable range-restricted signed 8-bit integer"); + chip::app::DataModel::Nullable value; + value.SetNonNull(); + value.Value() = 50; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, + TestCluster::Attributes::NullableRangeRestrictedInt8s::Id, value); + } + case 454: { + LogStep(454, "Verify nullable range-restricted signed 8-bit integer value is at max valid"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, + TestCluster::Attributes::NullableRangeRestrictedInt8s::Id); + } + case 455: { + LogStep(455, "Write middle valid value to a nullable range-restricted signed 8-bit integer"); + chip::app::DataModel::Nullable value; + value.SetNonNull(); + value.Value() = 6; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, + TestCluster::Attributes::NullableRangeRestrictedInt8s::Id, value); + } + case 456: { + LogStep(456, "Verify nullable range-restricted signed 8-bit integer value is at mid valid"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, + TestCluster::Attributes::NullableRangeRestrictedInt8s::Id); + } + case 457: { + LogStep(457, "Write null value to a nullable range-restricted signed 8-bit integer"); + chip::app::DataModel::Nullable value; + value.SetNull(); + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, + TestCluster::Attributes::NullableRangeRestrictedInt8s::Id, value); + } + case 458: { + LogStep(458, "Verify nullable range-restricted signed 8-bit integer value is at null"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, + TestCluster::Attributes::NullableRangeRestrictedInt8s::Id); + } + case 459: { + LogStep(459, "Read nullable range-restricted signed 16-bit integer"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, + TestCluster::Attributes::NullableRangeRestrictedInt16s::Id); + } + case 460: { + LogStep(460, "Write min value to a nullable range-restricted signed 16-bit integer"); + chip::app::DataModel::Nullable value; + value.SetNonNull(); + value.Value() = -32767; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, + TestCluster::Attributes::NullableRangeRestrictedInt16s::Id, value); + } + case 461: { + LogStep(461, "Write just-below-range value to a nullable range-restricted signed 16-bit integer"); + chip::app::DataModel::Nullable value; + value.SetNonNull(); + value.Value() = -151; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, + TestCluster::Attributes::NullableRangeRestrictedInt16s::Id, value); + } + case 462: { + LogStep(462, "Write just-above-range value to a nullable range-restricted signed 16-bit integer"); + chip::app::DataModel::Nullable value; + value.SetNonNull(); + value.Value() = 201; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, + TestCluster::Attributes::NullableRangeRestrictedInt16s::Id, value); + } + case 463: { + LogStep(463, "Write max value to a nullable range-restricted signed 16-bit integer"); + chip::app::DataModel::Nullable value; + value.SetNonNull(); + value.Value() = 32767; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, + TestCluster::Attributes::NullableRangeRestrictedInt16s::Id, value); + } + case 464: { + LogStep(464, "Verify nullable range-restricted signed 16-bit integer value has not changed"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, + TestCluster::Attributes::NullableRangeRestrictedInt16s::Id); + } + case 465: { + LogStep(465, "Write min valid value to a nullable range-restricted signed 16-bit integer"); + chip::app::DataModel::Nullable value; + value.SetNonNull(); + value.Value() = -150; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, + TestCluster::Attributes::NullableRangeRestrictedInt16s::Id, value); + } + case 466: { + LogStep(466, "Verify nullable range-restricted signed 16-bit integer value is at min valid"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, + TestCluster::Attributes::NullableRangeRestrictedInt16s::Id); + } + case 467: { + LogStep(467, "Write max valid value to a nullable range-restricted signed 16-bit integer"); + chip::app::DataModel::Nullable value; + value.SetNonNull(); + value.Value() = 200; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, + TestCluster::Attributes::NullableRangeRestrictedInt16s::Id, value); + } + case 468: { + LogStep(468, "Verify nullable range-restricted signed 16-bit integer value is at max valid"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, + TestCluster::Attributes::NullableRangeRestrictedInt16s::Id); + } + case 469: { + LogStep(469, "Write middle valid value to a nullable range-restricted signed 16-bit integer"); + chip::app::DataModel::Nullable value; + value.SetNonNull(); + value.Value() = 7; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, + TestCluster::Attributes::NullableRangeRestrictedInt16s::Id, value); + } + case 470: { + LogStep(470, "Verify nullable range-restricted signed 16-bit integer value is at mid valid"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, + TestCluster::Attributes::NullableRangeRestrictedInt16s::Id); + } + case 471: { + LogStep(471, "Write null value to a nullable range-restricted signed 16-bit integer"); + chip::app::DataModel::Nullable value; + value.SetNull(); + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, + TestCluster::Attributes::NullableRangeRestrictedInt16s::Id, value); + } + case 472: { + LogStep(472, "Verify nullable range-restricted signed 16-bit integer value is null"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, + TestCluster::Attributes::NullableRangeRestrictedInt16s::Id); + } + case 473: { + LogStep(473, "Write attribute that returns general status on write"); + bool value; + value = false; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::GeneralErrorBoolean::Id, + value); + } + case 474: { + LogStep(474, "Write attribute that returns cluster-specific status on write"); + bool value; + value = false; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::ClusterErrorBoolean::Id, + value); + } + case 475: { + LogStep(475, "Read attribute that returns general status on read"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::GeneralErrorBoolean::Id); + } + case 476: { + LogStep(476, "read attribute that returns cluster-specific status on read"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::ClusterErrorBoolean::Id); + } + case 477: { + LogStep(477, "read AcceptedCommandList attribute"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::AcceptedCommandList::Id); + } + case 478: { + LogStep(478, "read GeneratedCommandList attribute"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, + TestCluster::Attributes::GeneratedCommandList::Id); + } + case 479: { + LogStep(479, "Write struct-typed attribute"); + chip::app::Clusters::TestCluster::Structs::SimpleStruct::Type value; + + value.a = 5; + value.b = true; + value.c = static_cast(2); + value.d = chip::ByteSpan(chip::Uint8::from_const_char("abcgarbage: not in length on purpose"), 3); + value.e = chip::Span("garbage: not in length on purpose", 0); + value.f = static_cast>(17); + value.g = 1.5f; + value.h = 3.14159265358979; + + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::StructAttr::Id, value); + } + case 480: { + LogStep(480, "Read struct-typed attribute"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::StructAttr::Id); + } + } return CHIP_NO_ERROR; } +}; - void OnFailureResponse_49(CHIP_ERROR error) +class TestClusterComplexTypesSuite : public TestCommand +{ +public: + TestClusterComplexTypesSuite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("TestClusterComplexTypes", 21, credsIssuerConfig) { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_FIELD)); - NextTest(); + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - void OnSuccessResponse_49() { ThrowSuccessResponse(); } - - CHIP_ERROR TestClearYearDayScheduleWithNonExistingUser_50() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::ClearYearDaySchedule::Type; - - RequestType request; - request.yearDayIndex = 1; - request.userIndex = 2U; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_50(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_50(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } + ~TestClusterComplexTypesSuite() {} - void OnFailureResponse_50(CHIP_ERROR error) + chip::System::Clock::Timeout GetWaitDuration() const override { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_NOT_FOUND)); - NextTest(); + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } - void OnSuccessResponse_50() { ThrowSuccessResponse(); } - - CHIP_ERROR TestMakeSureThatWeekDayScheduleWasNotDeleted_51() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::GetWeekDaySchedule::Type; - - RequestType request; - request.weekDayIndex = 1; - request.userIndex = 1U; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context)) - ->OnSuccessResponse_51(data.weekDayIndex, data.userIndex, data.status, data.daysMask, data.startHour, - data.startMinute, data.endHour, data.endMinute); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_51(error); - }; +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } - void OnFailureResponse_51(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } + // + // Tests methods + // - void OnSuccessResponse_51(uint8_t weekDayIndex, uint16_t userIndex, chip::app::Clusters::DoorLock::DlStatus status, - const chip::Optional> & daysMask, - const chip::Optional & startHour, const chip::Optional & startMinute, - const chip::Optional & endHour, const chip::Optional & endMinute) + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { - VerifyOrReturn(CheckValue("weekDayIndex", weekDayIndex, 1)); - - VerifyOrReturn(CheckValue("userIndex", userIndex, 1U)); - - VerifyOrReturn(CheckValue("status", status, 0)); - - VerifyOrReturn(CheckValuePresent("daysMask", daysMask)); - VerifyOrReturn(CheckValue("daysMask.Value()", daysMask.Value(), 1)); - - VerifyOrReturn(CheckValuePresent("startHour", startHour)); - VerifyOrReturn(CheckValue("startHour.Value()", startHour.Value(), 15)); + bool shouldContinue = false; - VerifyOrReturn(CheckValuePresent("startMinute", startMinute)); - VerifyOrReturn(CheckValue("startMinute.Value()", startMinute.Value(), 16)); + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::TestCluster::Commands::TestNullableOptionalResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("wasPresent", value.wasPresent, true)); - VerifyOrReturn(CheckValuePresent("endHour", endHour)); - VerifyOrReturn(CheckValue("endHour.Value()", endHour.Value(), 18)); + VerifyOrReturn(CheckValuePresent("wasNull", value.wasNull)); + VerifyOrReturn(CheckValue("wasNull.Value()", value.wasNull.Value(), true)); - VerifyOrReturn(CheckValuePresent("endMinute", endMinute)); - VerifyOrReturn(CheckValue("endMinute.Value()", endMinute.Value(), 0)); + VerifyOrReturn(CheckValuePresent("originalValue", value.originalValue)); + VerifyOrReturn(CheckValueNull("originalValue.Value()", value.originalValue.Value())); + } + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_NEEDS_TIMED_INTERACTION)); + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_ACCESS)); + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_ACCESS)); + break; + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + bool value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("timedWriteBoolean", value, false)); + } + break; + case 8: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_NEEDS_TIMED_INTERACTION)); + break; + case 9: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + bool value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("timedWriteBoolean", value, false)); + } + break; + case 10: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_ACCESS)); + break; + case 11: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + bool value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("timedWriteBoolean", value, false)); + } + break; + case 12: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 13: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + bool value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("timedWriteBoolean", value, true)); + } + break; + case 14: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 15: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + bool value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("boolean", value, false)); + } + break; + case 16: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_ACCESS)); + break; + case 17: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + bool value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("boolean", value, false)); + } + break; + case 18: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 19: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + bool value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("boolean", value, true)); + } + break; + case 20: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } - NextTest(); + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } } - CHIP_ERROR TestMakeSureThatYearDayScheduleWasNotDeleted_52() + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::GetYearDaySchedule::Type; - - RequestType request; - request.yearDayIndex = 1; - request.userIndex = 1U; + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "Send Test Command with optional arg set to null."); + chip::app::Clusters::TestCluster::Commands::TestNullableOptionalRequest::Type value; + value.arg1.Emplace(); + value.arg1.Value().SetNull(); + return SendCommand(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, + TestCluster::Commands::TestNullableOptionalRequest::Id, value); + } + case 2: { + LogStep(2, "Send command that needs timed invoke without a timeout value"); + chip::app::Clusters::TestCluster::Commands::TimedInvokeRequest::Type value; + return SendCommand(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Commands::TimedInvokeRequest::Id, + value, chip::NullOptional); + } + case 3: { + LogStep(3, "Send command that needs timed invoke with a long timeout value"); + chip::app::Clusters::TestCluster::Commands::TimedInvokeRequest::Type value; + return SendCommand(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Commands::TimedInvokeRequest::Id, + value, chip::Optional(10000)); + } + case 4: { + LogStep(4, "Send command that needs timed invoke with a too-short timeout value"); + chip::app::Clusters::TestCluster::Commands::TimedInvokeRequest::Type value; + ReturnErrorOnFailure(SendCommand(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, + TestCluster::Commands::TimedInvokeRequest::Id, value, chip::Optional(1))); - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context)) - ->OnSuccessResponse_52(data.yearDayIndex, data.userIndex, data.status, data.localStartTime, data.localEndTime); - }; + using namespace chip::System::Clock::Literals; + return BusyWaitFor(100_ms); + } + case 5: { + LogStep(5, "Send command that does not need timed invoke with a long timeout value"); + chip::app::Clusters::TestCluster::Commands::Test::Type value; + return SendCommand(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Commands::Test::Id, value, + chip::Optional(10000)); + } + case 6: { + LogStep(6, "Send command that does not need timed invoke with a too-short timeout value"); + chip::app::Clusters::TestCluster::Commands::Test::Type value; + ReturnErrorOnFailure(SendCommand(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Commands::Test::Id, + value, chip::Optional(1))); - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_52(error); - }; + using namespace chip::System::Clock::Literals; + return BusyWaitFor(100_ms); + } + case 7: { + LogStep(7, "Read attribute that needs timed write initial state"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::TimedWriteBoolean::Id); + } + case 8: { + LogStep(8, "Write attribute that needs timed write without a timeout value"); + bool value; + value = true; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::TimedWriteBoolean::Id, + value, chip::NullOptional); + } + case 9: { + LogStep(9, "Read attribute that needs timed write state unchanged 1"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::TimedWriteBoolean::Id); + } + case 10: { + LogStep(10, "Write attribute that needs timed write with a too-short timeout value"); + bool value; + value = true; + ReturnErrorOnFailure(WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, + TestCluster::Attributes::TimedWriteBoolean::Id, value, + chip::Optional(1))); - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + using namespace chip::System::Clock::Literals; + return BusyWaitFor(100_ms); + } + case 11: { + LogStep(11, "Read attribute that needs timed write state unchanged 2"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::TimedWriteBoolean::Id); + } + case 12: { + LogStep(12, "Write attribute that needs timed write with a long timeout value"); + bool value; + value = true; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::TimedWriteBoolean::Id, + value, chip::Optional(10000)); + } + case 13: { + LogStep(13, "Read attribute that needs timed write state changed"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::TimedWriteBoolean::Id); + } + case 14: { + LogStep(14, "Write attribute that needs timed write reset to default"); + bool value; + value = false; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::TimedWriteBoolean::Id, + value, chip::Optional(10000)); + } + case 15: { + LogStep(15, "Read attribute that does not need timed write initial value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Boolean::Id); + } + case 16: { + LogStep(16, "Write attribute that does not need timed write with a too-short timeout value"); + bool value; + value = true; + ReturnErrorOnFailure(WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, + TestCluster::Attributes::Boolean::Id, value, chip::Optional(1))); + + using namespace chip::System::Clock::Literals; + return BusyWaitFor(100_ms); + } + case 17: { + LogStep(17, "Read attribute that does not need timed write unchanged value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Boolean::Id); + } + case 18: { + LogStep(18, "Write attribute that does not need timed write with a long timeout value"); + bool value; + value = true; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Boolean::Id, value, + chip::Optional(10000)); + } + case 19: { + LogStep(19, "Read attribute that does not need timed write changed value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Boolean::Id); + } + case 20: { + LogStep(20, "Write attribute that does not need timed write reset to default"); + bool value; + value = false; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Boolean::Id, value); + } + } return CHIP_NO_ERROR; } +}; - void OnFailureResponse_52(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_52(uint8_t yearDayIndex, uint16_t userIndex, chip::app::Clusters::DoorLock::DlStatus status, - const chip::Optional & localStartTime, const chip::Optional & localEndTime) +class TestConstraintsSuite : public TestCommand +{ +public: + TestConstraintsSuite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("TestConstraints", 22, credsIssuerConfig) { - VerifyOrReturn(CheckValue("yearDayIndex", yearDayIndex, 1)); - - VerifyOrReturn(CheckValue("userIndex", userIndex, 1U)); - - VerifyOrReturn(CheckValue("status", status, 0)); - - VerifyOrReturn(CheckValuePresent("localStartTime", localStartTime)); - VerifyOrReturn(CheckValue("localStartTime.Value()", localStartTime.Value(), 12345UL)); - - VerifyOrReturn(CheckValuePresent("localEndTime", localEndTime)); - VerifyOrReturn(CheckValue("localEndTime.Value()", localEndTime.Value(), 12345689UL)); - - NextTest(); + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - CHIP_ERROR TestCreateAnotherWeekDayScheduleWithValidParameters_53() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::SetWeekDaySchedule::Type; - - RequestType request; - request.weekDayIndex = 2; - request.userIndex = 1U; - request.daysMask = static_cast>(2); - request.startHour = 0; - request.startMinute = 0; - request.endHour = 23; - request.endMinute = 59; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_53(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_53(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } + ~TestConstraintsSuite() {} - void OnFailureResponse_53(CHIP_ERROR error) + chip::System::Clock::Timeout GetWaitDuration() const override { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } - void OnSuccessResponse_53() { NextTest(); } - - CHIP_ERROR TestVerifyCreatedWeekDaySchedule_54() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::GetWeekDaySchedule::Type; - - RequestType request; - request.weekDayIndex = 2; - request.userIndex = 1U; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context)) - ->OnSuccessResponse_54(data.weekDayIndex, data.userIndex, data.status, data.daysMask, data.startHour, - data.startMinute, data.endHour, data.endMinute); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_54(error); - }; +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } - void OnFailureResponse_54(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } + // + // Tests methods + // - void OnSuccessResponse_54(uint8_t weekDayIndex, uint16_t userIndex, chip::app::Clusters::DoorLock::DlStatus status, - const chip::Optional> & daysMask, - const chip::Optional & startHour, const chip::Optional & startMinute, - const chip::Optional & endHour, const chip::Optional & endMinute) + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { - VerifyOrReturn(CheckValue("weekDayIndex", weekDayIndex, 2)); - - VerifyOrReturn(CheckValue("userIndex", userIndex, 1U)); - - VerifyOrReturn(CheckValue("status", status, 0)); - - VerifyOrReturn(CheckValuePresent("daysMask", daysMask)); - VerifyOrReturn(CheckValue("daysMask.Value()", daysMask.Value(), 2)); - - VerifyOrReturn(CheckValuePresent("startHour", startHour)); - VerifyOrReturn(CheckValue("startHour.Value()", startHour.Value(), 0)); - - VerifyOrReturn(CheckValuePresent("startMinute", startMinute)); - VerifyOrReturn(CheckValue("startMinute.Value()", startMinute.Value(), 0)); - - VerifyOrReturn(CheckValuePresent("endHour", endHour)); - VerifyOrReturn(CheckValue("endHour.Value()", endHour.Value(), 23)); + bool shouldContinue = false; - VerifyOrReturn(CheckValuePresent("endMinute", endMinute)); - VerifyOrReturn(CheckValue("endMinute.Value()", endMinute.Value(), 59)); + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintMinValue("value", value, 5UL)); + } + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 5UL)); + } + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintNotValue("value", value, 6UL)); + } + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::CharSpan value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintMinLength("value", value.size(), 5)); + } + break; + case 8: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::CharSpan value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintMaxLength("value", value.size(), 20)); + } + break; + case 9: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::CharSpan value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintStartsWith("value", value, "**")); + } + break; + case 10: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::CharSpan value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintEndsWith("value", value, "**")); + } + break; + case 11: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 12: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::CharSpan value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintIsUpperCase("value", value, false)); + VerifyOrReturn(CheckConstraintIsLowerCase("value", value, true)); + } + break; + case 13: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 14: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::CharSpan value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintIsUpperCase("value", value, true)); + VerifyOrReturn(CheckConstraintIsLowerCase("value", value, false)); + } + break; + case 15: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 16: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::CharSpan value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintIsUpperCase("value", value, false)); + VerifyOrReturn(CheckConstraintIsLowerCase("value", value, false)); + } + break; + case 17: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 18: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::CharSpan value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintIsHexString("value", value, false)); + } + break; + case 19: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 20: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::CharSpan value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintIsHexString("value", value, true)); + } + break; + case 21: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } - NextTest(); + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } } - CHIP_ERROR TestCreateAnotherYearDayScheduleWithValidParameters_55() + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::SetYearDaySchedule::Type; - - RequestType request; - request.yearDayIndex = 2; - request.userIndex = 1U; - request.localStartTime = 9000UL; - request.localEndTime = 888888888UL; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_55(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_55(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "Write attribute INT32U Value"); + uint32_t value; + value = 5UL; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Int32u::Id, value); + } + case 2: { + LogStep(2, "Read attribute INT32U Value MinValue Constraints"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Int32u::Id); + } + case 3: { + LogStep(3, "Read attribute INT32U Value MaxValue Constraints"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Int32u::Id); + } + case 4: { + LogStep(4, "Read attribute INT32U Value NotValue Constraints"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Int32u::Id); + } + case 5: { + LogStep(5, "Write attribute INT32U Value Back to Default Value"); + uint32_t value; + value = 0UL; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Int32u::Id, value); + } + case 6: { + LogStep(6, "Write attribute CHAR_STRING Value"); + chip::CharSpan value; + value = chip::Span("** Test **garbage: not in length on purpose", 10); + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::CharString::Id, value); + } + case 7: { + LogStep(7, "Read attribute CHAR_STRING Value MinLength Constraints"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::CharString::Id); + } + case 8: { + LogStep(8, "Read attribute CHAR_STRING Value MaxLength Constraints"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::CharString::Id); + } + case 9: { + LogStep(9, "Read attribute CHAR_STRING Value StartsWith Constraints"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::CharString::Id); + } + case 10: { + LogStep(10, "Read attribute CHAR_STRING Value EndsWith Constraints"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::CharString::Id); + } + case 11: { + LogStep(11, "Write attribute CHAR_STRING Value"); + chip::CharSpan value; + value = chip::Span("lowercasegarbage: not in length on purpose", 9); + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::CharString::Id, value); + } + case 12: { + LogStep(12, "Read attribute CHAR_STRING Value isLowerCase/isUpperCase Constraints"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::CharString::Id); + } + case 13: { + LogStep(13, "Write attribute CHAR_STRING Value"); + chip::CharSpan value; + value = chip::Span("UPPERCASEgarbage: not in length on purpose", 9); + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::CharString::Id, value); + } + case 14: { + LogStep(14, "Read attribute CHAR_STRING Value isLowerCase/isUpperCase Constraints"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::CharString::Id); + } + case 15: { + LogStep(15, "Write attribute CHAR_STRING Value"); + chip::CharSpan value; + value = chip::Span("lowUPPERgarbage: not in length on purpose", 8); + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::CharString::Id, value); + } + case 16: { + LogStep(16, "Read attribute CHAR_STRING Value isLowerCase/isUpperCase Constraints"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::CharString::Id); + } + case 17: { + LogStep(17, "Write attribute CHAR_STRING Value"); + chip::CharSpan value; + value = chip::Span("ABCDEF012Vgarbage: not in length on purpose", 10); + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::CharString::Id, value); + } + case 18: { + LogStep(18, "Read attribute CHAR_STRING Value isHexString Constraints"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::CharString::Id); + } + case 19: { + LogStep(19, "Write attribute CHAR_STRING Value"); + chip::CharSpan value; + value = chip::Span("ABCDEF0123garbage: not in length on purpose", 10); + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::CharString::Id, value); + } + case 20: { + LogStep(20, "Read attribute CHAR_STRING Value isHexString Constraints"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::CharString::Id); + } + case 21: { + LogStep(21, "Write attribute CHAR_STRING Value Back to Default Value"); + chip::CharSpan value; + value = chip::Span("garbage: not in length on purpose", 0); + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::CharString::Id, value); + } + } return CHIP_NO_ERROR; } +}; - void OnFailureResponse_55(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_55() { NextTest(); } - - CHIP_ERROR TestVerifyCreatedYearDaySchedule_56() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::GetYearDaySchedule::Type; - - RequestType request; - request.yearDayIndex = 2; - request.userIndex = 1U; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context)) - ->OnSuccessResponse_56(data.yearDayIndex, data.userIndex, data.status, data.localStartTime, data.localEndTime); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_56(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; +class TestDelayCommandsSuite : public TestCommand +{ +public: + TestDelayCommandsSuite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("TestDelayCommands", 2, credsIssuerConfig) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - void OnFailureResponse_56(CHIP_ERROR error) + ~TestDelayCommandsSuite() {} + + chip::System::Clock::Timeout GetWaitDuration() const override { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } - void OnSuccessResponse_56(uint8_t yearDayIndex, uint16_t userIndex, chip::app::Clusters::DoorLock::DlStatus status, - const chip::Optional & localStartTime, const chip::Optional & localEndTime) - { - VerifyOrReturn(CheckValue("yearDayIndex", yearDayIndex, 2)); +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; - VerifyOrReturn(CheckValue("userIndex", userIndex, 1U)); + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } - VerifyOrReturn(CheckValue("status", status, 0)); + // + // Tests methods + // - VerifyOrReturn(CheckValuePresent("localStartTime", localStartTime)); - VerifyOrReturn(CheckValue("localStartTime.Value()", localStartTime.Value(), 9000UL)); + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override + { + bool shouldContinue = false; - VerifyOrReturn(CheckValuePresent("localEndTime", localEndTime)); - VerifyOrReturn(CheckValue("localEndTime.Value()", localEndTime.Value(), 888888888UL)); + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } - NextTest(); + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } } - CHIP_ERROR TestClearASingleWeekDayScheduleForTheFirstUser_57() + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::ClearWeekDaySchedule::Type; - - RequestType request; - request.weekDayIndex = 1; - request.userIndex = 1U; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_57(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_57(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "Wait 100ms"); + SetIdentity(kIdentityAlpha); + return WaitForMs(100); + } + } return CHIP_NO_ERROR; } +}; - void OnFailureResponse_57(CHIP_ERROR error) +class TestDiscoverySuite : public TestCommand +{ +public: + TestDiscoverySuite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("TestDiscovery", 25, credsIssuerConfig) { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("discriminator", 0, UINT16_MAX, &mDiscriminator); + AddArgument("vendorId", 0, UINT16_MAX, &mVendorId); + AddArgument("productId", 0, UINT16_MAX, &mProductId); + AddArgument("deviceType", 0, UINT16_MAX, &mDeviceType); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - void OnSuccessResponse_57() { NextTest(); } - - CHIP_ERROR TestVerifyClearedWeekDaySchedule_58() + ~TestDiscoverySuite() { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::GetWeekDaySchedule::Type; - - RequestType request; - request.weekDayIndex = 1; - request.userIndex = 1U; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context)) - ->OnSuccessResponse_58(data.weekDayIndex, data.userIndex, data.status, data.daysMask, data.startHour, - data.startMinute, data.endHour, data.endMinute); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_58(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; + if (deviceInstanceNameBeforeRebootBuffer != nullptr) + { + chip::Platform::MemoryFree(deviceInstanceNameBeforeRebootBuffer); + deviceInstanceNameBeforeRebootBuffer = nullptr; + } } - void OnFailureResponse_58(CHIP_ERROR error) + chip::System::Clock::Timeout GetWaitDuration() const override { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } - void OnSuccessResponse_58(uint8_t weekDayIndex, uint16_t userIndex, chip::app::Clusters::DoorLock::DlStatus status, - const chip::Optional> & daysMask, - const chip::Optional & startHour, const chip::Optional & startMinute, - const chip::Optional & endHour, const chip::Optional & endMinute) - { - VerifyOrReturn(CheckValue("weekDayIndex", weekDayIndex, 1)); +private: + chip::Optional mNodeId; + chip::Optional mEndpoint; + chip::Optional mDiscriminator; + chip::Optional mVendorId; + chip::Optional mProductId; + chip::Optional mDeviceType; + chip::Optional mTimeout; - VerifyOrReturn(CheckValue("userIndex", userIndex, 1U)); + char * deviceInstanceNameBeforeRebootBuffer = nullptr; + chip::CharSpan deviceInstanceNameBeforeReboot; - VerifyOrReturn(CheckValue("status", status, 139)); + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } - NextTest(); - } + // + // Tests methods + // - CHIP_ERROR TestClearAllRemainingWeekDaySchedulesForTheFirstUser_59() + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::ClearWeekDaySchedule::Type; - - RequestType request; - request.weekDayIndex = 254; - request.userIndex = 1U; + bool shouldContinue = false; - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_59(); - }; + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_COMMAND)); + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_COMMAND)); + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_59(error); - }; + VerifyOrReturn(CheckConstraintIsUpperCase("value.instanceName", value.instanceName, true)); + VerifyOrReturn(CheckConstraintIsHexString("value.instanceName", value.instanceName, true)); + VerifyOrReturn(CheckConstraintMinLength("value.instanceName", value.instanceName.size(), 16)); + VerifyOrReturn(CheckConstraintMaxLength("value.instanceName", value.instanceName.size(), 16)); + if (deviceInstanceNameBeforeRebootBuffer != nullptr) + { + chip::Platform::MemoryFree(deviceInstanceNameBeforeRebootBuffer); + } + deviceInstanceNameBeforeRebootBuffer = static_cast(chip::Platform::MemoryAlloc(value.instanceName.size())); + memcpy(deviceInstanceNameBeforeRebootBuffer, value.instanceName.data(), value.instanceName.size()); + deviceInstanceNameBeforeReboot = chip::CharSpan(deviceInstanceNameBeforeRebootBuffer, value.instanceName.size()); + } + shouldContinue = true; + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + } + shouldContinue = true; + break; + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + } + shouldContinue = true; + break; + case 8: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + } + shouldContinue = true; + break; + case 9: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + } + shouldContinue = true; + break; + case 10: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } + VerifyOrReturn(CheckValue("longDiscriminator", value.longDiscriminator, + mDiscriminator.HasValue() ? mDiscriminator.Value() : 3840U)); + VerifyOrReturn(CheckConstraintMinValue("value.longDiscriminator", value.longDiscriminator, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value.longDiscriminator", value.longDiscriminator, 4096U)); + } + shouldContinue = true; + break; + case 11: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - void OnFailureResponse_59(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } + VerifyOrReturn(CheckValue("vendorId", value.vendorId, mVendorId.HasValue() ? mVendorId.Value() : 65521U)); + } + shouldContinue = true; + break; + case 12: + if (IsUnsupported(status.mStatus)) + { + shouldContinue = true; + return; + } + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - void OnSuccessResponse_59() { NextTest(); } + VerifyOrReturn(CheckValue("productId", value.productId, mProductId.HasValue() ? mProductId.Value() : 32769U)); + } + shouldContinue = true; + break; + case 13: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - CHIP_ERROR TestVerifyClearedWeekSchedule_60() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::GetWeekDaySchedule::Type; + VerifyOrReturn(CheckValuePresent("value.mrpRetryIntervalIdle", value.mrpRetryIntervalIdle)); + VerifyOrReturn( + CheckConstraintMaxValue("value.mrpRetryIntervalIdle.Value()", value.mrpRetryIntervalIdle.Value(), 3600000UL)); + } + shouldContinue = true; + break; + case 14: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - RequestType request; - request.weekDayIndex = 2; - request.userIndex = 1U; + VerifyOrReturn(CheckValuePresent("value.mrpRetryIntervalActive", value.mrpRetryIntervalActive)); + VerifyOrReturn(CheckConstraintMaxValue("value.mrpRetryIntervalActive.Value()", value.mrpRetryIntervalActive.Value(), + 3600000UL)); + } + shouldContinue = true; + break; + case 15: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context)) - ->OnSuccessResponse_60(data.weekDayIndex, data.userIndex, data.status, data.daysMask, data.startHour, - data.startMinute, data.endHour, data.endMinute); - }; + VerifyOrReturn(CheckValue("commissioningMode", value.commissioningMode, 1)); + } + shouldContinue = true; + break; + case 16: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_60(error); - }; + VerifyOrReturn(CheckConstraintMaxLength("value.deviceName", value.deviceName.size(), 32)); + } + shouldContinue = true; + break; + case 17: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } + VerifyOrReturn(CheckConstraintMaxValue("value.rotatingIdLen", value.rotatingIdLen, 100ULL)); + } + shouldContinue = true; + break; + case 18: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - void OnFailureResponse_60(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } + VerifyOrReturn(CheckConstraintNotValue("value.pairingHint", value.pairingHint, 0U)); + } + shouldContinue = true; + break; + case 19: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - void OnSuccessResponse_60(uint8_t weekDayIndex, uint16_t userIndex, chip::app::Clusters::DoorLock::DlStatus status, - const chip::Optional> & daysMask, - const chip::Optional & startHour, const chip::Optional & startMinute, - const chip::Optional & endHour, const chip::Optional & endMinute) - { - VerifyOrReturn(CheckValue("weekDayIndex", weekDayIndex, 2)); + VerifyOrReturn(CheckConstraintMaxLength("value.pairingInstruction", value.pairingInstruction.size(), 128)); + } + shouldContinue = true; + break; + case 20: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("userIndex", userIndex, 1U)); + VerifyOrReturn(CheckConstraintMinValue("value.numIPs", value.numIPs, 1)); + } + shouldContinue = true; + break; + case 21: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 22: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 23: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 24: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("status", status, 139)); + VerifyOrReturn(CheckConstraintIsUpperCase("value.instanceName", value.instanceName, true)); + VerifyOrReturn(CheckConstraintIsHexString("value.instanceName", value.instanceName, true)); + VerifyOrReturn(CheckConstraintMinLength("value.instanceName", value.instanceName.size(), 16)); + VerifyOrReturn(CheckConstraintMaxLength("value.instanceName", value.instanceName.size(), 16)); + VerifyOrReturn(CheckConstraintNotValue("value.instanceName", value.instanceName, deviceInstanceNameBeforeReboot)); + } + shouldContinue = true; + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } - NextTest(); + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } } - CHIP_ERROR TestMakeSureThatFirstYearDayScheduleWasNotDeleted_61() + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::GetYearDaySchedule::Type; - - RequestType request; - request.yearDayIndex = 1; - request.userIndex = 1U; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context)) - ->OnSuccessResponse_61(data.yearDayIndex, data.userIndex, data.status, data.localStartTime, data.localEndTime); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_61(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Reboot target device"); + SetIdentity(kIdentityAlpha); + return Reboot(mDiscriminator.HasValue() ? mDiscriminator.Value() : 3840U); + } + case 1: { + LogStep(1, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 2: { + LogStep(2, "Open Commissioning Window with too-short timeout"); + chip::app::Clusters::AdministratorCommissioning::Commands::OpenBasicCommissioningWindow::Type value; + value.commissioningTimeout = 120U; + return SendCommand(kIdentityAlpha, GetEndpoint(0), AdministratorCommissioning::Id, + AdministratorCommissioning::Commands::OpenBasicCommissioningWindow::Id, value, + chip::Optional(10000)); + } + case 3: { + LogStep(3, "Open Commissioning Window with too-long timeout"); + chip::app::Clusters::AdministratorCommissioning::Commands::OpenBasicCommissioningWindow::Type value; + value.commissioningTimeout = 1000U; + return SendCommand(kIdentityAlpha, GetEndpoint(0), AdministratorCommissioning::Id, + AdministratorCommissioning::Commands::OpenBasicCommissioningWindow::Id, value, + chip::Optional(10000)); + } + case 4: { + LogStep(4, "Open Commissioning Window"); + chip::app::Clusters::AdministratorCommissioning::Commands::OpenBasicCommissioningWindow::Type value; + value.commissioningTimeout = 180U; + return SendCommand(kIdentityAlpha, GetEndpoint(0), AdministratorCommissioning::Id, + AdministratorCommissioning::Commands::OpenBasicCommissioningWindow::Id, value, + chip::Optional(10000)); + } + case 5: { + LogStep(5, "Check Instance Name"); + SetIdentity(kIdentityAlpha); + return FindCommissionable(); + } + case 6: { + LogStep(6, "Check Long Discriminator _L"); + SetIdentity(kIdentityAlpha); + return FindCommissionableByLongDiscriminator(mDiscriminator.HasValue() ? mDiscriminator.Value() : 3840U); + } + case 7: { + LogStep(7, "Check Short Discriminator (_S)"); + SetIdentity(kIdentityAlpha); + return FindCommissionableByShortDiscriminator(mDiscriminator.HasValue() ? mDiscriminator.Value() : 3840U); + } + case 8: { + LogStep(8, "Check Commissioning Mode (_CM)"); + SetIdentity(kIdentityAlpha); + return FindCommissionableByCommissioningMode(); + } + case 9: { + LogStep(9, "Check Vendor ID (_V)"); + VerifyOrdo(!ShouldSkip("VENDOR_SUBTYPE"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + SetIdentity(kIdentityAlpha); + return FindCommissionableByVendorId(mVendorId.HasValue() ? mVendorId.Value() : 65521U); + } + case 10: { + LogStep(10, "TXT key for discriminator (D)"); + SetIdentity(kIdentityAlpha); + return FindCommissionable(); + } + case 11: { + LogStep(11, "TXT key for Vendor ID and Product ID (VP)"); + VerifyOrdo(!ShouldSkip("VP_KEY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + SetIdentity(kIdentityAlpha); + return FindCommissionable(); + } + case 12: { + LogStep(12, "TXT key for Vendor ID and Product ID (VP)"); + VerifyOrdo(!ShouldSkip("VP_KEY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + SetIdentity(kIdentityAlpha); + return FindCommissionable(); + } + case 13: { + LogStep(13, "Optional TXT key for MRP Retry Interval Idle (CRI)"); + VerifyOrdo(!ShouldSkip("CRI_COMM_DISCOVERY_KEY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + SetIdentity(kIdentityAlpha); + return FindCommissionable(); + } + case 14: { + LogStep(14, "Optional TXT key for MRP Retry Interval Active (CRA)"); + VerifyOrdo(!ShouldSkip("CRA_COMM_DISCOVERY_KEY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + SetIdentity(kIdentityAlpha); + return FindCommissionable(); + } + case 15: { + LogStep(15, "TXT key for commissioning mode (CM)"); + SetIdentity(kIdentityAlpha); + return FindCommissionable(); + } + case 16: { + LogStep(16, "Optional TXT key for device name (DN)"); + VerifyOrdo(!ShouldSkip("DN_KEY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + SetIdentity(kIdentityAlpha); + return FindCommissionable(); + } + case 17: { + LogStep(17, "Optional TXT key for rotating device identifier (RI)"); + VerifyOrdo(!ShouldSkip("RI_KEY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + SetIdentity(kIdentityAlpha); + return FindCommissionable(); + } + case 18: { + LogStep(18, "Optional TXT key for pairing hint (PH)"); + VerifyOrdo(!ShouldSkip("PH_KEY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + SetIdentity(kIdentityAlpha); + return FindCommissionable(); + } + case 19: { + LogStep(19, "Optional TXT key for pairing instructions (PI)"); + VerifyOrdo(!ShouldSkip("PI_KEY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + SetIdentity(kIdentityAlpha); + return FindCommissionable(); + } + case 20: { + LogStep(20, "Check IPs"); + SetIdentity(kIdentityAlpha); + return FindCommissionable(); + } + case 21: { + LogStep(21, "Reboot target device"); + SetIdentity(kIdentityAlpha); + return Reboot(mDiscriminator.HasValue() ? mDiscriminator.Value() : 3840U); + } + case 22: { + LogStep(22, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 23: { + LogStep(23, "Open Commissioning Window"); + chip::app::Clusters::AdministratorCommissioning::Commands::OpenBasicCommissioningWindow::Type value; + value.commissioningTimeout = 180U; + return SendCommand(kIdentityAlpha, GetEndpoint(0), AdministratorCommissioning::Id, + AdministratorCommissioning::Commands::OpenBasicCommissioningWindow::Id, value, + chip::Optional(10000)); + } + case 24: { + LogStep(24, "Check Instance Name"); + SetIdentity(kIdentityAlpha); + return FindCommissionable(); + } + } return CHIP_NO_ERROR; } +}; - void OnFailureResponse_61(CHIP_ERROR error) +class TestLogCommandsSuite : public TestCommand +{ +public: + TestLogCommandsSuite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("TestLogCommands", 3, credsIssuerConfig) { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - void OnSuccessResponse_61(uint8_t yearDayIndex, uint16_t userIndex, chip::app::Clusters::DoorLock::DlStatus status, - const chip::Optional & localStartTime, const chip::Optional & localEndTime) - { - VerifyOrReturn(CheckValue("yearDayIndex", yearDayIndex, 1)); - - VerifyOrReturn(CheckValue("userIndex", userIndex, 1U)); + ~TestLogCommandsSuite() {} - VerifyOrReturn(CheckValue("status", status, 0)); + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } - VerifyOrReturn(CheckValuePresent("localStartTime", localStartTime)); - VerifyOrReturn(CheckValue("localStartTime.Value()", localStartTime.Value(), 12345UL)); +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; - VerifyOrReturn(CheckValuePresent("localEndTime", localEndTime)); - VerifyOrReturn(CheckValue("localEndTime.Value()", localEndTime.Value(), 12345689UL)); + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } - NextTest(); - } + // + // Tests methods + // - CHIP_ERROR TestMakeSureThatSecondYearDayScheduleWasNotDeleted_62() + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::GetYearDaySchedule::Type; - - RequestType request; - request.yearDayIndex = 2; - request.userIndex = 1U; + bool shouldContinue = false; - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context)) - ->OnSuccessResponse_62(data.yearDayIndex, data.userIndex, data.status, data.localStartTime, data.localEndTime); - }; + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_62(error); - }; + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } + } - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "Log a simple message"); + SetIdentity(kIdentityAlpha); + return Log("This is a simple message"); + } + case 2: { + LogStep(2, "Do a simple user prompt message"); + SetIdentity(kIdentityAlpha); + return UserPrompt("This is a simple message"); + } + } return CHIP_NO_ERROR; } +}; - void OnFailureResponse_62(CHIP_ERROR error) +class TestSaveAsSuite : public TestCommand +{ +public: + TestSaveAsSuite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("TestSaveAs", 110, credsIssuerConfig) { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - void OnSuccessResponse_62(uint8_t yearDayIndex, uint16_t userIndex, chip::app::Clusters::DoorLock::DlStatus status, - const chip::Optional & localStartTime, const chip::Optional & localEndTime) + ~TestSaveAsSuite() { - VerifyOrReturn(CheckValue("yearDayIndex", yearDayIndex, 2)); - - VerifyOrReturn(CheckValue("userIndex", userIndex, 1U)); - - VerifyOrReturn(CheckValue("status", status, 0)); - - VerifyOrReturn(CheckValuePresent("localStartTime", localStartTime)); - VerifyOrReturn(CheckValue("localStartTime.Value()", localStartTime.Value(), 9000UL)); - - VerifyOrReturn(CheckValuePresent("localEndTime", localEndTime)); - VerifyOrReturn(CheckValue("localEndTime.Value()", localEndTime.Value(), 888888888UL)); - - NextTest(); + if (readAttributeCharStringDefaultValueBuffer != nullptr) + { + chip::Platform::MemoryFree(readAttributeCharStringDefaultValueBuffer); + readAttributeCharStringDefaultValueBuffer = nullptr; + } + if (readAttributeCharStringNotDefaultValueBuffer != nullptr) + { + chip::Platform::MemoryFree(readAttributeCharStringNotDefaultValueBuffer); + readAttributeCharStringNotDefaultValueBuffer = nullptr; + } + if (readAttributeOctetStringDefaultValueBuffer != nullptr) + { + chip::Platform::MemoryFree(readAttributeOctetStringDefaultValueBuffer); + readAttributeOctetStringDefaultValueBuffer = nullptr; + } + if (readAttributeOctetStringNotDefaultValueBuffer != nullptr) + { + chip::Platform::MemoryFree(readAttributeOctetStringNotDefaultValueBuffer); + readAttributeOctetStringNotDefaultValueBuffer = nullptr; + } } - CHIP_ERROR TestCreateAnotherWeekDayScheduleWithValidParameters_63() + chip::System::Clock::Timeout GetWaitDuration() const override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::SetWeekDaySchedule::Type; + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } - RequestType request; - request.weekDayIndex = 1; - request.userIndex = 1U; - request.daysMask = static_cast>(2); - request.startHour = 0; - request.startMinute = 0; - request.endHour = 23; - request.endMinute = 59; +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_63(); - }; + uint8_t TestAddArgumentDefaultValue; + bool readAttributeBooleanDefaultValue; + chip::BitFlags readAttributeBitmap8DefaultValue; + chip::BitFlags readAttributeBitmap16DefaultValue; + chip::BitFlags readAttributeBitmap32DefaultValue; + chip::BitFlags readAttributeBitmap64DefaultValue; + uint8_t readAttributeInt8uDefaultValue; + uint16_t readAttributeInt16uDefaultValue; + uint32_t readAttributeInt32uDefaultValue; + uint64_t readAttributeInt64uDefaultValue; + int8_t readAttributeInt8sDefaultValue; + int16_t readAttributeInt16sDefaultValue; + int32_t readAttributeInt32sDefaultValue; + int64_t readAttributeInt64sDefaultValue; + uint8_t readAttributeEnum8DefaultValue; + uint16_t readAttributeEnum16DefaultValue; + uint64_t readAttributeEpochUSDefaultValue; + uint32_t readAttributeEpochSDefaultValue; + chip::VendorId readAttributeVendorIdDefaultValue; + char * readAttributeCharStringDefaultValueBuffer = nullptr; + chip::CharSpan readAttributeCharStringDefaultValue; + char * readAttributeCharStringNotDefaultValueBuffer = nullptr; + chip::CharSpan readAttributeCharStringNotDefaultValue; + uint8_t * readAttributeOctetStringDefaultValueBuffer = nullptr; + chip::ByteSpan readAttributeOctetStringDefaultValue; + uint8_t * readAttributeOctetStringNotDefaultValueBuffer = nullptr; + chip::ByteSpan readAttributeOctetStringNotDefaultValue; - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_63(error); - }; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } + // + // Tests methods + // - void OnFailureResponse_63(CHIP_ERROR error) + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } + bool shouldContinue = false; - void OnSuccessResponse_63() { NextTest(); } + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::TestCluster::Commands::TestAddArgumentsResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("returnValue", value.returnValue, 20)); - CHIP_ERROR TestClearASingleYearDayScheduleForTheFirstUser_64() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::ClearYearDaySchedule::Type; + TestAddArgumentDefaultValue = value.returnValue; + } + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::TestCluster::Commands::TestAddArgumentsResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("returnValue", value.returnValue, TestAddArgumentDefaultValue)); + } + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::TestCluster::Commands::TestAddArgumentsResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintNotValue("value.returnValue", value.returnValue, TestAddArgumentDefaultValue)); + } + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + bool value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("boolean", value, 0)); + + readAttributeBooleanDefaultValue = value; + } + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + bool value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintNotValue("value", value, readAttributeBooleanDefaultValue)); + } + break; + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 8: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + bool value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("boolean", value, readAttributeBooleanDefaultValue)); + } + break; + case 9: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::BitFlags value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("bitmap8", value, 0)); - RequestType request; - request.yearDayIndex = 1; - request.userIndex = 1U; + readAttributeBitmap8DefaultValue = value; + } + break; + case 10: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 11: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::BitFlags value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintNotValue("value", value, readAttributeBitmap8DefaultValue)); + } + break; + case 12: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 13: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::BitFlags value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("bitmap8", value, readAttributeBitmap8DefaultValue)); + } + break; + case 14: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::BitFlags value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("bitmap16", value, 0U)); - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_64(); - }; + readAttributeBitmap16DefaultValue = value; + } + break; + case 15: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 16: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::BitFlags value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintNotValue("value", value, readAttributeBitmap16DefaultValue)); + } + break; + case 17: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 18: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::BitFlags value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("bitmap16", value, readAttributeBitmap16DefaultValue)); + } + break; + case 19: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::BitFlags value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("bitmap32", value, 0UL)); - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_64(error); - }; + readAttributeBitmap32DefaultValue = value; + } + break; + case 20: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 21: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::BitFlags value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintNotValue("value", value, readAttributeBitmap32DefaultValue)); + } + break; + case 22: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 23: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::BitFlags value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("bitmap32", value, readAttributeBitmap32DefaultValue)); + } + break; + case 24: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::BitFlags value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("bitmap64", value, 0ULL)); - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } + readAttributeBitmap64DefaultValue = value; + } + break; + case 25: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 26: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::BitFlags value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintNotValue("value", value, readAttributeBitmap64DefaultValue)); + } + break; + case 27: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 28: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::BitFlags value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("bitmap64", value, readAttributeBitmap64DefaultValue)); + } + break; + case 29: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("int8u", value, 0)); - void OnFailureResponse_64(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } + readAttributeInt8uDefaultValue = value; + } + break; + case 30: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 31: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintNotValue("value", value, readAttributeInt8uDefaultValue)); + } + break; + case 32: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 33: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("int8u", value, readAttributeInt8uDefaultValue)); + } + break; + case 34: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("int16u", value, 0U)); - void OnSuccessResponse_64() { NextTest(); } + readAttributeInt16uDefaultValue = value; + } + break; + case 35: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 36: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintNotValue("value", value, readAttributeInt16uDefaultValue)); + } + break; + case 37: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 38: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("int16u", value, readAttributeInt16uDefaultValue)); + } + break; + case 39: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("int32u", value, 0UL)); - CHIP_ERROR TestVerifyClearedYearDaySchedule_65() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::GetYearDaySchedule::Type; + readAttributeInt32uDefaultValue = value; + } + break; + case 40: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 41: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintNotValue("value", value, readAttributeInt32uDefaultValue)); + } + break; + case 42: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 43: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("int32u", value, readAttributeInt32uDefaultValue)); + } + break; + case 44: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint64_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("int64u", value, 0ULL)); - RequestType request; - request.yearDayIndex = 1; - request.userIndex = 1U; + readAttributeInt64uDefaultValue = value; + } + break; + case 45: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 46: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint64_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintNotValue("value", value, readAttributeInt64uDefaultValue)); + } + break; + case 47: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 48: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint64_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("int64u", value, readAttributeInt64uDefaultValue)); + } + break; + case 49: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + int8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("int8s", value, 0)); - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context)) - ->OnSuccessResponse_65(data.yearDayIndex, data.userIndex, data.status, data.localStartTime, data.localEndTime); - }; + readAttributeInt8sDefaultValue = value; + } + break; + case 50: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 51: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + int8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintNotValue("value", value, readAttributeInt8sDefaultValue)); + } + break; + case 52: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 53: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + int8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("int8s", value, readAttributeInt8sDefaultValue)); + } + break; + case 54: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + int16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("int16s", value, 0)); - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_65(error); - }; + readAttributeInt16sDefaultValue = value; + } + break; + case 55: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 56: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + int16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintNotValue("value", value, readAttributeInt16sDefaultValue)); + } + break; + case 57: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 58: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + int16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("int16s", value, readAttributeInt16sDefaultValue)); + } + break; + case 59: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + int32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("int32s", value, 0L)); - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } + readAttributeInt32sDefaultValue = value; + } + break; + case 60: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 61: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + int32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintNotValue("value", value, readAttributeInt32sDefaultValue)); + } + break; + case 62: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 63: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + int32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("int32s", value, readAttributeInt32sDefaultValue)); + } + break; + case 64: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + int64_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("int64s", value, 0LL)); - void OnFailureResponse_65(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } + readAttributeInt64sDefaultValue = value; + } + break; + case 65: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 66: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + int64_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintNotValue("value", value, readAttributeInt64sDefaultValue)); + } + break; + case 67: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 68: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + int64_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("int64s", value, readAttributeInt64sDefaultValue)); + } + break; + case 69: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("enum8", value, 0)); - void OnSuccessResponse_65(uint8_t yearDayIndex, uint16_t userIndex, chip::app::Clusters::DoorLock::DlStatus status, - const chip::Optional & localStartTime, const chip::Optional & localEndTime) - { - VerifyOrReturn(CheckValue("yearDayIndex", yearDayIndex, 1)); + readAttributeEnum8DefaultValue = value; + } + break; + case 70: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 71: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintNotValue("value", value, readAttributeEnum8DefaultValue)); + } + break; + case 72: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 73: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("enum8", value, readAttributeEnum8DefaultValue)); + } + break; + case 74: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("enum16", value, 0U)); - VerifyOrReturn(CheckValue("userIndex", userIndex, 1U)); + readAttributeEnum16DefaultValue = value; + } + break; + case 75: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 76: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintNotValue("value", value, readAttributeEnum16DefaultValue)); + } + break; + case 77: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 78: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("enum16", value, readAttributeEnum16DefaultValue)); + } + break; + case 79: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint64_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("epochUs", value, 0ULL)); - VerifyOrReturn(CheckValue("status", status, 139)); + readAttributeEpochUSDefaultValue = value; + } + break; + case 80: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 81: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint64_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintNotValue("value", value, readAttributeEpochUSDefaultValue)); + } + break; + case 82: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 83: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint64_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("epochUs", value, readAttributeEpochUSDefaultValue)); + } + break; + case 84: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("epochS", value, 0UL)); - NextTest(); - } + readAttributeEpochSDefaultValue = value; + } + break; + case 85: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 86: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintNotValue("value", value, readAttributeEpochSDefaultValue)); + } + break; + case 87: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 88: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("epochS", value, readAttributeEpochSDefaultValue)); + } + break; + case 89: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::VendorId value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("vendorId", value, 0U)); - CHIP_ERROR TestClearAllRemainingYearSchedulesForTheFirstUser_66() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::ClearYearDaySchedule::Type; + readAttributeVendorIdDefaultValue = value; + } + break; + case 90: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 91: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::VendorId value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintNotValue("value", value, readAttributeVendorIdDefaultValue)); + } + break; + case 92: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 93: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::VendorId value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("vendorId", value, readAttributeVendorIdDefaultValue)); + } + break; + case 94: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::CharSpan value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueAsString("charString", value, chip::CharSpan("", 0))); - RequestType request; - request.yearDayIndex = 254; - request.userIndex = 1U; + if (readAttributeCharStringDefaultValueBuffer != nullptr) + { + chip::Platform::MemoryFree(readAttributeCharStringDefaultValueBuffer); + } + readAttributeCharStringDefaultValueBuffer = static_cast(chip::Platform::MemoryAlloc(value.size())); + memcpy(readAttributeCharStringDefaultValueBuffer, value.data(), value.size()); + readAttributeCharStringDefaultValue = chip::CharSpan(readAttributeCharStringDefaultValueBuffer, value.size()); + } + break; + case 95: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::CharSpan value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueAsString("charString", value, readAttributeCharStringDefaultValue)); + } + break; + case 96: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 97: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::CharSpan value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueAsString("charString", value, chip::CharSpan("NotDefault", 10))); + VerifyOrReturn(CheckConstraintNotValue("value", value, readAttributeCharStringDefaultValue)); - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_66(); - }; + if (readAttributeCharStringNotDefaultValueBuffer != nullptr) + { + chip::Platform::MemoryFree(readAttributeCharStringNotDefaultValueBuffer); + } + readAttributeCharStringNotDefaultValueBuffer = static_cast(chip::Platform::MemoryAlloc(value.size())); + memcpy(readAttributeCharStringNotDefaultValueBuffer, value.data(), value.size()); + readAttributeCharStringNotDefaultValue = chip::CharSpan(readAttributeCharStringNotDefaultValueBuffer, value.size()); + } + break; + case 98: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::CharSpan value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueAsString("charString", value, readAttributeCharStringNotDefaultValue)); + VerifyOrReturn(CheckConstraintNotValue("value", value, readAttributeCharStringDefaultValue)); + } + break; + case 99: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 100: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::CharSpan value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueAsString("charString", value, chip::CharSpan("NotDefault", 10))); + } + break; + case 101: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 102: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::ByteSpan value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueAsString("octetString", value, chip::ByteSpan(chip::Uint8::from_const_char(""), 0))); - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_66(error); - }; + if (readAttributeOctetStringDefaultValueBuffer != nullptr) + { + chip::Platform::MemoryFree(readAttributeOctetStringDefaultValueBuffer); + } + readAttributeOctetStringDefaultValueBuffer = static_cast(chip::Platform::MemoryAlloc(value.size())); + memcpy(readAttributeOctetStringDefaultValueBuffer, value.data(), value.size()); + readAttributeOctetStringDefaultValue = chip::ByteSpan(readAttributeOctetStringDefaultValueBuffer, value.size()); + } + break; + case 103: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::ByteSpan value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueAsString("octetString", value, readAttributeOctetStringDefaultValue)); + } + break; + case 104: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 105: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::ByteSpan value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn( + CheckValueAsString("octetString", value, chip::ByteSpan(chip::Uint8::from_const_char("NotDefault"), 10))); + VerifyOrReturn(CheckConstraintNotValue("value", value, readAttributeOctetStringDefaultValue)); - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } + if (readAttributeOctetStringNotDefaultValueBuffer != nullptr) + { + chip::Platform::MemoryFree(readAttributeOctetStringNotDefaultValueBuffer); + } + readAttributeOctetStringNotDefaultValueBuffer = static_cast(chip::Platform::MemoryAlloc(value.size())); + memcpy(readAttributeOctetStringNotDefaultValueBuffer, value.data(), value.size()); + readAttributeOctetStringNotDefaultValue = + chip::ByteSpan(readAttributeOctetStringNotDefaultValueBuffer, value.size()); + } + break; + case 106: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::ByteSpan value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueAsString("octetString", value, readAttributeOctetStringNotDefaultValue)); + VerifyOrReturn(CheckConstraintNotValue("value", value, readAttributeOctetStringDefaultValue)); + } + break; + case 107: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 108: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::ByteSpan value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn( + CheckValueAsString("octetString", value, chip::ByteSpan(chip::Uint8::from_const_char("NotDefault"), 10))); + } + break; + case 109: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } - void OnFailureResponse_66(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } } - void OnSuccessResponse_66() { NextTest(); } - - CHIP_ERROR TestVerifyThatSecondYearDayScheduleWasCleared_67() + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::GetYearDaySchedule::Type; - - RequestType request; - request.yearDayIndex = 2; - request.userIndex = 1U; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context)) - ->OnSuccessResponse_67(data.yearDayIndex, data.userIndex, data.status, data.localStartTime, data.localEndTime); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_67(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "Send Test Add Arguments Command"); + chip::app::Clusters::TestCluster::Commands::TestAddArguments::Type value; + value.arg1 = 3; + value.arg2 = 17; + return SendCommand(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Commands::TestAddArguments::Id, value); + } + case 2: { + LogStep(2, "Send Test Add Arguments Command"); + chip::app::Clusters::TestCluster::Commands::TestAddArguments::Type value; + value.arg1 = 3; + value.arg2 = 17; + return SendCommand(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Commands::TestAddArguments::Id, value); + } + case 3: { + LogStep(3, "Send Test Add Arguments Command"); + chip::app::Clusters::TestCluster::Commands::TestAddArguments::Type value; + value.arg1 = 3; + value.arg2 = TestAddArgumentDefaultValue; + return SendCommand(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Commands::TestAddArguments::Id, value); + } + case 4: { + LogStep(4, "Read attribute BOOLEAN Default Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Boolean::Id); + } + case 5: { + LogStep(5, "Write attribute BOOLEAN Not Default Value"); + bool value; + value = 1; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Boolean::Id, value); + } + case 6: { + LogStep(6, "Read attribute BOOLEAN Not Default Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Boolean::Id); + } + case 7: { + LogStep(7, "Write attribute BOOLEAN DefaultValue"); + bool value; + value = readAttributeBooleanDefaultValue; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Boolean::Id, value); + } + case 8: { + LogStep(8, "Read attribute BOOLEAN False"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Boolean::Id); + } + case 9: { + LogStep(9, "Read attribute BITMAP8 Default Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Bitmap8::Id); + } + case 10: { + LogStep(10, "Write attribute BITMAP8 Not Default Value"); + chip::BitFlags value; + value = static_cast>(1); + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Bitmap8::Id, value); + } + case 11: { + LogStep(11, "Read attribute BITMAP8 Not Default Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Bitmap8::Id); + } + case 12: { + LogStep(12, "Write attribute BITMAP8 Default Value"); + chip::BitFlags value; + value = readAttributeBitmap8DefaultValue; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Bitmap8::Id, value); + } + case 13: { + LogStep(13, "Read attribute BITMAP8 Default Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Bitmap8::Id); + } + case 14: { + LogStep(14, "Read attribute BITMAP16 Default Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Bitmap16::Id); + } + case 15: { + LogStep(15, "Write attribute BITMAP16 Not Default Value"); + chip::BitFlags value; + value = static_cast>(1U); + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Bitmap16::Id, value); + } + case 16: { + LogStep(16, "Read attribute BITMAP16 Not Default Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Bitmap16::Id); + } + case 17: { + LogStep(17, "Write attribute BITMAP16 Default Value"); + chip::BitFlags value; + value = readAttributeBitmap16DefaultValue; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Bitmap16::Id, value); + } + case 18: { + LogStep(18, "Read attribute BITMAP16 Default Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Bitmap16::Id); + } + case 19: { + LogStep(19, "Read attribute BITMAP32 Default Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Bitmap32::Id); + } + case 20: { + LogStep(20, "Write attribute BITMAP32 Not Default Value"); + chip::BitFlags value; + value = static_cast>(1UL); + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Bitmap32::Id, value); + } + case 21: { + LogStep(21, "Read attribute BITMAP32 Not Default Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Bitmap32::Id); + } + case 22: { + LogStep(22, "Write attribute BITMAP32 Default Value"); + chip::BitFlags value; + value = readAttributeBitmap32DefaultValue; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Bitmap32::Id, value); + } + case 23: { + LogStep(23, "Read attribute BITMAP32 Default Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Bitmap32::Id); + } + case 24: { + LogStep(24, "Read attribute BITMAP64 Default Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Bitmap64::Id); + } + case 25: { + LogStep(25, "Write attribute BITMAP64 Not Default Value"); + chip::BitFlags value; + value = static_cast>(1ULL); + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Bitmap64::Id, value); + } + case 26: { + LogStep(26, "Read attribute BITMAP64 Default Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Bitmap64::Id); + } + case 27: { + LogStep(27, "Write attribute BITMAP64 Default Value"); + chip::BitFlags value; + value = readAttributeBitmap64DefaultValue; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Bitmap64::Id, value); + } + case 28: { + LogStep(28, "Read attribute BITMAP64 Default Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Bitmap64::Id); + } + case 29: { + LogStep(29, "Read attribute INT8U Default Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Int8u::Id); + } + case 30: { + LogStep(30, "Write attribute INT8U Not Default Value"); + uint8_t value; + value = 1; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Int8u::Id, value); + } + case 31: { + LogStep(31, "Read attribute INT8U Not Default Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Int8u::Id); + } + case 32: { + LogStep(32, "Write attribute INT8U Default Value"); + uint8_t value; + value = readAttributeInt8uDefaultValue; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Int8u::Id, value); + } + case 33: { + LogStep(33, "Read attribute INT8U Default Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Int8u::Id); + } + case 34: { + LogStep(34, "Read attribute INT16U Default Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Int16u::Id); + } + case 35: { + LogStep(35, "Write attribute INT16U Not Default Value"); + uint16_t value; + value = 1U; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Int16u::Id, value); + } + case 36: { + LogStep(36, "Read attribute INT16U Not Default Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Int16u::Id); + } + case 37: { + LogStep(37, "Write attribute INT16U Default Value"); + uint16_t value; + value = readAttributeInt16uDefaultValue; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Int16u::Id, value); + } + case 38: { + LogStep(38, "Read attribute INT16U Default Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Int16u::Id); + } + case 39: { + LogStep(39, "Read attribute INT32U Default Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Int32u::Id); + } + case 40: { + LogStep(40, "Write attribute INT32U Not Default Value"); + uint32_t value; + value = 1UL; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Int32u::Id, value); + } + case 41: { + LogStep(41, "Read attribute INT32U Not Default Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Int32u::Id); + } + case 42: { + LogStep(42, "Write attribute INT32U Default Value"); + uint32_t value; + value = readAttributeInt32uDefaultValue; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Int32u::Id, value); + } + case 43: { + LogStep(43, "Read attribute INT32U Default Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Int32u::Id); + } + case 44: { + LogStep(44, "Read attribute INT64U Default Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Int64u::Id); + } + case 45: { + LogStep(45, "Write attribute INT64U Not Default Value"); + uint64_t value; + value = 1ULL; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Int64u::Id, value); + } + case 46: { + LogStep(46, "Read attribute INT64U Not Default Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Int64u::Id); + } + case 47: { + LogStep(47, "Write attribute INT64U Default Value"); + uint64_t value; + value = readAttributeInt64uDefaultValue; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Int64u::Id, value); + } + case 48: { + LogStep(48, "Read attribute INT64U Default Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Int64u::Id); + } + case 49: { + LogStep(49, "Read attribute INT8S Default Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Int8s::Id); + } + case 50: { + LogStep(50, "Write attribute INT8S Not Default Value"); + int8_t value; + value = 1; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Int8s::Id, value); + } + case 51: { + LogStep(51, "Read attribute INT8S Not Default Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Int8s::Id); + } + case 52: { + LogStep(52, "Write attribute INT8S Default Value"); + int8_t value; + value = readAttributeInt8sDefaultValue; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Int8s::Id, value); + } + case 53: { + LogStep(53, "Read attribute INT8S Default Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Int8s::Id); + } + case 54: { + LogStep(54, "Read attribute INT16S Default Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Int16s::Id); + } + case 55: { + LogStep(55, "Write attribute INT16S Not Default Value"); + int16_t value; + value = 1; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Int16s::Id, value); + } + case 56: { + LogStep(56, "Read attribute INT16S Not Default Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Int16s::Id); + } + case 57: { + LogStep(57, "Write attribute INT16S Default Value"); + int16_t value; + value = readAttributeInt16sDefaultValue; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Int16s::Id, value); + } + case 58: { + LogStep(58, "Read attribute INT16S Default Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Int16s::Id); + } + case 59: { + LogStep(59, "Read attribute INT32S Default Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Int32s::Id); + } + case 60: { + LogStep(60, "Write attribute INT32S Not Default Value"); + int32_t value; + value = 1L; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Int32s::Id, value); + } + case 61: { + LogStep(61, "Read attribute INT32S Not Default Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Int32s::Id); + } + case 62: { + LogStep(62, "Write attribute INT32S Default Value"); + int32_t value; + value = readAttributeInt32sDefaultValue; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Int32s::Id, value); + } + case 63: { + LogStep(63, "Read attribute INT32S Default Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Int32s::Id); + } + case 64: { + LogStep(64, "Read attribute INT64S Default Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Int64s::Id); + } + case 65: { + LogStep(65, "Write attribute INTS Not Default Value"); + int64_t value; + value = 1LL; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Int64s::Id, value); + } + case 66: { + LogStep(66, "Read attribute INT64S Not Default Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Int64s::Id); + } + case 67: { + LogStep(67, "Write attribute INT64S Default Value"); + int64_t value; + value = readAttributeInt64sDefaultValue; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Int64s::Id, value); + } + case 68: { + LogStep(68, "Read attribute INT64S Default Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Int64s::Id); + } + case 69: { + LogStep(69, "Read attribute ENUM8 Default Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Enum8::Id); + } + case 70: { + LogStep(70, "Write attribute ENUM8 Not Default Value"); + uint8_t value; + value = 1; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Enum8::Id, value); + } + case 71: { + LogStep(71, "Read attribute ENUM8 Not Default Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Enum8::Id); + } + case 72: { + LogStep(72, "Write attribute ENUM8 Default Value"); + uint8_t value; + value = readAttributeEnum8DefaultValue; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Enum8::Id, value); + } + case 73: { + LogStep(73, "Read attribute ENUM8 Default Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Enum8::Id); + } + case 74: { + LogStep(74, "Read attribute ENUM16 Default Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Enum16::Id); + } + case 75: { + LogStep(75, "Write attribute ENUM16 Not Default Value"); + uint16_t value; + value = 1U; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Enum16::Id, value); + } + case 76: { + LogStep(76, "Read attribute ENUM16 Not Default Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Enum16::Id); + } + case 77: { + LogStep(77, "Write attribute ENUM16 Default Value"); + uint16_t value; + value = readAttributeEnum16DefaultValue; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Enum16::Id, value); + } + case 78: { + LogStep(78, "Read attribute ENUM16 Default Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::Enum16::Id); + } + case 79: { + LogStep(79, "Read attribute EPOCH_US Default Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::EpochUs::Id); + } + case 80: { + LogStep(80, "Write attribute EPOCH_US Not Default Value"); + uint64_t value; + value = 1ULL; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::EpochUs::Id, value); + } + case 81: { + LogStep(81, "Read attribute EPOCH_US Not Default Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::EpochUs::Id); + } + case 82: { + LogStep(82, "Write attribute EPOCH_US Default Value"); + uint64_t value; + value = readAttributeEpochUSDefaultValue; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::EpochUs::Id, value); + } + case 83: { + LogStep(83, "Read attribute EPOCH_US Default Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::EpochUs::Id); + } + case 84: { + LogStep(84, "Read attribute EPOCH_S Default Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::EpochS::Id); + } + case 85: { + LogStep(85, "Write attribute EPOCH_S Not Default Value"); + uint32_t value; + value = 1UL; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::EpochS::Id, value); + } + case 86: { + LogStep(86, "Read attribute EPOCH_S Not Default Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::EpochS::Id); + } + case 87: { + LogStep(87, "Write attribute EPOCH_S Default Value"); + uint32_t value; + value = readAttributeEpochSDefaultValue; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::EpochS::Id, value); + } + case 88: { + LogStep(88, "Read attribute EPOCH_S Default Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::EpochS::Id); + } + case 89: { + LogStep(89, "Read attribute vendor_id Default Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::VendorId::Id); + } + case 90: { + LogStep(90, "Write attribute vendor_id Not Default Value"); + chip::VendorId value; + value = static_cast(1); + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::VendorId::Id, value); + } + case 91: { + LogStep(91, "Read attribute vendor_id Not Default Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::VendorId::Id); + } + case 92: { + LogStep(92, "Write attribute vendor_id Default Value"); + chip::VendorId value; + value = readAttributeVendorIdDefaultValue; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::VendorId::Id, value); + } + case 93: { + LogStep(93, "Read attribute vendor_id Default Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::VendorId::Id); + } + case 94: { + LogStep(94, "Read attribute char_string Default Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::CharString::Id); + } + case 95: { + LogStep(95, "Read attribute char_string Default Value and compare to saved value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::CharString::Id); + } + case 96: { + LogStep(96, "Write attribute char_string Not Default Value"); + chip::CharSpan value; + value = chip::Span("NotDefaultgarbage: not in length on purpose", 10); + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::CharString::Id, value); + } + case 97: { + LogStep(97, "Read attribute char_string Not Default Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::CharString::Id); + } + case 98: { + LogStep(98, "Read attribute char_string Not Default Value and compare to saved value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::CharString::Id); + } + case 99: { + LogStep(99, "Write attribute char_string Not Default Value from saved value"); + chip::CharSpan value; + value = readAttributeCharStringNotDefaultValue; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::CharString::Id, value); + } + case 100: { + LogStep(100, "Read attribute char_string Not Default Value and compare to expected value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::CharString::Id); + } + case 101: { + LogStep(101, "Write attribute char_string Default Value"); + chip::CharSpan value; + value = readAttributeCharStringDefaultValue; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::CharString::Id, value); + } + case 102: { + LogStep(102, "Read attribute octet_string Default Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::OctetString::Id); + } + case 103: { + LogStep(103, "Read attribute octet_string Default Value and compare to saved value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::OctetString::Id); + } + case 104: { + LogStep(104, "Write attribute octet_string Not Default Value"); + chip::ByteSpan value; + value = chip::ByteSpan(chip::Uint8::from_const_char("NotDefaultgarbage: not in length on purpose"), 10); + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::OctetString::Id, value); + } + case 105: { + LogStep(105, "Read attribute octet_string Not Default Value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::OctetString::Id); + } + case 106: { + LogStep(106, "Read attribute octet_string Not Default Value and compare to saved value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::OctetString::Id); + } + case 107: { + LogStep(107, "Write attribute octet_string Not Default Value from saved value"); + chip::ByteSpan value; + value = readAttributeOctetStringNotDefaultValue; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::OctetString::Id, value); + } + case 108: { + LogStep(108, "Read attribute octet_string Not Default Value and compare to expected value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::OctetString::Id); + } + case 109: { + LogStep(109, "Write attribute octet_string Default Value"); + chip::ByteSpan value; + value = readAttributeOctetStringDefaultValue; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Attributes::OctetString::Id, value); + } + } return CHIP_NO_ERROR; } +}; - void OnFailureResponse_67(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_67(uint8_t yearDayIndex, uint16_t userIndex, chip::app::Clusters::DoorLock::DlStatus status, - const chip::Optional & localStartTime, const chip::Optional & localEndTime) +class TestConfigVariablesSuite : public TestCommand +{ +public: + TestConfigVariablesSuite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("TestConfigVariables", 3, credsIssuerConfig) { - VerifyOrReturn(CheckValue("yearDayIndex", yearDayIndex, 2)); - - VerifyOrReturn(CheckValue("userIndex", userIndex, 1U)); - - VerifyOrReturn(CheckValue("status", status, 139)); - - NextTest(); + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("arg1", 0, UINT8_MAX, &mArg1); + AddArgument("returnValueWithArg1", 0, UINT8_MAX, &mReturnValueWithArg1); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - CHIP_ERROR TestVerifyCreatedWeekDaySchedule_68() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::GetWeekDaySchedule::Type; - - RequestType request; - request.weekDayIndex = 1; - request.userIndex = 1U; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context)) - ->OnSuccessResponse_68(data.weekDayIndex, data.userIndex, data.status, data.daysMask, data.startHour, - data.startMinute, data.endHour, data.endMinute); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_68(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } + ~TestConfigVariablesSuite() {} - void OnFailureResponse_68(CHIP_ERROR error) + chip::System::Clock::Timeout GetWaitDuration() const override { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } - void OnSuccessResponse_68(uint8_t weekDayIndex, uint16_t userIndex, chip::app::Clusters::DoorLock::DlStatus status, - const chip::Optional> & daysMask, - const chip::Optional & startHour, const chip::Optional & startMinute, - const chip::Optional & endHour, const chip::Optional & endMinute) - { - VerifyOrReturn(CheckValue("weekDayIndex", weekDayIndex, 1)); - - VerifyOrReturn(CheckValue("userIndex", userIndex, 1U)); - - VerifyOrReturn(CheckValue("status", status, 0)); - - VerifyOrReturn(CheckValuePresent("daysMask", daysMask)); - VerifyOrReturn(CheckValue("daysMask.Value()", daysMask.Value(), 2)); - - VerifyOrReturn(CheckValuePresent("startHour", startHour)); - VerifyOrReturn(CheckValue("startHour.Value()", startHour.Value(), 0)); - - VerifyOrReturn(CheckValuePresent("startMinute", startMinute)); - VerifyOrReturn(CheckValue("startMinute.Value()", startMinute.Value(), 0)); +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mArg1; + chip::Optional mReturnValueWithArg1; + chip::Optional mTimeout; - VerifyOrReturn(CheckValuePresent("endHour", endHour)); - VerifyOrReturn(CheckValue("endHour.Value()", endHour.Value(), 23)); + uint8_t TestAddArgumentDefaultValue; - VerifyOrReturn(CheckValuePresent("endMinute", endMinute)); - VerifyOrReturn(CheckValue("endMinute.Value()", endMinute.Value(), 59)); + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } - NextTest(); - } + // + // Tests methods + // - CHIP_ERROR TestClearAllRemainingWeekDaySchedulesForTheFirstUser_69() + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::ClearWeekDaySchedule::Type; - - RequestType request; - request.weekDayIndex = 254; - request.userIndex = 1U; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_69(); - }; + bool shouldContinue = false; - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_69(error); - }; + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::TestCluster::Commands::TestAddArgumentsResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("returnValue", value.returnValue, 20)); - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } + TestAddArgumentDefaultValue = value.returnValue; + } + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::TestCluster::Commands::TestAddArgumentsResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("returnValue", value.returnValue, + mReturnValueWithArg1.HasValue() ? mReturnValueWithArg1.Value() : 25)); + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } - void OnFailureResponse_69(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } } - void OnSuccessResponse_69() { NextTest(); } - - CHIP_ERROR TestCreateNewUserWithoutCredentialSoWeCanAddMoreSchedulesToIt_70() + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::SetUser::Type; - - RequestType request; - request.operationType = static_cast(0); - request.userIndex = 2U; - request.userName.SetNull(); - request.userUniqueId.SetNull(); - request.userStatus.SetNull(); - request.userType.SetNull(); - request.credentialRule.SetNull(); - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_70(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_70(error); - }; - - ReturnErrorOnFailure( - chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request, 10000)); + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "Send Test Add Arguments Command"); + chip::app::Clusters::TestCluster::Commands::TestAddArguments::Type value; + value.arg1 = 3; + value.arg2 = 17; + return SendCommand(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Commands::TestAddArguments::Id, value); + } + case 2: { + LogStep(2, "Send Test Add Arguments Command"); + chip::app::Clusters::TestCluster::Commands::TestAddArguments::Type value; + value.arg1 = mArg1.HasValue() ? mArg1.Value() : 5; + value.arg2 = TestAddArgumentDefaultValue; + return SendCommand(kIdentityAlpha, GetEndpoint(1), TestCluster::Id, TestCluster::Commands::TestAddArguments::Id, value); + } + } return CHIP_NO_ERROR; } +}; - void OnFailureResponse_70(CHIP_ERROR error) +class TestDescriptorClusterSuite : public TestCommand +{ +public: + TestDescriptorClusterSuite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("TestDescriptorCluster", 5, credsIssuerConfig) { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - void OnSuccessResponse_70() { NextTest(); } - - CHIP_ERROR TestCreateWeekDayScheduleWithValidParametersForFirstUser_71() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::SetWeekDaySchedule::Type; - - RequestType request; - request.weekDayIndex = 1; - request.userIndex = 1U; - request.daysMask = static_cast>(1); - request.startHour = 0; - request.startMinute = 0; - request.endHour = 23; - request.endMinute = 59; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_71(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_71(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } + ~TestDescriptorClusterSuite() {} - void OnFailureResponse_71(CHIP_ERROR error) + chip::System::Clock::Timeout GetWaitDuration() const override { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } - void OnSuccessResponse_71() { NextTest(); } - - CHIP_ERROR TestVerifyCreatedWeekDayScheduleForFirstUser_72() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::GetWeekDaySchedule::Type; - - RequestType request; - request.weekDayIndex = 1; - request.userIndex = 1U; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context)) - ->OnSuccessResponse_72(data.weekDayIndex, data.userIndex, data.status, data.daysMask, data.startHour, - data.startMinute, data.endHour, data.endMinute); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_72(error); - }; +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } - void OnFailureResponse_72(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } + // + // Tests methods + // - void OnSuccessResponse_72(uint8_t weekDayIndex, uint16_t userIndex, chip::app::Clusters::DoorLock::DlStatus status, - const chip::Optional> & daysMask, - const chip::Optional & startHour, const chip::Optional & startMinute, - const chip::Optional & endHour, const chip::Optional & endMinute) + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { - VerifyOrReturn(CheckValue("weekDayIndex", weekDayIndex, 1)); - - VerifyOrReturn(CheckValue("userIndex", userIndex, 1U)); - - VerifyOrReturn(CheckValue("status", status, 0)); - - VerifyOrReturn(CheckValuePresent("daysMask", daysMask)); - VerifyOrReturn(CheckValue("daysMask.Value()", daysMask.Value(), 1)); - - VerifyOrReturn(CheckValuePresent("startHour", startHour)); - VerifyOrReturn(CheckValue("startHour.Value()", startHour.Value(), 0)); - - VerifyOrReturn(CheckValuePresent("startMinute", startMinute)); - VerifyOrReturn(CheckValue("startMinute.Value()", startMinute.Value(), 0)); - - VerifyOrReturn(CheckValuePresent("endHour", endHour)); - VerifyOrReturn(CheckValue("endHour.Value()", endHour.Value(), 23)); + bool shouldContinue = false; - VerifyOrReturn(CheckValuePresent("endMinute", endMinute)); - VerifyOrReturn(CheckValue("endMinute.Value()", endMinute.Value(), 59)); + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + { + auto iter_0 = value.begin(); + VerifyOrReturn(CheckNextListItemDecodes("deviceList", iter_0, 0)); + VerifyOrReturn(CheckValue("deviceList[0].type", iter_0.GetValue().type, 22UL)); + VerifyOrReturn(CheckValue("deviceList[0].revision", iter_0.GetValue().revision, 1U)); + VerifyOrReturn(CheckNoMoreListItems("deviceList", iter_0, 1)); + } + } + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + { + auto iter_0 = value.begin(); + VerifyOrReturn(CheckNextListItemDecodes("serverList", iter_0, 0)); + VerifyOrReturn(CheckValue("serverList[0]", iter_0.GetValue(), 3UL)); + VerifyOrReturn(CheckNextListItemDecodes("serverList", iter_0, 1)); + VerifyOrReturn(CheckValue("serverList[1]", iter_0.GetValue(), 4UL)); + VerifyOrReturn(CheckNextListItemDecodes("serverList", iter_0, 2)); + VerifyOrReturn(CheckValue("serverList[2]", iter_0.GetValue(), 29UL)); + VerifyOrReturn(CheckNextListItemDecodes("serverList", iter_0, 3)); + VerifyOrReturn(CheckValue("serverList[3]", iter_0.GetValue(), 30UL)); + VerifyOrReturn(CheckNextListItemDecodes("serverList", iter_0, 4)); + VerifyOrReturn(CheckValue("serverList[4]", iter_0.GetValue(), 31UL)); + VerifyOrReturn(CheckNextListItemDecodes("serverList", iter_0, 5)); + VerifyOrReturn(CheckValue("serverList[5]", iter_0.GetValue(), 40UL)); + VerifyOrReturn(CheckNextListItemDecodes("serverList", iter_0, 6)); + VerifyOrReturn(CheckValue("serverList[6]", iter_0.GetValue(), 42UL)); + VerifyOrReturn(CheckNextListItemDecodes("serverList", iter_0, 7)); + VerifyOrReturn(CheckValue("serverList[7]", iter_0.GetValue(), 43UL)); + VerifyOrReturn(CheckNextListItemDecodes("serverList", iter_0, 8)); + VerifyOrReturn(CheckValue("serverList[8]", iter_0.GetValue(), 44UL)); + VerifyOrReturn(CheckNextListItemDecodes("serverList", iter_0, 9)); + VerifyOrReturn(CheckValue("serverList[9]", iter_0.GetValue(), 45UL)); + VerifyOrReturn(CheckNextListItemDecodes("serverList", iter_0, 10)); + VerifyOrReturn(CheckValue("serverList[10]", iter_0.GetValue(), 46UL)); + VerifyOrReturn(CheckNextListItemDecodes("serverList", iter_0, 11)); + VerifyOrReturn(CheckValue("serverList[11]", iter_0.GetValue(), 48UL)); + VerifyOrReturn(CheckNextListItemDecodes("serverList", iter_0, 12)); + VerifyOrReturn(CheckValue("serverList[12]", iter_0.GetValue(), 49UL)); + VerifyOrReturn(CheckNextListItemDecodes("serverList", iter_0, 13)); + VerifyOrReturn(CheckValue("serverList[13]", iter_0.GetValue(), 50UL)); + VerifyOrReturn(CheckNextListItemDecodes("serverList", iter_0, 14)); + VerifyOrReturn(CheckValue("serverList[14]", iter_0.GetValue(), 51UL)); + VerifyOrReturn(CheckNextListItemDecodes("serverList", iter_0, 15)); + VerifyOrReturn(CheckValue("serverList[15]", iter_0.GetValue(), 52UL)); + VerifyOrReturn(CheckNextListItemDecodes("serverList", iter_0, 16)); + VerifyOrReturn(CheckValue("serverList[16]", iter_0.GetValue(), 53UL)); + VerifyOrReturn(CheckNextListItemDecodes("serverList", iter_0, 17)); + VerifyOrReturn(CheckValue("serverList[17]", iter_0.GetValue(), 54UL)); + VerifyOrReturn(CheckNextListItemDecodes("serverList", iter_0, 18)); + VerifyOrReturn(CheckValue("serverList[18]", iter_0.GetValue(), 55UL)); + VerifyOrReturn(CheckNextListItemDecodes("serverList", iter_0, 19)); + VerifyOrReturn(CheckValue("serverList[19]", iter_0.GetValue(), 60UL)); + VerifyOrReturn(CheckNextListItemDecodes("serverList", iter_0, 20)); + VerifyOrReturn(CheckValue("serverList[20]", iter_0.GetValue(), 62UL)); + VerifyOrReturn(CheckNextListItemDecodes("serverList", iter_0, 21)); + VerifyOrReturn(CheckValue("serverList[21]", iter_0.GetValue(), 63UL)); + VerifyOrReturn(CheckNextListItemDecodes("serverList", iter_0, 22)); + VerifyOrReturn(CheckValue("serverList[22]", iter_0.GetValue(), 64UL)); + VerifyOrReturn(CheckNextListItemDecodes("serverList", iter_0, 23)); + VerifyOrReturn(CheckValue("serverList[23]", iter_0.GetValue(), 65UL)); + VerifyOrReturn(CheckNextListItemDecodes("serverList", iter_0, 24)); + VerifyOrReturn(CheckValue("serverList[24]", iter_0.GetValue(), 1029UL)); + VerifyOrReturn(CheckNoMoreListItems("serverList", iter_0, 25)); + } + } + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + { + auto iter_0 = value.begin(); + VerifyOrReturn(CheckNextListItemDecodes("clientList", iter_0, 0)); + VerifyOrReturn(CheckValue("clientList[0]", iter_0.GetValue(), 41UL)); + VerifyOrReturn(CheckNoMoreListItems("clientList", iter_0, 1)); + } + } + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + { + auto iter_0 = value.begin(); + VerifyOrReturn(CheckNextListItemDecodes("partsList", iter_0, 0)); + VerifyOrReturn(CheckValue("partsList[0]", iter_0.GetValue(), 1U)); + VerifyOrReturn(CheckNextListItemDecodes("partsList", iter_0, 1)); + VerifyOrReturn(CheckValue("partsList[1]", iter_0.GetValue(), 2U)); + VerifyOrReturn(CheckNoMoreListItems("partsList", iter_0, 2)); + } + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } - NextTest(); + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } } - CHIP_ERROR TestCreateYearDayScheduleForFirstUser_73() + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::SetYearDaySchedule::Type; - - RequestType request; - request.yearDayIndex = 4; - request.userIndex = 1U; - request.localStartTime = 9000UL; - request.localEndTime = 888888888UL; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_73(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_73(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "Read attribute Device list"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), Descriptor::Id, Descriptor::Attributes::DeviceList::Id); + } + case 2: { + LogStep(2, "Read attribute Server list"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), Descriptor::Id, Descriptor::Attributes::ServerList::Id); + } + case 3: { + LogStep(3, "Read attribute Client list"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), Descriptor::Id, Descriptor::Attributes::ClientList::Id); + } + case 4: { + LogStep(4, "Read attribute Parts list"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), Descriptor::Id, Descriptor::Attributes::PartsList::Id); + } + } return CHIP_NO_ERROR; } +}; - void OnFailureResponse_73(CHIP_ERROR error) +class TestBasicInformationSuite : public TestCommand +{ +public: + TestBasicInformationSuite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("TestBasicInformation", 6, credsIssuerConfig) { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - void OnSuccessResponse_73() { NextTest(); } - - CHIP_ERROR TestVerifyCreatedYearDayScheduleForFirst_74() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::GetYearDaySchedule::Type; - - RequestType request; - request.yearDayIndex = 4; - request.userIndex = 1U; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context)) - ->OnSuccessResponse_74(data.yearDayIndex, data.userIndex, data.status, data.localStartTime, data.localEndTime); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_74(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } + ~TestBasicInformationSuite() {} - void OnFailureResponse_74(CHIP_ERROR error) + chip::System::Clock::Timeout GetWaitDuration() const override { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } - void OnSuccessResponse_74(uint8_t yearDayIndex, uint16_t userIndex, chip::app::Clusters::DoorLock::DlStatus status, - const chip::Optional & localStartTime, const chip::Optional & localEndTime) - { - VerifyOrReturn(CheckValue("yearDayIndex", yearDayIndex, 4)); +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; - VerifyOrReturn(CheckValue("userIndex", userIndex, 1U)); + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } - VerifyOrReturn(CheckValue("status", status, 0)); + // + // Tests methods + // - VerifyOrReturn(CheckValuePresent("localStartTime", localStartTime)); - VerifyOrReturn(CheckValue("localStartTime.Value()", localStartTime.Value(), 9000UL)); + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override + { + bool shouldContinue = false; - VerifyOrReturn(CheckValuePresent("localEndTime", localEndTime)); - VerifyOrReturn(CheckValue("localEndTime.Value()", localEndTime.Value(), 888888888UL)); + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::CharSpan value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueAsString("location", value, chip::CharSpan("XX", 2))); + } + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::CharSpan value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueAsString("location", value, chip::CharSpan("US", 2))); + } + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + { + auto iter_0 = value.begin(); + VerifyOrReturn(CheckNextListItemDecodes("attributeList", iter_0, 0)); + VerifyOrReturn(CheckValue("attributeList[0]", iter_0.GetValue(), 0UL)); + VerifyOrReturn(CheckNextListItemDecodes("attributeList", iter_0, 1)); + VerifyOrReturn(CheckValue("attributeList[1]", iter_0.GetValue(), 1UL)); + VerifyOrReturn(CheckNextListItemDecodes("attributeList", iter_0, 2)); + VerifyOrReturn(CheckValue("attributeList[2]", iter_0.GetValue(), 2UL)); + VerifyOrReturn(CheckNextListItemDecodes("attributeList", iter_0, 3)); + VerifyOrReturn(CheckValue("attributeList[3]", iter_0.GetValue(), 3UL)); + VerifyOrReturn(CheckNextListItemDecodes("attributeList", iter_0, 4)); + VerifyOrReturn(CheckValue("attributeList[4]", iter_0.GetValue(), 4UL)); + VerifyOrReturn(CheckNextListItemDecodes("attributeList", iter_0, 5)); + VerifyOrReturn(CheckValue("attributeList[5]", iter_0.GetValue(), 5UL)); + VerifyOrReturn(CheckNextListItemDecodes("attributeList", iter_0, 6)); + VerifyOrReturn(CheckValue("attributeList[6]", iter_0.GetValue(), 6UL)); + VerifyOrReturn(CheckNextListItemDecodes("attributeList", iter_0, 7)); + VerifyOrReturn(CheckValue("attributeList[7]", iter_0.GetValue(), 7UL)); + VerifyOrReturn(CheckNextListItemDecodes("attributeList", iter_0, 8)); + VerifyOrReturn(CheckValue("attributeList[8]", iter_0.GetValue(), 8UL)); + VerifyOrReturn(CheckNextListItemDecodes("attributeList", iter_0, 9)); + VerifyOrReturn(CheckValue("attributeList[9]", iter_0.GetValue(), 9UL)); + VerifyOrReturn(CheckNextListItemDecodes("attributeList", iter_0, 10)); + VerifyOrReturn(CheckValue("attributeList[10]", iter_0.GetValue(), 10UL)); + VerifyOrReturn(CheckNextListItemDecodes("attributeList", iter_0, 11)); + VerifyOrReturn(CheckValue("attributeList[11]", iter_0.GetValue(), 11UL)); + VerifyOrReturn(CheckNextListItemDecodes("attributeList", iter_0, 12)); + VerifyOrReturn(CheckValue("attributeList[12]", iter_0.GetValue(), 12UL)); + VerifyOrReturn(CheckNextListItemDecodes("attributeList", iter_0, 13)); + VerifyOrReturn(CheckValue("attributeList[13]", iter_0.GetValue(), 13UL)); + VerifyOrReturn(CheckNextListItemDecodes("attributeList", iter_0, 14)); + VerifyOrReturn(CheckValue("attributeList[14]", iter_0.GetValue(), 14UL)); + VerifyOrReturn(CheckNextListItemDecodes("attributeList", iter_0, 15)); + VerifyOrReturn(CheckValue("attributeList[15]", iter_0.GetValue(), 15UL)); + VerifyOrReturn(CheckNextListItemDecodes("attributeList", iter_0, 16)); + VerifyOrReturn(CheckValue("attributeList[16]", iter_0.GetValue(), 16UL)); + VerifyOrReturn(CheckNextListItemDecodes("attributeList", iter_0, 17)); + VerifyOrReturn(CheckValue("attributeList[17]", iter_0.GetValue(), 17UL)); + VerifyOrReturn(CheckNextListItemDecodes("attributeList", iter_0, 18)); + VerifyOrReturn(CheckValue("attributeList[18]", iter_0.GetValue(), 18UL)); + VerifyOrReturn(CheckNextListItemDecodes("attributeList", iter_0, 19)); + VerifyOrReturn(CheckValue("attributeList[19]", iter_0.GetValue(), 19UL)); + VerifyOrReturn(CheckNextListItemDecodes("attributeList", iter_0, 20)); + VerifyOrReturn(CheckValue("attributeList[20]", iter_0.GetValue(), 65528UL)); + VerifyOrReturn(CheckNextListItemDecodes("attributeList", iter_0, 21)); + VerifyOrReturn(CheckValue("attributeList[21]", iter_0.GetValue(), 65529UL)); + VerifyOrReturn(CheckNextListItemDecodes("attributeList", iter_0, 22)); + VerifyOrReturn(CheckValue("attributeList[22]", iter_0.GetValue(), 65531UL)); + VerifyOrReturn(CheckNextListItemDecodes("attributeList", iter_0, 23)); + VerifyOrReturn(CheckValue("attributeList[23]", iter_0.GetValue(), 65533UL)); + VerifyOrReturn(CheckNoMoreListItems("attributeList", iter_0, 24)); + } + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } - NextTest(); + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } } - CHIP_ERROR TestCreateWeekDayScheduleWithValidParametersForSecondUser_75() + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::SetWeekDaySchedule::Type; - - RequestType request; - request.weekDayIndex = 4; - request.userIndex = 2U; - request.daysMask = static_cast>(64); - request.startHour = 23; - request.startMinute = 0; - request.endHour = 23; - request.endMinute = 59; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_75(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_75(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "Read location"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), Basic::Id, Basic::Attributes::Location::Id); + } + case 2: { + LogStep(2, "Write location"); + chip::CharSpan value; + value = chip::Span("USgarbage: not in length on purpose", 2); + return WriteAttribute(kIdentityAlpha, GetEndpoint(0), Basic::Id, Basic::Attributes::Location::Id, value); + } + case 3: { + LogStep(3, "Read back location"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), Basic::Id, Basic::Attributes::Location::Id); + } + case 4: { + LogStep(4, "Restore initial location value"); + chip::CharSpan value; + value = chip::Span("XXgarbage: not in length on purpose", 2); + return WriteAttribute(kIdentityAlpha, GetEndpoint(0), Basic::Id, Basic::Attributes::Location::Id, value); + } + case 5: { + LogStep(5, "Read AttributeList value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), Basic::Id, Basic::Attributes::AttributeList::Id); + } + } return CHIP_NO_ERROR; } +}; - void OnFailureResponse_75(CHIP_ERROR error) +class TestGeneralCommissioningSuite : public TestCommand +{ +public: + TestGeneralCommissioningSuite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("TestGeneralCommissioning", 6, credsIssuerConfig) { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - void OnSuccessResponse_75() { NextTest(); } - - CHIP_ERROR TestVerifyCreatedWeekDayScheduleForFirstUser_76() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::GetWeekDaySchedule::Type; - - RequestType request; - request.weekDayIndex = 4; - request.userIndex = 2U; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context)) - ->OnSuccessResponse_76(data.weekDayIndex, data.userIndex, data.status, data.daysMask, data.startHour, - data.startMinute, data.endHour, data.endMinute); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_76(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } + ~TestGeneralCommissioningSuite() {} - void OnFailureResponse_76(CHIP_ERROR error) + chip::System::Clock::Timeout GetWaitDuration() const override { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } - void OnSuccessResponse_76(uint8_t weekDayIndex, uint16_t userIndex, chip::app::Clusters::DoorLock::DlStatus status, - const chip::Optional> & daysMask, - const chip::Optional & startHour, const chip::Optional & startMinute, - const chip::Optional & endHour, const chip::Optional & endMinute) - { - VerifyOrReturn(CheckValue("weekDayIndex", weekDayIndex, 4)); - - VerifyOrReturn(CheckValue("userIndex", userIndex, 2U)); - - VerifyOrReturn(CheckValue("status", status, 0)); - - VerifyOrReturn(CheckValuePresent("daysMask", daysMask)); - VerifyOrReturn(CheckValue("daysMask.Value()", daysMask.Value(), 64)); +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; - VerifyOrReturn(CheckValuePresent("startHour", startHour)); - VerifyOrReturn(CheckValue("startHour.Value()", startHour.Value(), 23)); + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } - VerifyOrReturn(CheckValuePresent("startMinute", startMinute)); - VerifyOrReturn(CheckValue("startMinute.Value()", startMinute.Value(), 0)); + // + // Tests methods + // - VerifyOrReturn(CheckValuePresent("endHour", endHour)); - VerifyOrReturn(CheckValue("endHour.Value()", endHour.Value(), 23)); + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override + { + bool shouldContinue = false; - VerifyOrReturn(CheckValuePresent("endMinute", endMinute)); - VerifyOrReturn(CheckValue("endMinute.Value()", endMinute.Value(), 59)); + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint64_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("breadcrumb", value, 137438953472ULL)); + } + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint64_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("breadcrumb", value, 81ULL)); + } + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + bool value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "bool")); + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } - NextTest(); + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } } - CHIP_ERROR TestCreateYearDayScheduleForSecondUser_77() + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::SetYearDaySchedule::Type; - - RequestType request; - request.yearDayIndex = 1; - request.userIndex = 1U; - request.localStartTime = 55555UL; - request.localEndTime = 7777777UL; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_77(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_77(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "Write Breadcrumb (1/2)"); + uint64_t value; + value = 137438953472ULL; + return WriteAttribute(kIdentityAlpha, GetEndpoint(0), GeneralCommissioning::Id, + GeneralCommissioning::Attributes::Breadcrumb::Id, value); + } + case 2: { + LogStep(2, "Read back Breadcrumb (1/2)"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), GeneralCommissioning::Id, + GeneralCommissioning::Attributes::Breadcrumb::Id); + } + case 3: { + LogStep(3, "Write Breadcrumb (2/2)"); + uint64_t value; + value = 81ULL; + return WriteAttribute(kIdentityAlpha, GetEndpoint(0), GeneralCommissioning::Id, + GeneralCommissioning::Attributes::Breadcrumb::Id, value); + } + case 4: { + LogStep(4, "Read back Breadcrumb (2/2)"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), GeneralCommissioning::Id, + GeneralCommissioning::Attributes::Breadcrumb::Id); + } + case 5: { + LogStep(5, "Validate presence of SupportsConcurrentConnection"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), GeneralCommissioning::Id, + GeneralCommissioning::Attributes::SupportsConcurrentConnection::Id); + } + } return CHIP_NO_ERROR; } +}; - void OnFailureResponse_77(CHIP_ERROR error) +class TestIdentifyClusterSuite : public TestCommand +{ +public: + TestIdentifyClusterSuite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("TestIdentifyCluster", 2, credsIssuerConfig) { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - void OnSuccessResponse_77() { NextTest(); } - - CHIP_ERROR TestVerifyCreatedYearDayScheduleForFirst_78() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::GetYearDaySchedule::Type; - - RequestType request; - request.yearDayIndex = 1; - request.userIndex = 1U; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context)) - ->OnSuccessResponse_78(data.yearDayIndex, data.userIndex, data.status, data.localStartTime, data.localEndTime); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_78(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } + ~TestIdentifyClusterSuite() {} - void OnFailureResponse_78(CHIP_ERROR error) + chip::System::Clock::Timeout GetWaitDuration() const override { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } - void OnSuccessResponse_78(uint8_t yearDayIndex, uint16_t userIndex, chip::app::Clusters::DoorLock::DlStatus status, - const chip::Optional & localStartTime, const chip::Optional & localEndTime) - { - VerifyOrReturn(CheckValue("yearDayIndex", yearDayIndex, 1)); +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; - VerifyOrReturn(CheckValue("userIndex", userIndex, 1U)); + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } - VerifyOrReturn(CheckValue("status", status, 0)); + // + // Tests methods + // - VerifyOrReturn(CheckValuePresent("localStartTime", localStartTime)); - VerifyOrReturn(CheckValue("localStartTime.Value()", localStartTime.Value(), 55555UL)); + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override + { + bool shouldContinue = false; - VerifyOrReturn(CheckValuePresent("localEndTime", localEndTime)); - VerifyOrReturn(CheckValue("localEndTime.Value()", localEndTime.Value(), 7777777UL)); + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } - NextTest(); + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } } - CHIP_ERROR TestCleanup_79() + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::ClearUser::Type; - - RequestType request; - request.userIndex = 65534U; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_79(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_79(error); - }; - - ReturnErrorOnFailure( - chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request, 10000)); + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "Send Identify command and expect success response"); + chip::app::Clusters::Identify::Commands::Identify::Type value; + value.identifyTime = 0U; + return SendCommand(kIdentityAlpha, GetEndpoint(0), Identify::Id, Identify::Commands::Identify::Id, value); + } + } return CHIP_NO_ERROR; } +}; - void OnFailureResponse_79(CHIP_ERROR error) +class TestOperationalCredentialsClusterSuite : public TestCommand +{ +public: + TestOperationalCredentialsClusterSuite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("TestOperationalCredentialsCluster", 8, credsIssuerConfig) { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - void OnSuccessResponse_79() { NextTest(); } + ~TestOperationalCredentialsClusterSuite() {} - CHIP_ERROR TestMakeSureClearingFirstUserAlsoClearedWeekDaySchedules_80() + chip::System::Clock::Timeout GetWaitDuration() const override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::GetWeekDaySchedule::Type; - - RequestType request; - request.weekDayIndex = 1; - request.userIndex = 1U; + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context)) - ->OnSuccessResponse_80(data.weekDayIndex, data.userIndex, data.status, data.daysMask, data.startHour, - data.startMinute, data.endHour, data.endMinute); - }; +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_80(error); - }; + chip::FabricIndex ourFabricIndex; - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } - void OnFailureResponse_80(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } + // + // Tests methods + // - void OnSuccessResponse_80(uint8_t weekDayIndex, uint16_t userIndex, chip::app::Clusters::DoorLock::DlStatus status, - const chip::Optional> & daysMask, - const chip::Optional & startHour, const chip::Optional & startMinute, - const chip::Optional & endHour, const chip::Optional & endMinute) + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { - VerifyOrReturn(CheckValue("weekDayIndex", weekDayIndex, 1)); + bool shouldContinue = false; - VerifyOrReturn(CheckValue("userIndex", userIndex, 1U)); + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint8")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 4)); + } + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint8")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 1)); + } + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::FabricIndex value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint8")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 1)); + ourFabricIndex = value; + } + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::OperationalCredentials::Commands::NOCResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("statusCode", value.statusCode, 11)); + } + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList< + chip::app::Clusters::OperationalCredentials::Structs::FabricDescriptor::DecodableType> + value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + { + auto iter_0 = value.begin(); + VerifyOrReturn(CheckNextListItemDecodes("fabrics", iter_0, 0)); + VerifyOrReturn(CheckValueAsString("fabrics[0].label", iter_0.GetValue().label, chip::CharSpan("", 0))); + VerifyOrReturn(CheckValue("fabrics[0].fabricIndex", iter_0.GetValue().fabricIndex, ourFabricIndex)); + VerifyOrReturn(CheckNoMoreListItems("fabrics", iter_0, 1)); + } + } + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::OperationalCredentials::Commands::NOCResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("statusCode", value.statusCode, 0)); - VerifyOrReturn(CheckValue("status", status, 139)); + VerifyOrReturn(CheckValuePresent("fabricIndex", value.fabricIndex)); + VerifyOrReturn(CheckValue("fabricIndex.Value()", value.fabricIndex.Value(), ourFabricIndex)); + } + break; + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList< + chip::app::Clusters::OperationalCredentials::Structs::FabricDescriptor::DecodableType> + value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + { + auto iter_0 = value.begin(); + VerifyOrReturn(CheckNextListItemDecodes("fabrics", iter_0, 0)); + VerifyOrReturn(CheckValueAsString("fabrics[0].label", iter_0.GetValue().label, chip::CharSpan("Batcave", 7))); + VerifyOrReturn(CheckValue("fabrics[0].fabricIndex", iter_0.GetValue().fabricIndex, ourFabricIndex)); + VerifyOrReturn(CheckNoMoreListItems("fabrics", iter_0, 1)); + } + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } - NextTest(); + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } } - CHIP_ERROR TestMakeSureClearingFirstUserAlsoClearedYearDaySchedules_81() + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::GetYearDaySchedule::Type; - - RequestType request; - request.yearDayIndex = 4; - request.userIndex = 1U; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context)) - ->OnSuccessResponse_81(data.yearDayIndex, data.userIndex, data.status, data.localStartTime, data.localEndTime); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_81(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "Read number of supported fabrics"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), OperationalCredentials::Id, + OperationalCredentials::Attributes::SupportedFabrics::Id); + } + case 2: { + LogStep(2, "Read number of commissioned fabrics"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), OperationalCredentials::Id, + OperationalCredentials::Attributes::CommissionedFabrics::Id); + } + case 3: { + LogStep(3, "Read current fabric index"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), OperationalCredentials::Id, + OperationalCredentials::Attributes::CurrentFabricIndex::Id); + } + case 4: { + LogStep(4, "Remove nonexistent fabric"); + chip::app::Clusters::OperationalCredentials::Commands::RemoveFabric::Type value; + value.fabricIndex = 243; + return SendCommand(kIdentityAlpha, GetEndpoint(0), OperationalCredentials::Id, + OperationalCredentials::Commands::RemoveFabric::Id, value); + } + case 5: { + LogStep(5, "Read fabric list before setting label"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), OperationalCredentials::Id, + OperationalCredentials::Attributes::Fabrics::Id); + } + case 6: { + LogStep(6, "Set the fabric label"); + chip::app::Clusters::OperationalCredentials::Commands::UpdateFabricLabel::Type value; + value.label = chip::Span("Batcavegarbage: not in length on purpose", 7); + return SendCommand(kIdentityAlpha, GetEndpoint(0), OperationalCredentials::Id, + OperationalCredentials::Commands::UpdateFabricLabel::Id, value); + } + case 7: { + LogStep(7, "Read fabric list after setting label"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), OperationalCredentials::Id, + OperationalCredentials::Attributes::Fabrics::Id); + } + } return CHIP_NO_ERROR; } +}; - void OnFailureResponse_81(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_81(uint8_t yearDayIndex, uint16_t userIndex, chip::app::Clusters::DoorLock::DlStatus status, - const chip::Optional & localStartTime, const chip::Optional & localEndTime) +class TestModeSelectClusterSuite : public TestCommand +{ +public: + TestModeSelectClusterSuite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("TestModeSelectCluster", 32, credsIssuerConfig) { - VerifyOrReturn(CheckValue("yearDayIndex", yearDayIndex, 4)); - - VerifyOrReturn(CheckValue("userIndex", userIndex, 1U)); - - VerifyOrReturn(CheckValue("status", status, 139)); - - NextTest(); + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("discriminator", 0, UINT16_MAX, &mDiscriminator); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - CHIP_ERROR TestMakeSureClearingSecondUserAlsoClearedWeekDaySchedules_82() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::GetWeekDaySchedule::Type; - - RequestType request; - request.weekDayIndex = 4; - request.userIndex = 2U; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context)) - ->OnSuccessResponse_82(data.weekDayIndex, data.userIndex, data.status, data.daysMask, data.startHour, - data.startMinute, data.endHour, data.endMinute); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_82(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } + ~TestModeSelectClusterSuite() {} - void OnFailureResponse_82(CHIP_ERROR error) + chip::System::Clock::Timeout GetWaitDuration() const override { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } - void OnSuccessResponse_82(uint8_t weekDayIndex, uint16_t userIndex, chip::app::Clusters::DoorLock::DlStatus status, - const chip::Optional> & daysMask, - const chip::Optional & startHour, const chip::Optional & startMinute, - const chip::Optional & endHour, const chip::Optional & endMinute) - { - VerifyOrReturn(CheckValue("weekDayIndex", weekDayIndex, 4)); +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mDiscriminator; + chip::Optional mTimeout; - VerifyOrReturn(CheckValue("userIndex", userIndex, 2U)); + uint8_t currentModeBeforeToggle; + chip::app::DataModel::Nullable OnModeValue; - VerifyOrReturn(CheckValue("status", status, 139)); + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } - NextTest(); - } + // + // Tests methods + // - CHIP_ERROR TestMakeSureClearingSecondUserAlsoClearedYearDaySchedules_83() + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::GetYearDaySchedule::Type; - - RequestType request; - request.yearDayIndex = 1; - request.userIndex = 2U; + bool shouldContinue = false; - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context)) - ->OnSuccessResponse_83(data.yearDayIndex, data.userIndex, data.status, data.localStartTime, data.localEndTime); - }; + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::CharSpan value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueAsString("description", value, chip::CharSpan("Coffee", 6))); + } + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNonNull("standardNamespace", value)); + VerifyOrReturn(CheckValue("standardNamespace.Value()", value.Value(), 0U)); + } + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList + value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + { + auto iter_0 = value.begin(); + VerifyOrReturn(CheckNextListItemDecodes("supportedModes", iter_0, 0)); + VerifyOrReturn( + CheckValueAsString("supportedModes[0].label", iter_0.GetValue().label, chip::CharSpan("Black", 5))); + VerifyOrReturn(CheckValue("supportedModes[0].mode", iter_0.GetValue().mode, 0)); + VerifyOrReturn(CheckValue("supportedModes[0].semanticTag", iter_0.GetValue().semanticTag, 0UL)); + VerifyOrReturn(CheckNextListItemDecodes("supportedModes", iter_0, 1)); + VerifyOrReturn( + CheckValueAsString("supportedModes[1].label", iter_0.GetValue().label, chip::CharSpan("Cappuccino", 10))); + VerifyOrReturn(CheckValue("supportedModes[1].mode", iter_0.GetValue().mode, 4)); + VerifyOrReturn(CheckValue("supportedModes[1].semanticTag", iter_0.GetValue().semanticTag, 0UL)); + VerifyOrReturn(CheckNextListItemDecodes("supportedModes", iter_0, 2)); + VerifyOrReturn( + CheckValueAsString("supportedModes[2].label", iter_0.GetValue().label, chip::CharSpan("Espresso", 8))); + VerifyOrReturn(CheckValue("supportedModes[2].mode", iter_0.GetValue().mode, 7)); + VerifyOrReturn(CheckValue("supportedModes[2].semanticTag", iter_0.GetValue().semanticTag, 0UL)); + VerifyOrReturn(CheckNoMoreListItems("supportedModes", iter_0, 3)); + } + } + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("currentMode", value, 0)); + } + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNonNull("startUpMode", value)); + VerifyOrReturn(CheckValue("startUpMode.Value()", value.Value(), 0)); + } + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNull("onMode", value)); + } + break; + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 8: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("currentMode", value, 4)); - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_83(error); - }; + currentModeBeforeToggle = value; + } + break; + case 9: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_COMMAND)); + break; + case 10: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 11: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 12: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("currentMode", value, currentModeBeforeToggle)); + } + break; + case 13: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_COMMAND)); + break; + case 14: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 15: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNonNull("onMode", value)); + VerifyOrReturn(CheckValue("onMode.Value()", value.Value(), 7)); - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } + OnModeValue = value; + } + break; + case 16: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 17: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 18: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("currentMode", value, OnModeValue)); + } + break; + case 19: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_COMMAND)); + break; + case 20: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 21: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNonNull("startUpMode", value)); + VerifyOrReturn(CheckValue("startUpMode.Value()", value.Value(), 7)); + } + break; + case 22: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 23: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 24: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 25: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 26: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 27: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("currentMode", value, 4)); + } + break; + case 28: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 29: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 30: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 31: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("currentMode", value, 7)); + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } - void OnFailureResponse_83(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } } - void OnSuccessResponse_83(uint8_t yearDayIndex, uint16_t userIndex, chip::app::Clusters::DoorLock::DlStatus status, - const chip::Optional & localStartTime, const chip::Optional & localEndTime) + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - VerifyOrReturn(CheckValue("yearDayIndex", yearDayIndex, 1)); - - VerifyOrReturn(CheckValue("userIndex", userIndex, 2U)); - - VerifyOrReturn(CheckValue("status", status, 139)); - - NextTest(); + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "Read Description"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ModeSelect::Id, ModeSelect::Attributes::Description::Id); + } + case 2: { + LogStep(2, "Read StandardNamespace"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ModeSelect::Id, ModeSelect::Attributes::StandardNamespace::Id); + } + case 3: { + LogStep(3, "Read SupportedModes"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ModeSelect::Id, ModeSelect::Attributes::SupportedModes::Id); + } + case 4: { + LogStep(4, "Read CurrentMode"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ModeSelect::Id, ModeSelect::Attributes::CurrentMode::Id); + } + case 5: { + LogStep(5, "Read StartUpMode"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ModeSelect::Id, ModeSelect::Attributes::StartUpMode::Id); + } + case 6: { + LogStep(6, "Read OnMode"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ModeSelect::Id, ModeSelect::Attributes::OnMode::Id); + } + case 7: { + LogStep(7, "Change to Supported Mode"); + chip::app::Clusters::ModeSelect::Commands::ChangeToMode::Type value; + value.newMode = 4; + return SendCommand(kIdentityAlpha, GetEndpoint(1), ModeSelect::Id, ModeSelect::Commands::ChangeToMode::Id, value); + } + case 8: { + LogStep(8, "Verify Current Mode Change"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ModeSelect::Id, ModeSelect::Attributes::CurrentMode::Id); + } + case 9: { + LogStep(9, "Change to Unsupported Mode"); + chip::app::Clusters::ModeSelect::Commands::ChangeToMode::Type value; + value.newMode = 2; + return SendCommand(kIdentityAlpha, GetEndpoint(1), ModeSelect::Id, ModeSelect::Commands::ChangeToMode::Id, value); + } + case 10: { + LogStep(10, "Toggle OnOff"); + chip::app::Clusters::OnOff::Commands::Off::Type value; + return SendCommand(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Commands::Off::Id, value); + } + case 11: { + LogStep(11, "Toggle OnOff"); + chip::app::Clusters::OnOff::Commands::On::Type value; + return SendCommand(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Commands::On::Id, value); + } + case 12: { + LogStep(12, "Verify Current Mode does not change when OnMode is null"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ModeSelect::Id, ModeSelect::Attributes::CurrentMode::Id); + } + case 13: { + LogStep(13, "Change to Unsupported OnMode"); + chip::app::DataModel::Nullable value; + value.SetNonNull(); + value.Value() = 2; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), ModeSelect::Id, ModeSelect::Attributes::OnMode::Id, value); + } + case 14: { + LogStep(14, "Change OnMode"); + chip::app::DataModel::Nullable value; + value.SetNonNull(); + value.Value() = 7; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), ModeSelect::Id, ModeSelect::Attributes::OnMode::Id, value); + } + case 15: { + LogStep(15, "Verify OnMode"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ModeSelect::Id, ModeSelect::Attributes::OnMode::Id); + } + case 16: { + LogStep(16, "Toggle OnOff"); + chip::app::Clusters::OnOff::Commands::Off::Type value; + return SendCommand(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Commands::Off::Id, value); + } + case 17: { + LogStep(17, "Toggle OnOff"); + chip::app::Clusters::OnOff::Commands::On::Type value; + return SendCommand(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Commands::On::Id, value); + } + case 18: { + LogStep(18, "Verify Current Mode Changes if OnMode is not null"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ModeSelect::Id, ModeSelect::Attributes::CurrentMode::Id); + } + case 19: { + LogStep(19, "Change to Unsupported StartUp Mode"); + chip::app::DataModel::Nullable value; + value.SetNonNull(); + value.Value() = 2; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), ModeSelect::Id, ModeSelect::Attributes::StartUpMode::Id, value); + } + case 20: { + LogStep(20, "Change to Supported StartUp Mode"); + chip::app::DataModel::Nullable value; + value.SetNonNull(); + value.Value() = 7; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), ModeSelect::Id, ModeSelect::Attributes::StartUpMode::Id, value); + } + case 21: { + LogStep(21, "Verify StartUp Mode Change"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ModeSelect::Id, ModeSelect::Attributes::StartUpMode::Id); + } + case 22: { + LogStep(22, "Change CurrentMode to another value"); + chip::app::Clusters::ModeSelect::Commands::ChangeToMode::Type value; + value.newMode = 0; + return SendCommand(kIdentityAlpha, GetEndpoint(1), ModeSelect::Id, ModeSelect::Commands::ChangeToMode::Id, value); + } + case 23: { + LogStep(23, "Change On Mode"); + chip::app::DataModel::Nullable value; + value.SetNonNull(); + value.Value() = 4; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), ModeSelect::Id, ModeSelect::Attributes::OnMode::Id, value); + } + case 24: { + LogStep(24, "Set StartUpOnOff"); + chip::app::DataModel::Nullable value; + value.SetNonNull(); + value.Value() = static_cast(1); + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::StartUpOnOff::Id, value); + } + case 25: { + LogStep(25, "Reboot target device"); + SetIdentity(kIdentityAlpha); + return Reboot(mDiscriminator.HasValue() ? mDiscriminator.Value() : 3840U); + } + case 26: { + LogStep(26, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 27: { + LogStep(27, "Verify Current Mode Change based on OnMode, as it overwrites StartUpMode"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ModeSelect::Id, ModeSelect::Attributes::CurrentMode::Id); + } + case 28: { + LogStep(28, "Change On Mode to Null"); + chip::app::DataModel::Nullable value; + value.SetNull(); + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), ModeSelect::Id, ModeSelect::Attributes::OnMode::Id, value); + } + case 29: { + LogStep(29, "Reboot target device"); + SetIdentity(kIdentityAlpha); + return Reboot(mDiscriminator.HasValue() ? mDiscriminator.Value() : 3840U); + } + case 30: { + LogStep(30, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 31: { + LogStep(31, "Verify Current Mode Change based on new StartUp Mode"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ModeSelect::Id, ModeSelect::Attributes::CurrentMode::Id); + } + } + return CHIP_NO_ERROR; } }; -class Test_TC_DL_1_3Suite : public TestCommand +class TestSystemCommandsSuite : public TestCommand { public: - Test_TC_DL_1_3Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_DL_1_3", credsIssuerConfig), mTestIndex(0) + TestSystemCommandsSuite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("TestSystemCommands", 14, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -111900,92 +41198,207 @@ class Test_TC_DL_1_3Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_DL_1_3Suite() {} + ~TestSystemCommandsSuite() {} - /////////// TestCommand Interface ///////// - void NextTest() override + chip::System::Clock::Timeout GetWaitDuration() const override { - CHIP_ERROR err = CHIP_NO_ERROR; + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_DL_1_3\n"); - } +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_DL_1_3\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // - Wait(); + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override + { + bool shouldContinue = false; - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) + switch (mTestIndex - 1) { case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; break; case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Create new PIN credential and lock/unlock user\n"); - err = TestCreateNewPinCredentialAndLockUnlockUser_1(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; break; case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Precondition: Door is in locked state\n"); - err = TestPreconditionDoorIsInLockedState_2(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; break; case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : TH writes AutoRelockTime attribute value as 10 seconds on the DUT\n"); - err = TestThWritesAutoRelockTimeAttributeValueAs10SecondsOnTheDut_3(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; break; case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : TH sends the unlock Door command to the DUT with valid PINCode\n"); - err = TestThSendsTheUnlockDoorCommandToTheDutWithValidPINCode_4(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; break; case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : TH reads AutoRelockTime attribute from DUT\n"); - err = TestThReadsAutoRelockTimeAttributeFromDut_5(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; break; case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : Wait 10000ms\n"); - err = TestWait10000ms_6(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; break; case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : TH reads LockState attriute\n"); - err = TestThReadsLockStateAttriute_7(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; break; case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : Clean the created credential\n"); - err = TestCleanTheCreatedCredential_8(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 9: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 10: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; break; + case 11: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 12: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 13: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } + + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); } + } - if (CHIP_NO_ERROR != err) + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "Stop the accessory"); + SetIdentity(kIdentityAlpha); + return Stop(); + } + case 2: { + LogStep(2, "Start the accessory with no command line options"); + SetIdentity(kIdentityAlpha); + return Start(); + } + case 3: { + LogStep(3, "Stop the accessory"); + SetIdentity(kIdentityAlpha); + return Stop(); + } + case 4: { + LogStep(4, "Start the accessory with only discriminator command line option"); + SetIdentity(kIdentityAlpha); + return Start(1111); + } + case 5: { + LogStep(5, "Stop the accessory"); + SetIdentity(kIdentityAlpha); + return Stop(); + } + case 6: { + LogStep(6, "Start the accessory with discriminator and port command line option"); + SetIdentity(kIdentityAlpha); + return Start(1111, 5560); + } + case 7: { + LogStep(7, "Stop the accessory"); + SetIdentity(kIdentityAlpha); + return Stop(); + } + case 8: { + LogStep(8, "Start the accessory with all command line options"); + SetIdentity(kIdentityAlpha); + return Start(1111, 5560, "/tmp/chip_kvs_test"); + } + case 9: { + LogStep(9, "Reboot the accessory with no command line options"); + SetIdentity(kIdentityAlpha); + return Reboot(); + } + case 10: { + LogStep(10, "Reboot the accessory with only discriminator command line option"); + SetIdentity(kIdentityAlpha); + return Reboot(2222); + } + case 11: { + LogStep(11, "Reboot the accessory with discriminator and port command line option"); + SetIdentity(kIdentityAlpha); + return Reboot(2222, 5565); } + case 12: { + LogStep(12, "Reboot the accessory with all command line options"); + SetIdentity(kIdentityAlpha); + return Reboot(2222, 5565, "/tmp/chip_kvs_test"); + } + case 13: { + LogStep(13, "Factory Reset the accessory"); + SetIdentity(kIdentityAlpha); + return FactoryReset(); + } + } + return CHIP_NO_ERROR; + } +}; + +class TestBindingSuite : public TestCommand +{ +public: + TestBindingSuite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("TestBinding", 9, credsIssuerConfig) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } + ~TestBindingSuite() {} + chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 9; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -111996,9 +41409,103 @@ class Test_TC_DL_1_3Suite : public TestCommand VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); shouldContinue = true; break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + { + auto iter_0 = value.begin(); + VerifyOrReturn(CheckNoMoreListItems("binding", iter_0, 0)); + } + } + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + { + auto iter_0 = value.begin(); + VerifyOrReturn(CheckNextListItemDecodes("binding", iter_0, 0)); + VerifyOrReturn(CheckValuePresent("binding[0].group", iter_0.GetValue().group)); + VerifyOrReturn(CheckValue("binding[0].group.Value()", iter_0.GetValue().group.Value(), 1U)); + VerifyOrReturn(CheckValue("binding[0].fabricIndex", iter_0.GetValue().fabricIndex, 1)); + VerifyOrReturn(CheckNextListItemDecodes("binding", iter_0, 1)); + VerifyOrReturn(CheckValuePresent("binding[1].node", iter_0.GetValue().node)); + VerifyOrReturn(CheckValue("binding[1].node.Value()", iter_0.GetValue().node.Value(), 1ULL)); + VerifyOrReturn(CheckValuePresent("binding[1].endpoint", iter_0.GetValue().endpoint)); + VerifyOrReturn(CheckValue("binding[1].endpoint.Value()", iter_0.GetValue().endpoint.Value(), 1U)); + VerifyOrReturn(CheckValuePresent("binding[1].cluster", iter_0.GetValue().cluster)); + VerifyOrReturn(CheckValue("binding[1].cluster.Value()", iter_0.GetValue().cluster.Value(), 6UL)); + VerifyOrReturn(CheckValue("binding[1].fabricIndex", iter_0.GetValue().fabricIndex, 1)); + VerifyOrReturn(CheckNextListItemDecodes("binding", iter_0, 2)); + VerifyOrReturn(CheckValuePresent("binding[2].node", iter_0.GetValue().node)); + VerifyOrReturn(CheckValue("binding[2].node.Value()", iter_0.GetValue().node.Value(), 2ULL)); + VerifyOrReturn(CheckValuePresent("binding[2].endpoint", iter_0.GetValue().endpoint)); + VerifyOrReturn(CheckValue("binding[2].endpoint.Value()", iter_0.GetValue().endpoint.Value(), 1U)); + VerifyOrReturn(CheckValue("binding[2].fabricIndex", iter_0.GetValue().fabricIndex, 1)); + VerifyOrReturn(CheckNoMoreListItems("binding", iter_0, 3)); + } + } + break; case 6: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; + break; + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + { + auto iter_0 = value.begin(); + VerifyOrReturn(CheckNextListItemDecodes("binding", iter_0, 0)); + VerifyOrReturn(CheckValuePresent("binding[0].node", iter_0.GetValue().node)); + VerifyOrReturn(CheckValue("binding[0].node.Value()", iter_0.GetValue().node.Value(), 3ULL)); + VerifyOrReturn(CheckValuePresent("binding[0].endpoint", iter_0.GetValue().endpoint)); + VerifyOrReturn(CheckValue("binding[0].endpoint.Value()", iter_0.GetValue().endpoint.Value(), 1U)); + VerifyOrReturn(CheckValue("binding[0].fabricIndex", iter_0.GetValue().fabricIndex, 1)); + VerifyOrReturn(CheckNoMoreListItems("binding", iter_0, 1)); + } + } + break; + case 8: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + { + auto iter_0 = value.begin(); + VerifyOrReturn(CheckNextListItemDecodes("binding", iter_0, 0)); + VerifyOrReturn(CheckValuePresent("binding[0].group", iter_0.GetValue().group)); + VerifyOrReturn(CheckValue("binding[0].group.Value()", iter_0.GetValue().group.Value(), 1U)); + VerifyOrReturn(CheckValue("binding[0].fabricIndex", iter_0.GetValue().fabricIndex, 1)); + VerifyOrReturn(CheckNextListItemDecodes("binding", iter_0, 1)); + VerifyOrReturn(CheckValuePresent("binding[1].node", iter_0.GetValue().node)); + VerifyOrReturn(CheckValue("binding[1].node.Value()", iter_0.GetValue().node.Value(), 1ULL)); + VerifyOrReturn(CheckValuePresent("binding[1].endpoint", iter_0.GetValue().endpoint)); + VerifyOrReturn(CheckValue("binding[1].endpoint.Value()", iter_0.GetValue().endpoint.Value(), 1U)); + VerifyOrReturn(CheckValuePresent("binding[1].cluster", iter_0.GetValue().cluster)); + VerifyOrReturn(CheckValue("binding[1].cluster.Value()", iter_0.GetValue().cluster.Value(), 6UL)); + VerifyOrReturn(CheckValue("binding[1].fabricIndex", iter_0.GetValue().fabricIndex, 1)); + VerifyOrReturn(CheckNextListItemDecodes("binding", iter_0, 2)); + VerifyOrReturn(CheckValuePresent("binding[2].node", iter_0.GetValue().node)); + VerifyOrReturn(CheckValue("binding[2].node.Value()", iter_0.GetValue().node.Value(), 2ULL)); + VerifyOrReturn(CheckValuePresent("binding[2].endpoint", iter_0.GetValue().endpoint)); + VerifyOrReturn(CheckValue("binding[2].endpoint.Value()", iter_0.GetValue().endpoint.Value(), 1U)); + VerifyOrReturn(CheckValue("binding[2].fabricIndex", iter_0.GetValue().fabricIndex, 1)); + VerifyOrReturn(CheckNoMoreListItems("binding", iter_0, 3)); + } + } break; default: LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); @@ -112010,388 +41517,717 @@ class Test_TC_DL_1_3Suite : public TestCommand } } - static void OnFailureCallback_3(void * context, CHIP_ERROR error) + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - (static_cast(context))->OnFailureResponse_3(error); - } - - static void OnSuccessCallback_3(void * context) { (static_cast(context))->OnSuccessResponse_3(); } + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "Write empty binding table"); + ListFreer listFreer; + chip::app::DataModel::List value; - static void OnFailureCallback_5(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_5(error); - } + value = chip::app::DataModel::List(); + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), Binding::Id, Binding::Attributes::Binding::Id, value); + } + case 2: { + LogStep(2, "Read empty binding table"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Binding::Id, Binding::Attributes::Binding::Id); + } + case 3: { + LogStep(3, "Write invalid binding table"); + ListFreer listFreer; + chip::app::DataModel::List value; - static void OnSuccessCallback_5(void * context, uint32_t autoRelockTime) - { - (static_cast(context))->OnSuccessResponse_5(autoRelockTime); - } + { + auto * listHolder_0 = new ListHolder(2); + listFreer.add(listHolder_0); - static void OnFailureCallback_7(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_7(error); - } + listHolder_0->mList[0].fabricIndex = 0; - static void OnSuccessCallback_7(void * context, - const chip::app::DataModel::Nullable & lockState) - { - (static_cast(context))->OnSuccessResponse_7(lockState); - } + listHolder_0->mList[1].node.Emplace(); + listHolder_0->mList[1].node.Value() = 1ULL; + listHolder_0->mList[1].group.Emplace(); + listHolder_0->mList[1].group.Value() = 1U; + listHolder_0->mList[1].endpoint.Emplace(); + listHolder_0->mList[1].endpoint.Value() = 1U; + listHolder_0->mList[1].cluster.Emplace(); + listHolder_0->mList[1].cluster.Value() = 6UL; + listHolder_0->mList[1].fabricIndex = 0; - // - // Tests methods - // + value = + chip::app::DataModel::List(listHolder_0->mList, 2); + } + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), Binding::Id, Binding::Attributes::Binding::Id, value); + } + case 4: { + LogStep(4, "Write binding table (endpoint 1)"); + ListFreer listFreer; + chip::app::DataModel::List value; - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } + { + auto * listHolder_0 = new ListHolder(3); + listFreer.add(listHolder_0); - CHIP_ERROR TestCreateNewPinCredentialAndLockUnlockUser_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::SetCredential::Type; + listHolder_0->mList[0].group.Emplace(); + listHolder_0->mList[0].group.Value() = 1U; + listHolder_0->mList[0].fabricIndex = 0; - RequestType request; - request.operationType = static_cast(0); + listHolder_0->mList[1].node.Emplace(); + listHolder_0->mList[1].node.Value() = 1ULL; + listHolder_0->mList[1].endpoint.Emplace(); + listHolder_0->mList[1].endpoint.Value() = 1U; + listHolder_0->mList[1].cluster.Emplace(); + listHolder_0->mList[1].cluster.Value() = 6UL; + listHolder_0->mList[1].fabricIndex = 0; - request.credential.credentialType = static_cast(1); - request.credential.credentialIndex = 1U; + listHolder_0->mList[2].node.Emplace(); + listHolder_0->mList[2].node.Value() = 2ULL; + listHolder_0->mList[2].endpoint.Emplace(); + listHolder_0->mList[2].endpoint.Value() = 1U; + listHolder_0->mList[2].fabricIndex = 0; - request.credentialData = chip::ByteSpan(chip::Uint8::from_const_char("123456garbage: not in length on purpose"), 6); - request.userIndex.SetNull(); - request.userStatus.SetNull(); - request.userType.SetNull(); + value = + chip::app::DataModel::List(listHolder_0->mList, 3); + } + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), Binding::Id, Binding::Attributes::Binding::Id, value); + } + case 5: { + LogStep(5, "Read binding table (endpoint 1)"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Binding::Id, Binding::Attributes::Binding::Id); + } + case 6: { + LogStep(6, "Write binding table (endpoint 0)"); + ListFreer listFreer; + chip::app::DataModel::List value; - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context)) - ->OnSuccessResponse_1(data.status, data.userIndex, data.nextCredentialIndex); - }; + { + auto * listHolder_0 = new ListHolder(1); + listFreer.add(listHolder_0); - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_1(error); - }; + listHolder_0->mList[0].node.Emplace(); + listHolder_0->mList[0].node.Value() = 3ULL; + listHolder_0->mList[0].endpoint.Emplace(); + listHolder_0->mList[0].endpoint.Value() = 1U; + listHolder_0->mList[0].fabricIndex = 0; - ReturnErrorOnFailure( - chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request, 10000)); + value = + chip::app::DataModel::List(listHolder_0->mList, 1); + } + return WriteAttribute(kIdentityAlpha, GetEndpoint(0), Binding::Id, Binding::Attributes::Binding::Id, value); + } + case 7: { + LogStep(7, "Read binding table (endpoint 0)"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), Binding::Id, Binding::Attributes::Binding::Id); + } + case 8: { + LogStep(8, "Verify endpoint 1 not changed"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Binding::Id, Binding::Attributes::Binding::Id); + } + } return CHIP_NO_ERROR; } +}; - void OnFailureResponse_1(CHIP_ERROR error) +class TestUserLabelClusterSuite : public TestCommand +{ +public: + TestUserLabelClusterSuite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("TestUserLabelCluster", 7, credsIssuerConfig) { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("discriminator", 0, UINT16_MAX, &mDiscriminator); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - void OnSuccessResponse_1(chip::app::Clusters::DoorLock::DlStatus status, - const chip::app::DataModel::Nullable & userIndex, - const chip::app::DataModel::Nullable & nextCredentialIndex) - { - VerifyOrReturn(CheckValue("status", status, 0)); - - VerifyOrReturn(CheckValueNonNull("userIndex", userIndex)); - VerifyOrReturn(CheckValue("userIndex.Value()", userIndex.Value(), 1U)); - - VerifyOrReturn(CheckValueNonNull("nextCredentialIndex", nextCredentialIndex)); - VerifyOrReturn(CheckValue("nextCredentialIndex.Value()", nextCredentialIndex.Value(), 2U)); - - NextTest(); - } + ~TestUserLabelClusterSuite() {} - CHIP_ERROR TestPreconditionDoorIsInLockedState_2() + chip::System::Clock::Timeout GetWaitDuration() const override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::LockDoor::Type; - - RequestType request; - request.pinCode.Emplace(); - request.pinCode.Value() = chip::ByteSpan(chip::Uint8::from_const_char("123456garbage: not in length on purpose"), 6); - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_2(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_2(error); - }; - - ReturnErrorOnFailure( - chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request, 10000)); - return CHIP_NO_ERROR; + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } - void OnFailureResponse_2(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mDiscriminator; + chip::Optional mTimeout; - void OnSuccessResponse_2() { NextTest(); } + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } - CHIP_ERROR TestThWritesAutoRelockTimeAttributeValueAs10SecondsOnTheDut_3() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::DoorLockClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); + // + // Tests methods + // - uint32_t autoRelockTimeArgument; - autoRelockTimeArgument = 10UL; + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override + { + bool shouldContinue = false; - ReturnErrorOnFailure(cluster.WriteAttribute( - autoRelockTimeArgument, this, OnSuccessCallback_3, OnFailureCallback_3)); - return CHIP_NO_ERROR; - } + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + { + auto iter_0 = value.begin(); + VerifyOrReturn(CheckNoMoreListItems("labelList", iter_0, 0)); + } + } + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + { + auto iter_0 = value.begin(); + VerifyOrReturn(CheckNextListItemDecodes("labelList", iter_0, 0)); + VerifyOrReturn(CheckValueAsString("labelList[0].label", iter_0.GetValue().label, chip::CharSpan("room", 4))); + VerifyOrReturn( + CheckValueAsString("labelList[0].value", iter_0.GetValue().value, chip::CharSpan("bedroom 2", 9))); + VerifyOrReturn(CheckNextListItemDecodes("labelList", iter_0, 1)); + VerifyOrReturn( + CheckValueAsString("labelList[1].label", iter_0.GetValue().label, chip::CharSpan("orientation", 11))); + VerifyOrReturn(CheckValueAsString("labelList[1].value", iter_0.GetValue().value, chip::CharSpan("North", 5))); + VerifyOrReturn(CheckNextListItemDecodes("labelList", iter_0, 2)); + VerifyOrReturn(CheckValueAsString("labelList[2].label", iter_0.GetValue().label, chip::CharSpan("floor", 5))); + VerifyOrReturn(CheckValueAsString("labelList[2].value", iter_0.GetValue().value, chip::CharSpan("5", 1))); + VerifyOrReturn(CheckNextListItemDecodes("labelList", iter_0, 3)); + VerifyOrReturn( + CheckValueAsString("labelList[3].label", iter_0.GetValue().label, chip::CharSpan("direction", 9))); + VerifyOrReturn(CheckValueAsString("labelList[3].value", iter_0.GetValue().value, chip::CharSpan("up", 2))); + VerifyOrReturn(CheckNoMoreListItems("labelList", iter_0, 4)); + } + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } - void OnFailureResponse_3(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } } - void OnSuccessResponse_3() { NextTest(); } - - CHIP_ERROR TestThSendsTheUnlockDoorCommandToTheDutWithValidPINCode_4() + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::UnlockDoor::Type; - - RequestType request; - request.pinCode.Emplace(); - request.pinCode.Value() = chip::ByteSpan(chip::Uint8::from_const_char("123456garbage: not in length on purpose"), 6); + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "Clear User Label List"); + ListFreer listFreer; + chip::app::DataModel::List value; - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_4(); - }; + value = chip::app::DataModel::List(); + return WriteAttribute(kIdentityAlpha, GetEndpoint(0), UserLabel::Id, UserLabel::Attributes::LabelList::Id, value); + } + case 2: { + LogStep(2, "Read User Label List"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), UserLabel::Id, UserLabel::Attributes::LabelList::Id); + } + case 3: { + LogStep(3, "Write User Label List"); + ListFreer listFreer; + chip::app::DataModel::List value; - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_4(error); - }; + { + auto * listHolder_0 = new ListHolder(4); + listFreer.add(listHolder_0); - ReturnErrorOnFailure( - chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request, 10000)); - return CHIP_NO_ERROR; - } + listHolder_0->mList[0].label = chip::Span("roomgarbage: not in length on purpose", 4); + listHolder_0->mList[0].value = chip::Span("bedroom 2garbage: not in length on purpose", 9); - void OnFailureResponse_4(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } + listHolder_0->mList[1].label = chip::Span("orientationgarbage: not in length on purpose", 11); + listHolder_0->mList[1].value = chip::Span("Northgarbage: not in length on purpose", 5); - void OnSuccessResponse_4() { NextTest(); } + listHolder_0->mList[2].label = chip::Span("floorgarbage: not in length on purpose", 5); + listHolder_0->mList[2].value = chip::Span("5garbage: not in length on purpose", 1); - CHIP_ERROR TestThReadsAutoRelockTimeAttributeFromDut_5() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::DoorLockClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); + listHolder_0->mList[3].label = chip::Span("directiongarbage: not in length on purpose", 9); + listHolder_0->mList[3].value = chip::Span("upgarbage: not in length on purpose", 2); - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_5, OnFailureCallback_5, true)); + value = + chip::app::DataModel::List(listHolder_0->mList, 4); + } + return WriteAttribute(kIdentityAlpha, GetEndpoint(0), UserLabel::Id, UserLabel::Attributes::LabelList::Id, value); + } + case 4: { + LogStep(4, "Reboot target device"); + SetIdentity(kIdentityAlpha); + return Reboot(mDiscriminator.HasValue() ? mDiscriminator.Value() : 3840U); + } + case 5: { + LogStep(5, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 6: { + LogStep(6, "Verify"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), UserLabel::Id, UserLabel::Attributes::LabelList::Id); + } + } return CHIP_NO_ERROR; } +}; - void OnFailureResponse_5(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_5(uint32_t autoRelockTime) +class TestArmFailSafeSuite : public TestCommand +{ +public: + TestArmFailSafeSuite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("TestArmFailSafe", 5, credsIssuerConfig) { - VerifyOrReturn(CheckValue("autoRelockTime", autoRelockTime, 10UL)); - - NextTest(); + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("discriminator", 0, UINT16_MAX, &mDiscriminator); + AddArgument("payload", &mPayload); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - CHIP_ERROR TestWait10000ms_6() - { - SetIdentity(kIdentityAlpha); - return WaitForMs(10000); - } + ~TestArmFailSafeSuite() {} - CHIP_ERROR TestThReadsLockStateAttriute_7() + chip::System::Clock::Timeout GetWaitDuration() const override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::DoorLockClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_7, OnFailureCallback_7, true)); - return CHIP_NO_ERROR; + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } - void OnFailureResponse_7(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } +private: + chip::Optional mNodeId; + chip::Optional mEndpoint; + chip::Optional mDiscriminator; + chip::Optional mPayload; + chip::Optional mTimeout; - void OnSuccessResponse_7(const chip::app::DataModel::Nullable & lockState) - { - VerifyOrReturn(CheckValueNonNull("lockState", lockState)); - VerifyOrReturn(CheckValue("lockState.Value()", lockState.Value(), 1)); + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } - NextTest(); - } + // + // Tests methods + // - CHIP_ERROR TestCleanTheCreatedCredential_8() + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::DoorLock::Commands::ClearCredential::Type; - - RequestType request; - request.credential.SetNonNull(); - - request.credential.Value().credentialType = static_cast(1); - request.credential.Value().credentialIndex = 1U; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_8(); - }; + bool shouldContinue = false; - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_8(error); - }; + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList< + chip::app::Clusters::OperationalCredentials::Structs::FabricDescriptor::DecodableType> + value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + { + auto iter_0 = value.begin(); + VerifyOrReturn(CheckNextListItemDecodes("fabrics", iter_0, 0)); + VerifyOrReturn(CheckValueAsString("fabrics[0].label", iter_0.GetValue().label, chip::CharSpan("", 0))); + VerifyOrReturn(CheckNoMoreListItems("fabrics", iter_0, 1)); + } + VerifyOrReturn(CheckConstraintType("value", "", "list")); + } + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::GeneralCommissioning::Commands::ArmFailSafeResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("errorCode", value.errorCode, 0)); + } + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::CharSpan value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueAsString("nodeLabel", value, chip::CharSpan("", 0))); + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } - ReturnErrorOnFailure( - chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request, 10000)); - return CHIP_NO_ERROR; + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } } - void OnFailureResponse_8(CHIP_ERROR error) + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Reboot target device"); + SetIdentity(kIdentityAlpha); + return Reboot(mDiscriminator.HasValue() ? mDiscriminator.Value() : 3840U); + } + case 1: { + LogStep(1, "Wait for the alpha device to be retrieved "); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 2: { + LogStep(2, "Query fabrics list"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), OperationalCredentials::Id, + OperationalCredentials::Attributes::Fabrics::Id); + } + case 3: { + LogStep(3, "ArmFailSafe on target device with timeout 0"); + chip::app::Clusters::GeneralCommissioning::Commands::ArmFailSafe::Type value; + value.expiryLengthSeconds = 0U; + value.breadcrumb = 0ULL; + return SendCommand(kIdentityAlpha, GetEndpoint(0), GeneralCommissioning::Id, + GeneralCommissioning::Commands::ArmFailSafe::Id, value); + } + case 4: { + LogStep(4, "Reads NodeLabel mandatory attribute of target device"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), Basic::Id, Basic::Attributes::NodeLabel::Id); + } + } + return CHIP_NO_ERROR; } - - void OnSuccessResponse_8() { NextTest(); } }; -class TestGroupMessagingSuite : public TestCommand +class TestMultiAdminSuite : public TestCommand { public: - TestGroupMessagingSuite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("TestGroupMessaging", credsIssuerConfig), mTestIndex(0) + TestMultiAdminSuite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("TestMultiAdmin", 17, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); + AddArgument("nodeIdForDuplicateCommissioning", 0, UINT64_MAX, &mNodeIdForDuplicateCommissioning); + AddArgument("nodeId2", 0, UINT64_MAX, &mNodeId2); + AddArgument("nodeId3", 0, UINT64_MAX, &mNodeId3); AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("discriminator", 0, UINT16_MAX, &mDiscriminator); + AddArgument("payload", &mPayload); AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~TestGroupMessagingSuite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override + ~TestMultiAdminSuite() { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) + if (readFromAlphaBuffer != nullptr) { - ChipLogProgress(chipTool, " **** Test Start: TestGroupMessaging\n"); + chip::Platform::MemoryFree(readFromAlphaBuffer); + readFromAlphaBuffer = nullptr; } + } - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: TestGroupMessaging\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } + +private: + chip::Optional mNodeId; + chip::Optional mNodeIdForDuplicateCommissioning; + chip::Optional mNodeId2; + chip::Optional mNodeId3; + chip::Optional mEndpoint; + chip::Optional mDiscriminator; + chip::Optional mPayload; + chip::Optional mTimeout; + + char * readFromAlphaBuffer = nullptr; + chip::CharSpan readFromAlpha; + + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } - Wait(); + // + // Tests methods + // + + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override + { + bool shouldContinue = false; - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) + switch (mTestIndex - 1) { case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; break; case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Add Group 1 (endpoint 1)\n"); - err = TestAddGroup1Endpoint1_1(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; break; case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Add Group 2 (endpoint 0)\n"); - err = TestAddGroup2Endpoint0_2(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); + shouldContinue = true; break; case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : KeySet Write 1\n"); - err = TestKeySetWrite1_3(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : KeySet Write 2\n"); - err = TestKeySetWrite2_4(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); + VerifyOrReturn(CheckValue("clusterStatus", status.mClusterStatus.HasValue(), true)); + VerifyOrReturn(CheckValue("clusterStatus", status.mClusterStatus.Value(), 9)); + shouldContinue = true; break; case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Write Group Keys\n"); - err = TestWriteGroupKeys_5(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList< + chip::app::Clusters::OperationalCredentials::Structs::FabricDescriptor::DecodableType> + value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + { + auto iter_0 = value.begin(); + VerifyOrReturn(CheckNextListItemDecodes("fabrics", iter_0, 0)); + VerifyOrReturn(CheckNoMoreListItems("fabrics", iter_0, 1)); + } + } break; case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : Install ACLs\n"); - err = TestInstallACLs_6(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : Read initial Attribute value\n"); - err = TestReadInitialAttributeValue_7(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : Group Write Attribute\n"); - err = TestGroupWriteAttribute_8(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; break; case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : Read back Attribute\n"); - err = TestReadBackAttribute_9(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; break; case 10: - ChipLogProgress(chipTool, " ***** Test Step 10 : Restore initial Attribute value\n"); - err = TestRestoreInitialAttributeValue_10(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; case 11: - ChipLogProgress(chipTool, " ***** Test Step 11 : Read back Attribute\n"); - err = TestReadBackAttribute_11(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; break; case 12: - ChipLogProgress(chipTool, " ***** Test Step 12 : Turn On the light to see attribute change\n"); - err = TestTurnOnTheLightToSeeAttributeChange_12(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; break; case 13: - ChipLogProgress(chipTool, - " ***** Test Step 13 : Check on/off attribute value is true after on command for endpoint 1\n"); - err = TestCheckOnOffAttributeValueIsTrueAfterOnCommandForEndpoint1_13(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::CharSpan value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueAsString("nodeLabel", value, chip::CharSpan("", 0))); + + if (readFromAlphaBuffer != nullptr) + { + chip::Platform::MemoryFree(readFromAlphaBuffer); + } + readFromAlphaBuffer = static_cast(chip::Platform::MemoryAlloc(value.size())); + memcpy(readFromAlphaBuffer, value.data(), value.size()); + readFromAlpha = chip::CharSpan(readFromAlphaBuffer, value.size()); + } break; case 14: - ChipLogProgress(chipTool, " ***** Test Step 14 : Cleanup ACLs\n"); - err = TestCleanupACLs_14(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 15: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::CharSpan value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintNotValue("value", value, readFromAlpha)); + } + break; + case 16: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } + + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); } + } - if (CHIP_NO_ERROR != err) + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); + case 0: { + LogStep(0, "Reboot target device"); + SetIdentity(kIdentityAlpha); + return Reboot(mDiscriminator.HasValue() ? mDiscriminator.Value() : 3840U); + } + case 1: { + LogStep(1, "Wait for the commissioned device to be retrieved for alpha"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 2: { + LogStep(2, "Commission from alpha when the commissioning window is not opened"); + SetIdentity(kIdentityAlpha); + return PairWithQRCode(mNodeIdForDuplicateCommissioning.HasValue() ? mNodeIdForDuplicateCommissioning.Value() : 17ULL, + mPayload.HasValue() ? mPayload.Value() + : chip::CharSpan::fromCharString("MT:-24J0AFN00KA0648G00")); } + case 3: { + LogStep(3, "Open Commissioning Window from alpha"); + chip::app::Clusters::AdministratorCommissioning::Commands::OpenBasicCommissioningWindow::Type value; + value.commissioningTimeout = 180U; + return SendCommand(kIdentityAlpha, GetEndpoint(0), AdministratorCommissioning::Id, + AdministratorCommissioning::Commands::OpenBasicCommissioningWindow::Id, value, + chip::Optional(10000)); + } + case 4: { + LogStep(4, "Commission from alpha again"); + SetIdentity(kIdentityAlpha); + return PairWithQRCode(mNodeIdForDuplicateCommissioning.HasValue() ? mNodeIdForDuplicateCommissioning.Value() : 17ULL, + mPayload.HasValue() ? mPayload.Value() + : chip::CharSpan::fromCharString("MT:-24J0AFN00KA0648G00")); + } + case 5: { + LogStep(5, "Check that we just have the one fabric and did not add a new one"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), OperationalCredentials::Id, + OperationalCredentials::Attributes::Fabrics::Id, false); + } + case 6: { + LogStep(6, "Close Commissioning Window after failed commissioning"); + chip::app::Clusters::AdministratorCommissioning::Commands::RevokeCommissioning::Type value; + return SendCommand(kIdentityAlpha, GetEndpoint(0), AdministratorCommissioning::Id, + AdministratorCommissioning::Commands::RevokeCommissioning::Id, value, + chip::Optional(10000)); + } + case 7: { + LogStep(7, "Open Commissioning Window from alpha again"); + chip::app::Clusters::AdministratorCommissioning::Commands::OpenBasicCommissioningWindow::Type value; + value.commissioningTimeout = 180U; + return SendCommand(kIdentityAlpha, GetEndpoint(0), AdministratorCommissioning::Id, + AdministratorCommissioning::Commands::OpenBasicCommissioningWindow::Id, value, + chip::Optional(10000)); + } + case 8: { + LogStep(8, "Commission from beta"); + SetIdentity(kIdentityBeta); + return PairWithQRCode(mNodeId2.HasValue() ? mNodeId2.Value() : 51966ULL, + mPayload.HasValue() ? mPayload.Value() + : chip::CharSpan::fromCharString("MT:-24J0AFN00KA0648G00")); + } + case 9: { + LogStep(9, "Wait for the commissioned device to be retrieved for beta"); + SetIdentity(kIdentityBeta); + return WaitForCommissionee(mNodeId2.HasValue() ? mNodeId2.Value() : 51966ULL); + } + case 10: { + LogStep(10, "Open Commissioning Window from beta"); + chip::app::Clusters::AdministratorCommissioning::Commands::OpenBasicCommissioningWindow::Type value; + value.commissioningTimeout = 180U; + return SendCommand(kIdentityBeta, GetEndpoint(0), AdministratorCommissioning::Id, + AdministratorCommissioning::Commands::OpenBasicCommissioningWindow::Id, value, + chip::Optional(10000)); + } + case 11: { + LogStep(11, "Commission from gamma"); + SetIdentity(kIdentityGamma); + return PairWithQRCode(mNodeId3.HasValue() ? mNodeId3.Value() : 12586990ULL, + mPayload.HasValue() ? mPayload.Value() + : chip::CharSpan::fromCharString("MT:-24J0AFN00KA0648G00")); + } + case 12: { + LogStep(12, "Wait for the commissioned device to be retrieved for gamma"); + SetIdentity(kIdentityGamma); + return WaitForCommissionee(mNodeId3.HasValue() ? mNodeId3.Value() : 12586990ULL); + } + case 13: { + LogStep(13, "read the mandatory attribute: NodeLabel from alpha"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), Basic::Id, Basic::Attributes::NodeLabel::Id); + } + case 14: { + LogStep(14, "write the mandatory attribute NodeLabel from beta"); + chip::CharSpan value; + value = chip::Span("written from betagarbage: not in length on purpose", 17); + return WriteAttribute(kIdentityBeta, GetEndpoint(0), Basic::Id, Basic::Attributes::NodeLabel::Id, value); + } + case 15: { + LogStep(15, "read the mandatory attribute: NodeLabel from gamma"); + return ReadAttribute(kIdentityGamma, GetEndpoint(0), Basic::Id, Basic::Attributes::NodeLabel::Id); + } + case 16: { + LogStep(16, "write the mandatory attribute NodeLabel back to default"); + chip::CharSpan value; + value = readFromAlpha; + return WriteAttribute(kIdentityAlpha, GetEndpoint(0), Basic::Id, Basic::Attributes::NodeLabel::Id, value); + } + } + return CHIP_NO_ERROR; + } +}; + +class Test_TC_SWDIAG_1_1Suite : public TestCommand +{ +public: + Test_TC_SWDIAG_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_SWDIAG_1_1", 5, credsIssuerConfig) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } + ~Test_TC_SWDIAG_1_1Suite() {} + chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 15; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -112402,6 +42238,51 @@ class TestGroupMessagingSuite : public TestCommand VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); shouldContinue = true; break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList + value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "list")); + } + break; + case 2: + if (IsUnsupported(status.mStatus)) + { + return; + } + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint64_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint64")); + } + break; + case 3: + if (IsUnsupported(status.mStatus)) + { + return; + } + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint64_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint64")); + } + break; + case 4: + if (IsUnsupported(status.mStatus)) + { + return; + } + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint64_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint64")); + } + break; default: LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); } @@ -112412,571 +42293,216 @@ class TestGroupMessagingSuite : public TestCommand } } - static void OnFailureCallback_5(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_5(error); - } - - static void OnSuccessCallback_5(void * context) { (static_cast(context))->OnSuccessResponse_5(); } - - static void OnFailureCallback_6(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_6(error); - } - - static void OnSuccessCallback_6(void * context) { (static_cast(context))->OnSuccessResponse_6(); } - - static void OnFailureCallback_7(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_7(error); - } - - static void OnSuccessCallback_7(void * context, chip::CharSpan nodeLabel) + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - (static_cast(context))->OnSuccessResponse_7(nodeLabel); - } - - static void OnDoneCallback_8(void * context) { (static_cast(context))->OnDoneResponse_8(); } - - static void OnFailureCallback_8(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_8(error); - } - - static void OnSuccessCallback_8(void * context) { (static_cast(context))->OnSuccessResponse_8(); } - - static void OnFailureCallback_9(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_9(error); - } - - static void OnSuccessCallback_9(void * context, chip::CharSpan nodeLabel) - { - (static_cast(context))->OnSuccessResponse_9(nodeLabel); - } - - static void OnDoneCallback_10(void * context) { (static_cast(context))->OnDoneResponse_10(); } - - static void OnFailureCallback_10(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_10(error); - } - - static void OnSuccessCallback_10(void * context) { (static_cast(context))->OnSuccessResponse_10(); } - - static void OnFailureCallback_11(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_11(error); + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "Reads a list of ThreadMetrics struct non-global attribute from DUT."); + VerifyOrdo(!ShouldSkip("A_THREADMETRICS"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), SoftwareDiagnostics::Id, + SoftwareDiagnostics::Attributes::ThreadMetrics::Id); + } + case 2: { + LogStep(2, "Reads CurrentHeapFree non-global attribute value from DUT"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), SoftwareDiagnostics::Id, + SoftwareDiagnostics::Attributes::CurrentHeapFree::Id); + } + case 3: { + LogStep(3, "Reads CurrentHeapUsed non-global attribute value from DUT"); + VerifyOrdo(!ShouldSkip("A_CURRENTHEAPUSED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), SoftwareDiagnostics::Id, + SoftwareDiagnostics::Attributes::CurrentHeapUsed::Id); + } + case 4: { + LogStep(4, "Reads CurrentHeapHighWaterMark non-global attribute value from DUT"); + VerifyOrdo(!ShouldSkip("A_CURRENTHEAPHIGHWATERMARK"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), SoftwareDiagnostics::Id, + SoftwareDiagnostics::Attributes::CurrentHeapHighWatermark::Id); + } + } + return CHIP_NO_ERROR; } +}; - static void OnSuccessCallback_11(void * context, chip::CharSpan nodeLabel) +class Test_TC_SWDIAG_2_1Suite : public TestCommand +{ +public: + Test_TC_SWDIAG_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_SWDIAG_2_1", 0, credsIssuerConfig) { - (static_cast(context))->OnSuccessResponse_11(nodeLabel); + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - static void OnFailureCallback_13(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_13(error); - } + ~Test_TC_SWDIAG_2_1Suite() {} - static void OnSuccessCallback_13(void * context, bool onOff) + chip::System::Clock::Timeout GetWaitDuration() const override { - (static_cast(context))->OnSuccessResponse_13(onOff); + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } - static void OnFailureCallback_14(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_14(error); - } +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; - static void OnSuccessCallback_14(void * context) { (static_cast(context))->OnSuccessResponse_14(); } + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } // // Tests methods // - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestAddGroup1Endpoint1_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::Groups::Commands::AddGroup::Type; - - RequestType request; - request.groupId = 257U; - request.groupName = chip::Span("Group #1garbage: not in length on purpose", 8); - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_1(data.status, data.groupId); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_1(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_1(uint8_t status, chip::GroupId groupId) - { - VerifyOrReturn(CheckValue("status", status, 0)); - - VerifyOrReturn(CheckValue("groupId", groupId, 257U)); - - NextTest(); - } - - CHIP_ERROR TestAddGroup2Endpoint0_2() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - using RequestType = chip::app::Clusters::Groups::Commands::AddGroup::Type; - - RequestType request; - request.groupId = 258U; - request.groupName = chip::Span("Group #2garbage: not in length on purpose", 8); - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_2(data.status, data.groupId); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_2(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_2(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_2(uint8_t status, chip::GroupId groupId) - { - VerifyOrReturn(CheckValue("status", status, 0)); - - VerifyOrReturn(CheckValue("groupId", groupId, 258U)); - - NextTest(); - } - - CHIP_ERROR TestKeySetWrite1_3() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - using RequestType = chip::app::Clusters::GroupKeyManagement::Commands::KeySetWrite::Type; - - RequestType request; - - request.groupKeySet.groupKeySetID = 417U; - request.groupKeySet.groupKeySecurityPolicy = - static_cast(0); - request.groupKeySet.epochKey0.SetNonNull(); - request.groupKeySet.epochKey0.Value() = - chip::ByteSpan(chip::Uint8::from_const_char( - "\240\241\242\243\244\245\246\247\250\251\252\253\254\255\256\257garbage: not in length on purpose"), - 16); - request.groupKeySet.epochStartTime0.SetNonNull(); - request.groupKeySet.epochStartTime0.Value() = 1110000ULL; - request.groupKeySet.epochKey1.SetNonNull(); - request.groupKeySet.epochKey1.Value() = - chip::ByteSpan(chip::Uint8::from_const_char( - "\260\261\262\263\264\265\266\267\270\271\272\273\274\275\276\277garbage: not in length on purpose"), - 16); - request.groupKeySet.epochStartTime1.SetNonNull(); - request.groupKeySet.epochStartTime1.Value() = 1110001ULL; - request.groupKeySet.epochKey2.SetNonNull(); - request.groupKeySet.epochKey2.Value() = - chip::ByteSpan(chip::Uint8::from_const_char( - "\300\301\302\303\304\305\306\307\310\311\312\313\314\315\316\317garbage: not in length on purpose"), - 16); - request.groupKeySet.epochStartTime2.SetNonNull(); - request.groupKeySet.epochStartTime2.Value() = 1110002ULL; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_3(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_3(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_3(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_3() { NextTest(); } - - CHIP_ERROR TestKeySetWrite2_4() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - using RequestType = chip::app::Clusters::GroupKeyManagement::Commands::KeySetWrite::Type; - - RequestType request; - - request.groupKeySet.groupKeySetID = 418U; - request.groupKeySet.groupKeySecurityPolicy = - static_cast(0); - request.groupKeySet.epochKey0.SetNonNull(); - request.groupKeySet.epochKey0.Value() = - chip::ByteSpan(chip::Uint8::from_const_char( - "\320\321\322\323\324\325\326\327\330\331\332\333\334\335\336\337garbage: not in length on purpose"), - 16); - request.groupKeySet.epochStartTime0.SetNonNull(); - request.groupKeySet.epochStartTime0.Value() = 2220000ULL; - request.groupKeySet.epochKey1.SetNonNull(); - request.groupKeySet.epochKey1.Value() = - chip::ByteSpan(chip::Uint8::from_const_char( - "\340\341\342\343\344\345\346\347\350\351\352\353\354\355\356\357garbage: not in length on purpose"), - 16); - request.groupKeySet.epochStartTime1.SetNonNull(); - request.groupKeySet.epochStartTime1.Value() = 2220001ULL; - request.groupKeySet.epochKey2.SetNonNull(); - request.groupKeySet.epochKey2.Value() = - chip::ByteSpan(chip::Uint8::from_const_char( - "\360\361\362\363\364\365\366\367\370\371\372\373\374\375\376\377garbage: not in length on purpose"), - 16); - request.groupKeySet.epochStartTime2.SetNonNull(); - request.groupKeySet.epochStartTime2.Value() = 2220002ULL; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_4(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_4(error); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_4(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_4() { NextTest(); } - - CHIP_ERROR TestWriteGroupKeys_5() + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::GroupKeyManagementClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ListFreer listFreer; - chip::app::DataModel::List - groupKeyMapArgument; + bool shouldContinue = false; + switch (mTestIndex - 1) { - auto * listHolder_0 = new ListHolder(2); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].groupId = 257U; - listHolder_0->mList[0].groupKeySetID = 417U; - listHolder_0->mList[0].fabricIndex = 1; - - listHolder_0->mList[1].groupId = 258U; - listHolder_0->mList[1].groupKeySetID = 418U; - listHolder_0->mList[1].fabricIndex = 1; - - groupKeyMapArgument = - chip::app::DataModel::List( - listHolder_0->mList, 2); + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); } - ReturnErrorOnFailure(cluster.WriteAttribute( - groupKeyMapArgument, this, OnSuccessCallback_5, OnFailureCallback_5)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_5(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_5() { NextTest(); } - - CHIP_ERROR TestInstallACLs_6() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::AccessControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ListFreer listFreer; - chip::app::DataModel::List aclArgument; - + if (shouldContinue) { - auto * listHolder_0 = new ListHolder(2); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].privilege = static_cast(5); - listHolder_0->mList[0].authMode = static_cast(2); - listHolder_0->mList[0].subjects.SetNull(); - listHolder_0->mList[0].targets.SetNull(); - listHolder_0->mList[0].fabricIndex = 0; - - listHolder_0->mList[1].privilege = static_cast(4); - listHolder_0->mList[1].authMode = static_cast(3); - listHolder_0->mList[1].subjects.SetNull(); - listHolder_0->mList[1].targets.SetNull(); - listHolder_0->mList[1].fabricIndex = 0; - - aclArgument = chip::app::DataModel::List( - listHolder_0->mList, 2); + ContinueOnChipMainThread(CHIP_NO_ERROR); } - - ReturnErrorOnFailure(cluster.WriteAttribute( - aclArgument, this, OnSuccessCallback_6, OnFailureCallback_6)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_6(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_6() { NextTest(); } - - CHIP_ERROR TestReadInitialAttributeValue_7() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::BasicClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_7, OnFailureCallback_7, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_7(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_7(chip::CharSpan nodeLabel) - { - VerifyOrReturn(CheckValueAsString("nodeLabel", nodeLabel, chip::CharSpan("", 0))); - - NextTest(); - } - - CHIP_ERROR TestGroupWriteAttribute_8() - { - const chip::GroupId groupId = 258; - chip::Controller::BasicClusterTest cluster; - - chip::CharSpan nodeLabelArgument; - nodeLabelArgument = chip::Span("xyzzygarbage: not in length on purpose", 5); - - ReturnErrorOnFailure(cluster.WriteAttribute( - groupId, mDevices[kIdentityAlpha]->GetSecureSession().Value()->GetFabricIndex(), nodeLabelArgument, this, - OnSuccessCallback_8, OnFailureCallback_8, OnDoneCallback_8)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_8(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); } - void OnSuccessResponse_8() { NextTest(); } - - void OnDoneResponse_8() { NextTest(); } - - CHIP_ERROR TestReadBackAttribute_9() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::BasicClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_9, OnFailureCallback_9, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_9(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_9(chip::CharSpan nodeLabel) - { - VerifyOrReturn(CheckValueAsString("nodeLabel", nodeLabel, chip::CharSpan("xyzzy", 5))); - - NextTest(); - } - - CHIP_ERROR TestRestoreInitialAttributeValue_10() - { - const chip::GroupId groupId = 258; - chip::Controller::BasicClusterTest cluster; - - chip::CharSpan nodeLabelArgument; - nodeLabelArgument = chip::Span("garbage: not in length on purpose", 0); - - ReturnErrorOnFailure(cluster.WriteAttribute( - groupId, mDevices[kIdentityAlpha]->GetSecureSession().Value()->GetFabricIndex(), nodeLabelArgument, this, - OnSuccessCallback_10, OnFailureCallback_10, OnDoneCallback_10)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_10(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_10() { NextTest(); } - - void OnDoneResponse_10() { NextTest(); } - - CHIP_ERROR TestReadBackAttribute_11() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::BasicClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_11, OnFailureCallback_11, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_11(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_11(chip::CharSpan nodeLabel) - { - VerifyOrReturn(CheckValueAsString("nodeLabel", nodeLabel, chip::CharSpan("", 0))); - - NextTest(); - } - - CHIP_ERROR TestTurnOnTheLightToSeeAttributeChange_12() + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - const chip::GroupId groupId = 257; - using RequestType = chip::app::Clusters::OnOff::Commands::On::Type; - - RequestType request; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_12(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_12(error); - }; - - auto done = [](void * context) { (static_cast(context))->OnDoneResponse_12(); }; - - ReturnErrorOnFailure( - chip::Controller::InvokeGroupCommand(mDevices[kIdentityAlpha], this, success, failure, done, groupId, request)); + using namespace chip::app::Clusters; + switch (testIndex) + { + } return CHIP_NO_ERROR; } +}; - void OnFailureResponse_12(CHIP_ERROR error) +class Test_TC_SWDIAG_3_1Suite : public TestCommand +{ +public: + Test_TC_SWDIAG_3_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_SWDIAG_3_1", 4, credsIssuerConfig) { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - void OnSuccessResponse_12() { NextTest(); } - - void OnDoneResponse_12() { NextTest(); } + ~Test_TC_SWDIAG_3_1Suite() {} - CHIP_ERROR TestCheckOnOffAttributeValueIsTrueAfterOnCommandForEndpoint1_13() + chip::System::Clock::Timeout GetWaitDuration() const override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::OnOffClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_13, OnFailureCallback_13, true)); - return CHIP_NO_ERROR; + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } - void OnFailureResponse_13(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; - void OnSuccessResponse_13(bool onOff) - { - VerifyOrReturn(CheckValue("onOff", onOff, 1)); + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } - NextTest(); - } + // + // Tests methods + // - CHIP_ERROR TestCleanupACLs_14() + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::AccessControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ListFreer listFreer; - chip::app::DataModel::List aclArgument; + bool shouldContinue = false; + switch (mTestIndex - 1) { - auto * listHolder_0 = new ListHolder(1); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].privilege = static_cast(5); - listHolder_0->mList[0].authMode = static_cast(2); - listHolder_0->mList[0].subjects.SetNull(); - listHolder_0->mList[0].targets.SetNull(); - listHolder_0->mList[0].fabricIndex = 0; - - aclArgument = chip::app::DataModel::List( - listHolder_0->mList, 1); + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 2: + if (IsUnsupported(status.mStatus)) + { + return; + } + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint64_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint64")); + } + break; + case 3: + if (IsUnsupported(status.mStatus)) + { + return; + } + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint64_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "", "uint64")); + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); } - ReturnErrorOnFailure(cluster.WriteAttribute( - aclArgument, this, OnSuccessCallback_14, OnFailureCallback_14)); - return CHIP_NO_ERROR; + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } } - void OnFailureResponse_14(CHIP_ERROR error) + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "Sends ResetWatermarks to DUT"); + VerifyOrdo(!ShouldSkip("CR_RESETWATERMARKS"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + chip::app::Clusters::SoftwareDiagnostics::Commands::ResetWatermarks::Type value; + return SendCommand(kIdentityAlpha, GetEndpoint(0), SoftwareDiagnostics::Id, + SoftwareDiagnostics::Commands::ResetWatermarks::Id, value); + } + case 2: { + LogStep(2, "Reads CurrentHeapUsed attribute value from DUT"); + VerifyOrdo(!ShouldSkip("A_CURRENTHEAPUSED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), SoftwareDiagnostics::Id, + SoftwareDiagnostics::Attributes::CurrentHeapUsed::Id); + } + case 3: { + LogStep(3, "Reads CurrentHeapHighWaterMark attribute value from DUT"); + VerifyOrdo(!ShouldSkip("A_CURRENTHEAPHIGHWATERMARK"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), SoftwareDiagnostics::Id, + SoftwareDiagnostics::Attributes::CurrentHeapHighWatermark::Id); + } + } + return CHIP_NO_ERROR; } - - void OnSuccessResponse_14() { NextTest(); } }; -class TestGroupsClusterSuite : public TestCommand +class TestSubscribe_OnOffSuite : public TestCommand { public: - TestGroupsClusterSuite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("TestGroupsCluster", credsIssuerConfig), mTestIndex(0) + TestSubscribe_OnOffSuite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("TestSubscribe_OnOff", 7, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -112984,132 +42510,157 @@ class TestGroupsClusterSuite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~TestGroupsClusterSuite() {} + ~TestSubscribe_OnOffSuite() {} - /////////// TestCommand Interface ///////// - void NextTest() override + chip::System::Clock::Timeout GetWaitDuration() const override { - CHIP_ERROR err = CHIP_NO_ERROR; + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: TestGroupsCluster\n"); - } +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: TestGroupsCluster\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // - Wait(); + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override + { + bool shouldContinue = false; - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) + switch (mTestIndex - 1) { case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; break; case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : View Group 0 (invalid)\n"); - err = TestViewGroup0Invalid_1(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : View Group 1 (not found)\n"); - err = TestViewGroup1NotFound_2(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + bool value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("onOff", value, false)); + } break; case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Add Group 1 (new)\n"); - err = TestAddGroup1New_3(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : View Group 1 (new)\n"); - err = TestViewGroup1New_4(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + bool value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("onOff", value, true)); + } + shouldContinue = true; break; case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : View Group 2 (not found)\n"); - err = TestViewGroup2NotFound_5(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : Get Group Membership 1 (all)\n"); - err = TestGetGroupMembership1All_6(); - break; - case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : View Group 3 (not found)\n"); - err = TestViewGroup3NotFound_7(); - break; - case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : View Group 1 (existing)\n"); - err = TestViewGroup1Existing_8(); - break; - case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : Remove Group 0 (invalid)\n"); - err = TestRemoveGroup0Invalid_9(); - break; - case 10: - ChipLogProgress(chipTool, " ***** Test Step 10 : Remove Group 4 (not found)\n"); - err = TestRemoveGroup4NotFound_10(); - break; - case 11: - ChipLogProgress(chipTool, " ***** Test Step 11 : View Group 1 (not removed)\n"); - err = TestViewGroup1NotRemoved_11(); - break; - case 12: - ChipLogProgress(chipTool, " ***** Test Step 12 : View Group 2 (removed)\n"); - err = TestViewGroup2Removed_12(); - break; - case 13: - ChipLogProgress(chipTool, " ***** Test Step 13 : Get Group Membership 3\n"); - err = TestGetGroupMembership3_13(); - break; - case 14: - ChipLogProgress(chipTool, " ***** Test Step 14 : Remove All\n"); - err = TestRemoveAll_14(); - break; - case 15: - ChipLogProgress(chipTool, " ***** Test Step 15 : View Group 1 (removed)\n"); - err = TestViewGroup1Removed_15(); - break; - case 16: - ChipLogProgress(chipTool, " ***** Test Step 16 : View Group 2 (still removed)\n"); - err = TestViewGroup2StillRemoved_16(); - break; - case 17: - ChipLogProgress(chipTool, " ***** Test Step 17 : View Group 3 (removed)\n"); - err = TestViewGroup3Removed_17(); - break; - case 18: - ChipLogProgress(chipTool, " ***** Test Step 18 : Get Group Membership 4\n"); - err = TestGetGroupMembership4_18(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + bool value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("onOff", value, false)); + } + shouldContinue = true; break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } + + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); } + } - if (CHIP_NO_ERROR != err) + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "Set OnOff Attribute to false"); + chip::app::Clusters::OnOff::Commands::Off::Type value; + return SendCommand(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Commands::Off::Id, value); + } + case 2: { + LogStep(2, "Subscribe OnOff Attribute"); + return SubscribeAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnOff::Id, 2, 5); + } + case 3: { + LogStep(3, "Turn On the light to see attribute change"); + chip::app::Clusters::OnOff::Commands::On::Type value; + return SendCommand(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Commands::On::Id, value); + } + case 4: { + LogStep(4, "Check for attribute report"); + return WaitForReport(); + } + case 5: { + LogStep(5, "Turn Off the light to see attribute change"); + chip::app::Clusters::OnOff::Commands::Off::Type value; + return SendCommand(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Commands::Off::Id, value); } + case 6: { + LogStep(6, "Check for attribute report"); + return WaitForReport(); + } + } + return CHIP_NO_ERROR; + } +}; + +class DL_UsersAndCredentialsSuite : public TestCommand +{ +public: + DL_UsersAndCredentialsSuite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("DL_UsersAndCredentials", 102, credsIssuerConfig) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } + ~DL_UsersAndCredentialsSuite() {} + chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 19; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + uint16_t NumberOfTotalUsersSupported; + uint16_t NumberOfPINUsersSupported; + uint16_t NumberOfRFIDUsersSupported; + + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -113120,1545 +42671,2535 @@ class TestGroupsClusterSuite : public TestCommand VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); shouldContinue = true; break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DoorLock::Commands::GetUserResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("userIndex", value.userIndex, 1U)); - CHIP_ERROR TestViewGroup0Invalid_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::Groups::Commands::ViewGroup::Type; + VerifyOrReturn(CheckValueNull("userName", value.userName)); - RequestType request; - request.groupId = 0U; + VerifyOrReturn(CheckValueNull("userUniqueId", value.userUniqueId)); - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_1(data.status, data.groupId, data.groupName); - }; + VerifyOrReturn(CheckValueNull("userStatus", value.userStatus)); - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_1(error); - }; + VerifyOrReturn(CheckValueNull("userType", value.userType)); - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } + VerifyOrReturn(CheckValueNull("credentialRule", value.credentialRule)); - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } + VerifyOrReturn(CheckValueNull("credentials", value.credentials)); - void OnSuccessResponse_1(uint8_t status, chip::GroupId groupId, chip::CharSpan groupName) - { - VerifyOrReturn(CheckValue("status", status, 135)); + VerifyOrReturn(CheckValueNull("creatorFabricIndex", value.creatorFabricIndex)); - VerifyOrReturn(CheckValue("groupId", groupId, 0U)); + VerifyOrReturn(CheckValueNull("lastModifiedFabricIndex", value.lastModifiedFabricIndex)); - NextTest(); - } + VerifyOrReturn(CheckValueNonNull("nextUserIndex", value.nextUserIndex)); + VerifyOrReturn(CheckValue("nextUserIndex.Value()", value.nextUserIndex.Value(), 2U)); + } + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("numberOfTotalUsersSupported", value, 10U)); - CHIP_ERROR TestViewGroup1NotFound_2() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::Groups::Commands::ViewGroup::Type; + NumberOfTotalUsersSupported = value; + } + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_COMMAND)); + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_COMMAND)); + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DoorLock::Commands::GetUserResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("userIndex", value.userIndex, 1U)); - RequestType request; - request.groupId = 1U; + VerifyOrReturn(CheckValueNonNull("userName", value.userName)); + VerifyOrReturn(CheckValueAsString("userName.Value()", value.userName.Value(), chip::CharSpan("", 0))); - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_2(data.status, data.groupId, data.groupName); - }; + VerifyOrReturn(CheckValueNull("userUniqueId", value.userUniqueId)); - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_2(error); - }; + VerifyOrReturn(CheckValueNonNull("userStatus", value.userStatus)); + VerifyOrReturn(CheckValue("userStatus.Value()", value.userStatus.Value(), 1)); - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } + VerifyOrReturn(CheckValueNonNull("userType", value.userType)); + VerifyOrReturn(CheckValue("userType.Value()", value.userType.Value(), 0)); - void OnFailureResponse_2(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } + VerifyOrReturn(CheckValueNonNull("credentialRule", value.credentialRule)); + VerifyOrReturn(CheckValue("credentialRule.Value()", value.credentialRule.Value(), 0)); - void OnSuccessResponse_2(uint8_t status, chip::GroupId groupId, chip::CharSpan groupName) - { - VerifyOrReturn(CheckValue("status", status, 139)); + VerifyOrReturn(CheckValueNull("credentials", value.credentials)); - VerifyOrReturn(CheckValue("groupId", groupId, 1U)); + VerifyOrReturn(CheckValueNonNull("creatorFabricIndex", value.creatorFabricIndex)); + VerifyOrReturn(CheckValue("creatorFabricIndex.Value()", value.creatorFabricIndex.Value(), 1)); - NextTest(); - } + VerifyOrReturn(CheckValueNonNull("lastModifiedFabricIndex", value.lastModifiedFabricIndex)); + VerifyOrReturn(CheckValue("lastModifiedFabricIndex.Value()", value.lastModifiedFabricIndex.Value(), 1)); - CHIP_ERROR TestAddGroup1New_3() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::Groups::Commands::AddGroup::Type; + VerifyOrReturn(CheckValueNonNull("nextUserIndex", value.nextUserIndex)); + VerifyOrReturn(CheckValue("nextUserIndex.Value()", value.nextUserIndex.Value(), 2U)); + } + break; + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 1)); + break; + case 8: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 9: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DoorLock::Commands::GetUserResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("userIndex", value.userIndex, 1U)); - RequestType request; - request.groupId = 1U; - request.groupName = chip::Span("Group #1garbage: not in length on purpose", 8); + VerifyOrReturn(CheckValueNonNull("userName", value.userName)); + VerifyOrReturn(CheckValueAsString("userName.Value()", value.userName.Value(), chip::CharSpan("new_user", 8))); - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_3(data.status, data.groupId); - }; + VerifyOrReturn(CheckValueNull("userUniqueId", value.userUniqueId)); - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_3(error); - }; + VerifyOrReturn(CheckValueNonNull("userStatus", value.userStatus)); + VerifyOrReturn(CheckValue("userStatus.Value()", value.userStatus.Value(), 1)); - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } + VerifyOrReturn(CheckValueNonNull("userType", value.userType)); + VerifyOrReturn(CheckValue("userType.Value()", value.userType.Value(), 0)); - void OnFailureResponse_3(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } + VerifyOrReturn(CheckValueNonNull("credentialRule", value.credentialRule)); + VerifyOrReturn(CheckValue("credentialRule.Value()", value.credentialRule.Value(), 0)); - void OnSuccessResponse_3(uint8_t status, chip::GroupId groupId) - { - VerifyOrReturn(CheckValue("status", status, 0)); + VerifyOrReturn(CheckValueNull("credentials", value.credentials)); - VerifyOrReturn(CheckValue("groupId", groupId, 1U)); + VerifyOrReturn(CheckValueNonNull("creatorFabricIndex", value.creatorFabricIndex)); + VerifyOrReturn(CheckValue("creatorFabricIndex.Value()", value.creatorFabricIndex.Value(), 1)); - NextTest(); - } + VerifyOrReturn(CheckValueNonNull("lastModifiedFabricIndex", value.lastModifiedFabricIndex)); + VerifyOrReturn(CheckValue("lastModifiedFabricIndex.Value()", value.lastModifiedFabricIndex.Value(), 1)); - CHIP_ERROR TestViewGroup1New_4() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::Groups::Commands::ViewGroup::Type; + VerifyOrReturn(CheckValueNonNull("nextUserIndex", value.nextUserIndex)); + VerifyOrReturn(CheckValue("nextUserIndex.Value()", value.nextUserIndex.Value(), 2U)); + } + break; + case 10: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 11: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DoorLock::Commands::GetUserResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("userIndex", value.userIndex, 1U)); - RequestType request; - request.groupId = 1U; + VerifyOrReturn(CheckValueNonNull("userName", value.userName)); + VerifyOrReturn(CheckValueAsString("userName.Value()", value.userName.Value(), chip::CharSpan("new_user", 8))); - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_4(data.status, data.groupId, data.groupName); - }; + VerifyOrReturn(CheckValueNonNull("userUniqueId", value.userUniqueId)); + VerifyOrReturn(CheckValue("userUniqueId.Value()", value.userUniqueId.Value(), 305441741UL)); - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_4(error); - }; + VerifyOrReturn(CheckValueNonNull("userStatus", value.userStatus)); + VerifyOrReturn(CheckValue("userStatus.Value()", value.userStatus.Value(), 1)); - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } + VerifyOrReturn(CheckValueNonNull("userType", value.userType)); + VerifyOrReturn(CheckValue("userType.Value()", value.userType.Value(), 0)); - void OnFailureResponse_4(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } + VerifyOrReturn(CheckValueNonNull("credentialRule", value.credentialRule)); + VerifyOrReturn(CheckValue("credentialRule.Value()", value.credentialRule.Value(), 0)); - void OnSuccessResponse_4(uint8_t status, chip::GroupId groupId, chip::CharSpan groupName) - { - VerifyOrReturn(CheckValue("status", status, 0)); + VerifyOrReturn(CheckValueNull("credentials", value.credentials)); - VerifyOrReturn(CheckValue("groupId", groupId, 1U)); + VerifyOrReturn(CheckValueNonNull("creatorFabricIndex", value.creatorFabricIndex)); + VerifyOrReturn(CheckValue("creatorFabricIndex.Value()", value.creatorFabricIndex.Value(), 1)); - VerifyOrReturn(CheckValueAsString("groupName", groupName, chip::CharSpan("Group #1", 8))); + VerifyOrReturn(CheckValueNonNull("lastModifiedFabricIndex", value.lastModifiedFabricIndex)); + VerifyOrReturn(CheckValue("lastModifiedFabricIndex.Value()", value.lastModifiedFabricIndex.Value(), 1)); - NextTest(); - } + VerifyOrReturn(CheckValueNonNull("nextUserIndex", value.nextUserIndex)); + VerifyOrReturn(CheckValue("nextUserIndex.Value()", value.nextUserIndex.Value(), 2U)); + } + break; + case 12: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 13: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DoorLock::Commands::GetUserResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("userIndex", value.userIndex, 1U)); - CHIP_ERROR TestViewGroup2NotFound_5() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::Groups::Commands::ViewGroup::Type; + VerifyOrReturn(CheckValueNonNull("userName", value.userName)); + VerifyOrReturn(CheckValueAsString("userName.Value()", value.userName.Value(), chip::CharSpan("new_user", 8))); - RequestType request; - request.groupId = 4369U; + VerifyOrReturn(CheckValueNonNull("userUniqueId", value.userUniqueId)); + VerifyOrReturn(CheckValue("userUniqueId.Value()", value.userUniqueId.Value(), 305441741UL)); - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_5(data.status, data.groupId, data.groupName); - }; + VerifyOrReturn(CheckValueNonNull("userStatus", value.userStatus)); + VerifyOrReturn(CheckValue("userStatus.Value()", value.userStatus.Value(), 3)); - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_5(error); - }; + VerifyOrReturn(CheckValueNonNull("userType", value.userType)); + VerifyOrReturn(CheckValue("userType.Value()", value.userType.Value(), 0)); - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } + VerifyOrReturn(CheckValueNonNull("credentialRule", value.credentialRule)); + VerifyOrReturn(CheckValue("credentialRule.Value()", value.credentialRule.Value(), 0)); - void OnFailureResponse_5(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } + VerifyOrReturn(CheckValueNull("credentials", value.credentials)); - void OnSuccessResponse_5(uint8_t status, chip::GroupId groupId, chip::CharSpan groupName) - { - VerifyOrReturn(CheckValue("status", status, 139)); + VerifyOrReturn(CheckValueNonNull("creatorFabricIndex", value.creatorFabricIndex)); + VerifyOrReturn(CheckValue("creatorFabricIndex.Value()", value.creatorFabricIndex.Value(), 1)); - VerifyOrReturn(CheckValue("groupId", groupId, 4369U)); + VerifyOrReturn(CheckValueNonNull("lastModifiedFabricIndex", value.lastModifiedFabricIndex)); + VerifyOrReturn(CheckValue("lastModifiedFabricIndex.Value()", value.lastModifiedFabricIndex.Value(), 1)); - NextTest(); - } + VerifyOrReturn(CheckValueNonNull("nextUserIndex", value.nextUserIndex)); + VerifyOrReturn(CheckValue("nextUserIndex.Value()", value.nextUserIndex.Value(), 2U)); + } + break; + case 14: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 15: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DoorLock::Commands::GetUserResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("userIndex", value.userIndex, 1U)); - CHIP_ERROR TestGetGroupMembership1All_6() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::Groups::Commands::GetGroupMembership::Type; + VerifyOrReturn(CheckValueNonNull("userName", value.userName)); + VerifyOrReturn(CheckValueAsString("userName.Value()", value.userName.Value(), chip::CharSpan("new_user", 8))); - ListFreer listFreer; - RequestType request; + VerifyOrReturn(CheckValueNonNull("userUniqueId", value.userUniqueId)); + VerifyOrReturn(CheckValue("userUniqueId.Value()", value.userUniqueId.Value(), 305441741UL)); - request.groupList = chip::app::DataModel::List(); + VerifyOrReturn(CheckValueNonNull("userStatus", value.userStatus)); + VerifyOrReturn(CheckValue("userStatus.Value()", value.userStatus.Value(), 3)); - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_6(data.capacity, data.groupList); - }; + VerifyOrReturn(CheckValueNonNull("userType", value.userType)); + VerifyOrReturn(CheckValue("userType.Value()", value.userType.Value(), 6)); - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_6(error); - }; + VerifyOrReturn(CheckValueNonNull("credentialRule", value.credentialRule)); + VerifyOrReturn(CheckValue("credentialRule.Value()", value.credentialRule.Value(), 0)); - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } + VerifyOrReturn(CheckValueNull("credentials", value.credentials)); - void OnFailureResponse_6(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } + VerifyOrReturn(CheckValueNonNull("creatorFabricIndex", value.creatorFabricIndex)); + VerifyOrReturn(CheckValue("creatorFabricIndex.Value()", value.creatorFabricIndex.Value(), 1)); - void OnSuccessResponse_6(const chip::app::DataModel::Nullable & capacity, - const chip::app::DataModel::DecodableList & groupList) - { - VerifyOrReturn(CheckValueNull("capacity", capacity)); + VerifyOrReturn(CheckValueNonNull("lastModifiedFabricIndex", value.lastModifiedFabricIndex)); + VerifyOrReturn(CheckValue("lastModifiedFabricIndex.Value()", value.lastModifiedFabricIndex.Value(), 1)); - { - auto iter_0 = groupList.begin(); - VerifyOrReturn(CheckNextListItemDecodes("groupList", iter_0, 0)); - VerifyOrReturn(CheckValue("groupList[0]", iter_0.GetValue(), 1U)); - VerifyOrReturn(CheckNoMoreListItems("groupList", iter_0, 1)); - } + VerifyOrReturn(CheckValueNonNull("nextUserIndex", value.nextUserIndex)); + VerifyOrReturn(CheckValue("nextUserIndex.Value()", value.nextUserIndex.Value(), 2U)); + } + break; + case 16: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 17: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DoorLock::Commands::GetUserResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("userIndex", value.userIndex, 1U)); - NextTest(); - } + VerifyOrReturn(CheckValueNonNull("userName", value.userName)); + VerifyOrReturn(CheckValueAsString("userName.Value()", value.userName.Value(), chip::CharSpan("new_user", 8))); - CHIP_ERROR TestViewGroup3NotFound_7() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::Groups::Commands::ViewGroup::Type; + VerifyOrReturn(CheckValueNonNull("userUniqueId", value.userUniqueId)); + VerifyOrReturn(CheckValue("userUniqueId.Value()", value.userUniqueId.Value(), 305441741UL)); - RequestType request; - request.groupId = 32767U; + VerifyOrReturn(CheckValueNonNull("userStatus", value.userStatus)); + VerifyOrReturn(CheckValue("userStatus.Value()", value.userStatus.Value(), 3)); - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_7(data.status, data.groupId, data.groupName); - }; + VerifyOrReturn(CheckValueNonNull("userType", value.userType)); + VerifyOrReturn(CheckValue("userType.Value()", value.userType.Value(), 6)); - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_7(error); - }; + VerifyOrReturn(CheckValueNonNull("credentialRule", value.credentialRule)); + VerifyOrReturn(CheckValue("credentialRule.Value()", value.credentialRule.Value(), 2)); - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } + VerifyOrReturn(CheckValueNull("credentials", value.credentials)); - void OnFailureResponse_7(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } + VerifyOrReturn(CheckValueNonNull("creatorFabricIndex", value.creatorFabricIndex)); + VerifyOrReturn(CheckValue("creatorFabricIndex.Value()", value.creatorFabricIndex.Value(), 1)); - void OnSuccessResponse_7(uint8_t status, chip::GroupId groupId, chip::CharSpan groupName) - { - VerifyOrReturn(CheckValue("status", status, 139)); + VerifyOrReturn(CheckValueNonNull("lastModifiedFabricIndex", value.lastModifiedFabricIndex)); + VerifyOrReturn(CheckValue("lastModifiedFabricIndex.Value()", value.lastModifiedFabricIndex.Value(), 1)); - VerifyOrReturn(CheckValue("groupId", groupId, 32767U)); + VerifyOrReturn(CheckValueNonNull("nextUserIndex", value.nextUserIndex)); + VerifyOrReturn(CheckValue("nextUserIndex.Value()", value.nextUserIndex.Value(), 2U)); + } + break; + case 18: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 19: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DoorLock::Commands::GetUserResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("userIndex", value.userIndex, 1U)); - NextTest(); - } + VerifyOrReturn(CheckValueNonNull("userName", value.userName)); + VerifyOrReturn(CheckValueAsString("userName.Value()", value.userName.Value(), chip::CharSpan("test_user", 9))); - CHIP_ERROR TestViewGroup1Existing_8() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::Groups::Commands::ViewGroup::Type; + VerifyOrReturn(CheckValueNonNull("userUniqueId", value.userUniqueId)); + VerifyOrReturn(CheckValue("userUniqueId.Value()", value.userUniqueId.Value(), 466460832UL)); - RequestType request; - request.groupId = 1U; + VerifyOrReturn(CheckValueNonNull("userStatus", value.userStatus)); + VerifyOrReturn(CheckValue("userStatus.Value()", value.userStatus.Value(), 1)); - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_8(data.status, data.groupId, data.groupName); - }; + VerifyOrReturn(CheckValueNonNull("userType", value.userType)); + VerifyOrReturn(CheckValue("userType.Value()", value.userType.Value(), 0)); - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_8(error); - }; + VerifyOrReturn(CheckValueNonNull("credentialRule", value.credentialRule)); + VerifyOrReturn(CheckValue("credentialRule.Value()", value.credentialRule.Value(), 1)); - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } + VerifyOrReturn(CheckValueNull("credentials", value.credentials)); - void OnFailureResponse_8(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } + VerifyOrReturn(CheckValueNonNull("creatorFabricIndex", value.creatorFabricIndex)); + VerifyOrReturn(CheckValue("creatorFabricIndex.Value()", value.creatorFabricIndex.Value(), 1)); - void OnSuccessResponse_8(uint8_t status, chip::GroupId groupId, chip::CharSpan groupName) - { - VerifyOrReturn(CheckValue("status", status, 0)); + VerifyOrReturn(CheckValueNonNull("lastModifiedFabricIndex", value.lastModifiedFabricIndex)); + VerifyOrReturn(CheckValue("lastModifiedFabricIndex.Value()", value.lastModifiedFabricIndex.Value(), 1)); - VerifyOrReturn(CheckValue("groupId", groupId, 1U)); + VerifyOrReturn(CheckValueNonNull("nextUserIndex", value.nextUserIndex)); + VerifyOrReturn(CheckValue("nextUserIndex.Value()", value.nextUserIndex.Value(), 2U)); + } + break; + case 20: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 21: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DoorLock::Commands::GetUserResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("userIndex", value.userIndex, 2U)); - VerifyOrReturn(CheckValueAsString("groupName", groupName, chip::CharSpan("Group #1", 8))); + VerifyOrReturn(CheckValueNonNull("userName", value.userName)); + VerifyOrReturn(CheckValueAsString("userName.Value()", value.userName.Value(), chip::CharSpan("test_user2", 10))); - NextTest(); - } + VerifyOrReturn(CheckValueNonNull("userUniqueId", value.userUniqueId)); + VerifyOrReturn(CheckValue("userUniqueId.Value()", value.userUniqueId.Value(), 12648430UL)); - CHIP_ERROR TestRemoveGroup0Invalid_9() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::Groups::Commands::RemoveGroup::Type; + VerifyOrReturn(CheckValueNonNull("userStatus", value.userStatus)); + VerifyOrReturn(CheckValue("userStatus.Value()", value.userStatus.Value(), 1)); - RequestType request; - request.groupId = 0U; + VerifyOrReturn(CheckValueNonNull("userType", value.userType)); + VerifyOrReturn(CheckValue("userType.Value()", value.userType.Value(), 1)); - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_9(data.status, data.groupId); - }; + VerifyOrReturn(CheckValueNonNull("credentialRule", value.credentialRule)); + VerifyOrReturn(CheckValue("credentialRule.Value()", value.credentialRule.Value(), 2)); - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_9(error); - }; + VerifyOrReturn(CheckValueNull("credentials", value.credentials)); - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } + VerifyOrReturn(CheckValueNonNull("creatorFabricIndex", value.creatorFabricIndex)); + VerifyOrReturn(CheckValue("creatorFabricIndex.Value()", value.creatorFabricIndex.Value(), 1)); - void OnFailureResponse_9(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } + VerifyOrReturn(CheckValueNonNull("lastModifiedFabricIndex", value.lastModifiedFabricIndex)); + VerifyOrReturn(CheckValue("lastModifiedFabricIndex.Value()", value.lastModifiedFabricIndex.Value(), 1)); - void OnSuccessResponse_9(uint8_t status, chip::GroupId groupId) - { - VerifyOrReturn(CheckValue("status", status, 135)); + VerifyOrReturn(CheckValueNonNull("nextUserIndex", value.nextUserIndex)); + VerifyOrReturn(CheckValue("nextUserIndex.Value()", value.nextUserIndex.Value(), 3U)); + } + break; + case 22: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 23: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DoorLock::Commands::GetUserResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("userIndex", value.userIndex, NumberOfTotalUsersSupported)); - VerifyOrReturn(CheckValue("groupId", groupId, 0U)); + VerifyOrReturn(CheckValueNonNull("userName", value.userName)); + VerifyOrReturn(CheckValueAsString("userName.Value()", value.userName.Value(), chip::CharSpan("last_user", 9))); - NextTest(); - } + VerifyOrReturn(CheckValueNull("userUniqueId", value.userUniqueId)); - CHIP_ERROR TestRemoveGroup4NotFound_10() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::Groups::Commands::RemoveGroup::Type; + VerifyOrReturn(CheckValueNonNull("userStatus", value.userStatus)); + VerifyOrReturn(CheckValue("userStatus.Value()", value.userStatus.Value(), 1)); - RequestType request; - request.groupId = 4U; + VerifyOrReturn(CheckValueNonNull("userType", value.userType)); + VerifyOrReturn(CheckValue("userType.Value()", value.userType.Value(), 0)); - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_10(data.status, data.groupId); - }; + VerifyOrReturn(CheckValueNonNull("credentialRule", value.credentialRule)); + VerifyOrReturn(CheckValue("credentialRule.Value()", value.credentialRule.Value(), 0)); - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_10(error); - }; + VerifyOrReturn(CheckValueNull("credentials", value.credentials)); - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } + VerifyOrReturn(CheckValueNonNull("creatorFabricIndex", value.creatorFabricIndex)); + VerifyOrReturn(CheckValue("creatorFabricIndex.Value()", value.creatorFabricIndex.Value(), 1)); - void OnFailureResponse_10(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } + VerifyOrReturn(CheckValueNonNull("lastModifiedFabricIndex", value.lastModifiedFabricIndex)); + VerifyOrReturn(CheckValue("lastModifiedFabricIndex.Value()", value.lastModifiedFabricIndex.Value(), 1)); - void OnSuccessResponse_10(uint8_t status, chip::GroupId groupId) - { - VerifyOrReturn(CheckValue("status", status, 139)); + VerifyOrReturn(CheckValueNull("nextUserIndex", value.nextUserIndex)); + } + break; + case 24: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_COMMAND)); + break; + case 25: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_COMMAND)); + break; + case 26: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 27: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DoorLock::Commands::GetUserResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("userIndex", value.userIndex, 1U)); - VerifyOrReturn(CheckValue("groupId", groupId, 4U)); + VerifyOrReturn(CheckValueNull("userName", value.userName)); - NextTest(); - } + VerifyOrReturn(CheckValueNull("userUniqueId", value.userUniqueId)); - CHIP_ERROR TestViewGroup1NotRemoved_11() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::Groups::Commands::ViewGroup::Type; + VerifyOrReturn(CheckValueNull("userStatus", value.userStatus)); - RequestType request; - request.groupId = 1U; + VerifyOrReturn(CheckValueNull("userType", value.userType)); - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_11(data.status, data.groupId, data.groupName); - }; + VerifyOrReturn(CheckValueNull("credentialRule", value.credentialRule)); - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_11(error); - }; + VerifyOrReturn(CheckValueNull("credentials", value.credentials)); - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } + VerifyOrReturn(CheckValueNull("creatorFabricIndex", value.creatorFabricIndex)); - void OnFailureResponse_11(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } + VerifyOrReturn(CheckValueNull("lastModifiedFabricIndex", value.lastModifiedFabricIndex)); - void OnSuccessResponse_11(uint8_t status, chip::GroupId groupId, chip::CharSpan groupName) - { - VerifyOrReturn(CheckValue("status", status, 0)); + VerifyOrReturn(CheckValueNonNull("nextUserIndex", value.nextUserIndex)); + VerifyOrReturn(CheckValue("nextUserIndex.Value()", value.nextUserIndex.Value(), 3U)); + } + break; + case 28: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 29: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DoorLock::Commands::GetUserResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("userIndex", value.userIndex, 1U)); - VerifyOrReturn(CheckValue("groupId", groupId, 1U)); + VerifyOrReturn(CheckValueNonNull("userName", value.userName)); + VerifyOrReturn(CheckValueAsString("userName.Value()", value.userName.Value(), chip::CharSpan("", 0))); - VerifyOrReturn(CheckValueAsString("groupName", groupName, chip::CharSpan("Group #1", 8))); + VerifyOrReturn(CheckValueNull("userUniqueId", value.userUniqueId)); - NextTest(); - } + VerifyOrReturn(CheckValueNonNull("userStatus", value.userStatus)); + VerifyOrReturn(CheckValue("userStatus.Value()", value.userStatus.Value(), 1)); - CHIP_ERROR TestViewGroup2Removed_12() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::Groups::Commands::ViewGroup::Type; + VerifyOrReturn(CheckValueNonNull("userType", value.userType)); + VerifyOrReturn(CheckValue("userType.Value()", value.userType.Value(), 0)); - RequestType request; - request.groupId = 4369U; + VerifyOrReturn(CheckValueNonNull("credentialRule", value.credentialRule)); + VerifyOrReturn(CheckValue("credentialRule.Value()", value.credentialRule.Value(), 0)); - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_12(data.status, data.groupId, data.groupName); - }; + VerifyOrReturn(CheckValueNull("credentials", value.credentials)); - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_12(error); - }; + VerifyOrReturn(CheckValueNonNull("creatorFabricIndex", value.creatorFabricIndex)); + VerifyOrReturn(CheckValue("creatorFabricIndex.Value()", value.creatorFabricIndex.Value(), 1)); - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } + VerifyOrReturn(CheckValueNonNull("lastModifiedFabricIndex", value.lastModifiedFabricIndex)); + VerifyOrReturn(CheckValue("lastModifiedFabricIndex.Value()", value.lastModifiedFabricIndex.Value(), 1)); - void OnFailureResponse_12(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } + VerifyOrReturn(CheckValueNonNull("nextUserIndex", value.nextUserIndex)); + VerifyOrReturn(CheckValue("nextUserIndex.Value()", value.nextUserIndex.Value(), 3U)); + } + break; + case 30: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_COMMAND)); + break; + case 31: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_COMMAND)); + break; + case 32: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 33: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DoorLock::Commands::GetUserResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("userIndex", value.userIndex, 2U)); - void OnSuccessResponse_12(uint8_t status, chip::GroupId groupId, chip::CharSpan groupName) - { - VerifyOrReturn(CheckValue("status", status, 139)); + VerifyOrReturn(CheckValueNull("userName", value.userName)); - VerifyOrReturn(CheckValue("groupId", groupId, 4369U)); + VerifyOrReturn(CheckValueNull("userUniqueId", value.userUniqueId)); - NextTest(); - } + VerifyOrReturn(CheckValueNull("userStatus", value.userStatus)); - CHIP_ERROR TestGetGroupMembership3_13() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::Groups::Commands::GetGroupMembership::Type; + VerifyOrReturn(CheckValueNull("userType", value.userType)); - ListFreer listFreer; - RequestType request; + VerifyOrReturn(CheckValueNull("credentialRule", value.credentialRule)); - { - auto * listHolder_0 = new ListHolder(4); - listFreer.add(listHolder_0); - listHolder_0->mList[0] = 1U; - listHolder_0->mList[1] = 2U; - listHolder_0->mList[2] = 4369U; - listHolder_0->mList[3] = 3U; - request.groupList = chip::app::DataModel::List(listHolder_0->mList, 4); - } + VerifyOrReturn(CheckValueNull("credentials", value.credentials)); - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_13(data.capacity, data.groupList); - }; + VerifyOrReturn(CheckValueNull("creatorFabricIndex", value.creatorFabricIndex)); - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_13(error); - }; + VerifyOrReturn(CheckValueNull("lastModifiedFabricIndex", value.lastModifiedFabricIndex)); - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } + VerifyOrReturn(CheckValueNonNull("nextUserIndex", value.nextUserIndex)); + VerifyOrReturn(CheckValue("nextUserIndex.Value()", value.nextUserIndex.Value(), 3U)); + } + break; + case 34: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DoorLock::Commands::GetUserResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("userIndex", value.userIndex, NumberOfTotalUsersSupported)); - void OnFailureResponse_13(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } + VerifyOrReturn(CheckValueNull("userName", value.userName)); - void OnSuccessResponse_13(const chip::app::DataModel::Nullable & capacity, - const chip::app::DataModel::DecodableList & groupList) - { - VerifyOrReturn(CheckValueNull("capacity", capacity)); + VerifyOrReturn(CheckValueNull("userUniqueId", value.userUniqueId)); - { - auto iter_0 = groupList.begin(); - VerifyOrReturn(CheckNextListItemDecodes("groupList", iter_0, 0)); - VerifyOrReturn(CheckValue("groupList[0]", iter_0.GetValue(), 1U)); - VerifyOrReturn(CheckNoMoreListItems("groupList", iter_0, 1)); - } + VerifyOrReturn(CheckValueNull("userStatus", value.userStatus)); - NextTest(); - } + VerifyOrReturn(CheckValueNull("userType", value.userType)); - CHIP_ERROR TestRemoveAll_14() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::Groups::Commands::RemoveAllGroups::Type; + VerifyOrReturn(CheckValueNull("credentialRule", value.credentialRule)); - RequestType request; + VerifyOrReturn(CheckValueNull("credentials", value.credentials)); - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_14(); - }; + VerifyOrReturn(CheckValueNull("creatorFabricIndex", value.creatorFabricIndex)); - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_14(error); - }; + VerifyOrReturn(CheckValueNull("lastModifiedFabricIndex", value.lastModifiedFabricIndex)); - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } + VerifyOrReturn(CheckValueNull("nextUserIndex", value.nextUserIndex)); + } + break; + case 35: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("numberOfPINUsersSupported", value, 10U)); - void OnFailureResponse_14(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } + NumberOfPINUsersSupported = value; + } + break; + case 36: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DoorLock::Commands::GetCredentialStatusResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("credentialExists", value.credentialExists, false)); - void OnSuccessResponse_14() { NextTest(); } + VerifyOrReturn(CheckValueNull("userIndex", value.userIndex)); - CHIP_ERROR TestViewGroup1Removed_15() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::Groups::Commands::ViewGroup::Type; + VerifyOrReturn(CheckValueNonNull("nextCredentialIndex", value.nextCredentialIndex)); + VerifyOrReturn(CheckValue("nextCredentialIndex.Value()", value.nextCredentialIndex.Value(), 2U)); + } + break; + case 37: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_COMMAND)); + break; + case 38: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_COMMAND)); + break; + case 39: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DoorLock::Commands::SetCredentialResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("status", value.status, 0)); - RequestType request; - request.groupId = 1U; + VerifyOrReturn(CheckValueNonNull("userIndex", value.userIndex)); + VerifyOrReturn(CheckValue("userIndex.Value()", value.userIndex.Value(), 1U)); - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_15(data.status, data.groupId, data.groupName); - }; + VerifyOrReturn(CheckValueNonNull("nextCredentialIndex", value.nextCredentialIndex)); + VerifyOrReturn(CheckValue("nextCredentialIndex.Value()", value.nextCredentialIndex.Value(), 2U)); + } + break; + case 40: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DoorLock::Commands::GetUserResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("userIndex", value.userIndex, 1U)); - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_15(error); - }; + VerifyOrReturn(CheckValueNonNull("userName", value.userName)); + VerifyOrReturn(CheckValueAsString("userName.Value()", value.userName.Value(), chip::CharSpan("", 0))); - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } + VerifyOrReturn(CheckValueNull("userUniqueId", value.userUniqueId)); - void OnFailureResponse_15(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } + VerifyOrReturn(CheckValueNonNull("userStatus", value.userStatus)); + VerifyOrReturn(CheckValue("userStatus.Value()", value.userStatus.Value(), 1)); - void OnSuccessResponse_15(uint8_t status, chip::GroupId groupId, chip::CharSpan groupName) - { - VerifyOrReturn(CheckValue("status", status, 139)); + VerifyOrReturn(CheckValueNonNull("userType", value.userType)); + VerifyOrReturn(CheckValue("userType.Value()", value.userType.Value(), 0)); - VerifyOrReturn(CheckValue("groupId", groupId, 1U)); + VerifyOrReturn(CheckValueNonNull("credentialRule", value.credentialRule)); + VerifyOrReturn(CheckValue("credentialRule.Value()", value.credentialRule.Value(), 0)); - NextTest(); - } + VerifyOrReturn(CheckValueNonNull("credentials", value.credentials)); + { + auto iter_1 = value.credentials.Value().begin(); + VerifyOrReturn(CheckNextListItemDecodes("credentials.Value()", iter_1, 0)); + VerifyOrReturn(CheckValue("credentials.Value()[0].credentialType", iter_1.GetValue().credentialType, 1)); + VerifyOrReturn(CheckValue("credentials.Value()[0].credentialIndex", iter_1.GetValue().credentialIndex, 1U)); + VerifyOrReturn(CheckNoMoreListItems("credentials.Value()", iter_1, 1)); + } - CHIP_ERROR TestViewGroup2StillRemoved_16() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::Groups::Commands::ViewGroup::Type; + VerifyOrReturn(CheckValueNonNull("creatorFabricIndex", value.creatorFabricIndex)); + VerifyOrReturn(CheckValue("creatorFabricIndex.Value()", value.creatorFabricIndex.Value(), 1)); - RequestType request; - request.groupId = 4369U; + VerifyOrReturn(CheckValueNonNull("lastModifiedFabricIndex", value.lastModifiedFabricIndex)); + VerifyOrReturn(CheckValue("lastModifiedFabricIndex.Value()", value.lastModifiedFabricIndex.Value(), 1)); - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_16(data.status, data.groupId, data.groupName); - }; + VerifyOrReturn(CheckValueNonNull("nextUserIndex", value.nextUserIndex)); + VerifyOrReturn(CheckValue("nextUserIndex.Value()", value.nextUserIndex.Value(), 2U)); + } + break; + case 41: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DoorLock::Commands::GetCredentialStatusResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("credentialExists", value.credentialExists, true)); - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_16(error); - }; + VerifyOrReturn(CheckValueNonNull("userIndex", value.userIndex)); + VerifyOrReturn(CheckValue("userIndex.Value()", value.userIndex.Value(), 1U)); - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } + VerifyOrReturn(CheckValueNonNull("nextCredentialIndex", value.nextCredentialIndex)); + VerifyOrReturn(CheckValue("nextCredentialIndex.Value()", value.nextCredentialIndex.Value(), 2U)); + } + break; + case 42: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DoorLock::Commands::SetCredentialResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("status", value.status, 133)); - void OnFailureResponse_16(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } + VerifyOrReturn(CheckValueNull("userIndex", value.userIndex)); - void OnSuccessResponse_16(uint8_t status, chip::GroupId groupId, chip::CharSpan groupName) - { - VerifyOrReturn(CheckValue("status", status, 139)); + VerifyOrReturn(CheckValueNonNull("nextCredentialIndex", value.nextCredentialIndex)); + VerifyOrReturn(CheckValue("nextCredentialIndex.Value()", value.nextCredentialIndex.Value(), 2U)); + } + break; + case 43: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DoorLock::Commands::SetCredentialResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("status", value.status, 133)); - VerifyOrReturn(CheckValue("groupId", groupId, 4369U)); + VerifyOrReturn(CheckValueNull("userIndex", value.userIndex)); - NextTest(); - } + VerifyOrReturn(CheckValueNull("nextCredentialIndex", value.nextCredentialIndex)); + } + break; + case 44: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("numberOfRFIDUsersSupported", value, 10U)); - CHIP_ERROR TestViewGroup3Removed_17() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::Groups::Commands::ViewGroup::Type; + NumberOfRFIDUsersSupported = value; + } + break; + case 45: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_COMMAND)); + break; + case 46: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_COMMAND)); + break; + case 47: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DoorLock::Commands::GetCredentialStatusResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("credentialExists", value.credentialExists, false)); - RequestType request; - request.groupId = 32767U; + VerifyOrReturn(CheckValueNull("userIndex", value.userIndex)); - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_17(data.status, data.groupId, data.groupName); - }; + VerifyOrReturn(CheckValueNonNull("nextCredentialIndex", value.nextCredentialIndex)); + VerifyOrReturn(CheckValue("nextCredentialIndex.Value()", value.nextCredentialIndex.Value(), 3U)); + } + break; + case 48: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DoorLock::Commands::SetCredentialResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("status", value.status, 0)); - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_17(error); - }; + VerifyOrReturn(CheckValueNull("userIndex", value.userIndex)); - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } + VerifyOrReturn(CheckValueNonNull("nextCredentialIndex", value.nextCredentialIndex)); + VerifyOrReturn(CheckValue("nextCredentialIndex.Value()", value.nextCredentialIndex.Value(), 3U)); + } + break; + case 49: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DoorLock::Commands::GetUserResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("userIndex", value.userIndex, 1U)); - void OnFailureResponse_17(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } + VerifyOrReturn(CheckValueNonNull("userName", value.userName)); + VerifyOrReturn(CheckValueAsString("userName.Value()", value.userName.Value(), chip::CharSpan("", 0))); - void OnSuccessResponse_17(uint8_t status, chip::GroupId groupId, chip::CharSpan groupName) - { - VerifyOrReturn(CheckValue("status", status, 139)); + VerifyOrReturn(CheckValueNull("userUniqueId", value.userUniqueId)); - VerifyOrReturn(CheckValue("groupId", groupId, 32767U)); + VerifyOrReturn(CheckValueNonNull("userStatus", value.userStatus)); + VerifyOrReturn(CheckValue("userStatus.Value()", value.userStatus.Value(), 1)); - NextTest(); - } + VerifyOrReturn(CheckValueNonNull("userType", value.userType)); + VerifyOrReturn(CheckValue("userType.Value()", value.userType.Value(), 0)); - CHIP_ERROR TestGetGroupMembership4_18() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::Groups::Commands::GetGroupMembership::Type; + VerifyOrReturn(CheckValueNonNull("credentialRule", value.credentialRule)); + VerifyOrReturn(CheckValue("credentialRule.Value()", value.credentialRule.Value(), 0)); - ListFreer listFreer; - RequestType request; + VerifyOrReturn(CheckValueNonNull("credentials", value.credentials)); + { + auto iter_1 = value.credentials.Value().begin(); + VerifyOrReturn(CheckNextListItemDecodes("credentials.Value()", iter_1, 0)); + VerifyOrReturn(CheckValue("credentials.Value()[0].credentialType", iter_1.GetValue().credentialType, 1)); + VerifyOrReturn(CheckValue("credentials.Value()[0].credentialIndex", iter_1.GetValue().credentialIndex, 1U)); + VerifyOrReturn(CheckNextListItemDecodes("credentials.Value()", iter_1, 1)); + VerifyOrReturn(CheckValue("credentials.Value()[1].credentialType", iter_1.GetValue().credentialType, 2)); + VerifyOrReturn(CheckValue("credentials.Value()[1].credentialIndex", iter_1.GetValue().credentialIndex, 2U)); + VerifyOrReturn(CheckNoMoreListItems("credentials.Value()", iter_1, 2)); + } - { - auto * listHolder_0 = new ListHolder(5); - listFreer.add(listHolder_0); - listHolder_0->mList[0] = 1U; - listHolder_0->mList[1] = 2U; - listHolder_0->mList[2] = 4369U; - listHolder_0->mList[3] = 3U; - listHolder_0->mList[4] = 32767U; - request.groupList = chip::app::DataModel::List(listHolder_0->mList, 5); - } + VerifyOrReturn(CheckValueNonNull("creatorFabricIndex", value.creatorFabricIndex)); + VerifyOrReturn(CheckValue("creatorFabricIndex.Value()", value.creatorFabricIndex.Value(), 1)); - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_18(data.capacity, data.groupList); - }; + VerifyOrReturn(CheckValueNonNull("lastModifiedFabricIndex", value.lastModifiedFabricIndex)); + VerifyOrReturn(CheckValue("lastModifiedFabricIndex.Value()", value.lastModifiedFabricIndex.Value(), 1)); - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_18(error); - }; + VerifyOrReturn(CheckValueNonNull("nextUserIndex", value.nextUserIndex)); + VerifyOrReturn(CheckValue("nextUserIndex.Value()", value.nextUserIndex.Value(), 2U)); + } + break; + case 50: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DoorLock::Commands::GetCredentialStatusResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("credentialExists", value.credentialExists, true)); - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } + VerifyOrReturn(CheckValueNonNull("userIndex", value.userIndex)); + VerifyOrReturn(CheckValue("userIndex.Value()", value.userIndex.Value(), 1U)); - void OnFailureResponse_18(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } + VerifyOrReturn(CheckValueNonNull("nextCredentialIndex", value.nextCredentialIndex)); + VerifyOrReturn(CheckValue("nextCredentialIndex.Value()", value.nextCredentialIndex.Value(), 3U)); + } + break; + case 51: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DoorLock::Commands::SetCredentialResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("status", value.status, 133)); - void OnSuccessResponse_18(const chip::app::DataModel::Nullable & capacity, - const chip::app::DataModel::DecodableList & groupList) - { - VerifyOrReturn(CheckValueNull("capacity", capacity)); + VerifyOrReturn(CheckValueNull("userIndex", value.userIndex)); - { - auto iter_0 = groupList.begin(); - VerifyOrReturn(CheckNoMoreListItems("groupList", iter_0, 0)); - } + VerifyOrReturn(CheckValueNonNull("nextCredentialIndex", value.nextCredentialIndex)); + VerifyOrReturn(CheckValue("nextCredentialIndex.Value()", value.nextCredentialIndex.Value(), 3U)); + } + break; + case 52: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DoorLock::Commands::SetCredentialResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("status", value.status, 133)); - NextTest(); - } -}; + VerifyOrReturn(CheckValueNull("userIndex", value.userIndex)); -class TestGroupKeyManagementClusterSuite : public TestCommand -{ -public: - TestGroupKeyManagementClusterSuite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("TestGroupKeyManagementCluster", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } + VerifyOrReturn(CheckValueNull("nextCredentialIndex", value.nextCredentialIndex)); + } + break; + case 53: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DoorLock::Commands::SetCredentialResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("status", value.status, 3)); - ~TestGroupKeyManagementClusterSuite() {} + VerifyOrReturn(CheckValueNull("userIndex", value.userIndex)); - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; + VerifyOrReturn(CheckValueNonNull("nextCredentialIndex", value.nextCredentialIndex)); + VerifyOrReturn(CheckValue("nextCredentialIndex.Value()", value.nextCredentialIndex.Value(), 4U)); + } + break; + case 54: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DoorLock::Commands::SetCredentialResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("status", value.status, 133)); - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: TestGroupKeyManagementCluster\n"); - } + VerifyOrReturn(CheckValueNull("userIndex", value.userIndex)); - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: TestGroupKeyManagementCluster\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } + VerifyOrReturn(CheckValueNonNull("nextCredentialIndex", value.nextCredentialIndex)); + VerifyOrReturn(CheckValue("nextCredentialIndex.Value()", value.nextCredentialIndex.Value(), 4U)); + } + break; + case 55: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DoorLock::Commands::SetCredentialResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("status", value.status, 133)); - Wait(); + VerifyOrReturn(CheckValueNull("userIndex", value.userIndex)); - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Read maxGroupsPerFabric\n"); - err = TestReadMaxGroupsPerFabric_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Read maxGroupKeysPerFabric\n"); - err = TestReadMaxGroupKeysPerFabric_2(); - break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Add Group 1\n"); - err = TestAddGroup1_3(); - break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Add Group 2\n"); - err = TestAddGroup2_4(); - break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : KeySet Write 1\n"); - err = TestKeySetWrite1_5(); - break; - case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : KeySet Write 2\n"); - err = TestKeySetWrite2_6(); - break; - case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : KeySet Read\n"); - err = TestKeySetRead_7(); - break; - case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : Write Group Keys (invalid)\n"); - err = TestWriteGroupKeysInvalid_8(); - break; - case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : Write Group Keys\n"); - err = TestWriteGroupKeys_9(); - break; - case 10: - ChipLogProgress(chipTool, " ***** Test Step 10 : Read Group Keys\n"); - err = TestReadGroupKeys_10(); - break; - case 11: - ChipLogProgress(chipTool, " ***** Test Step 11 : Read GroupTable\n"); - err = TestReadGroupTable_11(); - break; - case 12: - ChipLogProgress(chipTool, " ***** Test Step 12 : KeySet Remove 1\n"); - err = TestKeySetRemove1_12(); - break; - case 13: - ChipLogProgress(chipTool, " ***** Test Step 13 : KeySet Read (removed)\n"); - err = TestKeySetReadRemoved_13(); - break; - case 14: - ChipLogProgress(chipTool, " ***** Test Step 14 : KeySet Read (not removed)\n"); - err = TestKeySetReadNotRemoved_14(); - break; - case 15: - ChipLogProgress(chipTool, " ***** Test Step 15 : Remove All\n"); - err = TestRemoveAll_15(); + VerifyOrReturn(CheckValueNonNull("nextCredentialIndex", value.nextCredentialIndex)); + VerifyOrReturn(CheckValue("nextCredentialIndex.Value()", value.nextCredentialIndex.Value(), 4U)); + } break; - case 16: - ChipLogProgress(chipTool, " ***** Test Step 16 : KeySet Remove 2\n"); - err = TestKeySetRemove2_16(); + case 56: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DoorLock::Commands::SetCredentialResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("status", value.status, 133)); + + VerifyOrReturn(CheckValueNull("userIndex", value.userIndex)); + + VerifyOrReturn(CheckValueNonNull("nextCredentialIndex", value.nextCredentialIndex)); + VerifyOrReturn(CheckValue("nextCredentialIndex.Value()", value.nextCredentialIndex.Value(), 4U)); + } break; - case 17: - ChipLogProgress(chipTool, " ***** Test Step 17 : KeySet Read (also removed)\n"); - err = TestKeySetReadAlsoRemoved_17(); + case 57: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DoorLock::Commands::SetCredentialResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("status", value.status, 133)); + + VerifyOrReturn(CheckValueNull("userIndex", value.userIndex)); + + VerifyOrReturn(CheckValueNonNull("nextCredentialIndex", value.nextCredentialIndex)); + VerifyOrReturn(CheckValue("nextCredentialIndex.Value()", value.nextCredentialIndex.Value(), 4U)); + } break; - } + case 58: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DoorLock::Commands::SetCredentialResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("status", value.status, 133)); - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } + VerifyOrReturn(CheckValueNull("userIndex", value.userIndex)); - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } + VerifyOrReturn(CheckValueNonNull("nextCredentialIndex", value.nextCredentialIndex)); + VerifyOrReturn(CheckValue("nextCredentialIndex.Value()", value.nextCredentialIndex.Value(), 4U)); + } + break; + case 59: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DoorLock::Commands::SetCredentialResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("status", value.status, 133)); -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 18; + VerifyOrReturn(CheckValueNull("userIndex", value.userIndex)); - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; + VerifyOrReturn(CheckValueNonNull("nextCredentialIndex", value.nextCredentialIndex)); + VerifyOrReturn(CheckValue("nextCredentialIndex.Value()", value.nextCredentialIndex.Value(), 4U)); + } + break; + case 60: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DoorLock::Commands::SetCredentialResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("status", value.status, 133)); - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; + VerifyOrReturn(CheckValueNull("userIndex", value.userIndex)); - switch (mTestIndex - 1) - { - case 0: + VerifyOrReturn(CheckValueNonNull("nextCredentialIndex", value.nextCredentialIndex)); + VerifyOrReturn(CheckValue("nextCredentialIndex.Value()", value.nextCredentialIndex.Value(), 4U)); + } + break; + case 61: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; + { + chip::app::Clusters::DoorLock::Commands::SetCredentialResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("status", value.status, 2)); + + VerifyOrReturn(CheckValueNull("userIndex", value.userIndex)); + + VerifyOrReturn(CheckValueNonNull("nextCredentialIndex", value.nextCredentialIndex)); + VerifyOrReturn(CheckValue("nextCredentialIndex.Value()", value.nextCredentialIndex.Value(), 5U)); + } break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } + case 62: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DoorLock::Commands::SetCredentialResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("status", value.status, 2)); - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } + VerifyOrReturn(CheckValueNull("userIndex", value.userIndex)); - static void OnFailureCallback_1(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_1(error); - } + VerifyOrReturn(CheckValueNonNull("nextCredentialIndex", value.nextCredentialIndex)); + VerifyOrReturn(CheckValue("nextCredentialIndex.Value()", value.nextCredentialIndex.Value(), 5U)); + } + break; + case 63: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DoorLock::Commands::SetCredentialResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("status", value.status, 0)); - static void OnSuccessCallback_1(void * context, uint16_t maxGroupsPerFabric) - { - (static_cast(context))->OnSuccessResponse_1(maxGroupsPerFabric); - } + VerifyOrReturn(CheckValueNull("userIndex", value.userIndex)); - static void OnFailureCallback_2(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_2(error); - } + VerifyOrReturn(CheckValueNonNull("nextCredentialIndex", value.nextCredentialIndex)); + VerifyOrReturn(CheckValue("nextCredentialIndex.Value()", value.nextCredentialIndex.Value(), 3U)); + } + break; + case 64: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DoorLock::Commands::SetCredentialResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("status", value.status, 0)); - static void OnSuccessCallback_2(void * context, uint16_t maxGroupKeysPerFabric) - { - (static_cast(context))->OnSuccessResponse_2(maxGroupKeysPerFabric); - } + VerifyOrReturn(CheckValueNonNull("userIndex", value.userIndex)); + VerifyOrReturn(CheckValue("userIndex.Value()", value.userIndex.Value(), 2U)); - static void OnFailureCallback_8(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_8(error); - } + VerifyOrReturn(CheckValueNonNull("nextCredentialIndex", value.nextCredentialIndex)); + VerifyOrReturn(CheckValue("nextCredentialIndex.Value()", value.nextCredentialIndex.Value(), 4U)); + } + break; + case 65: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DoorLock::Commands::SetCredentialResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("status", value.status, 2)); - static void OnSuccessCallback_8(void * context) - { - (static_cast(context))->OnSuccessResponse_8(); - } + VerifyOrReturn(CheckValueNull("userIndex", value.userIndex)); - static void OnFailureCallback_9(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_9(error); - } + VerifyOrReturn(CheckValueNonNull("nextCredentialIndex", value.nextCredentialIndex)); + VerifyOrReturn(CheckValue("nextCredentialIndex.Value()", value.nextCredentialIndex.Value(), 5U)); + } + break; + case 66: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 67: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DoorLock::Commands::GetCredentialStatusResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("credentialExists", value.credentialExists, false)); - static void OnSuccessCallback_9(void * context) - { - (static_cast(context))->OnSuccessResponse_9(); - } + VerifyOrReturn(CheckValueNull("userIndex", value.userIndex)); - static void OnFailureCallback_10(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_10(error); - } + VerifyOrReturn(CheckValueNonNull("nextCredentialIndex", value.nextCredentialIndex)); + VerifyOrReturn(CheckValue("nextCredentialIndex.Value()", value.nextCredentialIndex.Value(), 4U)); + } + break; + case 68: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DoorLock::Commands::GetUserResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("userIndex", value.userIndex, 1U)); - static void - OnSuccessCallback_10(void * context, - const chip::app::DataModel::DecodableList< - chip::app::Clusters::GroupKeyManagement::Structs::GroupKeyMapStruct::DecodableType> & groupKeyMap) - { - (static_cast(context))->OnSuccessResponse_10(groupKeyMap); - } + VerifyOrReturn(CheckValueNonNull("userName", value.userName)); + VerifyOrReturn(CheckValueAsString("userName.Value()", value.userName.Value(), chip::CharSpan("", 0))); - static void OnFailureCallback_11(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_11(error); - } + VerifyOrReturn(CheckValueNull("userUniqueId", value.userUniqueId)); - static void - OnSuccessCallback_11(void * context, - const chip::app::DataModel::DecodableList< - chip::app::Clusters::GroupKeyManagement::Structs::GroupInfoMapStruct::DecodableType> & groupTable) - { - (static_cast(context))->OnSuccessResponse_11(groupTable); - } + VerifyOrReturn(CheckValueNonNull("userStatus", value.userStatus)); + VerifyOrReturn(CheckValue("userStatus.Value()", value.userStatus.Value(), 1)); - // - // Tests methods - // + VerifyOrReturn(CheckValueNonNull("userType", value.userType)); + VerifyOrReturn(CheckValue("userType.Value()", value.userType.Value(), 0)); - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } + VerifyOrReturn(CheckValueNonNull("credentialRule", value.credentialRule)); + VerifyOrReturn(CheckValue("credentialRule.Value()", value.credentialRule.Value(), 0)); - CHIP_ERROR TestReadMaxGroupsPerFabric_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::GroupKeyManagementClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); + VerifyOrReturn(CheckValueNonNull("credentials", value.credentials)); + { + auto iter_1 = value.credentials.Value().begin(); + VerifyOrReturn(CheckNextListItemDecodes("credentials.Value()", iter_1, 0)); + VerifyOrReturn(CheckValue("credentials.Value()[0].credentialType", iter_1.GetValue().credentialType, 2)); + VerifyOrReturn(CheckValue("credentials.Value()[0].credentialIndex", iter_1.GetValue().credentialIndex, 2U)); + VerifyOrReturn(CheckNoMoreListItems("credentials.Value()", iter_1, 1)); + } - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_1, OnFailureCallback_1, true)); - return CHIP_NO_ERROR; - } + VerifyOrReturn(CheckValueNonNull("creatorFabricIndex", value.creatorFabricIndex)); + VerifyOrReturn(CheckValue("creatorFabricIndex.Value()", value.creatorFabricIndex.Value(), 1)); - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } + VerifyOrReturn(CheckValueNonNull("lastModifiedFabricIndex", value.lastModifiedFabricIndex)); + VerifyOrReturn(CheckValue("lastModifiedFabricIndex.Value()", value.lastModifiedFabricIndex.Value(), 1)); - void OnSuccessResponse_1(uint16_t maxGroupsPerFabric) - { - VerifyOrReturn(CheckConstraintMinValue("maxGroupsPerFabric", maxGroupsPerFabric, 2U)); - NextTest(); - } + VerifyOrReturn(CheckValueNonNull("nextUserIndex", value.nextUserIndex)); + VerifyOrReturn(CheckValue("nextUserIndex.Value()", value.nextUserIndex.Value(), 3U)); + } + break; + case 69: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 70: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DoorLock::Commands::GetCredentialStatusResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("credentialExists", value.credentialExists, false)); - CHIP_ERROR TestReadMaxGroupKeysPerFabric_2() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::GroupKeyManagementClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); + VerifyOrReturn(CheckValueNull("userIndex", value.userIndex)); - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_2, OnFailureCallback_2, true)); - return CHIP_NO_ERROR; - } + VerifyOrReturn(CheckValueNonNull("nextCredentialIndex", value.nextCredentialIndex)); + VerifyOrReturn(CheckValue("nextCredentialIndex.Value()", value.nextCredentialIndex.Value(), 4U)); + } + break; + case 71: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DoorLock::Commands::GetUserResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("userIndex", value.userIndex, 2U)); - void OnFailureResponse_2(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } + VerifyOrReturn(CheckValueNull("userName", value.userName)); - void OnSuccessResponse_2(uint16_t maxGroupKeysPerFabric) - { - VerifyOrReturn(CheckValue("maxGroupKeysPerFabric", maxGroupKeysPerFabric, 2U)); + VerifyOrReturn(CheckValueNull("userUniqueId", value.userUniqueId)); - NextTest(); - } + VerifyOrReturn(CheckValueNull("userStatus", value.userStatus)); - CHIP_ERROR TestAddGroup1_3() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::Groups::Commands::AddGroup::Type; + VerifyOrReturn(CheckValueNull("userType", value.userType)); - RequestType request; - request.groupId = 257U; - request.groupName = chip::Span("Group #1garbage: not in length on purpose", 8); + VerifyOrReturn(CheckValueNull("credentialRule", value.credentialRule)); - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_3(data.status, data.groupId); - }; + VerifyOrReturn(CheckValueNull("credentials", value.credentials)); - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_3(error); - }; + VerifyOrReturn(CheckValueNull("creatorFabricIndex", value.creatorFabricIndex)); - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } + VerifyOrReturn(CheckValueNull("lastModifiedFabricIndex", value.lastModifiedFabricIndex)); - void OnFailureResponse_3(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } + VerifyOrReturn(CheckValueNonNull("nextUserIndex", value.nextUserIndex)); + VerifyOrReturn(CheckValue("nextUserIndex.Value()", value.nextUserIndex.Value(), 3U)); + } + break; + case 72: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DoorLock::Commands::SetCredentialResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("status", value.status, 0)); - void OnSuccessResponse_3(uint8_t status, chip::GroupId groupId) - { - VerifyOrReturn(CheckValue("status", status, 0)); + VerifyOrReturn(CheckValueNonNull("userIndex", value.userIndex)); + VerifyOrReturn(CheckValue("userIndex.Value()", value.userIndex.Value(), 2U)); - VerifyOrReturn(CheckValue("groupId", groupId, 257U)); + VerifyOrReturn(CheckValueNonNull("nextCredentialIndex", value.nextCredentialIndex)); + VerifyOrReturn(CheckValue("nextCredentialIndex.Value()", value.nextCredentialIndex.Value(), 3U)); + } + break; + case 73: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 74: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DoorLock::Commands::GetCredentialStatusResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("credentialExists", value.credentialExists, false)); - NextTest(); - } + VerifyOrReturn(CheckValueNull("userIndex", value.userIndex)); - CHIP_ERROR TestAddGroup2_4() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::Groups::Commands::AddGroup::Type; + VerifyOrReturn(CheckValueNonNull("nextCredentialIndex", value.nextCredentialIndex)); + VerifyOrReturn(CheckValue("nextCredentialIndex.Value()", value.nextCredentialIndex.Value(), 2U)); + } + break; + case 75: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DoorLock::Commands::GetCredentialStatusResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("credentialExists", value.credentialExists, false)); - RequestType request; - request.groupId = 258U; - request.groupName = chip::Span("Group #2garbage: not in length on purpose", 8); + VerifyOrReturn(CheckValueNull("userIndex", value.userIndex)); - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_4(data.status, data.groupId); - }; + VerifyOrReturn(CheckValueNonNull("nextCredentialIndex", value.nextCredentialIndex)); + VerifyOrReturn(CheckValue("nextCredentialIndex.Value()", value.nextCredentialIndex.Value(), 3U)); + } + break; + case 76: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DoorLock::Commands::GetUserResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("userIndex", value.userIndex, 1U)); - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_4(error); - }; + VerifyOrReturn(CheckValueNull("userName", value.userName)); - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } + VerifyOrReturn(CheckValueNull("userUniqueId", value.userUniqueId)); - void OnFailureResponse_4(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } + VerifyOrReturn(CheckValueNull("userStatus", value.userStatus)); - void OnSuccessResponse_4(uint8_t status, chip::GroupId groupId) - { - VerifyOrReturn(CheckValue("status", status, 0)); + VerifyOrReturn(CheckValueNull("userType", value.userType)); - VerifyOrReturn(CheckValue("groupId", groupId, 258U)); + VerifyOrReturn(CheckValueNull("credentialRule", value.credentialRule)); - NextTest(); - } + VerifyOrReturn(CheckValueNull("credentials", value.credentials)); - CHIP_ERROR TestKeySetWrite1_5() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - using RequestType = chip::app::Clusters::GroupKeyManagement::Commands::KeySetWrite::Type; + VerifyOrReturn(CheckValueNull("creatorFabricIndex", value.creatorFabricIndex)); - RequestType request; + VerifyOrReturn(CheckValueNull("lastModifiedFabricIndex", value.lastModifiedFabricIndex)); - request.groupKeySet.groupKeySetID = 417U; - request.groupKeySet.groupKeySecurityPolicy = - static_cast(0); - request.groupKeySet.epochKey0.SetNonNull(); - request.groupKeySet.epochKey0.Value() = - chip::ByteSpan(chip::Uint8::from_const_char( - "\240\241\242\243\244\245\246\247\250\251\252\253\254\255\256\257garbage: not in length on purpose"), - 16); - request.groupKeySet.epochStartTime0.SetNonNull(); - request.groupKeySet.epochStartTime0.Value() = 1110000ULL; - request.groupKeySet.epochKey1.SetNonNull(); - request.groupKeySet.epochKey1.Value() = - chip::ByteSpan(chip::Uint8::from_const_char( - "\260\261\262\263\264\265\266\267\270\271\272\273\274\275\276\277garbage: not in length on purpose"), - 16); - request.groupKeySet.epochStartTime1.SetNonNull(); - request.groupKeySet.epochStartTime1.Value() = 1110001ULL; - request.groupKeySet.epochKey2.SetNonNull(); - request.groupKeySet.epochKey2.Value() = - chip::ByteSpan(chip::Uint8::from_const_char( - "\300\301\302\303\304\305\306\307\310\311\312\313\314\315\316\317garbage: not in length on purpose"), - 16); - request.groupKeySet.epochStartTime2.SetNonNull(); - request.groupKeySet.epochStartTime2.Value() = 1110002ULL; + VerifyOrReturn(CheckValueNonNull("nextUserIndex", value.nextUserIndex)); + VerifyOrReturn(CheckValue("nextUserIndex.Value()", value.nextUserIndex.Value(), 2U)); + } + break; + case 77: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DoorLock::Commands::GetUserResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("userIndex", value.userIndex, 2U)); - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_5(); - }; + VerifyOrReturn(CheckValueNull("userName", value.userName)); - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_5(error); - }; + VerifyOrReturn(CheckValueNull("userUniqueId", value.userUniqueId)); - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } + VerifyOrReturn(CheckValueNull("userStatus", value.userStatus)); - void OnFailureResponse_5(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } + VerifyOrReturn(CheckValueNull("userType", value.userType)); - void OnSuccessResponse_5() { NextTest(); } + VerifyOrReturn(CheckValueNull("credentialRule", value.credentialRule)); - CHIP_ERROR TestKeySetWrite2_6() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - using RequestType = chip::app::Clusters::GroupKeyManagement::Commands::KeySetWrite::Type; + VerifyOrReturn(CheckValueNull("credentials", value.credentials)); - RequestType request; + VerifyOrReturn(CheckValueNull("creatorFabricIndex", value.creatorFabricIndex)); - request.groupKeySet.groupKeySetID = 418U; - request.groupKeySet.groupKeySecurityPolicy = - static_cast(1); - request.groupKeySet.epochKey0.SetNonNull(); - request.groupKeySet.epochKey0.Value() = - chip::ByteSpan(chip::Uint8::from_const_char( - "\320\321\322\323\324\325\326\327\330\331\332\333\334\335\336\337garbage: not in length on purpose"), - 16); - request.groupKeySet.epochStartTime0.SetNonNull(); - request.groupKeySet.epochStartTime0.Value() = 2110000ULL; - request.groupKeySet.epochKey1.SetNonNull(); - request.groupKeySet.epochKey1.Value() = - chip::ByteSpan(chip::Uint8::from_const_char( - "\340\341\342\343\344\345\346\347\350\351\352\353\354\355\356\357garbage: not in length on purpose"), - 16); - request.groupKeySet.epochStartTime1.SetNonNull(); - request.groupKeySet.epochStartTime1.Value() = 2110001ULL; - request.groupKeySet.epochKey2.SetNonNull(); - request.groupKeySet.epochKey2.Value() = - chip::ByteSpan(chip::Uint8::from_const_char( - "\360\361\362\363\364\365\366\367\370\371\372\373\374\375\376\377garbage: not in length on purpose"), - 16); - request.groupKeySet.epochStartTime2.SetNonNull(); - request.groupKeySet.epochStartTime2.Value() = 2110002ULL; + VerifyOrReturn(CheckValueNull("lastModifiedFabricIndex", value.lastModifiedFabricIndex)); - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_6(); - }; + VerifyOrReturn(CheckValueNonNull("nextUserIndex", value.nextUserIndex)); + VerifyOrReturn(CheckValue("nextUserIndex.Value()", value.nextUserIndex.Value(), 3U)); + } + break; + case 78: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DoorLock::Commands::SetCredentialResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("status", value.status, 0)); - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_6(error); - }; + VerifyOrReturn(CheckValueNonNull("userIndex", value.userIndex)); + VerifyOrReturn(CheckValue("userIndex.Value()", value.userIndex.Value(), 1U)); - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } + VerifyOrReturn(CheckValueNonNull("nextCredentialIndex", value.nextCredentialIndex)); + VerifyOrReturn(CheckValue("nextCredentialIndex.Value()", value.nextCredentialIndex.Value(), 2U)); + } + break; + case 79: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DoorLock::Commands::SetCredentialResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("status", value.status, 0)); - void OnFailureResponse_6(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } + VerifyOrReturn(CheckValueNonNull("userIndex", value.userIndex)); + VerifyOrReturn(CheckValue("userIndex.Value()", value.userIndex.Value(), 2U)); - void OnSuccessResponse_6() { NextTest(); } + VerifyOrReturn(CheckValueNonNull("nextCredentialIndex", value.nextCredentialIndex)); + VerifyOrReturn(CheckValue("nextCredentialIndex.Value()", value.nextCredentialIndex.Value(), 3U)); + } + break; + case 80: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DoorLock::Commands::SetCredentialResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("status", value.status, 0)); - CHIP_ERROR TestKeySetRead_7() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - using RequestType = chip::app::Clusters::GroupKeyManagement::Commands::KeySetRead::Type; + VerifyOrReturn(CheckValueNonNull("userIndex", value.userIndex)); + VerifyOrReturn(CheckValue("userIndex.Value()", value.userIndex.Value(), 3U)); - RequestType request; - request.groupKeySetID = 417U; + VerifyOrReturn(CheckValueNonNull("nextCredentialIndex", value.nextCredentialIndex)); + VerifyOrReturn(CheckValue("nextCredentialIndex.Value()", value.nextCredentialIndex.Value(), 7U)); + } + break; + case 81: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 82: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DoorLock::Commands::GetCredentialStatusResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("credentialExists", value.credentialExists, false)); - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_7(data.groupKeySet); - }; + VerifyOrReturn(CheckValueNull("userIndex", value.userIndex)); - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_7(error); - }; + VerifyOrReturn(CheckValueNonNull("nextCredentialIndex", value.nextCredentialIndex)); + VerifyOrReturn(CheckValue("nextCredentialIndex.Value()", value.nextCredentialIndex.Value(), 2U)); + } + break; + case 83: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DoorLock::Commands::GetCredentialStatusResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("credentialExists", value.credentialExists, false)); - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } + VerifyOrReturn(CheckValueNull("userIndex", value.userIndex)); - void OnFailureResponse_7(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } + VerifyOrReturn(CheckValueNonNull("nextCredentialIndex", value.nextCredentialIndex)); + VerifyOrReturn(CheckValue("nextCredentialIndex.Value()", value.nextCredentialIndex.Value(), 3U)); + } + break; + case 84: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DoorLock::Commands::GetCredentialStatusResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("credentialExists", value.credentialExists, false)); - void OnSuccessResponse_7(const chip::app::Clusters::GroupKeyManagement::Structs::GroupKeySetStruct::DecodableType & groupKeySet) - { - VerifyOrReturn(CheckValue("groupKeySet.groupKeySetID", groupKeySet.groupKeySetID, 417U)); - VerifyOrReturn(CheckValue("groupKeySet.groupKeySecurityPolicy", groupKeySet.groupKeySecurityPolicy, 0)); - VerifyOrReturn(CheckValueNull("groupKeySet.epochKey0", groupKeySet.epochKey0)); - VerifyOrReturn(CheckValueNonNull("groupKeySet.epochStartTime0", groupKeySet.epochStartTime0)); - VerifyOrReturn(CheckValue("groupKeySet.epochStartTime0.Value()", groupKeySet.epochStartTime0.Value(), 1110000ULL)); - VerifyOrReturn(CheckValueNull("groupKeySet.epochKey1", groupKeySet.epochKey1)); - VerifyOrReturn(CheckValueNonNull("groupKeySet.epochStartTime1", groupKeySet.epochStartTime1)); - VerifyOrReturn(CheckValue("groupKeySet.epochStartTime1.Value()", groupKeySet.epochStartTime1.Value(), 1110001ULL)); - VerifyOrReturn(CheckValueNull("groupKeySet.epochKey2", groupKeySet.epochKey2)); - VerifyOrReturn(CheckValueNonNull("groupKeySet.epochStartTime2", groupKeySet.epochStartTime2)); - VerifyOrReturn(CheckValue("groupKeySet.epochStartTime2.Value()", groupKeySet.epochStartTime2.Value(), 1110002ULL)); + VerifyOrReturn(CheckValueNull("userIndex", value.userIndex)); - NextTest(); - } + VerifyOrReturn(CheckValueNonNull("nextCredentialIndex", value.nextCredentialIndex)); + VerifyOrReturn(CheckValue("nextCredentialIndex.Value()", value.nextCredentialIndex.Value(), 7U)); + } + break; + case 85: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DoorLock::Commands::GetUserResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("userIndex", value.userIndex, 1U)); - CHIP_ERROR TestWriteGroupKeysInvalid_8() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::GroupKeyManagementClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); + VerifyOrReturn(CheckValueNull("userName", value.userName)); - ListFreer listFreer; - chip::app::DataModel::List - groupKeyMapArgument; + VerifyOrReturn(CheckValueNull("userUniqueId", value.userUniqueId)); - { - auto * listHolder_0 = new ListHolder(1); - listFreer.add(listHolder_0); + VerifyOrReturn(CheckValueNull("userStatus", value.userStatus)); - listHolder_0->mList[0].groupId = 258U; - listHolder_0->mList[0].groupKeySetID = 0U; - listHolder_0->mList[0].fabricIndex = 1; + VerifyOrReturn(CheckValueNull("userType", value.userType)); - groupKeyMapArgument = - chip::app::DataModel::List( - listHolder_0->mList, 1); - } + VerifyOrReturn(CheckValueNull("credentialRule", value.credentialRule)); - ReturnErrorOnFailure(cluster.WriteAttribute( - groupKeyMapArgument, this, OnSuccessCallback_8, OnFailureCallback_8)); - return CHIP_NO_ERROR; - } + VerifyOrReturn(CheckValueNull("credentials", value.credentials)); - void OnFailureResponse_8(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - NextTest(); - } + VerifyOrReturn(CheckValueNull("creatorFabricIndex", value.creatorFabricIndex)); - void OnSuccessResponse_8() { ThrowSuccessResponse(); } + VerifyOrReturn(CheckValueNull("lastModifiedFabricIndex", value.lastModifiedFabricIndex)); - CHIP_ERROR TestWriteGroupKeys_9() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::GroupKeyManagementClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); + VerifyOrReturn(CheckValueNonNull("nextUserIndex", value.nextUserIndex)); + VerifyOrReturn(CheckValue("nextUserIndex.Value()", value.nextUserIndex.Value(), 2U)); + } + break; + case 86: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DoorLock::Commands::GetUserResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("userIndex", value.userIndex, 2U)); - ListFreer listFreer; - chip::app::DataModel::List - groupKeyMapArgument; + VerifyOrReturn(CheckValueNull("userName", value.userName)); - { - auto * listHolder_0 = new ListHolder(2); - listFreer.add(listHolder_0); + VerifyOrReturn(CheckValueNull("userUniqueId", value.userUniqueId)); - listHolder_0->mList[0].groupId = 257U; - listHolder_0->mList[0].groupKeySetID = 417U; - listHolder_0->mList[0].fabricIndex = 1; + VerifyOrReturn(CheckValueNull("userStatus", value.userStatus)); - listHolder_0->mList[1].groupId = 258U; - listHolder_0->mList[1].groupKeySetID = 418U; - listHolder_0->mList[1].fabricIndex = 1; + VerifyOrReturn(CheckValueNull("userType", value.userType)); - groupKeyMapArgument = - chip::app::DataModel::List( - listHolder_0->mList, 2); - } + VerifyOrReturn(CheckValueNull("credentialRule", value.credentialRule)); - ReturnErrorOnFailure(cluster.WriteAttribute( - groupKeyMapArgument, this, OnSuccessCallback_9, OnFailureCallback_9)); - return CHIP_NO_ERROR; - } + VerifyOrReturn(CheckValueNull("credentials", value.credentials)); - void OnFailureResponse_9(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } + VerifyOrReturn(CheckValueNull("creatorFabricIndex", value.creatorFabricIndex)); - void OnSuccessResponse_9() { NextTest(); } + VerifyOrReturn(CheckValueNull("lastModifiedFabricIndex", value.lastModifiedFabricIndex)); - CHIP_ERROR TestReadGroupKeys_10() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::GroupKeyManagementClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); + VerifyOrReturn(CheckValueNonNull("nextUserIndex", value.nextUserIndex)); + VerifyOrReturn(CheckValue("nextUserIndex.Value()", value.nextUserIndex.Value(), 3U)); + } + break; + case 87: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DoorLock::Commands::GetUserResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("userIndex", value.userIndex, 3U)); - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_10, OnFailureCallback_10, true)); - return CHIP_NO_ERROR; - } + VerifyOrReturn(CheckValueNull("userName", value.userName)); - void OnFailureResponse_10(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } + VerifyOrReturn(CheckValueNull("userUniqueId", value.userUniqueId)); - void OnSuccessResponse_10(const chip::app::DataModel::DecodableList< - chip::app::Clusters::GroupKeyManagement::Structs::GroupKeyMapStruct::DecodableType> & groupKeyMap) - { - { - auto iter_0 = groupKeyMap.begin(); - VerifyOrReturn(CheckNextListItemDecodes("groupKeyMap", iter_0, 0)); - VerifyOrReturn(CheckValue("groupKeyMap[0].groupId", iter_0.GetValue().groupId, 257U)); - VerifyOrReturn(CheckValue("groupKeyMap[0].groupKeySetID", iter_0.GetValue().groupKeySetID, 417U)); - VerifyOrReturn(CheckValue("groupKeyMap[0].fabricIndex", iter_0.GetValue().fabricIndex, 1)); - VerifyOrReturn(CheckNextListItemDecodes("groupKeyMap", iter_0, 1)); - VerifyOrReturn(CheckValue("groupKeyMap[1].groupId", iter_0.GetValue().groupId, 258U)); - VerifyOrReturn(CheckValue("groupKeyMap[1].groupKeySetID", iter_0.GetValue().groupKeySetID, 418U)); - VerifyOrReturn(CheckValue("groupKeyMap[1].fabricIndex", iter_0.GetValue().fabricIndex, 1)); - VerifyOrReturn(CheckNoMoreListItems("groupKeyMap", iter_0, 2)); - } + VerifyOrReturn(CheckValueNull("userStatus", value.userStatus)); - NextTest(); - } + VerifyOrReturn(CheckValueNull("userType", value.userType)); - CHIP_ERROR TestReadGroupTable_11() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::GroupKeyManagementClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); + VerifyOrReturn(CheckValueNull("credentialRule", value.credentialRule)); - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_11, OnFailureCallback_11, true)); - return CHIP_NO_ERROR; - } + VerifyOrReturn(CheckValueNull("credentials", value.credentials)); - void OnFailureResponse_11(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } + VerifyOrReturn(CheckValueNull("creatorFabricIndex", value.creatorFabricIndex)); - void OnSuccessResponse_11(const chip::app::DataModel::DecodableList< - chip::app::Clusters::GroupKeyManagement::Structs::GroupInfoMapStruct::DecodableType> & groupTable) - { - { - auto iter_0 = groupTable.begin(); - VerifyOrReturn(CheckNextListItemDecodes("groupTable", iter_0, 0)); - VerifyOrReturn(CheckValue("groupTable[0].groupId", iter_0.GetValue().groupId, 257U)); - VerifyOrReturn(CheckValuePresent("groupTable[0].groupName", iter_0.GetValue().groupName)); - VerifyOrReturn(CheckValueAsString("groupTable[0].groupName.Value()", iter_0.GetValue().groupName.Value(), - chip::CharSpan("Group #1", 8))); - VerifyOrReturn(CheckValue("groupTable[0].fabricIndex", iter_0.GetValue().fabricIndex, 1)); - VerifyOrReturn(CheckNextListItemDecodes("groupTable", iter_0, 1)); - VerifyOrReturn(CheckValue("groupTable[1].groupId", iter_0.GetValue().groupId, 258U)); - VerifyOrReturn(CheckValuePresent("groupTable[1].groupName", iter_0.GetValue().groupName)); - VerifyOrReturn(CheckValueAsString("groupTable[1].groupName.Value()", iter_0.GetValue().groupName.Value(), - chip::CharSpan("Group #2", 8))); - VerifyOrReturn(CheckValue("groupTable[1].fabricIndex", iter_0.GetValue().fabricIndex, 1)); - VerifyOrReturn(CheckNoMoreListItems("groupTable", iter_0, 2)); - } + VerifyOrReturn(CheckValueNull("lastModifiedFabricIndex", value.lastModifiedFabricIndex)); - NextTest(); - } + VerifyOrReturn(CheckValueNonNull("nextUserIndex", value.nextUserIndex)); + VerifyOrReturn(CheckValue("nextUserIndex.Value()", value.nextUserIndex.Value(), 4U)); + } + break; + case 88: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DoorLock::Commands::SetCredentialResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("status", value.status, 133)); - CHIP_ERROR TestKeySetRemove1_12() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - using RequestType = chip::app::Clusters::GroupKeyManagement::Commands::KeySetRemove::Type; + VerifyOrReturn(CheckValueNull("userIndex", value.userIndex)); + + VerifyOrReturn(CheckValueNull("nextCredentialIndex", value.nextCredentialIndex)); + } + break; + case 89: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DoorLock::Commands::SetCredentialResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("status", value.status, 0)); - RequestType request; - request.groupKeySetID = 417U; + VerifyOrReturn(CheckValueNonNull("userIndex", value.userIndex)); + VerifyOrReturn(CheckValue("userIndex.Value()", value.userIndex.Value(), 1U)); - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_12(); - }; + VerifyOrReturn(CheckValueNull("nextCredentialIndex", value.nextCredentialIndex)); + } + break; + case 90: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DoorLock::Commands::GetUserResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("userIndex", value.userIndex, 1U)); - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_12(error); - }; + VerifyOrReturn(CheckValueNonNull("userName", value.userName)); + VerifyOrReturn(CheckValueAsString("userName.Value()", value.userName.Value(), chip::CharSpan("", 0))); - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } + VerifyOrReturn(CheckValueNull("userUniqueId", value.userUniqueId)); - void OnFailureResponse_12(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } + VerifyOrReturn(CheckValueNonNull("userStatus", value.userStatus)); + VerifyOrReturn(CheckValue("userStatus.Value()", value.userStatus.Value(), 1)); - void OnSuccessResponse_12() { NextTest(); } + VerifyOrReturn(CheckValueNonNull("userType", value.userType)); + VerifyOrReturn(CheckValue("userType.Value()", value.userType.Value(), 0)); - CHIP_ERROR TestKeySetReadRemoved_13() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - using RequestType = chip::app::Clusters::GroupKeyManagement::Commands::KeySetRead::Type; + VerifyOrReturn(CheckValueNonNull("credentialRule", value.credentialRule)); + VerifyOrReturn(CheckValue("credentialRule.Value()", value.credentialRule.Value(), 0)); - RequestType request; - request.groupKeySetID = 417U; + VerifyOrReturn(CheckValueNonNull("credentials", value.credentials)); + { + auto iter_1 = value.credentials.Value().begin(); + VerifyOrReturn(CheckNextListItemDecodes("credentials.Value()", iter_1, 0)); + VerifyOrReturn(CheckValue("credentials.Value()[0].credentialType", iter_1.GetValue().credentialType, 0)); + VerifyOrReturn(CheckValue("credentials.Value()[0].credentialIndex", iter_1.GetValue().credentialIndex, 0U)); + VerifyOrReturn(CheckNoMoreListItems("credentials.Value()", iter_1, 1)); + } - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_13(data.groupKeySet); - }; + VerifyOrReturn(CheckValueNonNull("creatorFabricIndex", value.creatorFabricIndex)); + VerifyOrReturn(CheckValue("creatorFabricIndex.Value()", value.creatorFabricIndex.Value(), 1)); - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_13(error); - }; + VerifyOrReturn(CheckValueNonNull("lastModifiedFabricIndex", value.lastModifiedFabricIndex)); + VerifyOrReturn(CheckValue("lastModifiedFabricIndex.Value()", value.lastModifiedFabricIndex.Value(), 1)); - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } + VerifyOrReturn(CheckValueNonNull("nextUserIndex", value.nextUserIndex)); + VerifyOrReturn(CheckValue("nextUserIndex.Value()", value.nextUserIndex.Value(), 2U)); + } + break; + case 91: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DoorLock::Commands::GetCredentialStatusResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("credentialExists", value.credentialExists, true)); - void OnFailureResponse_13(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_NOT_FOUND)); - NextTest(); - } + VerifyOrReturn(CheckValueNonNull("userIndex", value.userIndex)); + VerifyOrReturn(CheckValue("userIndex.Value()", value.userIndex.Value(), 1U)); - void - OnSuccessResponse_13(const chip::app::Clusters::GroupKeyManagement::Structs::GroupKeySetStruct::DecodableType & groupKeySet) - { - ThrowSuccessResponse(); - } + VerifyOrReturn(CheckValueNull("nextCredentialIndex", value.nextCredentialIndex)); + } + break; + case 92: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DoorLock::Commands::SetCredentialResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("status", value.status, 0)); - CHIP_ERROR TestKeySetReadNotRemoved_14() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - using RequestType = chip::app::Clusters::GroupKeyManagement::Commands::KeySetRead::Type; + VerifyOrReturn(CheckValueNull("userIndex", value.userIndex)); - RequestType request; - request.groupKeySetID = 418U; + VerifyOrReturn(CheckValueNull("nextCredentialIndex", value.nextCredentialIndex)); + } + break; + case 93: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_COMMAND)); + break; + case 94: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_COMMAND)); + break; + case 95: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_COMMAND)); + break; + case 96: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_COMMAND)); + break; + case 97: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_COMMAND)); + break; + case 98: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_COMMAND)); + break; + case 99: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 100: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DoorLock::Commands::GetUserResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("userIndex", value.userIndex, 1U)); - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_14(data.groupKeySet); - }; + VerifyOrReturn(CheckValueNull("userName", value.userName)); - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_14(error); - }; + VerifyOrReturn(CheckValueNull("userUniqueId", value.userUniqueId)); - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } + VerifyOrReturn(CheckValueNull("userStatus", value.userStatus)); - void OnFailureResponse_14(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } + VerifyOrReturn(CheckValueNull("userType", value.userType)); - void - OnSuccessResponse_14(const chip::app::Clusters::GroupKeyManagement::Structs::GroupKeySetStruct::DecodableType & groupKeySet) - { - VerifyOrReturn(CheckValue("groupKeySet.groupKeySetID", groupKeySet.groupKeySetID, 418U)); - VerifyOrReturn(CheckValue("groupKeySet.groupKeySecurityPolicy", groupKeySet.groupKeySecurityPolicy, 1)); - VerifyOrReturn(CheckValueNull("groupKeySet.epochKey0", groupKeySet.epochKey0)); - VerifyOrReturn(CheckValueNonNull("groupKeySet.epochStartTime0", groupKeySet.epochStartTime0)); - VerifyOrReturn(CheckValue("groupKeySet.epochStartTime0.Value()", groupKeySet.epochStartTime0.Value(), 2110000ULL)); - VerifyOrReturn(CheckValueNull("groupKeySet.epochKey1", groupKeySet.epochKey1)); - VerifyOrReturn(CheckValueNonNull("groupKeySet.epochStartTime1", groupKeySet.epochStartTime1)); - VerifyOrReturn(CheckValue("groupKeySet.epochStartTime1.Value()", groupKeySet.epochStartTime1.Value(), 2110001ULL)); - VerifyOrReturn(CheckValueNull("groupKeySet.epochKey2", groupKeySet.epochKey2)); - VerifyOrReturn(CheckValueNonNull("groupKeySet.epochStartTime2", groupKeySet.epochStartTime2)); - VerifyOrReturn(CheckValue("groupKeySet.epochStartTime2.Value()", groupKeySet.epochStartTime2.Value(), 2110002ULL)); + VerifyOrReturn(CheckValueNull("credentialRule", value.credentialRule)); - NextTest(); - } + VerifyOrReturn(CheckValueNull("credentials", value.credentials)); - CHIP_ERROR TestRemoveAll_15() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::Groups::Commands::RemoveAllGroups::Type; + VerifyOrReturn(CheckValueNull("creatorFabricIndex", value.creatorFabricIndex)); - RequestType request; + VerifyOrReturn(CheckValueNull("lastModifiedFabricIndex", value.lastModifiedFabricIndex)); - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_15(); - }; + VerifyOrReturn(CheckValueNonNull("nextUserIndex", value.nextUserIndex)); + VerifyOrReturn(CheckValue("nextUserIndex.Value()", value.nextUserIndex.Value(), 2U)); + } + break; + case 101: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DoorLock::Commands::GetCredentialStatusResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("credentialExists", value.credentialExists, false)); - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_15(error); - }; + VerifyOrReturn(CheckValueNull("userIndex", value.userIndex)); - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } + VerifyOrReturn(CheckValueNull("nextCredentialIndex", value.nextCredentialIndex)); + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } + + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } + } + + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "Read available user slot and verify response fields"); + chip::app::Clusters::DoorLock::Commands::GetUser::Type value; + value.userIndex = 1U; + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetUser::Id, value); + } + case 2: { + LogStep(2, "Get number of supported users and verify default value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, + DoorLock::Attributes::NumberOfTotalUsersSupported::Id); + } + case 3: { + LogStep(3, "Read fails for user with index 0"); + chip::app::Clusters::DoorLock::Commands::GetUser::Type value; + value.userIndex = 0U; + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetUser::Id, value); + } + case 4: { + LogStep(4, "Read fails for user with index greater than Number Of Users Supported"); + chip::app::Clusters::DoorLock::Commands::GetUser::Type value; + value.userIndex = static_cast(NumberOfTotalUsersSupported + 1); + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetUser::Id, value); + } + case 5: { + LogStep(5, "Create new user with default parameters"); + chip::app::Clusters::DoorLock::Commands::SetUser::Type value; + value.operationType = static_cast(0); + value.userIndex = 1U; + value.userName.SetNull(); + value.userUniqueId.SetNull(); + value.userStatus.SetNull(); + value.userType.SetNull(); + value.credentialRule.SetNull(); + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetUser::Id, value, + chip::Optional(10000)); + } + case 6: { + LogStep(6, "Read the user back and verify its fields"); + chip::app::Clusters::DoorLock::Commands::GetUser::Type value; + value.userIndex = 1U; + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetUser::Id, value); + } + case 7: { + LogStep(7, "Set user at the occupied index fails with appropriate response"); + chip::app::Clusters::DoorLock::Commands::SetUser::Type value; + value.operationType = static_cast(0); + value.userIndex = 1U; + value.userName.SetNull(); + value.userUniqueId.SetNull(); + value.userStatus.SetNull(); + value.userType.SetNull(); + value.credentialRule.SetNull(); + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetUser::Id, value, + chip::Optional(10000)); + } + case 8: { + LogStep(8, "Modify userName for existing user"); + chip::app::Clusters::DoorLock::Commands::SetUser::Type value; + value.operationType = static_cast(2); + value.userIndex = 1U; + value.userName.SetNonNull(); + value.userName.Value() = chip::Span("new_usergarbage: not in length on purpose", 8); + value.userUniqueId.SetNull(); + value.userStatus.SetNull(); + value.userType.SetNull(); + value.credentialRule.SetNull(); + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetUser::Id, value, + chip::Optional(10000)); + } + case 9: { + LogStep(9, "Read the modified user back and verify its fields"); + chip::app::Clusters::DoorLock::Commands::GetUser::Type value; + value.userIndex = 1U; + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetUser::Id, value); + } + case 10: { + LogStep(10, "Modify userUniqueId for existing user"); + chip::app::Clusters::DoorLock::Commands::SetUser::Type value; + value.operationType = static_cast(2); + value.userIndex = 1U; + value.userName.SetNull(); + value.userUniqueId.SetNonNull(); + value.userUniqueId.Value() = 305441741UL; + value.userStatus.SetNull(); + value.userType.SetNull(); + value.credentialRule.SetNull(); + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetUser::Id, value, + chip::Optional(10000)); + } + case 11: { + LogStep(11, "Read the modified user back and verify its fields"); + chip::app::Clusters::DoorLock::Commands::GetUser::Type value; + value.userIndex = 1U; + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetUser::Id, value); + } + case 12: { + LogStep(12, "Modify userStatus for existing user"); + chip::app::Clusters::DoorLock::Commands::SetUser::Type value; + value.operationType = static_cast(2); + value.userIndex = 1U; + value.userName.SetNull(); + value.userUniqueId.SetNull(); + value.userStatus.SetNonNull(); + value.userStatus.Value() = static_cast(3); + value.userType.SetNull(); + value.credentialRule.SetNull(); + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetUser::Id, value, + chip::Optional(10000)); + } + case 13: { + LogStep(13, "Read the modified user back and verify its fields"); + chip::app::Clusters::DoorLock::Commands::GetUser::Type value; + value.userIndex = 1U; + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetUser::Id, value); + } + case 14: { + LogStep(14, "Modify userType for existing user"); + chip::app::Clusters::DoorLock::Commands::SetUser::Type value; + value.operationType = static_cast(2); + value.userIndex = 1U; + value.userName.SetNull(); + value.userUniqueId.SetNull(); + value.userStatus.SetNull(); + value.userType.SetNonNull(); + value.userType.Value() = static_cast(6); + value.credentialRule.SetNull(); + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetUser::Id, value, + chip::Optional(10000)); + } + case 15: { + LogStep(15, "Read the modified user back and verify its fields"); + chip::app::Clusters::DoorLock::Commands::GetUser::Type value; + value.userIndex = 1U; + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetUser::Id, value); + } + case 16: { + LogStep(16, "Modify credentialRule for existing user"); + chip::app::Clusters::DoorLock::Commands::SetUser::Type value; + value.operationType = static_cast(2); + value.userIndex = 1U; + value.userName.SetNull(); + value.userUniqueId.SetNull(); + value.userStatus.SetNull(); + value.userType.SetNull(); + value.credentialRule.SetNonNull(); + value.credentialRule.Value() = static_cast(2); + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetUser::Id, value, + chip::Optional(10000)); + } + case 17: { + LogStep(17, "Read the modified user back and verify its fields"); + chip::app::Clusters::DoorLock::Commands::GetUser::Type value; + value.userIndex = 1U; + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetUser::Id, value); + } + case 18: { + LogStep(18, "Modify all fields for existing user"); + chip::app::Clusters::DoorLock::Commands::SetUser::Type value; + value.operationType = static_cast(2); + value.userIndex = 1U; + value.userName.SetNonNull(); + value.userName.Value() = chip::Span("test_usergarbage: not in length on purpose", 9); + value.userUniqueId.SetNonNull(); + value.userUniqueId.Value() = 466460832UL; + value.userStatus.SetNonNull(); + value.userStatus.Value() = static_cast(1); + value.userType.SetNonNull(); + value.userType.Value() = static_cast(0); + value.credentialRule.SetNonNull(); + value.credentialRule.Value() = static_cast(1); + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetUser::Id, value, + chip::Optional(10000)); + } + case 19: { + LogStep(19, "Read the modified user back and verify its fields"); + chip::app::Clusters::DoorLock::Commands::GetUser::Type value; + value.userIndex = 1U; + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetUser::Id, value); + } + case 20: { + LogStep(20, "Add another user with non-default fields"); + chip::app::Clusters::DoorLock::Commands::SetUser::Type value; + value.operationType = static_cast(0); + value.userIndex = 2U; + value.userName.SetNonNull(); + value.userName.Value() = chip::Span("test_user2garbage: not in length on purpose", 10); + value.userUniqueId.SetNonNull(); + value.userUniqueId.Value() = 12648430UL; + value.userStatus.SetNonNull(); + value.userStatus.Value() = static_cast(1); + value.userType.SetNonNull(); + value.userType.Value() = static_cast(1); + value.credentialRule.SetNonNull(); + value.credentialRule.Value() = static_cast(2); + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetUser::Id, value, + chip::Optional(10000)); + } + case 21: { + LogStep(21, "Read the new user back and verify its fields"); + chip::app::Clusters::DoorLock::Commands::GetUser::Type value; + value.userIndex = 2U; + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetUser::Id, value); + } + case 22: { + LogStep(22, "Create user in the last slot"); + chip::app::Clusters::DoorLock::Commands::SetUser::Type value; + value.operationType = static_cast(0); + value.userIndex = NumberOfTotalUsersSupported; + value.userName.SetNonNull(); + value.userName.Value() = chip::Span("last_usergarbage: not in length on purpose", 9); + value.userUniqueId.SetNull(); + value.userStatus.SetNull(); + value.userType.SetNull(); + value.credentialRule.SetNull(); + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetUser::Id, value, + chip::Optional(10000)); + } + case 23: { + LogStep(23, "Read the last user back and verify its fields"); + chip::app::Clusters::DoorLock::Commands::GetUser::Type value; + value.userIndex = NumberOfTotalUsersSupported; + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetUser::Id, value); + } + case 24: { + LogStep(24, "User creation in the 0 slot fails"); + chip::app::Clusters::DoorLock::Commands::SetUser::Type value; + value.operationType = static_cast(0); + value.userIndex = 0U; + value.userName.SetNull(); + value.userUniqueId.SetNull(); + value.userStatus.SetNull(); + value.userType.SetNull(); + value.credentialRule.SetNull(); + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetUser::Id, value, + chip::Optional(10000)); + } + case 25: { + LogStep(25, "User creation in the out-of-bounds slot fails"); + chip::app::Clusters::DoorLock::Commands::SetUser::Type value; + value.operationType = static_cast(0); + value.userIndex = static_cast(NumberOfTotalUsersSupported + 1); + value.userName.SetNull(); + value.userUniqueId.SetNull(); + value.userStatus.SetNull(); + value.userType.SetNull(); + value.credentialRule.SetNull(); + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetUser::Id, value, + chip::Optional(10000)); + } + case 26: { + LogStep(26, "Clear first user"); + chip::app::Clusters::DoorLock::Commands::ClearUser::Type value; + value.userIndex = 1U; + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::ClearUser::Id, value, + chip::Optional(10000)); + } + case 27: { + LogStep(27, "Read cleared user and verify it is available"); + chip::app::Clusters::DoorLock::Commands::GetUser::Type value; + value.userIndex = 1U; + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetUser::Id, value); + } + case 28: { + LogStep(28, "Create new user in the cleared slot"); + chip::app::Clusters::DoorLock::Commands::SetUser::Type value; + value.operationType = static_cast(0); + value.userIndex = 1U; + value.userName.SetNull(); + value.userUniqueId.SetNull(); + value.userStatus.SetNull(); + value.userType.SetNull(); + value.credentialRule.SetNull(); + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetUser::Id, value, + chip::Optional(10000)); + } + case 29: { + LogStep(29, "Read the user in the previously cleared slot and verify its fields"); + chip::app::Clusters::DoorLock::Commands::GetUser::Type value; + value.userIndex = 1U; + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetUser::Id, value); + } + case 30: { + LogStep(30, "Clear user with index 0 fails"); + chip::app::Clusters::DoorLock::Commands::ClearUser::Type value; + value.userIndex = 0U; + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::ClearUser::Id, value, + chip::Optional(10000)); + } + case 31: { + LogStep(31, "Clear user with out-of-bounds index fails"); + chip::app::Clusters::DoorLock::Commands::ClearUser::Type value; + value.userIndex = static_cast(NumberOfTotalUsersSupported + 1); + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::ClearUser::Id, value, + chip::Optional(10000)); + } + case 32: { + LogStep(32, "Clear all users"); + chip::app::Clusters::DoorLock::Commands::ClearUser::Type value; + value.userIndex = 65534U; + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::ClearUser::Id, value, + chip::Optional(10000)); + } + case 33: { + LogStep(33, "Read first cleared user and verify it is available"); + chip::app::Clusters::DoorLock::Commands::GetUser::Type value; + value.userIndex = 2U; + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetUser::Id, value); + } + case 34: { + LogStep(34, "Read last cleared user and verify it is available"); + chip::app::Clusters::DoorLock::Commands::GetUser::Type value; + value.userIndex = NumberOfTotalUsersSupported; + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetUser::Id, value); + } + case 35: { + LogStep(35, "Get number of supported PIN credentials and verify default value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Attributes::NumberOfPINUsersSupported::Id); + } + case 36: { + LogStep(36, "Check that PIN credential does not exist"); + chip::app::Clusters::DoorLock::Commands::GetCredentialStatus::Type value; + + value.credential.credentialType = static_cast(1); + value.credential.credentialIndex = 1U; + + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetCredentialStatus::Id, value); + } + case 37: { + LogStep(37, "Reading PIN credential with index 0 fails"); + chip::app::Clusters::DoorLock::Commands::GetCredentialStatus::Type value; + + value.credential.credentialType = static_cast(1); + value.credential.credentialIndex = 0U; + + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetCredentialStatus::Id, value); + } + case 38: { + LogStep(38, "Reading PIN credential with out-of-bounds index fails"); + chip::app::Clusters::DoorLock::Commands::GetCredentialStatus::Type value; + + value.credential.credentialType = static_cast(1); + value.credential.credentialIndex = static_cast(NumberOfPINUsersSupported + 1); + + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetCredentialStatus::Id, value); + } + case 39: { + LogStep(39, "Create new PIN credential and user"); + chip::app::Clusters::DoorLock::Commands::SetCredential::Type value; + value.operationType = static_cast(0); + + value.credential.credentialType = static_cast(1); + value.credential.credentialIndex = 1U; + + value.credentialData = chip::ByteSpan(chip::Uint8::from_const_char("000000garbage: not in length on purpose"), 6); + value.userIndex.SetNull(); + value.userStatus.SetNull(); + value.userType.SetNull(); + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetCredential::Id, value, + chip::Optional(10000)); + } + case 40: { + LogStep(40, "Verify created user"); + chip::app::Clusters::DoorLock::Commands::GetUser::Type value; + value.userIndex = 1U; + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetUser::Id, value); + } + case 41: { + LogStep(41, "Verify created PIN credential"); + chip::app::Clusters::DoorLock::Commands::GetCredentialStatus::Type value; + + value.credential.credentialType = static_cast(1); + value.credential.credentialIndex = 1U; + + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetCredentialStatus::Id, value); + } + case 42: { + LogStep(42, "Create new PIN credential and user with index 0 fails"); + chip::app::Clusters::DoorLock::Commands::SetCredential::Type value; + value.operationType = static_cast(0); + + value.credential.credentialType = static_cast(1); + value.credential.credentialIndex = 0U; + + value.credentialData = chip::ByteSpan(chip::Uint8::from_const_char("123456garbage: not in length on purpose"), 6); + value.userIndex.SetNull(); + value.userStatus.SetNull(); + value.userType.SetNull(); + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetCredential::Id, value, + chip::Optional(10000)); + } + case 43: { + LogStep(43, "Create new PIN credential and user with out-of-bounds index fails"); + chip::app::Clusters::DoorLock::Commands::SetCredential::Type value; + value.operationType = static_cast(0); + + value.credential.credentialType = static_cast(1); + value.credential.credentialIndex = static_cast(NumberOfPINUsersSupported + 1); + + value.credentialData = chip::ByteSpan(chip::Uint8::from_const_char("123456garbage: not in length on purpose"), 6); + value.userIndex.SetNull(); + value.userStatus.SetNull(); + value.userType.SetNull(); + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetCredential::Id, value, + chip::Optional(10000)); + } + case 44: { + LogStep(44, "Get number of supported RFID credentials and verify default value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, + DoorLock::Attributes::NumberOfRFIDUsersSupported::Id); + } + case 45: { + LogStep(45, "Reading RFID credential with index 0 fails"); + chip::app::Clusters::DoorLock::Commands::GetCredentialStatus::Type value; + + value.credential.credentialType = static_cast(2); + value.credential.credentialIndex = 0U; + + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetCredentialStatus::Id, value); + } + case 46: { + LogStep(46, "Reading RFID credential with out-of-bounds index fails"); + chip::app::Clusters::DoorLock::Commands::GetCredentialStatus::Type value; + + value.credential.credentialType = static_cast(2); + value.credential.credentialIndex = static_cast(NumberOfRFIDUsersSupported + 1); + + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetCredentialStatus::Id, value); + } + case 47: { + LogStep(47, "Check that RFID credential does not exist"); + chip::app::Clusters::DoorLock::Commands::GetCredentialStatus::Type value; + + value.credential.credentialType = static_cast(2); + value.credential.credentialIndex = 2U; + + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetCredentialStatus::Id, value); + } + case 48: { + LogStep(48, "Create new RFID credential and add it to existing user"); + chip::app::Clusters::DoorLock::Commands::SetCredential::Type value; + value.operationType = static_cast(0); + + value.credential.credentialType = static_cast(2); + value.credential.credentialIndex = 2U; + + value.credentialData = + chip::ByteSpan(chip::Uint8::from_const_char("rfid_data_123456garbage: not in length on purpose"), 16); + value.userIndex.SetNonNull(); + value.userIndex.Value() = 1U; + value.userStatus.SetNull(); + value.userType.SetNull(); + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetCredential::Id, value, + chip::Optional(10000)); + } + case 49: { + LogStep(49, "Verify modified user"); + chip::app::Clusters::DoorLock::Commands::GetUser::Type value; + value.userIndex = 1U; + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetUser::Id, value); + } + case 50: { + LogStep(50, "Verify created credential"); + chip::app::Clusters::DoorLock::Commands::GetCredentialStatus::Type value; + + value.credential.credentialType = static_cast(2); + value.credential.credentialIndex = 2U; + + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetCredentialStatus::Id, value); + } + case 51: { + LogStep(51, "Create new RFID credential and user with index 0 fails"); + chip::app::Clusters::DoorLock::Commands::SetCredential::Type value; + value.operationType = static_cast(0); + + value.credential.credentialType = static_cast(2); + value.credential.credentialIndex = 0U; + + value.credentialData = + chip::ByteSpan(chip::Uint8::from_const_char("new_rfid_data_fieldgarbage: not in length on purpose"), 19); + value.userIndex.SetNull(); + value.userStatus.SetNull(); + value.userType.SetNull(); + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetCredential::Id, value, + chip::Optional(10000)); + } + case 52: { + LogStep(52, "Create new RFID credential and user with out-of-bounds index fails"); + chip::app::Clusters::DoorLock::Commands::SetCredential::Type value; + value.operationType = static_cast(0); + + value.credential.credentialType = static_cast(2); + value.credential.credentialIndex = static_cast(NumberOfRFIDUsersSupported + 1); + + value.credentialData = + chip::ByteSpan(chip::Uint8::from_const_char("new_rfid_data_fieldgarbage: not in length on purpose"), 19); + value.userIndex.SetNull(); + value.userStatus.SetNull(); + value.userType.SetNull(); + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetCredential::Id, value, + chip::Optional(10000)); + } + case 53: { + LogStep(53, "Create new PIN credential and try to add it to existing user"); + chip::app::Clusters::DoorLock::Commands::SetCredential::Type value; + value.operationType = static_cast(0); + + value.credential.credentialType = static_cast(1); + value.credential.credentialIndex = 3U; + + value.credentialData = chip::ByteSpan(chip::Uint8::from_const_char("123465garbage: not in length on purpose"), 6); + value.userIndex.SetNonNull(); + value.userIndex.Value() = 1U; + value.userStatus.SetNull(); + value.userType.SetNull(); + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetCredential::Id, value, + chip::Optional(10000)); + } + case 54: { + LogStep(54, "Create new credential and try to add it to 0 user"); + chip::app::Clusters::DoorLock::Commands::SetCredential::Type value; + value.operationType = static_cast(0); + + value.credential.credentialType = static_cast(1); + value.credential.credentialIndex = 3U; + + value.credentialData = chip::ByteSpan(chip::Uint8::from_const_char("123465garbage: not in length on purpose"), 6); + value.userIndex.SetNonNull(); + value.userIndex.Value() = 0U; + value.userStatus.SetNull(); + value.userType.SetNull(); + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetCredential::Id, value, + chip::Optional(10000)); + } + case 55: { + LogStep(55, "Create new credential and try to add it to out-of-bounds user"); + chip::app::Clusters::DoorLock::Commands::SetCredential::Type value; + value.operationType = static_cast(0); + + value.credential.credentialType = static_cast(1); + value.credential.credentialIndex = 3U; + + value.credentialData = chip::ByteSpan(chip::Uint8::from_const_char("123465garbage: not in length on purpose"), 6); + value.userIndex.SetNonNull(); + value.userIndex.Value() = static_cast(NumberOfTotalUsersSupported + 1); + value.userStatus.SetNull(); + value.userType.SetNull(); + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetCredential::Id, value, + chip::Optional(10000)); + } + case 56: { + LogStep(56, "Create new PIN with too short data"); + chip::app::Clusters::DoorLock::Commands::SetCredential::Type value; + value.operationType = static_cast(0); + + value.credential.credentialType = static_cast(1); + value.credential.credentialIndex = 3U; + + value.credentialData = chip::ByteSpan(chip::Uint8::from_const_char("12345garbage: not in length on purpose"), 5); + value.userIndex.SetNonNull(); + value.userIndex.Value() = 0U; + value.userStatus.SetNull(); + value.userType.SetNull(); + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetCredential::Id, value, + chip::Optional(10000)); + } + case 57: { + LogStep(57, "Create new PIN with too long data"); + chip::app::Clusters::DoorLock::Commands::SetCredential::Type value; + value.operationType = static_cast(0); + + value.credential.credentialType = static_cast(1); + value.credential.credentialIndex = 3U; + + value.credentialData = chip::ByteSpan(chip::Uint8::from_const_char("123456789garbage: not in length on purpose"), 9); + value.userIndex.SetNonNull(); + value.userIndex.Value() = 0U; + value.userStatus.SetNull(); + value.userType.SetNull(); + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetCredential::Id, value, + chip::Optional(10000)); + } + case 58: { + LogStep(58, "Create new RFID with too short data"); + chip::app::Clusters::DoorLock::Commands::SetCredential::Type value; + value.operationType = static_cast(0); + + value.credential.credentialType = static_cast(2); + value.credential.credentialIndex = 3U; + + value.credentialData = chip::ByteSpan(chip::Uint8::from_const_char("rfid_datagarbage: not in length on purpose"), 9); + value.userIndex.SetNonNull(); + value.userIndex.Value() = 0U; + value.userStatus.SetNull(); + value.userType.SetNull(); + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetCredential::Id, value, + chip::Optional(10000)); + } + case 59: { + LogStep(59, "Create new PIN with Programming user type fails"); + chip::app::Clusters::DoorLock::Commands::SetCredential::Type value; + value.operationType = static_cast(0); + + value.credential.credentialType = static_cast(1); + value.credential.credentialIndex = 3U; + + value.credentialData = chip::ByteSpan(chip::Uint8::from_const_char("123456garbage: not in length on purpose"), 6); + value.userIndex.SetNonNull(); + value.userIndex.Value() = 0U; + value.userStatus.SetNull(); + value.userType.SetNonNull(); + value.userType.Value() = static_cast(3); + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetCredential::Id, value, + chip::Optional(10000)); + } + case 60: { + LogStep(60, "Create new RFID with too short data"); + chip::app::Clusters::DoorLock::Commands::SetCredential::Type value; + value.operationType = static_cast(0); + + value.credential.credentialType = static_cast(2); + value.credential.credentialIndex = 3U; + + value.credentialData = chip::ByteSpan( + chip::Uint8::from_const_char("very_long_rfid_data_to_test_boundariesgarbage: not in length on purpose"), 38); + value.userIndex.SetNonNull(); + value.userIndex.Value() = 0U; + value.userStatus.SetNull(); + value.userType.SetNull(); + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetCredential::Id, value, + chip::Optional(10000)); + } + case 61: { + LogStep(61, "Create new PIN credential with data the would cause duplicate"); + chip::app::Clusters::DoorLock::Commands::SetCredential::Type value; + value.operationType = static_cast(0); + + value.credential.credentialType = static_cast(1); + value.credential.credentialIndex = 4U; + + value.credentialData = chip::ByteSpan(chip::Uint8::from_const_char("000000garbage: not in length on purpose"), 6); + value.userIndex.SetNull(); + value.userStatus.SetNull(); + value.userType.SetNull(); + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetCredential::Id, value, + chip::Optional(10000)); + } + case 62: { + LogStep(62, "Create new RFID credential with data the would cause duplicate"); + chip::app::Clusters::DoorLock::Commands::SetCredential::Type value; + value.operationType = static_cast(0); + + value.credential.credentialType = static_cast(2); + value.credential.credentialIndex = 4U; + + value.credentialData = + chip::ByteSpan(chip::Uint8::from_const_char("rfid_data_123456garbage: not in length on purpose"), 16); + value.userIndex.SetNull(); + value.userStatus.SetNull(); + value.userType.SetNull(); + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetCredential::Id, value, + chip::Optional(10000)); + } + case 63: { + LogStep(63, "Modify credentialData of existing PIN credential"); + chip::app::Clusters::DoorLock::Commands::SetCredential::Type value; + value.operationType = static_cast(2); + + value.credential.credentialType = static_cast(1); + value.credential.credentialIndex = 1U; + + value.credentialData = chip::ByteSpan(chip::Uint8::from_const_char("123456garbage: not in length on purpose"), 6); + value.userIndex.SetNonNull(); + value.userIndex.Value() = 1U; + value.userStatus.SetNull(); + value.userType.SetNull(); + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetCredential::Id, value, + chip::Optional(10000)); + } + case 64: { + LogStep(64, "Verify that credential was changed by creating new credential with old data"); + chip::app::Clusters::DoorLock::Commands::SetCredential::Type value; + value.operationType = static_cast(0); + + value.credential.credentialType = static_cast(1); + value.credential.credentialIndex = 3U; + + value.credentialData = chip::ByteSpan(chip::Uint8::from_const_char("000000garbage: not in length on purpose"), 6); + value.userIndex.SetNull(); + value.userStatus.SetNull(); + value.userType.SetNull(); + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetCredential::Id, value, + chip::Optional(10000)); + } + case 65: { + LogStep(65, "Verify that credential was changed by creating new credential with new data"); + chip::app::Clusters::DoorLock::Commands::SetCredential::Type value; + value.operationType = static_cast(0); + + value.credential.credentialType = static_cast(1); + value.credential.credentialIndex = 4U; + + value.credentialData = chip::ByteSpan(chip::Uint8::from_const_char("123456garbage: not in length on purpose"), 6); + value.userIndex.SetNull(); + value.userStatus.SetNull(); + value.userType.SetNull(); + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetCredential::Id, value, + chip::Optional(10000)); + } + case 66: { + LogStep(66, "Clear first PIN credential"); + chip::app::Clusters::DoorLock::Commands::ClearCredential::Type value; + value.credential.SetNonNull(); + + value.credential.Value().credentialType = static_cast(1); + value.credential.Value().credentialIndex = 1U; + + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::ClearCredential::Id, value, + chip::Optional(10000)); + } + case 67: { + LogStep(67, "Read back the credential and make sure it is deleted"); + chip::app::Clusters::DoorLock::Commands::GetCredentialStatus::Type value; + + value.credential.credentialType = static_cast(1); + value.credential.credentialIndex = 1U; + + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetCredentialStatus::Id, value); + } + case 68: { + LogStep(68, "Read the user back and make sure PIN credential is deleted"); + chip::app::Clusters::DoorLock::Commands::GetUser::Type value; + value.userIndex = 1U; + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetUser::Id, value); + } + case 69: { + LogStep(69, "Clear the second PIN credential"); + chip::app::Clusters::DoorLock::Commands::ClearCredential::Type value; + value.credential.SetNonNull(); + + value.credential.Value().credentialType = static_cast(1); + value.credential.Value().credentialIndex = 3U; + + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::ClearCredential::Id, value, + chip::Optional(10000)); + } + case 70: { + LogStep(70, "Read back the credential and make sure it is deleted"); + chip::app::Clusters::DoorLock::Commands::GetCredentialStatus::Type value; + + value.credential.credentialType = static_cast(1); + value.credential.credentialIndex = 3U; + + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetCredentialStatus::Id, value); + } + case 71: { + LogStep(71, "Read the user back and make sure related user is deleted"); + chip::app::Clusters::DoorLock::Commands::GetUser::Type value; + value.userIndex = 2U; + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetUser::Id, value); + } + case 72: { + LogStep(72, "Create new RFID credential with user"); + chip::app::Clusters::DoorLock::Commands::SetCredential::Type value; + value.operationType = static_cast(0); + + value.credential.credentialType = static_cast(2); + value.credential.credentialIndex = 1U; + + value.credentialData = + chip::ByteSpan(chip::Uint8::from_const_char("rfid_data_12345garbage: not in length on purpose"), 15); + value.userIndex.SetNull(); + value.userStatus.SetNull(); + value.userType.SetNull(); + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetCredential::Id, value, + chip::Optional(10000)); + } + case 73: { + LogStep(73, "Clear all the RFID credentials"); + chip::app::Clusters::DoorLock::Commands::ClearCredential::Type value; + value.credential.SetNonNull(); + + value.credential.Value().credentialType = static_cast(2); + value.credential.Value().credentialIndex = 65534U; + + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::ClearCredential::Id, value, + chip::Optional(10000)); + } + case 74: { + LogStep(74, "Read back the fist RFID credential and make sure it is deleted"); + chip::app::Clusters::DoorLock::Commands::GetCredentialStatus::Type value; + + value.credential.credentialType = static_cast(2); + value.credential.credentialIndex = 1U; + + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetCredentialStatus::Id, value); + } + case 75: { + LogStep(75, "Read back the second RFID credential and make sure it is deleted"); + chip::app::Clusters::DoorLock::Commands::GetCredentialStatus::Type value; + + value.credential.credentialType = static_cast(2); + value.credential.credentialIndex = 2U; + + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetCredentialStatus::Id, value); + } + case 76: { + LogStep(76, "Read the user related with first RFID back and make sure it is deleted"); + chip::app::Clusters::DoorLock::Commands::GetUser::Type value; + value.userIndex = 1U; + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetUser::Id, value); + } + case 77: { + LogStep(77, "Read the user related with second RFID back and make sure it is deleted"); + chip::app::Clusters::DoorLock::Commands::GetUser::Type value; + value.userIndex = 2U; + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetUser::Id, value); + } + case 78: { + LogStep(78, "Create new PIN credential with user"); + chip::app::Clusters::DoorLock::Commands::SetCredential::Type value; + value.operationType = static_cast(0); + + value.credential.credentialType = static_cast(1); + value.credential.credentialIndex = 1U; + + value.credentialData = chip::ByteSpan(chip::Uint8::from_const_char("123456garbage: not in length on purpose"), 6); + value.userIndex.SetNull(); + value.userStatus.SetNull(); + value.userType.SetNull(); + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetCredential::Id, value, + chip::Optional(10000)); + } + case 79: { + LogStep(79, "Create new RFID credential with user"); + chip::app::Clusters::DoorLock::Commands::SetCredential::Type value; + value.operationType = static_cast(0); + + value.credential.credentialType = static_cast(2); + value.credential.credentialIndex = 2U; + + value.credentialData = + chip::ByteSpan(chip::Uint8::from_const_char("rfid_data_1234garbage: not in length on purpose"), 14); + value.userIndex.SetNull(); + value.userStatus.SetNull(); + value.userType.SetNull(); + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetCredential::Id, value, + chip::Optional(10000)); + } + case 80: { + LogStep(80, "Create another RFID credential with user"); + chip::app::Clusters::DoorLock::Commands::SetCredential::Type value; + value.operationType = static_cast(0); + + value.credential.credentialType = static_cast(2); + value.credential.credentialIndex = 6U; + + value.credentialData = + chip::ByteSpan(chip::Uint8::from_const_char("rfid_data_9876garbage: not in length on purpose"), 14); + value.userIndex.SetNull(); + value.userStatus.SetNull(); + value.userType.SetNull(); + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetCredential::Id, value, + chip::Optional(10000)); + } + case 81: { + LogStep(81, "Clear all the credentials"); + chip::app::Clusters::DoorLock::Commands::ClearCredential::Type value; + value.credential.SetNull(); + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::ClearCredential::Id, value, + chip::Optional(10000)); + } + case 82: { + LogStep(82, "Read back the first PIN credential and make sure it is deleted"); + chip::app::Clusters::DoorLock::Commands::GetCredentialStatus::Type value; + + value.credential.credentialType = static_cast(1); + value.credential.credentialIndex = 1U; + + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetCredentialStatus::Id, value); + } + case 83: { + LogStep(83, "Read back the first RFID credential and make sure it is deleted"); + chip::app::Clusters::DoorLock::Commands::GetCredentialStatus::Type value; + + value.credential.credentialType = static_cast(2); + value.credential.credentialIndex = 2U; + + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetCredentialStatus::Id, value); + } + case 84: { + LogStep(84, "Read back the second PIN credential and make sure it is deleted"); + chip::app::Clusters::DoorLock::Commands::GetCredentialStatus::Type value; + + value.credential.credentialType = static_cast(1); + value.credential.credentialIndex = 6U; + + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetCredentialStatus::Id, value); + } + case 85: { + LogStep(85, "Read the user related with first PIN back and make sure it is deleted"); + chip::app::Clusters::DoorLock::Commands::GetUser::Type value; + value.userIndex = 1U; + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetUser::Id, value); + } + case 86: { + LogStep(86, "Read the user related with first RFID back and make sure it is deleted"); + chip::app::Clusters::DoorLock::Commands::GetUser::Type value; + value.userIndex = 2U; + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetUser::Id, value); + } + case 87: { + LogStep(87, "Read the user related with second PIN back and make sure it is deleted"); + chip::app::Clusters::DoorLock::Commands::GetUser::Type value; + value.userIndex = 3U; + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetUser::Id, value); + } + case 88: { + LogStep(88, "Create new Programming PIN credential with invalid index"); + chip::app::Clusters::DoorLock::Commands::SetCredential::Type value; + value.operationType = static_cast(0); + + value.credential.credentialType = static_cast(0); + value.credential.credentialIndex = 1U; + + value.credentialData = chip::ByteSpan(chip::Uint8::from_const_char("123456garbage: not in length on purpose"), 6); + value.userIndex.SetNull(); + value.userStatus.SetNull(); + value.userType.SetNull(); + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetCredential::Id, value, + chip::Optional(10000)); + } + case 89: { + LogStep(89, "Create new Programming PIN credential with valid index"); + chip::app::Clusters::DoorLock::Commands::SetCredential::Type value; + value.operationType = static_cast(0); + + value.credential.credentialType = static_cast(0); + value.credential.credentialIndex = 0U; + + value.credentialData = chip::ByteSpan(chip::Uint8::from_const_char("123456garbage: not in length on purpose"), 6); + value.userIndex.SetNull(); + value.userStatus.SetNull(); + value.userType.SetNull(); + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetCredential::Id, value, + chip::Optional(10000)); + } + case 90: { + LogStep(90, "Verify created user"); + chip::app::Clusters::DoorLock::Commands::GetUser::Type value; + value.userIndex = 1U; + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetUser::Id, value); + } + case 91: { + LogStep(91, "Verify created programming PIN credential"); + chip::app::Clusters::DoorLock::Commands::GetCredentialStatus::Type value; + + value.credential.credentialType = static_cast(0); + value.credential.credentialIndex = 0U; + + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetCredentialStatus::Id, value); + } + case 92: { + LogStep(92, "Modify the Programming PIN credential"); + chip::app::Clusters::DoorLock::Commands::SetCredential::Type value; + value.operationType = static_cast(2); - void OnFailureResponse_15(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } + value.credential.credentialType = static_cast(0); + value.credential.credentialIndex = 0U; - void OnSuccessResponse_15() { NextTest(); } + value.credentialData = chip::ByteSpan(chip::Uint8::from_const_char("654321garbage: not in length on purpose"), 6); + value.userIndex.SetNull(); + value.userStatus.SetNull(); + value.userType.SetNull(); + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetCredential::Id, value, + chip::Optional(10000)); + } + case 93: { + LogStep(93, "Clearing Programming PIN fails"); + chip::app::Clusters::DoorLock::Commands::ClearCredential::Type value; + value.credential.SetNonNull(); - CHIP_ERROR TestKeySetRemove2_16() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - using RequestType = chip::app::Clusters::GroupKeyManagement::Commands::KeySetRemove::Type; + value.credential.Value().credentialType = static_cast(0); + value.credential.Value().credentialIndex = 0U; - RequestType request; - request.groupKeySetID = 418U; + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::ClearCredential::Id, value, + chip::Optional(10000)); + } + case 94: { + LogStep(94, "Clearing Programming PIN with invalid index fails"); + chip::app::Clusters::DoorLock::Commands::ClearCredential::Type value; + value.credential.SetNonNull(); - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_16(); - }; + value.credential.Value().credentialType = static_cast(0); + value.credential.Value().credentialIndex = 1U; - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_16(error); - }; + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::ClearCredential::Id, value, + chip::Optional(10000)); + } + case 95: { + LogStep(95, "Clearing PIN credential with zero index fails"); + chip::app::Clusters::DoorLock::Commands::ClearCredential::Type value; + value.credential.SetNonNull(); - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } + value.credential.Value().credentialType = static_cast(1); + value.credential.Value().credentialIndex = 0U; - void OnFailureResponse_16(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::ClearCredential::Id, value, + chip::Optional(10000)); + } + case 96: { + LogStep(96, "Clearing PIN credential with out-of-bound index fails"); + chip::app::Clusters::DoorLock::Commands::ClearCredential::Type value; + value.credential.SetNonNull(); - void OnSuccessResponse_16() { NextTest(); } + value.credential.Value().credentialType = static_cast(1); + value.credential.Value().credentialIndex = static_cast(NumberOfPINUsersSupported + 1); - CHIP_ERROR TestKeySetReadAlsoRemoved_17() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - using RequestType = chip::app::Clusters::GroupKeyManagement::Commands::KeySetRead::Type; + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::ClearCredential::Id, value, + chip::Optional(10000)); + } + case 97: { + LogStep(97, "Clearing RFID credential with zero index fails"); + chip::app::Clusters::DoorLock::Commands::ClearCredential::Type value; + value.credential.SetNonNull(); - RequestType request; - request.groupKeySetID = 418U; + value.credential.Value().credentialType = static_cast(2); + value.credential.Value().credentialIndex = 0U; - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_17(data.groupKeySet); - }; + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::ClearCredential::Id, value, + chip::Optional(10000)); + } + case 98: { + LogStep(98, "Clearing RFID credential with out-of-bound index fails"); + chip::app::Clusters::DoorLock::Commands::ClearCredential::Type value; + value.credential.SetNonNull(); - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_17(error); - }; + value.credential.Value().credentialType = static_cast(2); + value.credential.Value().credentialIndex = static_cast(NumberOfRFIDUsersSupported + 1); - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::ClearCredential::Id, value, + chip::Optional(10000)); + } + case 99: { + LogStep(99, "Clear the Programming PIN user"); + chip::app::Clusters::DoorLock::Commands::ClearUser::Type value; + value.userIndex = 1U; + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::ClearUser::Id, value, + chip::Optional(10000)); + } + case 100: { + LogStep(100, "Make sure Programming PIN user is deleted"); + chip::app::Clusters::DoorLock::Commands::GetUser::Type value; + value.userIndex = 1U; + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetUser::Id, value); + } + case 101: { + LogStep(101, "Make sure programming PIN credential is deleted"); + chip::app::Clusters::DoorLock::Commands::GetCredentialStatus::Type value; - void OnFailureResponse_17(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_NOT_FOUND)); - NextTest(); - } + value.credential.credentialType = static_cast(0); + value.credential.credentialIndex = 0U; - void - OnSuccessResponse_17(const chip::app::Clusters::GroupKeyManagement::Structs::GroupKeySetStruct::DecodableType & groupKeySet) - { - ThrowSuccessResponse(); + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetCredentialStatus::Id, value); + } + } + return CHIP_NO_ERROR; } }; -class Test_TC_DD_1_5Suite : public TestCommand +class DL_LockUnlockSuite : public TestCommand { public: - Test_TC_DD_1_5Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_DD_1_5", credsIssuerConfig), mTestIndex(0) + DL_LockUnlockSuite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("DL_LockUnlock", 11, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -114666,45 +45207,7 @@ class Test_TC_DD_1_5Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_DD_1_5Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_DD_1_5\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_DD_1_5\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Step 1\n"); - err = TestStep1_0(); - break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } + ~DL_LockUnlockSuite() {} chip::System::Clock::Timeout GetWaitDuration() const override { @@ -114712,14 +45215,17 @@ class Test_TC_DD_1_5Suite : public TestCommand } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 1; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -114730,6 +45236,71 @@ class Test_TC_DD_1_5Suite : public TestCommand VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); shouldContinue = true; break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DoorLock::Commands::SetCredentialResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("status", value.status, 0)); + + VerifyOrReturn(CheckValueNonNull("userIndex", value.userIndex)); + VerifyOrReturn(CheckValue("userIndex.Value()", value.userIndex.Value(), 1U)); + + VerifyOrReturn(CheckValueNonNull("nextCredentialIndex", value.nextCredentialIndex)); + VerifyOrReturn(CheckValue("nextCredentialIndex.Value()", value.nextCredentialIndex.Value(), 2U)); + } + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNonNull("lockState", value)); + VerifyOrReturn(CheckValue("lockState.Value()", value.Value(), 1)); + } + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNonNull("lockState", value)); + VerifyOrReturn(CheckValue("lockState.Value()", value.Value(), 2)); + } + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); + break; + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNonNull("lockState", value)); + VerifyOrReturn(CheckValue("lockState.Value()", value.Value(), 2)); + } + break; + case 8: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 9: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNonNull("lockState", value)); + VerifyOrReturn(CheckValue("lockState.Value()", value.Value(), 1)); + } + break; + case 10: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; default: LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); } @@ -114740,23 +45311,99 @@ class Test_TC_DD_1_5Suite : public TestCommand } } - // - // Tests methods - // - - CHIP_ERROR TestStep1_0() + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - SetIdentity(kIdentityAlpha); - return Log("Verify that the onboarding payload for NFC tags SHALL use NDEF URI Record Type Definition as defined by NFC " - "Forum in URI Record Type Definition RTD URI"); + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "Create new PIN credential and lock/unlock user"); + chip::app::Clusters::DoorLock::Commands::SetCredential::Type value; + value.operationType = static_cast(0); + + value.credential.credentialType = static_cast(1); + value.credential.credentialIndex = 1U; + + value.credentialData = chip::ByteSpan(chip::Uint8::from_const_char("123456garbage: not in length on purpose"), 6); + value.userIndex.SetNull(); + value.userStatus.SetNull(); + value.userType.SetNull(); + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetCredential::Id, value, + chip::Optional(10000)); + } + case 2: { + LogStep(2, "Try to unlock the door with invalid PIN"); + chip::app::Clusters::DoorLock::Commands::UnlockDoor::Type value; + value.pinCode.Emplace(); + value.pinCode.Value() = chip::ByteSpan(chip::Uint8::from_const_char("000000garbage: not in length on purpose"), 6); + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::UnlockDoor::Id, value, + chip::Optional(10000)); + } + case 3: { + LogStep(3, "Verify that lock state attribute value is set to Locked"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Attributes::LockState::Id); + } + case 4: { + LogStep(4, "Try to unlock the door with valid PIN"); + chip::app::Clusters::DoorLock::Commands::UnlockDoor::Type value; + value.pinCode.Emplace(); + value.pinCode.Value() = chip::ByteSpan(chip::Uint8::from_const_char("123456garbage: not in length on purpose"), 6); + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::UnlockDoor::Id, value, + chip::Optional(10000)); + } + case 5: { + LogStep(5, "Verify that lock state attribute value is set to Unlocked"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Attributes::LockState::Id); + } + case 6: { + LogStep(6, "Try to lock the door with invalid PIN"); + chip::app::Clusters::DoorLock::Commands::LockDoor::Type value; + value.pinCode.Emplace(); + value.pinCode.Value() = chip::ByteSpan(chip::Uint8::from_const_char("000000garbage: not in length on purpose"), 6); + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::LockDoor::Id, value, + chip::Optional(10000)); + } + case 7: { + LogStep(7, "Verify that lock state attribute value is set to Unlocked"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Attributes::LockState::Id); + } + case 8: { + LogStep(8, "Try to unlock the door with valid PIN"); + chip::app::Clusters::DoorLock::Commands::LockDoor::Type value; + value.pinCode.Emplace(); + value.pinCode.Value() = chip::ByteSpan(chip::Uint8::from_const_char("123456garbage: not in length on purpose"), 6); + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::LockDoor::Id, value, + chip::Optional(10000)); + } + case 9: { + LogStep(9, "Verify that lock state attribute value is set to Locked"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Attributes::LockState::Id); + } + case 10: { + LogStep(10, "Clean the created credential"); + chip::app::Clusters::DoorLock::Commands::ClearCredential::Type value; + value.credential.SetNonNull(); + + value.credential.Value().credentialType = static_cast(1); + value.credential.Value().credentialIndex = 1U; + + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::ClearCredential::Id, value, + chip::Optional(10000)); + } + } + return CHIP_NO_ERROR; } }; -class Test_TC_DD_1_6Suite : public TestCommand +class DL_SchedulesSuite : public TestCommand { public: - Test_TC_DD_1_6Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_DD_1_6", credsIssuerConfig), mTestIndex(0) + DL_SchedulesSuite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("DL_Schedules", 84, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -114764,53 +45411,7 @@ class Test_TC_DD_1_6Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_DD_1_6Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_DD_1_6\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_DD_1_6\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Step 1\n"); - err = TestStep1_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Step 1 verification\n"); - err = TestStep1Verification_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Step 2 verificaiton\n"); - err = TestStep2Verificaiton_2(); - break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } + ~DL_SchedulesSuite() {} chip::System::Clock::Timeout GetWaitDuration() const override { @@ -114818,14 +45419,21 @@ class Test_TC_DD_1_6Suite : public TestCommand } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 3; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + uint16_t NumberOfTotalUsersSupported; + uint8_t NumberOfWeekDaySchedulesSupportedPerUser; + uint8_t NumberOfYearDaySchedulesSupportedPerUser; + + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -114838,484 +45446,1449 @@ class Test_TC_DD_1_6Suite : public TestCommand break; case 1: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; + { + chip::app::Clusters::DoorLock::Commands::SetCredentialResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("status", value.status, 0)); + + VerifyOrReturn(CheckValueNonNull("userIndex", value.userIndex)); + VerifyOrReturn(CheckValue("userIndex.Value()", value.userIndex.Value(), 1U)); + + VerifyOrReturn(CheckValueNonNull("nextCredentialIndex", value.nextCredentialIndex)); + VerifyOrReturn(CheckValue("nextCredentialIndex.Value()", value.nextCredentialIndex.Value(), 2U)); + } break; case 2: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("numberOfTotalUsersSupported", value, 10U)); + + NumberOfTotalUsersSupported = value; + } break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("numberOfWeekDaySchedulesSupportedPerUser", value, 10)); - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } + NumberOfWeekDaySchedulesSupportedPerUser = value; + } + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("numberOfYearDaySchedulesSupportedPerUser", value, 10)); - // - // Tests methods - // + NumberOfYearDaySchedulesSupportedPerUser = value; + } + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_FIELD)); + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_FIELD)); + break; + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_FIELD)); + break; + case 8: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_FIELD)); + break; + case 9: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_NOT_FOUND)); + break; + case 10: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_FIELD)); + break; + case 11: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_FIELD)); + break; + case 12: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_FIELD)); + break; + case 13: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_FIELD)); + break; + case 14: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_FIELD)); + break; + case 15: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_FIELD)); + break; + case 16: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_FIELD)); + break; + case 17: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_FIELD)); + break; + case 18: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_FIELD)); + break; + case 19: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DoorLock::Commands::GetWeekDayScheduleResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("weekDayIndex", value.weekDayIndex, 1)); - CHIP_ERROR TestStep1_0() - { - SetIdentity(kIdentityAlpha); - return Log("Scan the DUTs QR code using a QR code reader"); - } + VerifyOrReturn(CheckValue("userIndex", value.userIndex, 1U)); - CHIP_ERROR TestStep1Verification_1() - { - SetIdentity(kIdentityAlpha); - return Log( - "Verify the QR code gets scanned successfully and the QR code must be of sufficient size and contrast respective to " - "surface material as to be readable with standard readers such as smartphones in normal lighting conditions"); - } + VerifyOrReturn(CheckValue("status", value.status, 139)); + } + break; + case 20: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DoorLock::Commands::GetWeekDayScheduleResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("weekDayIndex", value.weekDayIndex, 0)); - CHIP_ERROR TestStep2Verificaiton_2() - { - SetIdentity(kIdentityAlpha); - return Log("Verify QR code version is 1 or higher"); - } -}; + VerifyOrReturn(CheckValue("userIndex", value.userIndex, 1U)); -class Test_TC_DD_1_7Suite : public TestCommand -{ -public: - Test_TC_DD_1_7Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_DD_1_7", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } + VerifyOrReturn(CheckValue("status", value.status, 133)); + } + break; + case 21: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DoorLock::Commands::GetWeekDayScheduleResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("weekDayIndex", value.weekDayIndex, + static_cast(NumberOfWeekDaySchedulesSupportedPerUser + 1))); - ~Test_TC_DD_1_7Suite() {} + VerifyOrReturn(CheckValue("userIndex", value.userIndex, 1U)); - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; + VerifyOrReturn(CheckValue("status", value.status, 133)); + } + break; + case 22: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DoorLock::Commands::GetWeekDayScheduleResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("weekDayIndex", value.weekDayIndex, 1)); - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_DD_1_7\n"); - } + VerifyOrReturn(CheckValue("userIndex", value.userIndex, 0U)); - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_DD_1_7\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } + VerifyOrReturn(CheckValue("status", value.status, 133)); + } + break; + case 23: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DoorLock::Commands::GetWeekDayScheduleResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("weekDayIndex", value.weekDayIndex, 1)); - Wait(); + VerifyOrReturn(CheckValue("userIndex", value.userIndex, static_cast(NumberOfTotalUsersSupported + 1))); - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Precondition\n"); - err = TestPrecondition_0(); + VerifyOrReturn(CheckValue("status", value.status, 133)); + } break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Step 1\n"); - err = TestStep1_1(); + case 24: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DoorLock::Commands::GetWeekDayScheduleResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("weekDayIndex", value.weekDayIndex, 1)); + + VerifyOrReturn(CheckValue("userIndex", value.userIndex, 2U)); + + VerifyOrReturn(CheckValue("status", value.status, 139)); + } break; - } + case 25: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_FIELD)); + break; + case 26: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_FIELD)); + break; + case 27: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_FIELD)); + break; + case 28: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_FIELD)); + break; + case 29: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_NOT_FOUND)); + break; + case 30: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_FIELD)); + break; + case 31: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DoorLock::Commands::GetYearDayScheduleResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("yearDayIndex", value.yearDayIndex, 1)); - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } + VerifyOrReturn(CheckValue("userIndex", value.userIndex, 1U)); - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } + VerifyOrReturn(CheckValue("status", value.status, 139)); + } + break; + case 32: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DoorLock::Commands::GetYearDayScheduleResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("yearDayIndex", value.yearDayIndex, 0)); -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 2; + VerifyOrReturn(CheckValue("userIndex", value.userIndex, 1U)); - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; + VerifyOrReturn(CheckValue("status", value.status, 133)); + } + break; + case 33: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DoorLock::Commands::GetYearDayScheduleResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("yearDayIndex", value.yearDayIndex, + static_cast(NumberOfYearDaySchedulesSupportedPerUser + 1))); - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; + VerifyOrReturn(CheckValue("userIndex", value.userIndex, 1U)); - switch (mTestIndex - 1) - { - case 0: + VerifyOrReturn(CheckValue("status", value.status, 133)); + } + break; + case 34: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; + { + chip::app::Clusters::DoorLock::Commands::GetYearDayScheduleResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("yearDayIndex", value.yearDayIndex, 1)); + + VerifyOrReturn(CheckValue("userIndex", value.userIndex, 0U)); + + VerifyOrReturn(CheckValue("status", value.status, 133)); + } break; - case 1: + case 35: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; + { + chip::app::Clusters::DoorLock::Commands::GetYearDayScheduleResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("yearDayIndex", value.yearDayIndex, 1)); + + VerifyOrReturn(CheckValue("userIndex", value.userIndex, static_cast(NumberOfTotalUsersSupported + 1))); + + VerifyOrReturn(CheckValue("status", value.status, 133)); + } break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } + case 36: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DoorLock::Commands::GetYearDayScheduleResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("yearDayIndex", value.yearDayIndex, 1)); - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } + VerifyOrReturn(CheckValue("userIndex", value.userIndex, 2U)); - // - // Tests methods - // + VerifyOrReturn(CheckValue("status", value.status, 139)); + } + break; + case 37: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 38: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DoorLock::Commands::GetWeekDayScheduleResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("weekDayIndex", value.weekDayIndex, 1)); - CHIP_ERROR TestPrecondition_0() - { - SetIdentity(kIdentityAlpha); - return Log("Verify manual pairing code is printed on the device or in additional provided materials"); - } + VerifyOrReturn(CheckValue("userIndex", value.userIndex, 1U)); - CHIP_ERROR TestStep1_1() - { - SetIdentity(kIdentityAlpha); - return Log("Verify that the Manual Pairing Code should be printed using a minimum font size of 6 points typically " - "producing a typeface height of 2.1 mm"); - } -}; + VerifyOrReturn(CheckValue("status", value.status, 0)); -class Test_TC_DD_1_8Suite : public TestCommand -{ -public: - Test_TC_DD_1_8Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_DD_1_8", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } + VerifyOrReturn(CheckValuePresent("daysMask", value.daysMask)); + VerifyOrReturn(CheckValue("daysMask.Value()", value.daysMask.Value(), 1)); - ~Test_TC_DD_1_8Suite() {} + VerifyOrReturn(CheckValuePresent("startHour", value.startHour)); + VerifyOrReturn(CheckValue("startHour.Value()", value.startHour.Value(), 15)); - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; + VerifyOrReturn(CheckValuePresent("startMinute", value.startMinute)); + VerifyOrReturn(CheckValue("startMinute.Value()", value.startMinute.Value(), 16)); - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_DD_1_8\n"); - } + VerifyOrReturn(CheckValuePresent("endHour", value.endHour)); + VerifyOrReturn(CheckValue("endHour.Value()", value.endHour.Value(), 18)); - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_DD_1_8\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } + VerifyOrReturn(CheckValuePresent("endMinute", value.endMinute)); + VerifyOrReturn(CheckValue("endMinute.Value()", value.endMinute.Value(), 0)); + } + break; + case 39: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 40: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DoorLock::Commands::GetYearDayScheduleResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("yearDayIndex", value.yearDayIndex, 1)); - Wait(); + VerifyOrReturn(CheckValue("userIndex", value.userIndex, 1U)); - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Step 1\n"); - err = TestStep1_0(); + VerifyOrReturn(CheckValue("status", value.status, 0)); + + VerifyOrReturn(CheckValuePresent("localStartTime", value.localStartTime)); + VerifyOrReturn(CheckValue("localStartTime.Value()", value.localStartTime.Value(), 12345UL)); + + VerifyOrReturn(CheckValuePresent("localEndTime", value.localEndTime)); + VerifyOrReturn(CheckValue("localEndTime.Value()", value.localEndTime.Value(), 12345689UL)); + } break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Step 1 verification\n"); - err = TestStep1Verification_1(); + case 41: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_FIELD)); break; - } + case 42: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_FIELD)); + break; + case 43: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_FIELD)); + break; + case 44: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_FIELD)); + break; + case 45: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_NOT_FOUND)); + break; + case 46: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_FIELD)); + break; + case 47: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_FIELD)); + break; + case 48: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_FIELD)); + break; + case 49: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_FIELD)); + break; + case 50: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_NOT_FOUND)); + break; + case 51: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DoorLock::Commands::GetWeekDayScheduleResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("weekDayIndex", value.weekDayIndex, 1)); - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } + VerifyOrReturn(CheckValue("userIndex", value.userIndex, 1U)); - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } + VerifyOrReturn(CheckValue("status", value.status, 0)); + + VerifyOrReturn(CheckValuePresent("daysMask", value.daysMask)); + VerifyOrReturn(CheckValue("daysMask.Value()", value.daysMask.Value(), 1)); + + VerifyOrReturn(CheckValuePresent("startHour", value.startHour)); + VerifyOrReturn(CheckValue("startHour.Value()", value.startHour.Value(), 15)); + + VerifyOrReturn(CheckValuePresent("startMinute", value.startMinute)); + VerifyOrReturn(CheckValue("startMinute.Value()", value.startMinute.Value(), 16)); + + VerifyOrReturn(CheckValuePresent("endHour", value.endHour)); + VerifyOrReturn(CheckValue("endHour.Value()", value.endHour.Value(), 18)); + + VerifyOrReturn(CheckValuePresent("endMinute", value.endMinute)); + VerifyOrReturn(CheckValue("endMinute.Value()", value.endMinute.Value(), 0)); + } + break; + case 52: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DoorLock::Commands::GetYearDayScheduleResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("yearDayIndex", value.yearDayIndex, 1)); + + VerifyOrReturn(CheckValue("userIndex", value.userIndex, 1U)); + + VerifyOrReturn(CheckValue("status", value.status, 0)); + + VerifyOrReturn(CheckValuePresent("localStartTime", value.localStartTime)); + VerifyOrReturn(CheckValue("localStartTime.Value()", value.localStartTime.Value(), 12345UL)); + + VerifyOrReturn(CheckValuePresent("localEndTime", value.localEndTime)); + VerifyOrReturn(CheckValue("localEndTime.Value()", value.localEndTime.Value(), 12345689UL)); + } + break; + case 53: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 54: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DoorLock::Commands::GetWeekDayScheduleResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("weekDayIndex", value.weekDayIndex, 2)); + + VerifyOrReturn(CheckValue("userIndex", value.userIndex, 1U)); + + VerifyOrReturn(CheckValue("status", value.status, 0)); + + VerifyOrReturn(CheckValuePresent("daysMask", value.daysMask)); + VerifyOrReturn(CheckValue("daysMask.Value()", value.daysMask.Value(), 2)); + + VerifyOrReturn(CheckValuePresent("startHour", value.startHour)); + VerifyOrReturn(CheckValue("startHour.Value()", value.startHour.Value(), 0)); + + VerifyOrReturn(CheckValuePresent("startMinute", value.startMinute)); + VerifyOrReturn(CheckValue("startMinute.Value()", value.startMinute.Value(), 0)); + + VerifyOrReturn(CheckValuePresent("endHour", value.endHour)); + VerifyOrReturn(CheckValue("endHour.Value()", value.endHour.Value(), 23)); + + VerifyOrReturn(CheckValuePresent("endMinute", value.endMinute)); + VerifyOrReturn(CheckValue("endMinute.Value()", value.endMinute.Value(), 59)); + } + break; + case 55: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 56: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DoorLock::Commands::GetYearDayScheduleResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("yearDayIndex", value.yearDayIndex, 2)); + + VerifyOrReturn(CheckValue("userIndex", value.userIndex, 1U)); + + VerifyOrReturn(CheckValue("status", value.status, 0)); + + VerifyOrReturn(CheckValuePresent("localStartTime", value.localStartTime)); + VerifyOrReturn(CheckValue("localStartTime.Value()", value.localStartTime.Value(), 9000UL)); + + VerifyOrReturn(CheckValuePresent("localEndTime", value.localEndTime)); + VerifyOrReturn(CheckValue("localEndTime.Value()", value.localEndTime.Value(), 888888888UL)); + } + break; + case 57: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 58: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DoorLock::Commands::GetWeekDayScheduleResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("weekDayIndex", value.weekDayIndex, 1)); + + VerifyOrReturn(CheckValue("userIndex", value.userIndex, 1U)); + + VerifyOrReturn(CheckValue("status", value.status, 139)); + } + break; + case 59: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 60: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DoorLock::Commands::GetWeekDayScheduleResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("weekDayIndex", value.weekDayIndex, 2)); + + VerifyOrReturn(CheckValue("userIndex", value.userIndex, 1U)); + + VerifyOrReturn(CheckValue("status", value.status, 139)); + } + break; + case 61: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DoorLock::Commands::GetYearDayScheduleResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("yearDayIndex", value.yearDayIndex, 1)); + + VerifyOrReturn(CheckValue("userIndex", value.userIndex, 1U)); + + VerifyOrReturn(CheckValue("status", value.status, 0)); + + VerifyOrReturn(CheckValuePresent("localStartTime", value.localStartTime)); + VerifyOrReturn(CheckValue("localStartTime.Value()", value.localStartTime.Value(), 12345UL)); + + VerifyOrReturn(CheckValuePresent("localEndTime", value.localEndTime)); + VerifyOrReturn(CheckValue("localEndTime.Value()", value.localEndTime.Value(), 12345689UL)); + } + break; + case 62: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DoorLock::Commands::GetYearDayScheduleResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("yearDayIndex", value.yearDayIndex, 2)); -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 2; + VerifyOrReturn(CheckValue("userIndex", value.userIndex, 1U)); - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; + VerifyOrReturn(CheckValue("status", value.status, 0)); - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; + VerifyOrReturn(CheckValuePresent("localStartTime", value.localStartTime)); + VerifyOrReturn(CheckValue("localStartTime.Value()", value.localStartTime.Value(), 9000UL)); - switch (mTestIndex - 1) - { - case 0: + VerifyOrReturn(CheckValuePresent("localEndTime", value.localEndTime)); + VerifyOrReturn(CheckValue("localEndTime.Value()", value.localEndTime.Value(), 888888888UL)); + } + break; + case 63: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; break; - case 1: + case 64: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } + case 65: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DoorLock::Commands::GetYearDayScheduleResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("yearDayIndex", value.yearDayIndex, 1)); - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } + VerifyOrReturn(CheckValue("userIndex", value.userIndex, 1U)); - // - // Tests methods - // + VerifyOrReturn(CheckValue("status", value.status, 139)); + } + break; + case 66: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 67: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DoorLock::Commands::GetYearDayScheduleResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("yearDayIndex", value.yearDayIndex, 2)); - CHIP_ERROR TestStep1_0() - { - SetIdentity(kIdentityAlpha); - return Log("Scan the device QR code using DUT"); - } + VerifyOrReturn(CheckValue("userIndex", value.userIndex, 1U)); - CHIP_ERROR TestStep1Verification_1() - { - SetIdentity(kIdentityAlpha); - return Log("Verify the DUT is able to scan and parse the QR code successfully to onboard the device onto the CHIP network"); - } -}; + VerifyOrReturn(CheckValue("status", value.status, 139)); + } + break; + case 68: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DoorLock::Commands::GetWeekDayScheduleResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("weekDayIndex", value.weekDayIndex, 1)); -class Test_TC_DD_1_9Suite : public TestCommand -{ -public: - Test_TC_DD_1_9Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_DD_1_9", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } + VerifyOrReturn(CheckValue("userIndex", value.userIndex, 1U)); - ~Test_TC_DD_1_9Suite() {} + VerifyOrReturn(CheckValue("status", value.status, 0)); - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; + VerifyOrReturn(CheckValuePresent("daysMask", value.daysMask)); + VerifyOrReturn(CheckValue("daysMask.Value()", value.daysMask.Value(), 2)); - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_DD_1_9\n"); - } + VerifyOrReturn(CheckValuePresent("startHour", value.startHour)); + VerifyOrReturn(CheckValue("startHour.Value()", value.startHour.Value(), 0)); - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_DD_1_9\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } + VerifyOrReturn(CheckValuePresent("startMinute", value.startMinute)); + VerifyOrReturn(CheckValue("startMinute.Value()", value.startMinute.Value(), 0)); - Wait(); + VerifyOrReturn(CheckValuePresent("endHour", value.endHour)); + VerifyOrReturn(CheckValue("endHour.Value()", value.endHour.Value(), 23)); - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Precondition\n"); - err = TestPrecondition_0(); + VerifyOrReturn(CheckValuePresent("endMinute", value.endMinute)); + VerifyOrReturn(CheckValue("endMinute.Value()", value.endMinute.Value(), 59)); + } break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Step 1\n"); - err = TestStep1_1(); + case 69: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Step 1 verification\n"); - err = TestStep1Verification_2(); + case 70: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - } + case 71: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 72: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DoorLock::Commands::GetWeekDayScheduleResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("weekDayIndex", value.weekDayIndex, 1)); - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } + VerifyOrReturn(CheckValue("userIndex", value.userIndex, 1U)); - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } + VerifyOrReturn(CheckValue("status", value.status, 0)); -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 3; + VerifyOrReturn(CheckValuePresent("daysMask", value.daysMask)); + VerifyOrReturn(CheckValue("daysMask.Value()", value.daysMask.Value(), 1)); - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; + VerifyOrReturn(CheckValuePresent("startHour", value.startHour)); + VerifyOrReturn(CheckValue("startHour.Value()", value.startHour.Value(), 0)); - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; + VerifyOrReturn(CheckValuePresent("startMinute", value.startMinute)); + VerifyOrReturn(CheckValue("startMinute.Value()", value.startMinute.Value(), 0)); - switch (mTestIndex - 1) - { - case 0: + VerifyOrReturn(CheckValuePresent("endHour", value.endHour)); + VerifyOrReturn(CheckValue("endHour.Value()", value.endHour.Value(), 23)); + + VerifyOrReturn(CheckValuePresent("endMinute", value.endMinute)); + VerifyOrReturn(CheckValue("endMinute.Value()", value.endMinute.Value(), 59)); + } + break; + case 73: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; break; - case 1: + case 74: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; + { + chip::app::Clusters::DoorLock::Commands::GetYearDayScheduleResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("yearDayIndex", value.yearDayIndex, 4)); + + VerifyOrReturn(CheckValue("userIndex", value.userIndex, 1U)); + + VerifyOrReturn(CheckValue("status", value.status, 0)); + + VerifyOrReturn(CheckValuePresent("localStartTime", value.localStartTime)); + VerifyOrReturn(CheckValue("localStartTime.Value()", value.localStartTime.Value(), 9000UL)); + + VerifyOrReturn(CheckValuePresent("localEndTime", value.localEndTime)); + VerifyOrReturn(CheckValue("localEndTime.Value()", value.localEndTime.Value(), 888888888UL)); + } break; - case 2: + case 75: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } + case 76: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DoorLock::Commands::GetWeekDayScheduleResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("weekDayIndex", value.weekDayIndex, 4)); - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } + VerifyOrReturn(CheckValue("userIndex", value.userIndex, 2U)); - // - // Tests methods - // + VerifyOrReturn(CheckValue("status", value.status, 0)); - CHIP_ERROR TestPrecondition_0() - { - SetIdentity(kIdentityAlpha); - return Log("Verify that the manual pairing code is printed on the device or in additional provided materials"); - } + VerifyOrReturn(CheckValuePresent("daysMask", value.daysMask)); + VerifyOrReturn(CheckValue("daysMask.Value()", value.daysMask.Value(), 64)); - CHIP_ERROR TestStep1_1() - { - SetIdentity(kIdentityAlpha); - return Log("Provide the 11 digit or 21 digit pairing code from the Device in text speech or any format supported by DUT"); - } + VerifyOrReturn(CheckValuePresent("startHour", value.startHour)); + VerifyOrReturn(CheckValue("startHour.Value()", value.startHour.Value(), 23)); - CHIP_ERROR TestStep1Verification_2() - { - SetIdentity(kIdentityAlpha); - return Log( - "Verify that the manual pairing code can be provided to DUT and parsed to onboard the device onto the CHIP network"); - } -}; + VerifyOrReturn(CheckValuePresent("startMinute", value.startMinute)); + VerifyOrReturn(CheckValue("startMinute.Value()", value.startMinute.Value(), 0)); -class Test_TC_DD_1_10Suite : public TestCommand -{ -public: - Test_TC_DD_1_10Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_DD_1_10", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } + VerifyOrReturn(CheckValuePresent("endHour", value.endHour)); + VerifyOrReturn(CheckValue("endHour.Value()", value.endHour.Value(), 23)); - ~Test_TC_DD_1_10Suite() {} + VerifyOrReturn(CheckValuePresent("endMinute", value.endMinute)); + VerifyOrReturn(CheckValue("endMinute.Value()", value.endMinute.Value(), 59)); + } + break; + case 77: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 78: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DoorLock::Commands::GetYearDayScheduleResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("yearDayIndex", value.yearDayIndex, 1)); - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; + VerifyOrReturn(CheckValue("userIndex", value.userIndex, 1U)); - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_DD_1_10\n"); - } + VerifyOrReturn(CheckValue("status", value.status, 0)); - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_DD_1_10\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } + VerifyOrReturn(CheckValuePresent("localStartTime", value.localStartTime)); + VerifyOrReturn(CheckValue("localStartTime.Value()", value.localStartTime.Value(), 55555UL)); - Wait(); + VerifyOrReturn(CheckValuePresent("localEndTime", value.localEndTime)); + VerifyOrReturn(CheckValue("localEndTime.Value()", value.localEndTime.Value(), 7777777UL)); + } + break; + case 79: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 80: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DoorLock::Commands::GetWeekDayScheduleResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("weekDayIndex", value.weekDayIndex, 1)); - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - } + VerifyOrReturn(CheckValue("userIndex", value.userIndex, 1U)); - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } + VerifyOrReturn(CheckValue("status", value.status, 139)); + } + break; + case 81: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DoorLock::Commands::GetYearDayScheduleResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("yearDayIndex", value.yearDayIndex, 4)); - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } + VerifyOrReturn(CheckValue("userIndex", value.userIndex, 1U)); -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; + VerifyOrReturn(CheckValue("status", value.status, 139)); + } + break; + case 82: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DoorLock::Commands::GetWeekDayScheduleResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("weekDayIndex", value.weekDayIndex, 4)); - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; + VerifyOrReturn(CheckValue("userIndex", value.userIndex, 2U)); - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; + VerifyOrReturn(CheckValue("status", value.status, 139)); + } + break; + case 83: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DoorLock::Commands::GetYearDayScheduleResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("yearDayIndex", value.yearDayIndex, 1)); - switch (mTestIndex - 1) - { + VerifyOrReturn(CheckValue("userIndex", value.userIndex, 2U)); + + VerifyOrReturn(CheckValue("status", value.status, 139)); + } + break; default: LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); } - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } + } + + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "Create new PIN credential and schedule user"); + chip::app::Clusters::DoorLock::Commands::SetCredential::Type value; + value.operationType = static_cast(0); + + value.credential.credentialType = static_cast(1); + value.credential.credentialIndex = 1U; + + value.credentialData = chip::ByteSpan(chip::Uint8::from_const_char("123456garbage: not in length on purpose"), 6); + value.userIndex.SetNull(); + value.userStatus.SetNull(); + value.userType.SetNull(); + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetCredential::Id, value, + chip::Optional(10000)); + } + case 2: { + LogStep(2, "Get number of supported users"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, + DoorLock::Attributes::NumberOfTotalUsersSupported::Id); + } + case 3: { + LogStep(3, "Get Max number of Week Day schedules for user and verify default value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, + DoorLock::Attributes::NumberOfWeekDaySchedulesSupportedPerUser::Id); + } + case 4: { + LogStep(4, "Get Max number of Year Day schedules for user and verify default value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, + DoorLock::Attributes::NumberOfYearDaySchedulesSupportedPerUser::Id); + } + case 5: { + LogStep(5, "Create Week Day schedule with 0 index"); + chip::app::Clusters::DoorLock::Commands::SetWeekDaySchedule::Type value; + value.weekDayIndex = 0; + value.userIndex = 1U; + value.daysMask = static_cast>(1); + value.startHour = 15; + value.startMinute = 16; + value.endHour = 18; + value.endMinute = 0; + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetWeekDaySchedule::Id, value); + } + case 6: { + LogStep(6, "Create Week Day schedule with out-of-bounds index"); + chip::app::Clusters::DoorLock::Commands::SetWeekDaySchedule::Type value; + value.weekDayIndex = static_cast(NumberOfWeekDaySchedulesSupportedPerUser + 1); + value.userIndex = 1U; + value.daysMask = static_cast>(1); + value.startHour = 15; + value.startMinute = 16; + value.endHour = 18; + value.endMinute = 0; + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetWeekDaySchedule::Id, value); + } + case 7: { + LogStep(7, "Create Week Day schedule with 0 user index"); + chip::app::Clusters::DoorLock::Commands::SetWeekDaySchedule::Type value; + value.weekDayIndex = 1; + value.userIndex = 0U; + value.daysMask = static_cast>(1); + value.startHour = 15; + value.startMinute = 16; + value.endHour = 18; + value.endMinute = 0; + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetWeekDaySchedule::Id, value); + } + case 8: { + LogStep(8, "Create Week Day schedule with out-of-bounds user index"); + chip::app::Clusters::DoorLock::Commands::SetWeekDaySchedule::Type value; + value.weekDayIndex = 1; + value.userIndex = static_cast(NumberOfTotalUsersSupported + 1); + value.daysMask = static_cast>(1); + value.startHour = 15; + value.startMinute = 16; + value.endHour = 18; + value.endMinute = 0; + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetWeekDaySchedule::Id, value); + } + case 9: { + LogStep(9, "Create Week Day schedule for non-existing user"); + chip::app::Clusters::DoorLock::Commands::SetWeekDaySchedule::Type value; + value.weekDayIndex = 1; + value.userIndex = 2U; + value.daysMask = static_cast>(1); + value.startHour = 15; + value.startMinute = 16; + value.endHour = 18; + value.endMinute = 0; + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetWeekDaySchedule::Id, value); + } + case 10: { + LogStep(10, "Create Week Day schedule with 0 days mask"); + chip::app::Clusters::DoorLock::Commands::SetWeekDaySchedule::Type value; + value.weekDayIndex = 1; + value.userIndex = 1U; + value.daysMask = static_cast>(0); + value.startHour = 15; + value.startMinute = 16; + value.endHour = 18; + value.endMinute = 0; + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetWeekDaySchedule::Id, value); + } + case 11: { + LogStep(11, "Create Week Day schedule for Sunday and Monday"); + chip::app::Clusters::DoorLock::Commands::SetWeekDaySchedule::Type value; + value.weekDayIndex = 1; + value.userIndex = 1U; + value.daysMask = static_cast>(3); + value.startHour = 15; + value.startMinute = 16; + value.endHour = 18; + value.endMinute = 0; + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetWeekDaySchedule::Id, value); + } + case 12: { + LogStep(12, "Create Week Day schedule for Sunday Wednesday and Saturday"); + chip::app::Clusters::DoorLock::Commands::SetWeekDaySchedule::Type value; + value.weekDayIndex = 1; + value.userIndex = 1U; + value.daysMask = static_cast>(73); + value.startHour = 15; + value.startMinute = 16; + value.endHour = 18; + value.endMinute = 0; + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetWeekDaySchedule::Id, value); + } + case 13: { + LogStep(13, "Create Week Day schedule with invalid start hour"); + chip::app::Clusters::DoorLock::Commands::SetWeekDaySchedule::Type value; + value.weekDayIndex = 1; + value.userIndex = 1U; + value.daysMask = static_cast>(1); + value.startHour = 24; + value.startMinute = 16; + value.endHour = 18; + value.endMinute = 0; + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetWeekDaySchedule::Id, value); + } + case 14: { + LogStep(14, "Create Week Day schedule with invalid start minute"); + chip::app::Clusters::DoorLock::Commands::SetWeekDaySchedule::Type value; + value.weekDayIndex = 1; + value.userIndex = 1U; + value.daysMask = static_cast>(1); + value.startHour = 15; + value.startMinute = 60; + value.endHour = 18; + value.endMinute = 0; + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetWeekDaySchedule::Id, value); + } + case 15: { + LogStep(15, "Create Week Day schedule with invalid end hour"); + chip::app::Clusters::DoorLock::Commands::SetWeekDaySchedule::Type value; + value.weekDayIndex = 1; + value.userIndex = 1U; + value.daysMask = static_cast>(1); + value.startHour = 15; + value.startMinute = 16; + value.endHour = 24; + value.endMinute = 0; + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetWeekDaySchedule::Id, value); + } + case 16: { + LogStep(16, "Create Week Day schedule with invalid end minute"); + chip::app::Clusters::DoorLock::Commands::SetWeekDaySchedule::Type value; + value.weekDayIndex = 1; + value.userIndex = 1U; + value.daysMask = static_cast>(1); + value.startHour = 15; + value.startMinute = 16; + value.endHour = 18; + value.endMinute = 60; + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetWeekDaySchedule::Id, value); + } + case 17: { + LogStep(17, "Create Week Day schedule with start hour later that end hour"); + chip::app::Clusters::DoorLock::Commands::SetWeekDaySchedule::Type value; + value.weekDayIndex = 1; + value.userIndex = 1U; + value.daysMask = static_cast>(1); + value.startHour = 19; + value.startMinute = 16; + value.endHour = 18; + value.endMinute = 0; + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetWeekDaySchedule::Id, value); + } + case 18: { + LogStep(18, "Create Week Day schedule with start minute later that end minute when hours are equal"); + chip::app::Clusters::DoorLock::Commands::SetWeekDaySchedule::Type value; + value.weekDayIndex = 1; + value.userIndex = 1U; + value.daysMask = static_cast>(1); + value.startHour = 15; + value.startMinute = 50; + value.endHour = 15; + value.endMinute = 49; + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetWeekDaySchedule::Id, value); + } + case 19: { + LogStep(19, "Make sure that previous operations did not create a schedule"); + chip::app::Clusters::DoorLock::Commands::GetWeekDaySchedule::Type value; + value.weekDayIndex = 1; + value.userIndex = 1U; + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetWeekDaySchedule::Id, value); + } + case 20: { + LogStep(20, "Get Week Day schedule with 0 index"); + chip::app::Clusters::DoorLock::Commands::GetWeekDaySchedule::Type value; + value.weekDayIndex = 0; + value.userIndex = 1U; + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetWeekDaySchedule::Id, value); + } + case 21: { + LogStep(21, "Get Week Day schedule with out-of-bounds index"); + chip::app::Clusters::DoorLock::Commands::GetWeekDaySchedule::Type value; + value.weekDayIndex = static_cast(NumberOfWeekDaySchedulesSupportedPerUser + 1); + value.userIndex = 1U; + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetWeekDaySchedule::Id, value); + } + case 22: { + LogStep(22, "Get Week Day schedule with 0 user index"); + chip::app::Clusters::DoorLock::Commands::GetWeekDaySchedule::Type value; + value.weekDayIndex = 1; + value.userIndex = 0U; + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetWeekDaySchedule::Id, value); + } + case 23: { + LogStep(23, "Get Week Day schedule with out-of-bounds user index"); + chip::app::Clusters::DoorLock::Commands::GetWeekDaySchedule::Type value; + value.weekDayIndex = 1; + value.userIndex = static_cast(NumberOfTotalUsersSupported + 1); + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetWeekDaySchedule::Id, value); + } + case 24: { + LogStep(24, "Get Week Day schedule with non-existing user index"); + chip::app::Clusters::DoorLock::Commands::GetWeekDaySchedule::Type value; + value.weekDayIndex = 1; + value.userIndex = 2U; + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetWeekDaySchedule::Id, value); + } + case 25: { + LogStep(25, "Create Year Day schedule with 0 index"); + chip::app::Clusters::DoorLock::Commands::SetYearDaySchedule::Type value; + value.yearDayIndex = 0; + value.userIndex = 1U; + value.localStartTime = 12345UL; + value.localEndTime = 12345689UL; + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetYearDaySchedule::Id, value); + } + case 26: { + LogStep(26, "Create Year Day schedule with out-of-bounds index"); + chip::app::Clusters::DoorLock::Commands::SetYearDaySchedule::Type value; + value.yearDayIndex = static_cast(NumberOfYearDaySchedulesSupportedPerUser + 1); + value.userIndex = 1U; + value.localStartTime = 12345UL; + value.localEndTime = 12345689UL; + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetYearDaySchedule::Id, value); + } + case 27: { + LogStep(27, "Create Year Day schedule with 0 user index"); + chip::app::Clusters::DoorLock::Commands::SetYearDaySchedule::Type value; + value.yearDayIndex = 1; + value.userIndex = 0U; + value.localStartTime = 12345UL; + value.localEndTime = 12345689UL; + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetYearDaySchedule::Id, value); + } + case 28: { + LogStep(28, "Create Year Day schedule with out-of-bounds user index"); + chip::app::Clusters::DoorLock::Commands::SetYearDaySchedule::Type value; + value.yearDayIndex = 1; + value.userIndex = static_cast(NumberOfTotalUsersSupported + 1); + value.localStartTime = 12345UL; + value.localEndTime = 12345689UL; + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetYearDaySchedule::Id, value); + } + case 29: { + LogStep(29, "Create Year Day schedule for non-existing user"); + chip::app::Clusters::DoorLock::Commands::SetYearDaySchedule::Type value; + value.yearDayIndex = 1; + value.userIndex = 2U; + value.localStartTime = 12345UL; + value.localEndTime = 12345689UL; + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetYearDaySchedule::Id, value); + } + case 30: { + LogStep(30, "Create Year Day schedule with start hour later that end hour"); + chip::app::Clusters::DoorLock::Commands::SetYearDaySchedule::Type value; + value.yearDayIndex = 1; + value.userIndex = 1U; + value.localStartTime = 12345689UL; + value.localEndTime = 12345688UL; + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetYearDaySchedule::Id, value); + } + case 31: { + LogStep(31, "Make sure that previous operations did not create a schedule"); + chip::app::Clusters::DoorLock::Commands::GetYearDaySchedule::Type value; + value.yearDayIndex = 1; + value.userIndex = 1U; + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetYearDaySchedule::Id, value); + } + case 32: { + LogStep(32, "Get Year Day schedule with 0 index"); + chip::app::Clusters::DoorLock::Commands::GetYearDaySchedule::Type value; + value.yearDayIndex = 0; + value.userIndex = 1U; + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetYearDaySchedule::Id, value); + } + case 33: { + LogStep(33, "Get Year Day schedule with out-of-bounds index"); + chip::app::Clusters::DoorLock::Commands::GetYearDaySchedule::Type value; + value.yearDayIndex = static_cast(NumberOfYearDaySchedulesSupportedPerUser + 1); + value.userIndex = 1U; + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetYearDaySchedule::Id, value); + } + case 34: { + LogStep(34, "Get Year Day schedule with 0 user index"); + chip::app::Clusters::DoorLock::Commands::GetYearDaySchedule::Type value; + value.yearDayIndex = 1; + value.userIndex = 0U; + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetYearDaySchedule::Id, value); + } + case 35: { + LogStep(35, "Get Year Day schedule with out-of-bounds user index"); + chip::app::Clusters::DoorLock::Commands::GetYearDaySchedule::Type value; + value.yearDayIndex = 1; + value.userIndex = static_cast(NumberOfTotalUsersSupported + 1); + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetYearDaySchedule::Id, value); + } + case 36: { + LogStep(36, "Get Year Day schedule with non-existing user index"); + chip::app::Clusters::DoorLock::Commands::GetYearDaySchedule::Type value; + value.yearDayIndex = 1; + value.userIndex = 2U; + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetYearDaySchedule::Id, value); + } + case 37: { + LogStep(37, "Create Week Day schedule with valid parameters"); + chip::app::Clusters::DoorLock::Commands::SetWeekDaySchedule::Type value; + value.weekDayIndex = 1; + value.userIndex = 1U; + value.daysMask = static_cast>(1); + value.startHour = 15; + value.startMinute = 16; + value.endHour = 18; + value.endMinute = 0; + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetWeekDaySchedule::Id, value); + } + case 38: { + LogStep(38, "Verify created schedule"); + chip::app::Clusters::DoorLock::Commands::GetWeekDaySchedule::Type value; + value.weekDayIndex = 1; + value.userIndex = 1U; + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetWeekDaySchedule::Id, value); + } + case 39: { + LogStep(39, "Create Year Day schedule with valid parameters"); + chip::app::Clusters::DoorLock::Commands::SetYearDaySchedule::Type value; + value.yearDayIndex = 1; + value.userIndex = 1U; + value.localStartTime = 12345UL; + value.localEndTime = 12345689UL; + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetYearDaySchedule::Id, value); + } + case 40: { + LogStep(40, "Verify created schedule"); + chip::app::Clusters::DoorLock::Commands::GetYearDaySchedule::Type value; + value.yearDayIndex = 1; + value.userIndex = 1U; + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetYearDaySchedule::Id, value); + } + case 41: { + LogStep(41, "Clear Week Day schedule with 0 index"); + chip::app::Clusters::DoorLock::Commands::ClearWeekDaySchedule::Type value; + value.weekDayIndex = 0; + value.userIndex = 1U; + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::ClearWeekDaySchedule::Id, value); + } + case 42: { + LogStep(42, "Clear Week Day schedule with out-of-bounds index"); + chip::app::Clusters::DoorLock::Commands::ClearWeekDaySchedule::Type value; + value.weekDayIndex = static_cast(NumberOfWeekDaySchedulesSupportedPerUser + 1); + value.userIndex = 1U; + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::ClearWeekDaySchedule::Id, value); + } + case 43: { + LogStep(43, "Clear Week Day schedule with 0 user index"); + chip::app::Clusters::DoorLock::Commands::ClearWeekDaySchedule::Type value; + value.weekDayIndex = 1; + value.userIndex = 0U; + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::ClearWeekDaySchedule::Id, value); + } + case 44: { + LogStep(44, "Clear Week Day schedule with out-of-bounds user index"); + chip::app::Clusters::DoorLock::Commands::ClearWeekDaySchedule::Type value; + value.weekDayIndex = 1; + value.userIndex = static_cast(NumberOfTotalUsersSupported + 1); + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::ClearWeekDaySchedule::Id, value); + } + case 45: { + LogStep(45, "Clear Week Day schedule with non-existing user"); + chip::app::Clusters::DoorLock::Commands::ClearWeekDaySchedule::Type value; + value.weekDayIndex = 1; + value.userIndex = 2U; + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::ClearWeekDaySchedule::Id, value); + } + case 46: { + LogStep(46, "Clear Year Day schedule with 0 index"); + chip::app::Clusters::DoorLock::Commands::ClearYearDaySchedule::Type value; + value.yearDayIndex = 0; + value.userIndex = 1U; + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::ClearYearDaySchedule::Id, value); + } + case 47: { + LogStep(47, "Clear Year Day schedule with out-of-bounds index"); + chip::app::Clusters::DoorLock::Commands::ClearYearDaySchedule::Type value; + value.yearDayIndex = static_cast(NumberOfYearDaySchedulesSupportedPerUser + 1); + value.userIndex = 1U; + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::ClearYearDaySchedule::Id, value); + } + case 48: { + LogStep(48, "Clear Year Day schedule with 0 user index"); + chip::app::Clusters::DoorLock::Commands::ClearYearDaySchedule::Type value; + value.yearDayIndex = 1; + value.userIndex = 0U; + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::ClearYearDaySchedule::Id, value); + } + case 49: { + LogStep(49, "Clear Year Day schedule with out-of-bounds user index"); + chip::app::Clusters::DoorLock::Commands::ClearYearDaySchedule::Type value; + value.yearDayIndex = 1; + value.userIndex = static_cast(NumberOfTotalUsersSupported + 1); + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::ClearYearDaySchedule::Id, value); + } + case 50: { + LogStep(50, "Clear Year Day schedule with non-existing user"); + chip::app::Clusters::DoorLock::Commands::ClearYearDaySchedule::Type value; + value.yearDayIndex = 1; + value.userIndex = 2U; + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::ClearYearDaySchedule::Id, value); + } + case 51: { + LogStep(51, "Make sure that week day schedule was not deleted"); + chip::app::Clusters::DoorLock::Commands::GetWeekDaySchedule::Type value; + value.weekDayIndex = 1; + value.userIndex = 1U; + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetWeekDaySchedule::Id, value); + } + case 52: { + LogStep(52, "Make sure that year day schedule was not deleted"); + chip::app::Clusters::DoorLock::Commands::GetYearDaySchedule::Type value; + value.yearDayIndex = 1; + value.userIndex = 1U; + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetYearDaySchedule::Id, value); + } + case 53: { + LogStep(53, "Create another Week Day schedule with valid parameters"); + chip::app::Clusters::DoorLock::Commands::SetWeekDaySchedule::Type value; + value.weekDayIndex = 2; + value.userIndex = 1U; + value.daysMask = static_cast>(2); + value.startHour = 0; + value.startMinute = 0; + value.endHour = 23; + value.endMinute = 59; + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetWeekDaySchedule::Id, value); + } + case 54: { + LogStep(54, "Verify created week day schedule"); + chip::app::Clusters::DoorLock::Commands::GetWeekDaySchedule::Type value; + value.weekDayIndex = 2; + value.userIndex = 1U; + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetWeekDaySchedule::Id, value); + } + case 55: { + LogStep(55, "Create another Year Day schedule with valid parameters"); + chip::app::Clusters::DoorLock::Commands::SetYearDaySchedule::Type value; + value.yearDayIndex = 2; + value.userIndex = 1U; + value.localStartTime = 9000UL; + value.localEndTime = 888888888UL; + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetYearDaySchedule::Id, value); + } + case 56: { + LogStep(56, "Verify created year day schedule"); + chip::app::Clusters::DoorLock::Commands::GetYearDaySchedule::Type value; + value.yearDayIndex = 2; + value.userIndex = 1U; + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetYearDaySchedule::Id, value); + } + case 57: { + LogStep(57, "Clear a single week day schedule for the first user"); + chip::app::Clusters::DoorLock::Commands::ClearWeekDaySchedule::Type value; + value.weekDayIndex = 1; + value.userIndex = 1U; + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::ClearWeekDaySchedule::Id, value); + } + case 58: { + LogStep(58, "Verify cleared week day schedule"); + chip::app::Clusters::DoorLock::Commands::GetWeekDaySchedule::Type value; + value.weekDayIndex = 1; + value.userIndex = 1U; + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetWeekDaySchedule::Id, value); + } + case 59: { + LogStep(59, "Clear all remaining week day schedules for the first user"); + chip::app::Clusters::DoorLock::Commands::ClearWeekDaySchedule::Type value; + value.weekDayIndex = 254; + value.userIndex = 1U; + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::ClearWeekDaySchedule::Id, value); + } + case 60: { + LogStep(60, "Verify cleared week schedule"); + chip::app::Clusters::DoorLock::Commands::GetWeekDaySchedule::Type value; + value.weekDayIndex = 2; + value.userIndex = 1U; + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetWeekDaySchedule::Id, value); + } + case 61: { + LogStep(61, "Make sure that first year day schedule was not deleted"); + chip::app::Clusters::DoorLock::Commands::GetYearDaySchedule::Type value; + value.yearDayIndex = 1; + value.userIndex = 1U; + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetYearDaySchedule::Id, value); + } + case 62: { + LogStep(62, "Make sure that second year day schedule was not deleted"); + chip::app::Clusters::DoorLock::Commands::GetYearDaySchedule::Type value; + value.yearDayIndex = 2; + value.userIndex = 1U; + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetYearDaySchedule::Id, value); + } + case 63: { + LogStep(63, "Create another Week Day schedule with valid parameters"); + chip::app::Clusters::DoorLock::Commands::SetWeekDaySchedule::Type value; + value.weekDayIndex = 1; + value.userIndex = 1U; + value.daysMask = static_cast>(2); + value.startHour = 0; + value.startMinute = 0; + value.endHour = 23; + value.endMinute = 59; + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetWeekDaySchedule::Id, value); + } + case 64: { + LogStep(64, "Clear a single year day schedule for the first user"); + chip::app::Clusters::DoorLock::Commands::ClearYearDaySchedule::Type value; + value.yearDayIndex = 1; + value.userIndex = 1U; + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::ClearYearDaySchedule::Id, value); + } + case 65: { + LogStep(65, "Verify cleared year day schedule"); + chip::app::Clusters::DoorLock::Commands::GetYearDaySchedule::Type value; + value.yearDayIndex = 1; + value.userIndex = 1U; + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetYearDaySchedule::Id, value); + } + case 66: { + LogStep(66, "Clear all remaining year schedules for the first user"); + chip::app::Clusters::DoorLock::Commands::ClearYearDaySchedule::Type value; + value.yearDayIndex = 254; + value.userIndex = 1U; + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::ClearYearDaySchedule::Id, value); + } + case 67: { + LogStep(67, "Verify that second year day schedule was cleared"); + chip::app::Clusters::DoorLock::Commands::GetYearDaySchedule::Type value; + value.yearDayIndex = 2; + value.userIndex = 1U; + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetYearDaySchedule::Id, value); + } + case 68: { + LogStep(68, "Verify created week day schedule"); + chip::app::Clusters::DoorLock::Commands::GetWeekDaySchedule::Type value; + value.weekDayIndex = 1; + value.userIndex = 1U; + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetWeekDaySchedule::Id, value); + } + case 69: { + LogStep(69, "Clear all remaining week day schedules for the first user"); + chip::app::Clusters::DoorLock::Commands::ClearWeekDaySchedule::Type value; + value.weekDayIndex = 254; + value.userIndex = 1U; + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::ClearWeekDaySchedule::Id, value); + } + case 70: { + LogStep(70, "Create new user without credential so we can add more schedules to it"); + chip::app::Clusters::DoorLock::Commands::SetUser::Type value; + value.operationType = static_cast(0); + value.userIndex = 2U; + value.userName.SetNull(); + value.userUniqueId.SetNull(); + value.userStatus.SetNull(); + value.userType.SetNull(); + value.credentialRule.SetNull(); + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetUser::Id, value, + chip::Optional(10000)); + } + case 71: { + LogStep(71, "Create Week Day schedule with valid parameters for first user"); + chip::app::Clusters::DoorLock::Commands::SetWeekDaySchedule::Type value; + value.weekDayIndex = 1; + value.userIndex = 1U; + value.daysMask = static_cast>(1); + value.startHour = 0; + value.startMinute = 0; + value.endHour = 23; + value.endMinute = 59; + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetWeekDaySchedule::Id, value); + } + case 72: { + LogStep(72, "Verify created week day schedule for first user"); + chip::app::Clusters::DoorLock::Commands::GetWeekDaySchedule::Type value; + value.weekDayIndex = 1; + value.userIndex = 1U; + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetWeekDaySchedule::Id, value); + } + case 73: { + LogStep(73, "Create Year Day schedule for first user"); + chip::app::Clusters::DoorLock::Commands::SetYearDaySchedule::Type value; + value.yearDayIndex = 4; + value.userIndex = 1U; + value.localStartTime = 9000UL; + value.localEndTime = 888888888UL; + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetYearDaySchedule::Id, value); + } + case 74: { + LogStep(74, "Verify created year day schedule for first"); + chip::app::Clusters::DoorLock::Commands::GetYearDaySchedule::Type value; + value.yearDayIndex = 4; + value.userIndex = 1U; + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetYearDaySchedule::Id, value); + } + case 75: { + LogStep(75, "Create Week Day schedule with valid parameters for second user"); + chip::app::Clusters::DoorLock::Commands::SetWeekDaySchedule::Type value; + value.weekDayIndex = 4; + value.userIndex = 2U; + value.daysMask = static_cast>(64); + value.startHour = 23; + value.startMinute = 0; + value.endHour = 23; + value.endMinute = 59; + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetWeekDaySchedule::Id, value); + } + case 76: { + LogStep(76, "Verify created week day schedule for first user"); + chip::app::Clusters::DoorLock::Commands::GetWeekDaySchedule::Type value; + value.weekDayIndex = 4; + value.userIndex = 2U; + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetWeekDaySchedule::Id, value); + } + case 77: { + LogStep(77, "Create Year Day schedule for second user"); + chip::app::Clusters::DoorLock::Commands::SetYearDaySchedule::Type value; + value.yearDayIndex = 1; + value.userIndex = 1U; + value.localStartTime = 55555UL; + value.localEndTime = 7777777UL; + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetYearDaySchedule::Id, value); + } + case 78: { + LogStep(78, "Verify created year day schedule for first"); + chip::app::Clusters::DoorLock::Commands::GetYearDaySchedule::Type value; + value.yearDayIndex = 1; + value.userIndex = 1U; + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetYearDaySchedule::Id, value); + } + case 79: { + LogStep(79, "Cleanup"); + chip::app::Clusters::DoorLock::Commands::ClearUser::Type value; + value.userIndex = 65534U; + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::ClearUser::Id, value, + chip::Optional(10000)); + } + case 80: { + LogStep(80, "Make sure clearing first user also cleared week day schedules"); + chip::app::Clusters::DoorLock::Commands::GetWeekDaySchedule::Type value; + value.weekDayIndex = 1; + value.userIndex = 1U; + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetWeekDaySchedule::Id, value); + } + case 81: { + LogStep(81, "Make sure clearing first user also cleared year day schedules"); + chip::app::Clusters::DoorLock::Commands::GetYearDaySchedule::Type value; + value.yearDayIndex = 4; + value.userIndex = 1U; + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetYearDaySchedule::Id, value); + } + case 82: { + LogStep(82, "Make sure clearing second user also cleared week day schedules"); + chip::app::Clusters::DoorLock::Commands::GetWeekDaySchedule::Type value; + value.weekDayIndex = 4; + value.userIndex = 2U; + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetWeekDaySchedule::Id, value); + } + case 83: { + LogStep(83, "Make sure clearing second user also cleared year day schedules"); + chip::app::Clusters::DoorLock::Commands::GetYearDaySchedule::Type value; + value.yearDayIndex = 1; + value.userIndex = 2U; + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetYearDaySchedule::Id, value); + } } + return CHIP_NO_ERROR; } - - // - // Tests methods - // }; -class Test_TC_DD_2_1Suite : public TestCommand +class Test_TC_DL_1_3Suite : public TestCommand { public: - Test_TC_DD_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_DD_2_1", credsIssuerConfig), mTestIndex(0) + Test_TC_DL_1_3Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_DL_1_3", 9, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -115323,41 +46896,7 @@ class Test_TC_DD_2_1Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_DD_2_1Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_DD_2_1\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_DD_2_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } + ~Test_TC_DL_1_3Suite() {} chip::System::Clock::Timeout GetWaitDuration() const override { @@ -115365,20 +46904,74 @@ class Test_TC_DD_2_1Suite : public TestCommand } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; switch (mTestIndex - 1) { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DoorLock::Commands::SetCredentialResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("status", value.status, 0)); + + VerifyOrReturn(CheckValueNonNull("userIndex", value.userIndex)); + VerifyOrReturn(CheckValue("userIndex.Value()", value.userIndex.Value(), 1U)); + + VerifyOrReturn(CheckValueNonNull("nextCredentialIndex", value.nextCredentialIndex)); + VerifyOrReturn(CheckValue("nextCredentialIndex.Value()", value.nextCredentialIndex.Value(), 2U)); + } + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("autoRelockTime", value, 10UL)); + } + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNonNull("lockState", value)); + VerifyOrReturn(CheckValue("lockState.Value()", value.Value(), 1)); + } + break; + case 8: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; default: LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); } @@ -115389,99 +46982,86 @@ class Test_TC_DD_2_1Suite : public TestCommand } } - // - // Tests methods - // -}; - -class Test_TC_DD_2_2Suite : public TestCommand -{ -public: - Test_TC_DD_2_2Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_DD_2_2", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_DD_2_2Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_DD_2_2\n"); - } - - if (mTestCount == mTestIndex) + using namespace chip::app::Clusters; + switch (testIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_DD_2_2\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); } + case 1: { + LogStep(1, "Create new PIN credential and lock/unlock user"); + chip::app::Clusters::DoorLock::Commands::SetCredential::Type value; + value.operationType = static_cast(0); - Wait(); + value.credential.credentialType = static_cast(1); + value.credential.credentialIndex = 1U; - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { + value.credentialData = chip::ByteSpan(chip::Uint8::from_const_char("123456garbage: not in length on purpose"), 6); + value.userIndex.SetNull(); + value.userStatus.SetNull(); + value.userType.SetNull(); + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetCredential::Id, value, + chip::Optional(10000)); } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); + case 2: { + LogStep(2, "Precondition: Door is in locked state"); + chip::app::Clusters::DoorLock::Commands::LockDoor::Type value; + value.pinCode.Emplace(); + value.pinCode.Value() = chip::ByteSpan(chip::Uint8::from_const_char("123456garbage: not in length on purpose"), 6); + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::LockDoor::Id, value, + chip::Optional(10000)); } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; + case 3: { + LogStep(3, "TH writes AutoRelockTime attribute value as 10 seconds on the DUT"); + uint32_t value; + value = 10UL; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Attributes::AutoRelockTime::Id, value); + } + case 4: { + LogStep(4, "TH sends the unlock Door command to the DUT with valid PINCode"); + chip::app::Clusters::DoorLock::Commands::UnlockDoor::Type value; + value.pinCode.Emplace(); + value.pinCode.Value() = chip::ByteSpan(chip::Uint8::from_const_char("123456garbage: not in length on purpose"), 6); + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::UnlockDoor::Id, value, + chip::Optional(10000)); + } + case 5: { + LogStep(5, "TH reads AutoRelockTime attribute from DUT"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Attributes::AutoRelockTime::Id); + } + case 6: { + LogStep(6, "Wait 10000ms"); + SetIdentity(kIdentityAlpha); + return WaitForMs(10000); + } + case 7: { + LogStep(7, "TH reads LockState attriute"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Attributes::LockState::Id); + } + case 8: { + LogStep(8, "Clean the created credential"); + chip::app::Clusters::DoorLock::Commands::ClearCredential::Type value; + value.credential.SetNonNull(); - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; + value.credential.Value().credentialType = static_cast(1); + value.credential.Value().credentialIndex = 1U; - switch (mTestIndex - 1) - { - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::ClearCredential::Id, value, + chip::Optional(10000)); } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); } + return CHIP_NO_ERROR; } - - // - // Tests methods - // }; -class Test_TC_DD_3_1Suite : public TestCommand +class TestGroupMessagingSuite : public TestCommand { public: - Test_TC_DD_3_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_DD_3_1", credsIssuerConfig), mTestIndex(0) + TestGroupMessagingSuite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("TestGroupMessaging", 15, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -115489,41 +47069,7 @@ class Test_TC_DD_3_1Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_DD_3_1Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_DD_3_1\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_DD_3_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } + ~TestGroupMessagingSuite() {} chip::System::Clock::Timeout GetWaitDuration() const override { @@ -115531,20 +47077,103 @@ class Test_TC_DD_3_1Suite : public TestCommand } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; switch (mTestIndex - 1) { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::Groups::Commands::AddGroupResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("status", value.status, 0)); + + VerifyOrReturn(CheckValue("groupId", value.groupId, 257U)); + } + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::Groups::Commands::AddGroupResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("status", value.status, 0)); + + VerifyOrReturn(CheckValue("groupId", value.groupId, 258U)); + } + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::CharSpan value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueAsString("nodeLabel", value, chip::CharSpan("", 0))); + } + break; + case 8: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 9: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::CharSpan value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueAsString("nodeLabel", value, chip::CharSpan("xyzzy", 5))); + } + break; + case 10: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 11: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::CharSpan value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueAsString("nodeLabel", value, chip::CharSpan("", 0))); + } + break; + case 12: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 13: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + bool value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("onOff", value, 1)); + } + break; + case 14: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; default: LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); } @@ -115555,99 +47184,205 @@ class Test_TC_DD_3_1Suite : public TestCommand } } - // - // Tests methods - // -}; - -class Test_TC_DD_3_2Suite : public TestCommand -{ -public: - Test_TC_DD_3_2Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_DD_3_2", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_DD_3_2Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) + using namespace chip::app::Clusters; + switch (testIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_DD_3_2\n"); + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_DD_3_2\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; + case 1: { + LogStep(1, "Add Group 1 (endpoint 1)"); + chip::app::Clusters::Groups::Commands::AddGroup::Type value; + value.groupId = 257U; + value.groupName = chip::Span("Group #1garbage: not in length on purpose", 8); + return SendCommand(kIdentityAlpha, GetEndpoint(1), Groups::Id, Groups::Commands::AddGroup::Id, value); + } + case 2: { + LogStep(2, "Add Group 2 (endpoint 0)"); + chip::app::Clusters::Groups::Commands::AddGroup::Type value; + value.groupId = 258U; + value.groupName = chip::Span("Group #2garbage: not in length on purpose", 8); + return SendCommand(kIdentityAlpha, GetEndpoint(0), Groups::Id, Groups::Commands::AddGroup::Id, value); } + case 3: { + LogStep(3, "KeySet Write 1"); + chip::app::Clusters::GroupKeyManagement::Commands::KeySetWrite::Type value; - Wait(); + value.groupKeySet.groupKeySetID = 417U; + value.groupKeySet.groupKeySecurityPolicy = + static_cast(0); + value.groupKeySet.epochKey0.SetNonNull(); + value.groupKeySet.epochKey0.Value() = chip::ByteSpan( + chip::Uint8::from_const_char( + "\240\241\242\243\244\245\246\247\250\251\252\253\254\255\256\257garbage: not in length on purpose"), + 16); + value.groupKeySet.epochStartTime0.SetNonNull(); + value.groupKeySet.epochStartTime0.Value() = 1110000ULL; + value.groupKeySet.epochKey1.SetNonNull(); + value.groupKeySet.epochKey1.Value() = chip::ByteSpan( + chip::Uint8::from_const_char( + "\260\261\262\263\264\265\266\267\270\271\272\273\274\275\276\277garbage: not in length on purpose"), + 16); + value.groupKeySet.epochStartTime1.SetNonNull(); + value.groupKeySet.epochStartTime1.Value() = 1110001ULL; + value.groupKeySet.epochKey2.SetNonNull(); + value.groupKeySet.epochKey2.Value() = chip::ByteSpan( + chip::Uint8::from_const_char( + "\300\301\302\303\304\305\306\307\310\311\312\313\314\315\316\317garbage: not in length on purpose"), + 16); + value.groupKeySet.epochStartTime2.SetNonNull(); + value.groupKeySet.epochStartTime2.Value() = 1110002ULL; + + return SendCommand(kIdentityAlpha, GetEndpoint(0), GroupKeyManagement::Id, + GroupKeyManagement::Commands::KeySetWrite::Id, value); + } + case 4: { + LogStep(4, "KeySet Write 2"); + chip::app::Clusters::GroupKeyManagement::Commands::KeySetWrite::Type value; + + value.groupKeySet.groupKeySetID = 418U; + value.groupKeySet.groupKeySecurityPolicy = + static_cast(0); + value.groupKeySet.epochKey0.SetNonNull(); + value.groupKeySet.epochKey0.Value() = chip::ByteSpan( + chip::Uint8::from_const_char( + "\320\321\322\323\324\325\326\327\330\331\332\333\334\335\336\337garbage: not in length on purpose"), + 16); + value.groupKeySet.epochStartTime0.SetNonNull(); + value.groupKeySet.epochStartTime0.Value() = 2220000ULL; + value.groupKeySet.epochKey1.SetNonNull(); + value.groupKeySet.epochKey1.Value() = chip::ByteSpan( + chip::Uint8::from_const_char( + "\340\341\342\343\344\345\346\347\350\351\352\353\354\355\356\357garbage: not in length on purpose"), + 16); + value.groupKeySet.epochStartTime1.SetNonNull(); + value.groupKeySet.epochStartTime1.Value() = 2220001ULL; + value.groupKeySet.epochKey2.SetNonNull(); + value.groupKeySet.epochKey2.Value() = chip::ByteSpan( + chip::Uint8::from_const_char( + "\360\361\362\363\364\365\366\367\370\371\372\373\374\375\376\377garbage: not in length on purpose"), + 16); + value.groupKeySet.epochStartTime2.SetNonNull(); + value.groupKeySet.epochStartTime2.Value() = 2220002ULL; - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { + return SendCommand(kIdentityAlpha, GetEndpoint(0), GroupKeyManagement::Id, + GroupKeyManagement::Commands::KeySetWrite::Id, value); } + case 5: { + LogStep(5, "Write Group Keys"); + ListFreer listFreer; + chip::app::DataModel::List value; - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } + { + auto * listHolder_0 = new ListHolder(2); + listFreer.add(listHolder_0); - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } + listHolder_0->mList[0].groupId = 257U; + listHolder_0->mList[0].groupKeySetID = 417U; + listHolder_0->mList[0].fabricIndex = 1; -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; + listHolder_0->mList[1].groupId = 258U; + listHolder_0->mList[1].groupKeySetID = 418U; + listHolder_0->mList[1].fabricIndex = 1; - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; + value = chip::app::DataModel::List( + listHolder_0->mList, 2); + } + return WriteAttribute(kIdentityAlpha, GetEndpoint(0), GroupKeyManagement::Id, + GroupKeyManagement::Attributes::GroupKeyMap::Id, value); + } + case 6: { + LogStep(6, "Install ACLs"); + ListFreer listFreer; + chip::app::DataModel::List value; - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; + { + auto * listHolder_0 = new ListHolder(2); + listFreer.add(listHolder_0); - switch (mTestIndex - 1) - { - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + listHolder_0->mList[0].privilege = static_cast(5); + listHolder_0->mList[0].authMode = static_cast(2); + listHolder_0->mList[0].subjects.SetNull(); + listHolder_0->mList[0].targets.SetNull(); + listHolder_0->mList[0].fabricIndex = 0; + + listHolder_0->mList[1].privilege = static_cast(4); + listHolder_0->mList[1].authMode = static_cast(3); + listHolder_0->mList[1].subjects.SetNull(); + listHolder_0->mList[1].targets.SetNull(); + listHolder_0->mList[1].fabricIndex = 0; + + value = chip::app::DataModel::List( + listHolder_0->mList, 2); + } + return WriteAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Acl::Id, value); + } + case 7: { + LogStep(7, "Read initial Attribute value"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), Basic::Id, Basic::Attributes::NodeLabel::Id); + } + case 8: { + LogStep(8, "Group Write Attribute"); + chip::CharSpan value; + value = chip::Span("xyzzygarbage: not in length on purpose", 5); + return WriteGroupAttribute(kIdentityAlpha, 258, Basic::Id, Basic::Attributes::NodeLabel::Id, value); + } + case 9: { + LogStep(9, "Read back Attribute"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), Basic::Id, Basic::Attributes::NodeLabel::Id); + } + case 10: { + LogStep(10, "Restore initial Attribute value"); + chip::CharSpan value; + value = chip::Span("garbage: not in length on purpose", 0); + return WriteGroupAttribute(kIdentityAlpha, 258, Basic::Id, Basic::Attributes::NodeLabel::Id, value); + } + case 11: { + LogStep(11, "Read back Attribute"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), Basic::Id, Basic::Attributes::NodeLabel::Id); + } + case 12: { + LogStep(12, "Turn On the light to see attribute change"); + chip::app::Clusters::OnOff::Commands::On::Type value; + return SendGroupCommand(kIdentityAlpha, 257, OnOff::Id, OnOff::Commands::On::Id, value); + } + case 13: { + LogStep(13, "Check on/off attribute value is true after on command for endpoint 1"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnOff::Id); } + case 14: { + LogStep(14, "Cleanup ACLs"); + ListFreer listFreer; + chip::app::DataModel::List value; - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); + { + auto * listHolder_0 = new ListHolder(1); + listFreer.add(listHolder_0); + + listHolder_0->mList[0].privilege = static_cast(5); + listHolder_0->mList[0].authMode = static_cast(2); + listHolder_0->mList[0].subjects.SetNull(); + listHolder_0->mList[0].targets.SetNull(); + listHolder_0->mList[0].fabricIndex = 0; + + value = chip::app::DataModel::List( + listHolder_0->mList, 1); + } + return WriteAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Acl::Id, value); } + } + return CHIP_NO_ERROR; } - - // - // Tests methods - // }; -class Test_TC_DD_3_5Suite : public TestCommand +class TestGroupsClusterSuite : public TestCommand { public: - Test_TC_DD_3_5Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_DD_3_5", credsIssuerConfig), mTestIndex(0) + TestGroupsClusterSuite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("TestGroupsCluster", 19, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -115655,41 +47390,7 @@ class Test_TC_DD_3_5Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_DD_3_5Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_DD_3_5\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_DD_3_5\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } + ~TestGroupsClusterSuite() {} chip::System::Clock::Timeout GetWaitDuration() const override { @@ -115697,103 +47398,219 @@ class Test_TC_DD_3_5Suite : public TestCommand } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; switch (mTestIndex - 1) { - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::Groups::Commands::ViewGroupResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("status", value.status, 135)); - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } + VerifyOrReturn(CheckValue("groupId", value.groupId, 0U)); + } + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::Groups::Commands::ViewGroupResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("status", value.status, 139)); - // - // Tests methods - // -}; + VerifyOrReturn(CheckValue("groupId", value.groupId, 1U)); + } + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::Groups::Commands::AddGroupResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("status", value.status, 0)); -class Test_TC_DD_3_6Suite : public TestCommand -{ -public: - Test_TC_DD_3_6Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_DD_3_6", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } + VerifyOrReturn(CheckValue("groupId", value.groupId, 1U)); + } + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::Groups::Commands::ViewGroupResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("status", value.status, 0)); - ~Test_TC_DD_3_6Suite() {} + VerifyOrReturn(CheckValue("groupId", value.groupId, 1U)); - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; + VerifyOrReturn(CheckValueAsString("groupName", value.groupName, chip::CharSpan("Group #1", 8))); + } + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::Groups::Commands::ViewGroupResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("status", value.status, 139)); - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_DD_3_6\n"); - } + VerifyOrReturn(CheckValue("groupId", value.groupId, 4369U)); + } + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::Groups::Commands::GetGroupMembershipResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNull("capacity", value.capacity)); - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_DD_3_6\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } + { + auto iter_0 = value.groupList.begin(); + VerifyOrReturn(CheckNextListItemDecodes("groupList", iter_0, 0)); + VerifyOrReturn(CheckValue("groupList[0]", iter_0.GetValue(), 1U)); + VerifyOrReturn(CheckNoMoreListItems("groupList", iter_0, 1)); + } + } + break; + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::Groups::Commands::ViewGroupResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("status", value.status, 139)); - Wait(); + VerifyOrReturn(CheckValue("groupId", value.groupId, 32767U)); + } + break; + case 8: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::Groups::Commands::ViewGroupResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("status", value.status, 0)); - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - } + VerifyOrReturn(CheckValue("groupId", value.groupId, 1U)); - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } + VerifyOrReturn(CheckValueAsString("groupName", value.groupName, chip::CharSpan("Group #1", 8))); + } + break; + case 9: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::Groups::Commands::RemoveGroupResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("status", value.status, 135)); - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } + VerifyOrReturn(CheckValue("groupId", value.groupId, 0U)); + } + break; + case 10: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::Groups::Commands::RemoveGroupResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("status", value.status, 139)); -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; + VerifyOrReturn(CheckValue("groupId", value.groupId, 4U)); + } + break; + case 11: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::Groups::Commands::ViewGroupResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("status", value.status, 0)); - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; + VerifyOrReturn(CheckValue("groupId", value.groupId, 1U)); - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; + VerifyOrReturn(CheckValueAsString("groupName", value.groupName, chip::CharSpan("Group #1", 8))); + } + break; + case 12: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::Groups::Commands::ViewGroupResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("status", value.status, 139)); - switch (mTestIndex - 1) - { + VerifyOrReturn(CheckValue("groupId", value.groupId, 4369U)); + } + break; + case 13: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::Groups::Commands::GetGroupMembershipResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNull("capacity", value.capacity)); + + { + auto iter_0 = value.groupList.begin(); + VerifyOrReturn(CheckNextListItemDecodes("groupList", iter_0, 0)); + VerifyOrReturn(CheckValue("groupList[0]", iter_0.GetValue(), 1U)); + VerifyOrReturn(CheckNoMoreListItems("groupList", iter_0, 1)); + } + } + break; + case 14: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 15: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::Groups::Commands::ViewGroupResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("status", value.status, 139)); + + VerifyOrReturn(CheckValue("groupId", value.groupId, 1U)); + } + break; + case 16: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::Groups::Commands::ViewGroupResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("status", value.status, 139)); + + VerifyOrReturn(CheckValue("groupId", value.groupId, 4369U)); + } + break; + case 17: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::Groups::Commands::ViewGroupResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("status", value.status, 139)); + + VerifyOrReturn(CheckValue("groupId", value.groupId, 32767U)); + } + break; + case 18: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::Groups::Commands::GetGroupMembershipResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNull("capacity", value.capacity)); + + { + auto iter_0 = value.groupList.begin(); + VerifyOrReturn(CheckNoMoreListItems("groupList", iter_0, 0)); + } + } + break; default: LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); } @@ -115804,99 +47621,157 @@ class Test_TC_DD_3_6Suite : public TestCommand } } - // - // Tests methods - // -}; - -class Test_TC_DD_3_9Suite : public TestCommand -{ -public: - Test_TC_DD_3_9Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_DD_3_9", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_DD_3_9Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) + using namespace chip::app::Clusters; + switch (testIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_DD_3_9\n"); + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_DD_3_9\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; + case 1: { + LogStep(1, "View Group 0 (invalid)"); + chip::app::Clusters::Groups::Commands::ViewGroup::Type value; + value.groupId = 0U; + return SendCommand(kIdentityAlpha, GetEndpoint(1), Groups::Id, Groups::Commands::ViewGroup::Id, value); } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { + case 2: { + LogStep(2, "View Group 1 (not found)"); + chip::app::Clusters::Groups::Commands::ViewGroup::Type value; + value.groupId = 1U; + return SendCommand(kIdentityAlpha, GetEndpoint(1), Groups::Id, Groups::Commands::ViewGroup::Id, value); } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); + case 3: { + LogStep(3, "Add Group 1 (new)"); + chip::app::Clusters::Groups::Commands::AddGroup::Type value; + value.groupId = 1U; + value.groupName = chip::Span("Group #1garbage: not in length on purpose", 8); + return SendCommand(kIdentityAlpha, GetEndpoint(1), Groups::Id, Groups::Commands::AddGroup::Id, value); } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; + case 4: { + LogStep(4, "View Group 1 (new)"); + chip::app::Clusters::Groups::Commands::ViewGroup::Type value; + value.groupId = 1U; + return SendCommand(kIdentityAlpha, GetEndpoint(1), Groups::Id, Groups::Commands::ViewGroup::Id, value); + } + case 5: { + LogStep(5, "View Group 2 (not found)"); + chip::app::Clusters::Groups::Commands::ViewGroup::Type value; + value.groupId = 4369U; + return SendCommand(kIdentityAlpha, GetEndpoint(1), Groups::Id, Groups::Commands::ViewGroup::Id, value); + } + case 6: { + LogStep(6, "Get Group Membership 1 (all)"); + ListFreer listFreer; + chip::app::Clusters::Groups::Commands::GetGroupMembership::Type value; - switch (mTestIndex - 1) - { - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + value.groupList = chip::app::DataModel::List(); + return SendCommand(kIdentityAlpha, GetEndpoint(1), Groups::Id, Groups::Commands::GetGroupMembership::Id, value); + } + case 7: { + LogStep(7, "View Group 3 (not found)"); + chip::app::Clusters::Groups::Commands::ViewGroup::Type value; + value.groupId = 32767U; + return SendCommand(kIdentityAlpha, GetEndpoint(1), Groups::Id, Groups::Commands::ViewGroup::Id, value); + } + case 8: { + LogStep(8, "View Group 1 (existing)"); + chip::app::Clusters::Groups::Commands::ViewGroup::Type value; + value.groupId = 1U; + return SendCommand(kIdentityAlpha, GetEndpoint(1), Groups::Id, Groups::Commands::ViewGroup::Id, value); } + case 9: { + LogStep(9, "Remove Group 0 (invalid)"); + chip::app::Clusters::Groups::Commands::RemoveGroup::Type value; + value.groupId = 0U; + return SendCommand(kIdentityAlpha, GetEndpoint(1), Groups::Id, Groups::Commands::RemoveGroup::Id, value); + } + case 10: { + LogStep(10, "Remove Group 4 (not found)"); + chip::app::Clusters::Groups::Commands::RemoveGroup::Type value; + value.groupId = 4U; + return SendCommand(kIdentityAlpha, GetEndpoint(1), Groups::Id, Groups::Commands::RemoveGroup::Id, value); + } + case 11: { + LogStep(11, "View Group 1 (not removed)"); + chip::app::Clusters::Groups::Commands::ViewGroup::Type value; + value.groupId = 1U; + return SendCommand(kIdentityAlpha, GetEndpoint(1), Groups::Id, Groups::Commands::ViewGroup::Id, value); + } + case 12: { + LogStep(12, "View Group 2 (removed)"); + chip::app::Clusters::Groups::Commands::ViewGroup::Type value; + value.groupId = 4369U; + return SendCommand(kIdentityAlpha, GetEndpoint(1), Groups::Id, Groups::Commands::ViewGroup::Id, value); + } + case 13: { + LogStep(13, "Get Group Membership 3"); + ListFreer listFreer; + chip::app::Clusters::Groups::Commands::GetGroupMembership::Type value; - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); + { + auto * listHolder_0 = new ListHolder(4); + listFreer.add(listHolder_0); + listHolder_0->mList[0] = 1U; + listHolder_0->mList[1] = 2U; + listHolder_0->mList[2] = 4369U; + listHolder_0->mList[3] = 3U; + value.groupList = chip::app::DataModel::List(listHolder_0->mList, 4); + } + return SendCommand(kIdentityAlpha, GetEndpoint(1), Groups::Id, Groups::Commands::GetGroupMembership::Id, value); + } + case 14: { + LogStep(14, "Remove All"); + chip::app::Clusters::Groups::Commands::RemoveAllGroups::Type value; + return SendCommand(kIdentityAlpha, GetEndpoint(1), Groups::Id, Groups::Commands::RemoveAllGroups::Id, value); + } + case 15: { + LogStep(15, "View Group 1 (removed)"); + chip::app::Clusters::Groups::Commands::ViewGroup::Type value; + value.groupId = 1U; + return SendCommand(kIdentityAlpha, GetEndpoint(1), Groups::Id, Groups::Commands::ViewGroup::Id, value); + } + case 16: { + LogStep(16, "View Group 2 (still removed)"); + chip::app::Clusters::Groups::Commands::ViewGroup::Type value; + value.groupId = 4369U; + return SendCommand(kIdentityAlpha, GetEndpoint(1), Groups::Id, Groups::Commands::ViewGroup::Id, value); + } + case 17: { + LogStep(17, "View Group 3 (removed)"); + chip::app::Clusters::Groups::Commands::ViewGroup::Type value; + value.groupId = 32767U; + return SendCommand(kIdentityAlpha, GetEndpoint(1), Groups::Id, Groups::Commands::ViewGroup::Id, value); + } + case 18: { + LogStep(18, "Get Group Membership 4"); + ListFreer listFreer; + chip::app::Clusters::Groups::Commands::GetGroupMembership::Type value; + + { + auto * listHolder_0 = new ListHolder(5); + listFreer.add(listHolder_0); + listHolder_0->mList[0] = 1U; + listHolder_0->mList[1] = 2U; + listHolder_0->mList[2] = 4369U; + listHolder_0->mList[3] = 3U; + listHolder_0->mList[4] = 32767U; + value.groupList = chip::app::DataModel::List(listHolder_0->mList, 5); + } + return SendCommand(kIdentityAlpha, GetEndpoint(1), Groups::Id, Groups::Commands::GetGroupMembership::Id, value); } + } + return CHIP_NO_ERROR; } - - // - // Tests methods - // }; -class Test_TC_DD_3_10Suite : public TestCommand +class TestGroupKeyManagementClusterSuite : public TestCommand { public: - Test_TC_DD_3_10Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_DD_3_10", credsIssuerConfig), mTestIndex(0) + TestGroupKeyManagementClusterSuite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("TestGroupKeyManagementCluster", 18, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -115904,41 +47779,7 @@ class Test_TC_DD_3_10Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_DD_3_10Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_DD_3_10\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_DD_3_10\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } + ~TestGroupKeyManagementClusterSuite() {} chip::System::Clock::Timeout GetWaitDuration() const override { @@ -115946,20 +47787,178 @@ class Test_TC_DD_3_10Suite : public TestCommand } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; switch (mTestIndex - 1) { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintMinValue("value", value, 2U)); + } + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("maxGroupKeysPerFabric", value, 2U)); + } + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::Groups::Commands::AddGroupResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("status", value.status, 0)); + + VerifyOrReturn(CheckValue("groupId", value.groupId, 257U)); + } + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::Groups::Commands::AddGroupResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("status", value.status, 0)); + + VerifyOrReturn(CheckValue("groupId", value.groupId, 258U)); + } + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::GroupKeyManagement::Commands::KeySetReadResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("groupKeySet.groupKeySetID", value.groupKeySet.groupKeySetID, 417U)); + VerifyOrReturn(CheckValue("groupKeySet.groupKeySecurityPolicy", value.groupKeySet.groupKeySecurityPolicy, 0)); + VerifyOrReturn(CheckValueNull("groupKeySet.epochKey0", value.groupKeySet.epochKey0)); + VerifyOrReturn(CheckValueNonNull("groupKeySet.epochStartTime0", value.groupKeySet.epochStartTime0)); + VerifyOrReturn( + CheckValue("groupKeySet.epochStartTime0.Value()", value.groupKeySet.epochStartTime0.Value(), 1110000ULL)); + VerifyOrReturn(CheckValueNull("groupKeySet.epochKey1", value.groupKeySet.epochKey1)); + VerifyOrReturn(CheckValueNonNull("groupKeySet.epochStartTime1", value.groupKeySet.epochStartTime1)); + VerifyOrReturn( + CheckValue("groupKeySet.epochStartTime1.Value()", value.groupKeySet.epochStartTime1.Value(), 1110001ULL)); + VerifyOrReturn(CheckValueNull("groupKeySet.epochKey2", value.groupKeySet.epochKey2)); + VerifyOrReturn(CheckValueNonNull("groupKeySet.epochStartTime2", value.groupKeySet.epochStartTime2)); + VerifyOrReturn( + CheckValue("groupKeySet.epochStartTime2.Value()", value.groupKeySet.epochStartTime2.Value(), 1110002ULL)); + } + break; + case 8: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); + break; + case 9: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 10: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList< + chip::app::Clusters::GroupKeyManagement::Structs::GroupKeyMapStruct::DecodableType> + value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + { + auto iter_0 = value.begin(); + VerifyOrReturn(CheckNextListItemDecodes("groupKeyMap", iter_0, 0)); + VerifyOrReturn(CheckValue("groupKeyMap[0].groupId", iter_0.GetValue().groupId, 257U)); + VerifyOrReturn(CheckValue("groupKeyMap[0].groupKeySetID", iter_0.GetValue().groupKeySetID, 417U)); + VerifyOrReturn(CheckValue("groupKeyMap[0].fabricIndex", iter_0.GetValue().fabricIndex, 1)); + VerifyOrReturn(CheckNextListItemDecodes("groupKeyMap", iter_0, 1)); + VerifyOrReturn(CheckValue("groupKeyMap[1].groupId", iter_0.GetValue().groupId, 258U)); + VerifyOrReturn(CheckValue("groupKeyMap[1].groupKeySetID", iter_0.GetValue().groupKeySetID, 418U)); + VerifyOrReturn(CheckValue("groupKeyMap[1].fabricIndex", iter_0.GetValue().fabricIndex, 1)); + VerifyOrReturn(CheckNoMoreListItems("groupKeyMap", iter_0, 2)); + } + } + break; + case 11: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList< + chip::app::Clusters::GroupKeyManagement::Structs::GroupInfoMapStruct::DecodableType> + value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + { + auto iter_0 = value.begin(); + VerifyOrReturn(CheckNextListItemDecodes("groupTable", iter_0, 0)); + VerifyOrReturn(CheckValue("groupTable[0].groupId", iter_0.GetValue().groupId, 257U)); + VerifyOrReturn(CheckValuePresent("groupTable[0].groupName", iter_0.GetValue().groupName)); + VerifyOrReturn(CheckValueAsString("groupTable[0].groupName.Value()", iter_0.GetValue().groupName.Value(), + chip::CharSpan("Group #1", 8))); + VerifyOrReturn(CheckValue("groupTable[0].fabricIndex", iter_0.GetValue().fabricIndex, 1)); + VerifyOrReturn(CheckNextListItemDecodes("groupTable", iter_0, 1)); + VerifyOrReturn(CheckValue("groupTable[1].groupId", iter_0.GetValue().groupId, 258U)); + VerifyOrReturn(CheckValuePresent("groupTable[1].groupName", iter_0.GetValue().groupName)); + VerifyOrReturn(CheckValueAsString("groupTable[1].groupName.Value()", iter_0.GetValue().groupName.Value(), + chip::CharSpan("Group #2", 8))); + VerifyOrReturn(CheckValue("groupTable[1].fabricIndex", iter_0.GetValue().fabricIndex, 1)); + VerifyOrReturn(CheckNoMoreListItems("groupTable", iter_0, 2)); + } + } + break; + case 12: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 13: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_NOT_FOUND)); + break; + case 14: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::GroupKeyManagement::Commands::KeySetReadResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("groupKeySet.groupKeySetID", value.groupKeySet.groupKeySetID, 418U)); + VerifyOrReturn(CheckValue("groupKeySet.groupKeySecurityPolicy", value.groupKeySet.groupKeySecurityPolicy, 1)); + VerifyOrReturn(CheckValueNull("groupKeySet.epochKey0", value.groupKeySet.epochKey0)); + VerifyOrReturn(CheckValueNonNull("groupKeySet.epochStartTime0", value.groupKeySet.epochStartTime0)); + VerifyOrReturn( + CheckValue("groupKeySet.epochStartTime0.Value()", value.groupKeySet.epochStartTime0.Value(), 2110000ULL)); + VerifyOrReturn(CheckValueNull("groupKeySet.epochKey1", value.groupKeySet.epochKey1)); + VerifyOrReturn(CheckValueNonNull("groupKeySet.epochStartTime1", value.groupKeySet.epochStartTime1)); + VerifyOrReturn( + CheckValue("groupKeySet.epochStartTime1.Value()", value.groupKeySet.epochStartTime1.Value(), 2110001ULL)); + VerifyOrReturn(CheckValueNull("groupKeySet.epochKey2", value.groupKeySet.epochKey2)); + VerifyOrReturn(CheckValueNonNull("groupKeySet.epochStartTime2", value.groupKeySet.epochStartTime2)); + VerifyOrReturn( + CheckValue("groupKeySet.epochStartTime2.Value()", value.groupKeySet.epochStartTime2.Value(), 2110002ULL)); + } + break; + case 15: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 16: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 17: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_NOT_FOUND)); + break; default: LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); } @@ -115970,99 +47969,212 @@ class Test_TC_DD_3_10Suite : public TestCommand } } - // - // Tests methods - // -}; - -class Test_TC_DD_3_11Suite : public TestCommand -{ -public: - Test_TC_DD_3_11Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_DD_3_11", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_DD_3_11Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) + using namespace chip::app::Clusters; + switch (testIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_DD_3_11\n"); + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_DD_3_11\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; + case 1: { + LogStep(1, "Read maxGroupsPerFabric"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), GroupKeyManagement::Id, + GroupKeyManagement::Attributes::MaxGroupsPerFabric::Id); + } + case 2: { + LogStep(2, "Read maxGroupKeysPerFabric"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), GroupKeyManagement::Id, + GroupKeyManagement::Attributes::MaxGroupKeysPerFabric::Id); + } + case 3: { + LogStep(3, "Add Group 1"); + chip::app::Clusters::Groups::Commands::AddGroup::Type value; + value.groupId = 257U; + value.groupName = chip::Span("Group #1garbage: not in length on purpose", 8); + return SendCommand(kIdentityAlpha, GetEndpoint(1), Groups::Id, Groups::Commands::AddGroup::Id, value); + } + case 4: { + LogStep(4, "Add Group 2"); + chip::app::Clusters::Groups::Commands::AddGroup::Type value; + value.groupId = 258U; + value.groupName = chip::Span("Group #2garbage: not in length on purpose", 8); + return SendCommand(kIdentityAlpha, GetEndpoint(1), Groups::Id, Groups::Commands::AddGroup::Id, value); } + case 5: { + LogStep(5, "KeySet Write 1"); + chip::app::Clusters::GroupKeyManagement::Commands::KeySetWrite::Type value; - Wait(); + value.groupKeySet.groupKeySetID = 417U; + value.groupKeySet.groupKeySecurityPolicy = + static_cast(0); + value.groupKeySet.epochKey0.SetNonNull(); + value.groupKeySet.epochKey0.Value() = chip::ByteSpan( + chip::Uint8::from_const_char( + "\240\241\242\243\244\245\246\247\250\251\252\253\254\255\256\257garbage: not in length on purpose"), + 16); + value.groupKeySet.epochStartTime0.SetNonNull(); + value.groupKeySet.epochStartTime0.Value() = 1110000ULL; + value.groupKeySet.epochKey1.SetNonNull(); + value.groupKeySet.epochKey1.Value() = chip::ByteSpan( + chip::Uint8::from_const_char( + "\260\261\262\263\264\265\266\267\270\271\272\273\274\275\276\277garbage: not in length on purpose"), + 16); + value.groupKeySet.epochStartTime1.SetNonNull(); + value.groupKeySet.epochStartTime1.Value() = 1110001ULL; + value.groupKeySet.epochKey2.SetNonNull(); + value.groupKeySet.epochKey2.Value() = chip::ByteSpan( + chip::Uint8::from_const_char( + "\300\301\302\303\304\305\306\307\310\311\312\313\314\315\316\317garbage: not in length on purpose"), + 16); + value.groupKeySet.epochStartTime2.SetNonNull(); + value.groupKeySet.epochStartTime2.Value() = 1110002ULL; + + return SendCommand(kIdentityAlpha, GetEndpoint(0), GroupKeyManagement::Id, + GroupKeyManagement::Commands::KeySetWrite::Id, value); + } + case 6: { + LogStep(6, "KeySet Write 2"); + chip::app::Clusters::GroupKeyManagement::Commands::KeySetWrite::Type value; + + value.groupKeySet.groupKeySetID = 418U; + value.groupKeySet.groupKeySecurityPolicy = + static_cast(1); + value.groupKeySet.epochKey0.SetNonNull(); + value.groupKeySet.epochKey0.Value() = chip::ByteSpan( + chip::Uint8::from_const_char( + "\320\321\322\323\324\325\326\327\330\331\332\333\334\335\336\337garbage: not in length on purpose"), + 16); + value.groupKeySet.epochStartTime0.SetNonNull(); + value.groupKeySet.epochStartTime0.Value() = 2110000ULL; + value.groupKeySet.epochKey1.SetNonNull(); + value.groupKeySet.epochKey1.Value() = chip::ByteSpan( + chip::Uint8::from_const_char( + "\340\341\342\343\344\345\346\347\350\351\352\353\354\355\356\357garbage: not in length on purpose"), + 16); + value.groupKeySet.epochStartTime1.SetNonNull(); + value.groupKeySet.epochStartTime1.Value() = 2110001ULL; + value.groupKeySet.epochKey2.SetNonNull(); + value.groupKeySet.epochKey2.Value() = chip::ByteSpan( + chip::Uint8::from_const_char( + "\360\361\362\363\364\365\366\367\370\371\372\373\374\375\376\377garbage: not in length on purpose"), + 16); + value.groupKeySet.epochStartTime2.SetNonNull(); + value.groupKeySet.epochStartTime2.Value() = 2110002ULL; - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { + return SendCommand(kIdentityAlpha, GetEndpoint(0), GroupKeyManagement::Id, + GroupKeyManagement::Commands::KeySetWrite::Id, value); } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); + case 7: { + LogStep(7, "KeySet Read"); + chip::app::Clusters::GroupKeyManagement::Commands::KeySetRead::Type value; + value.groupKeySetID = 417U; + return SendCommand(kIdentityAlpha, GetEndpoint(0), GroupKeyManagement::Id, GroupKeyManagement::Commands::KeySetRead::Id, + value); } - } + case 8: { + LogStep(8, "Write Group Keys (invalid)"); + ListFreer listFreer; + chip::app::DataModel::List value; - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } + { + auto * listHolder_0 = new ListHolder(1); + listFreer.add(listHolder_0); -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; + listHolder_0->mList[0].groupId = 258U; + listHolder_0->mList[0].groupKeySetID = 0U; + listHolder_0->mList[0].fabricIndex = 1; - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; + value = chip::app::DataModel::List( + listHolder_0->mList, 1); + } + return WriteAttribute(kIdentityAlpha, GetEndpoint(0), GroupKeyManagement::Id, + GroupKeyManagement::Attributes::GroupKeyMap::Id, value); + } + case 9: { + LogStep(9, "Write Group Keys"); + ListFreer listFreer; + chip::app::DataModel::List value; - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; + { + auto * listHolder_0 = new ListHolder(2); + listFreer.add(listHolder_0); - switch (mTestIndex - 1) - { - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } + listHolder_0->mList[0].groupId = 257U; + listHolder_0->mList[0].groupKeySetID = 417U; + listHolder_0->mList[0].fabricIndex = 1; - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); + listHolder_0->mList[1].groupId = 258U; + listHolder_0->mList[1].groupKeySetID = 418U; + listHolder_0->mList[1].fabricIndex = 1; + + value = chip::app::DataModel::List( + listHolder_0->mList, 2); + } + return WriteAttribute(kIdentityAlpha, GetEndpoint(0), GroupKeyManagement::Id, + GroupKeyManagement::Attributes::GroupKeyMap::Id, value); + } + case 10: { + LogStep(10, "Read Group Keys"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), GroupKeyManagement::Id, + GroupKeyManagement::Attributes::GroupKeyMap::Id); + } + case 11: { + LogStep(11, "Read GroupTable"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), GroupKeyManagement::Id, + GroupKeyManagement::Attributes::GroupTable::Id); } + case 12: { + LogStep(12, "KeySet Remove 1"); + chip::app::Clusters::GroupKeyManagement::Commands::KeySetRemove::Type value; + value.groupKeySetID = 417U; + return SendCommand(kIdentityAlpha, GetEndpoint(0), GroupKeyManagement::Id, + GroupKeyManagement::Commands::KeySetRemove::Id, value); + } + case 13: { + LogStep(13, "KeySet Read (removed)"); + chip::app::Clusters::GroupKeyManagement::Commands::KeySetRead::Type value; + value.groupKeySetID = 417U; + return SendCommand(kIdentityAlpha, GetEndpoint(0), GroupKeyManagement::Id, GroupKeyManagement::Commands::KeySetRead::Id, + value); + } + case 14: { + LogStep(14, "KeySet Read (not removed)"); + chip::app::Clusters::GroupKeyManagement::Commands::KeySetRead::Type value; + value.groupKeySetID = 418U; + return SendCommand(kIdentityAlpha, GetEndpoint(0), GroupKeyManagement::Id, GroupKeyManagement::Commands::KeySetRead::Id, + value); + } + case 15: { + LogStep(15, "Remove All"); + chip::app::Clusters::Groups::Commands::RemoveAllGroups::Type value; + return SendCommand(kIdentityAlpha, GetEndpoint(1), Groups::Id, Groups::Commands::RemoveAllGroups::Id, value); + } + case 16: { + LogStep(16, "KeySet Remove 2"); + chip::app::Clusters::GroupKeyManagement::Commands::KeySetRemove::Type value; + value.groupKeySetID = 418U; + return SendCommand(kIdentityAlpha, GetEndpoint(0), GroupKeyManagement::Id, + GroupKeyManagement::Commands::KeySetRemove::Id, value); + } + case 17: { + LogStep(17, "KeySet Read (also removed)"); + chip::app::Clusters::GroupKeyManagement::Commands::KeySetRead::Type value; + value.groupKeySetID = 418U; + return SendCommand(kIdentityAlpha, GetEndpoint(0), GroupKeyManagement::Id, GroupKeyManagement::Commands::KeySetRead::Id, + value); + } + } + return CHIP_NO_ERROR; } - - // - // Tests methods - // }; -class Test_TC_DD_3_12Suite : public TestCommand +class Test_TC_DD_1_5Suite : public TestCommand { public: - Test_TC_DD_3_12Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_DD_3_12", credsIssuerConfig), mTestIndex(0) + Test_TC_DD_1_5Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_DD_1_5", 1, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -116070,41 +48182,7 @@ class Test_TC_DD_3_12Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_DD_3_12Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_DD_3_12\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_DD_3_12\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } + ~Test_TC_DD_1_5Suite() {} chip::System::Clock::Timeout GetWaitDuration() const override { @@ -116112,20 +48190,27 @@ class Test_TC_DD_3_12Suite : public TestCommand } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; switch (mTestIndex - 1) { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; default: LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); } @@ -116134,81 +48219,72 @@ class Test_TC_DD_3_12Suite : public TestCommand { ContinueOnChipMainThread(CHIP_NO_ERROR); } - } - - // - // Tests methods - // -}; - -class Test_TC_DD_3_13Suite : public TestCommand -{ -public: - Test_TC_DD_3_13Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_DD_3_13", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_DD_3_13Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_DD_3_13\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_DD_3_13\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - } + } - if (CHIP_NO_ERROR != err) + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); + case 0: { + LogStep(0, "Step 1"); + SetIdentity(kIdentityAlpha); + return Log("Verify that the onboarding payload for NFC tags SHALL use NDEF URI Record Type Definition as defined by " + "NFC Forum in URI Record Type Definition RTD URI"); } + } + return CHIP_NO_ERROR; + } +}; + +class Test_TC_DD_1_6Suite : public TestCommand +{ +public: + Test_TC_DD_1_6Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_DD_1_6", 3, credsIssuerConfig) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } + ~Test_TC_DD_1_6Suite() {} + chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; switch (mTestIndex - 1) { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; default: LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); } @@ -116219,16 +48295,37 @@ class Test_TC_DD_3_13Suite : public TestCommand } } - // - // Tests methods - // + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Step 1"); + SetIdentity(kIdentityAlpha); + return Log("Scan the DUTs QR code using a QR code reader"); + } + case 1: { + LogStep(1, "Step 1 verification"); + SetIdentity(kIdentityAlpha); + return Log( + "Verify the QR code gets scanned successfully and the QR code must be of sufficient size and contrast respective " + "to surface material as to be readable with standard readers such as smartphones in normal lighting conditions"); + } + case 2: { + LogStep(2, "Step 2 verificaiton"); + SetIdentity(kIdentityAlpha); + return Log("Verify QR code version is 1 or higher"); + } + } + return CHIP_NO_ERROR; + } }; -class Test_TC_DD_3_14Suite : public TestCommand +class Test_TC_DD_1_7Suite : public TestCommand { public: - Test_TC_DD_3_14Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_DD_3_14", credsIssuerConfig), mTestIndex(0) + Test_TC_DD_1_7Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_DD_1_7", 2, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -116236,41 +48333,7 @@ class Test_TC_DD_3_14Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_DD_3_14Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_DD_3_14\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_DD_3_14\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } + ~Test_TC_DD_1_7Suite() {} chip::System::Clock::Timeout GetWaitDuration() const override { @@ -116278,20 +48341,31 @@ class Test_TC_DD_3_14Suite : public TestCommand } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; switch (mTestIndex - 1) { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; default: LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); } @@ -116302,16 +48376,31 @@ class Test_TC_DD_3_14Suite : public TestCommand } } - // - // Tests methods - // + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Precondition"); + SetIdentity(kIdentityAlpha); + return Log("Verify manual pairing code is printed on the device or in additional provided materials"); + } + case 1: { + LogStep(1, "Step 1"); + SetIdentity(kIdentityAlpha); + return Log("Verify that the Manual Pairing Code should be printed using a minimum font size of 6 points typically " + "producing a typeface height of 2.1 mm"); + } + } + return CHIP_NO_ERROR; + } }; -class Test_TC_DD_4_1Suite : public TestCommand +class Test_TC_DD_1_8Suite : public TestCommand { public: - Test_TC_DD_4_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_DD_4_1", credsIssuerConfig), mTestIndex(0) + Test_TC_DD_1_8Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_DD_1_8", 2, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -116319,41 +48408,7 @@ class Test_TC_DD_4_1Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_DD_4_1Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_DD_4_1\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_DD_4_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } + ~Test_TC_DD_1_8Suite() {} chip::System::Clock::Timeout GetWaitDuration() const override { @@ -116361,20 +48416,31 @@ class Test_TC_DD_4_1Suite : public TestCommand } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; switch (mTestIndex - 1) { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; default: LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); } @@ -116385,16 +48451,31 @@ class Test_TC_DD_4_1Suite : public TestCommand } } - // - // Tests methods - // + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Step 1"); + SetIdentity(kIdentityAlpha); + return Log("Scan the device QR code using DUT"); + } + case 1: { + LogStep(1, "Step 1 verification"); + SetIdentity(kIdentityAlpha); + return Log( + "Verify the DUT is able to scan and parse the QR code successfully to onboard the device onto the CHIP network"); + } + } + return CHIP_NO_ERROR; + } }; -class TestGroupDemoCommandSuite : public TestCommand +class Test_TC_DD_1_9Suite : public TestCommand { public: - TestGroupDemoCommandSuite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("TestGroupDemoCommand", credsIssuerConfig), mTestIndex(0) + Test_TC_DD_1_9Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_DD_1_9", 3, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -116402,125 +48483,7 @@ class TestGroupDemoCommandSuite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~TestGroupDemoCommandSuite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: TestGroupDemoCommand\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: TestGroupDemoCommand\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Turn On the light to see attribute change\n"); - err = TestTurnOnTheLightToSeeAttributeChange_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Wait 100ms\n"); - err = TestWait100ms_2(); - break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Turn Off the light to see attribute change\n"); - err = TestTurnOffTheLightToSeeAttributeChange_3(); - break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Wait 100ms\n"); - err = TestWait100ms_4(); - break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Turn On the light to see attribute change\n"); - err = TestTurnOnTheLightToSeeAttributeChange_5(); - break; - case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : Wait 100ms\n"); - err = TestWait100ms_6(); - break; - case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : Turn Off the light to see attribute change\n"); - err = TestTurnOffTheLightToSeeAttributeChange_7(); - break; - case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : Wait 100ms\n"); - err = TestWait100ms_8(); - break; - case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : Turn On the light to see attribute change\n"); - err = TestTurnOnTheLightToSeeAttributeChange_9(); - break; - case 10: - ChipLogProgress(chipTool, " ***** Test Step 10 : Wait 100ms\n"); - err = TestWait100ms_10(); - break; - case 11: - ChipLogProgress(chipTool, " ***** Test Step 11 : Turn Off the light to see attribute change\n"); - err = TestTurnOffTheLightToSeeAttributeChange_11(); - break; - case 12: - ChipLogProgress(chipTool, " ***** Test Step 12 : Wait 100ms\n"); - err = TestWait100ms_12(); - break; - case 13: - ChipLogProgress(chipTool, " ***** Test Step 13 : Turn On the light to see attribute change\n"); - err = TestTurnOnTheLightToSeeAttributeChange_13(); - break; - case 14: - ChipLogProgress(chipTool, " ***** Test Step 14 : Wait 100ms\n"); - err = TestWait100ms_14(); - break; - case 15: - ChipLogProgress(chipTool, " ***** Test Step 15 : Turn Off the light to see attribute change\n"); - err = TestTurnOffTheLightToSeeAttributeChange_15(); - break; - case 16: - ChipLogProgress(chipTool, " ***** Test Step 16 : Wait 100ms\n"); - err = TestWait100ms_16(); - break; - case 17: - ChipLogProgress(chipTool, " ***** Test Step 17 : Turn On the light to see attribute change\n"); - err = TestTurnOnTheLightToSeeAttributeChange_17(); - break; - case 18: - ChipLogProgress(chipTool, " ***** Test Step 18 : Wait 100ms\n"); - err = TestWait100ms_18(); - break; - case 19: - ChipLogProgress(chipTool, " ***** Test Step 19 : Turn Off the light to see attribute change\n"); - err = TestTurnOffTheLightToSeeAttributeChange_19(); - break; - case 20: - ChipLogProgress(chipTool, " ***** Test Step 20 : Wait 100ms\n"); - err = TestWait100ms_20(); - break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } + ~Test_TC_DD_1_9Suite() {} chip::System::Clock::Timeout GetWaitDuration() const override { @@ -116528,14 +48491,17 @@ class TestGroupDemoCommandSuite : public TestCommand } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 21; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -116546,43 +48512,11 @@ class TestGroupDemoCommandSuite : public TestCommand VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); shouldContinue = true; break; - case 2: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 4: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 6: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 8: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 10: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 12: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 14: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 16: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 18: + case 1: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); shouldContinue = true; break; - case 20: + case 2: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); shouldContinue = true; break; @@ -116596,402 +48530,261 @@ class TestGroupDemoCommandSuite : public TestCommand } } - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestTurnOnTheLightToSeeAttributeChange_1() - { - const chip::GroupId groupId = 257; - using RequestType = chip::app::Clusters::OnOff::Commands::On::Type; - - RequestType request; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_1(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_1(error); - }; - - auto done = [](void * context) { (static_cast(context))->OnDoneResponse_1(); }; - - ReturnErrorOnFailure( - chip::Controller::InvokeGroupCommand(mDevices[kIdentityAlpha], this, success, failure, done, groupId, request)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_1() { NextTest(); } - - void OnDoneResponse_1() { NextTest(); } - - CHIP_ERROR TestWait100ms_2() - { - SetIdentity(kIdentityAlpha); - return WaitForMs(1000); - } - - CHIP_ERROR TestTurnOffTheLightToSeeAttributeChange_3() + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - const chip::GroupId groupId = 257; - using RequestType = chip::app::Clusters::OnOff::Commands::Off::Type; - - RequestType request; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_3(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_3(error); - }; - - auto done = [](void * context) { (static_cast(context))->OnDoneResponse_3(); }; - - ReturnErrorOnFailure( - chip::Controller::InvokeGroupCommand(mDevices[kIdentityAlpha], this, success, failure, done, groupId, request)); + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Precondition"); + SetIdentity(kIdentityAlpha); + return Log("Verify that the manual pairing code is printed on the device or in additional provided materials"); + } + case 1: { + LogStep(1, "Step 1"); + SetIdentity(kIdentityAlpha); + return Log( + "Provide the 11 digit or 21 digit pairing code from the Device in text speech or any format supported by DUT"); + } + case 2: { + LogStep(2, "Step 1 verification"); + SetIdentity(kIdentityAlpha); + return Log("Verify that the manual pairing code can be provided to DUT and parsed to onboard the device onto the CHIP " + "network"); + } + } return CHIP_NO_ERROR; } +}; - void OnFailureResponse_3(CHIP_ERROR error) +class Test_TC_DD_1_10Suite : public TestCommand +{ +public: + Test_TC_DD_1_10Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_DD_1_10", 0, credsIssuerConfig) { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - void OnSuccessResponse_3() { NextTest(); } - - void OnDoneResponse_3() { NextTest(); } + ~Test_TC_DD_1_10Suite() {} - CHIP_ERROR TestWait100ms_4() + chip::System::Clock::Timeout GetWaitDuration() const override { - SetIdentity(kIdentityAlpha); - return WaitForMs(1000); + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } - CHIP_ERROR TestTurnOnTheLightToSeeAttributeChange_5() - { - const chip::GroupId groupId = 257; - using RequestType = chip::app::Clusters::OnOff::Commands::On::Type; - - RequestType request; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_5(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_5(error); - }; +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; - auto done = [](void * context) { (static_cast(context))->OnDoneResponse_5(); }; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } - ReturnErrorOnFailure( - chip::Controller::InvokeGroupCommand(mDevices[kIdentityAlpha], this, success, failure, done, groupId, request)); - return CHIP_NO_ERROR; - } + // + // Tests methods + // - void OnFailureResponse_5(CHIP_ERROR error) + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_5() { NextTest(); } + bool shouldContinue = false; - void OnDoneResponse_5() { NextTest(); } + switch (mTestIndex - 1) + { + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } - CHIP_ERROR TestWait100ms_6() - { - SetIdentity(kIdentityAlpha); - return WaitForMs(1000); + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } } - CHIP_ERROR TestTurnOffTheLightToSeeAttributeChange_7() + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - const chip::GroupId groupId = 257; - using RequestType = chip::app::Clusters::OnOff::Commands::Off::Type; - - RequestType request; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_7(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_7(error); - }; - - auto done = [](void * context) { (static_cast(context))->OnDoneResponse_7(); }; - - ReturnErrorOnFailure( - chip::Controller::InvokeGroupCommand(mDevices[kIdentityAlpha], this, success, failure, done, groupId, request)); + using namespace chip::app::Clusters; + switch (testIndex) + { + } return CHIP_NO_ERROR; } +}; - void OnFailureResponse_7(CHIP_ERROR error) +class Test_TC_DD_2_1Suite : public TestCommand +{ +public: + Test_TC_DD_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_DD_2_1", 0, credsIssuerConfig) { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - void OnSuccessResponse_7() { NextTest(); } - - void OnDoneResponse_7() { NextTest(); } + ~Test_TC_DD_2_1Suite() {} - CHIP_ERROR TestWait100ms_8() + chip::System::Clock::Timeout GetWaitDuration() const override { - SetIdentity(kIdentityAlpha); - return WaitForMs(1000); + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } - CHIP_ERROR TestTurnOnTheLightToSeeAttributeChange_9() - { - const chip::GroupId groupId = 257; - using RequestType = chip::app::Clusters::OnOff::Commands::On::Type; - - RequestType request; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_9(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_9(error); - }; +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; - auto done = [](void * context) { (static_cast(context))->OnDoneResponse_9(); }; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } - ReturnErrorOnFailure( - chip::Controller::InvokeGroupCommand(mDevices[kIdentityAlpha], this, success, failure, done, groupId, request)); - return CHIP_NO_ERROR; - } + // + // Tests methods + // - void OnFailureResponse_9(CHIP_ERROR error) + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_9() { NextTest(); } + bool shouldContinue = false; - void OnDoneResponse_9() { NextTest(); } + switch (mTestIndex - 1) + { + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } - CHIP_ERROR TestWait100ms_10() - { - SetIdentity(kIdentityAlpha); - return WaitForMs(1000); + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } } - CHIP_ERROR TestTurnOffTheLightToSeeAttributeChange_11() + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - const chip::GroupId groupId = 257; - using RequestType = chip::app::Clusters::OnOff::Commands::Off::Type; - - RequestType request; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_11(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_11(error); - }; - - auto done = [](void * context) { (static_cast(context))->OnDoneResponse_11(); }; - - ReturnErrorOnFailure( - chip::Controller::InvokeGroupCommand(mDevices[kIdentityAlpha], this, success, failure, done, groupId, request)); + using namespace chip::app::Clusters; + switch (testIndex) + { + } return CHIP_NO_ERROR; } +}; - void OnFailureResponse_11(CHIP_ERROR error) +class Test_TC_DD_2_2Suite : public TestCommand +{ +public: + Test_TC_DD_2_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_DD_2_2", 0, credsIssuerConfig) { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - void OnSuccessResponse_11() { NextTest(); } - - void OnDoneResponse_11() { NextTest(); } + ~Test_TC_DD_2_2Suite() {} - CHIP_ERROR TestWait100ms_12() + chip::System::Clock::Timeout GetWaitDuration() const override { - SetIdentity(kIdentityAlpha); - return WaitForMs(1000); + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } - CHIP_ERROR TestTurnOnTheLightToSeeAttributeChange_13() - { - const chip::GroupId groupId = 257; - using RequestType = chip::app::Clusters::OnOff::Commands::On::Type; - - RequestType request; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_13(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_13(error); - }; +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; - auto done = [](void * context) { (static_cast(context))->OnDoneResponse_13(); }; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } - ReturnErrorOnFailure( - chip::Controller::InvokeGroupCommand(mDevices[kIdentityAlpha], this, success, failure, done, groupId, request)); - return CHIP_NO_ERROR; - } + // + // Tests methods + // - void OnFailureResponse_13(CHIP_ERROR error) + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_13() { NextTest(); } + bool shouldContinue = false; - void OnDoneResponse_13() { NextTest(); } + switch (mTestIndex - 1) + { + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } - CHIP_ERROR TestWait100ms_14() - { - SetIdentity(kIdentityAlpha); - return WaitForMs(1000); + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } } - CHIP_ERROR TestTurnOffTheLightToSeeAttributeChange_15() + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - const chip::GroupId groupId = 257; - using RequestType = chip::app::Clusters::OnOff::Commands::Off::Type; - - RequestType request; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_15(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_15(error); - }; - - auto done = [](void * context) { (static_cast(context))->OnDoneResponse_15(); }; - - ReturnErrorOnFailure( - chip::Controller::InvokeGroupCommand(mDevices[kIdentityAlpha], this, success, failure, done, groupId, request)); + using namespace chip::app::Clusters; + switch (testIndex) + { + } return CHIP_NO_ERROR; } +}; - void OnFailureResponse_15(CHIP_ERROR error) +class Test_TC_DD_3_1Suite : public TestCommand +{ +public: + Test_TC_DD_3_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_DD_3_1", 0, credsIssuerConfig) { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - void OnSuccessResponse_15() { NextTest(); } - - void OnDoneResponse_15() { NextTest(); } + ~Test_TC_DD_3_1Suite() {} - CHIP_ERROR TestWait100ms_16() + chip::System::Clock::Timeout GetWaitDuration() const override { - SetIdentity(kIdentityAlpha); - return WaitForMs(1000); + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } - CHIP_ERROR TestTurnOnTheLightToSeeAttributeChange_17() - { - const chip::GroupId groupId = 257; - using RequestType = chip::app::Clusters::OnOff::Commands::On::Type; - - RequestType request; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_17(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_17(error); - }; +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; - auto done = [](void * context) { (static_cast(context))->OnDoneResponse_17(); }; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } - ReturnErrorOnFailure( - chip::Controller::InvokeGroupCommand(mDevices[kIdentityAlpha], this, success, failure, done, groupId, request)); - return CHIP_NO_ERROR; - } + // + // Tests methods + // - void OnFailureResponse_17(CHIP_ERROR error) + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_17() { NextTest(); } + bool shouldContinue = false; - void OnDoneResponse_17() { NextTest(); } + switch (mTestIndex - 1) + { + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } - CHIP_ERROR TestWait100ms_18() - { - SetIdentity(kIdentityAlpha); - return WaitForMs(1000); + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } } - CHIP_ERROR TestTurnOffTheLightToSeeAttributeChange_19() + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - const chip::GroupId groupId = 257; - using RequestType = chip::app::Clusters::OnOff::Commands::Off::Type; - - RequestType request; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_19(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_19(error); - }; - - auto done = [](void * context) { (static_cast(context))->OnDoneResponse_19(); }; - - ReturnErrorOnFailure( - chip::Controller::InvokeGroupCommand(mDevices[kIdentityAlpha], this, success, failure, done, groupId, request)); + using namespace chip::app::Clusters; + switch (testIndex) + { + } return CHIP_NO_ERROR; } - - void OnFailureResponse_19(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_19() { NextTest(); } - - void OnDoneResponse_19() { NextTest(); } - - CHIP_ERROR TestWait100ms_20() - { - SetIdentity(kIdentityAlpha); - return WaitForMs(1000); - } }; -class TestGroupDemoConfigSuite : public TestCommand +class Test_TC_DD_3_2Suite : public TestCommand { public: - TestGroupDemoConfigSuite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("TestGroupDemoConfig", credsIssuerConfig), mTestIndex(0) + Test_TC_DD_3_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_DD_3_2", 0, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -116999,86 +48792,87 @@ class TestGroupDemoConfigSuite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~TestGroupDemoConfigSuite() {} + ~Test_TC_DD_3_2Suite() {} + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } + +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // - /////////// TestCommand Interface ///////// - void NextTest() override + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { - CHIP_ERROR err = CHIP_NO_ERROR; + bool shouldContinue = false; - if (0 == mTestIndex) + switch (mTestIndex - 1) { - ChipLogProgress(chipTool, " **** Test Start: TestGroupDemoConfig\n"); + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); } - if (mTestCount == mTestIndex) + if (shouldContinue) { - ChipLogProgress(chipTool, " **** Test Complete: TestGroupDemoConfig\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; + ContinueOnChipMainThread(CHIP_NO_ERROR); } + } - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Add Group 1 - endpoint 1\n"); - err = TestAddGroup1Endpoint1_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : KeySet Write 1\n"); - err = TestKeySetWrite1_2(); - break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Map Group Key Set to group ID on a given fabric\n"); - err = TestMapGroupKeySetToGroupIdOnAGivenFabric_3(); - break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Install ACLs for test\n"); - err = TestInstallACLsForTest_4(); - break; } + return CHIP_NO_ERROR; + } +}; - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } +class Test_TC_DD_3_5Suite : public TestCommand +{ +public: + Test_TC_DD_3_5Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_DD_3_5", 0, credsIssuerConfig) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } + ~Test_TC_DD_3_5Suite() {} + chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 5; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; switch (mTestIndex - 1) { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; default: LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); } @@ -117089,209 +48883,188 @@ class TestGroupDemoConfigSuite : public TestCommand } } - static void OnFailureCallback_3(void * context, CHIP_ERROR error) + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + } + return CHIP_NO_ERROR; + } +}; + +class Test_TC_DD_3_6Suite : public TestCommand +{ +public: + Test_TC_DD_3_6Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_DD_3_6", 0, credsIssuerConfig) { - (static_cast(context))->OnFailureResponse_3(error); + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - static void OnSuccessCallback_3(void * context) { (static_cast(context))->OnSuccessResponse_3(); } + ~Test_TC_DD_3_6Suite() {} - static void OnFailureCallback_4(void * context, CHIP_ERROR error) + chip::System::Clock::Timeout GetWaitDuration() const override { - (static_cast(context))->OnFailureResponse_4(error); + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } - static void OnSuccessCallback_4(void * context) { (static_cast(context))->OnSuccessResponse_4(); } +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } // // Tests methods // - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestAddGroup1Endpoint1_1() + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::Groups::Commands::AddGroup::Type; - - RequestType request; - request.groupId = 257U; - request.groupName = chip::Span("Group #1garbage: not in length on purpose", 8); - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_1(data.status, data.groupId); - }; + bool shouldContinue = false; - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_1(error); - }; + switch (mTestIndex - 1) + { + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } } - void OnFailureResponse_1(CHIP_ERROR error) + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); + using namespace chip::app::Clusters; + switch (testIndex) + { + } + return CHIP_NO_ERROR; } +}; - void OnSuccessResponse_1(uint8_t status, chip::GroupId groupId) +class Test_TC_DD_3_9Suite : public TestCommand +{ +public: + Test_TC_DD_3_9Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_DD_3_9", 0, credsIssuerConfig) { - VerifyOrReturn(CheckValue("status", status, 0)); - - VerifyOrReturn(CheckValue("groupId", groupId, 257U)); - - NextTest(); + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - CHIP_ERROR TestKeySetWrite1_2() + ~Test_TC_DD_3_9Suite() {} + + chip::System::Clock::Timeout GetWaitDuration() const override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - using RequestType = chip::app::Clusters::GroupKeyManagement::Commands::KeySetWrite::Type; + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } - RequestType request; +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; - request.groupKeySet.groupKeySetID = 417U; - request.groupKeySet.groupKeySecurityPolicy = - static_cast(0); - request.groupKeySet.epochKey0.SetNonNull(); - request.groupKeySet.epochKey0.Value() = - chip::ByteSpan(chip::Uint8::from_const_char( - "\240\241\242\243\244\245\246\247\250\251\252\253\254\255\256\257garbage: not in length on purpose"), - 16); - request.groupKeySet.epochStartTime0.SetNonNull(); - request.groupKeySet.epochStartTime0.Value() = 1110000ULL; - request.groupKeySet.epochKey1.SetNonNull(); - request.groupKeySet.epochKey1.Value() = - chip::ByteSpan(chip::Uint8::from_const_char( - "\260\261\262\263\264\265\266\267\270\271\272\273\274\275\276\277garbage: not in length on purpose"), - 16); - request.groupKeySet.epochStartTime1.SetNonNull(); - request.groupKeySet.epochStartTime1.Value() = 1110001ULL; - request.groupKeySet.epochKey2.SetNonNull(); - request.groupKeySet.epochKey2.Value() = - chip::ByteSpan(chip::Uint8::from_const_char( - "\300\301\302\303\304\305\306\307\310\311\312\313\314\315\316\317garbage: not in length on purpose"), - 16); - request.groupKeySet.epochStartTime2.SetNonNull(); - request.groupKeySet.epochStartTime2.Value() = 1110002ULL; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_2(); - }; + // + // Tests methods + // - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_2(error); - }; + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override + { + bool shouldContinue = false; - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; - } + switch (mTestIndex - 1) + { + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } - void OnFailureResponse_2(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } } - void OnSuccessResponse_2() { NextTest(); } - - CHIP_ERROR TestMapGroupKeySetToGroupIdOnAGivenFabric_3() + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::GroupKeyManagementClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ListFreer listFreer; - chip::app::DataModel::List - groupKeyMapArgument; - + using namespace chip::app::Clusters; + switch (testIndex) { - auto * listHolder_0 = new ListHolder(1); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].groupId = 257U; - listHolder_0->mList[0].groupKeySetID = 417U; - listHolder_0->mList[0].fabricIndex = 1; - - groupKeyMapArgument = - chip::app::DataModel::List( - listHolder_0->mList, 1); } - - ReturnErrorOnFailure(cluster.WriteAttribute( - groupKeyMapArgument, this, OnSuccessCallback_3, OnFailureCallback_3)); return CHIP_NO_ERROR; } +}; - void OnFailureResponse_3(CHIP_ERROR error) +class Test_TC_DD_3_10Suite : public TestCommand +{ +public: + Test_TC_DD_3_10Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_DD_3_10", 0, credsIssuerConfig) { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - void OnSuccessResponse_3() { NextTest(); } + ~Test_TC_DD_3_10Suite() {} - CHIP_ERROR TestInstallACLsForTest_4() + chip::System::Clock::Timeout GetWaitDuration() const override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::AccessControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ListFreer listFreer; - chip::app::DataModel::List aclArgument; + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } - { - auto * listHolder_0 = new ListHolder(2); - listFreer.add(listHolder_0); +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; - listHolder_0->mList[0].privilege = static_cast(5); - listHolder_0->mList[0].authMode = static_cast(2); - listHolder_0->mList[0].subjects.SetNull(); - listHolder_0->mList[0].targets.SetNull(); - listHolder_0->mList[0].fabricIndex = 1; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } - listHolder_0->mList[1].privilege = static_cast(3); - listHolder_0->mList[1].authMode = static_cast(3); - listHolder_0->mList[1].subjects.SetNonNull(); + // + // Tests methods + // - { - auto * listHolder_3 = new ListHolder(1); - listFreer.add(listHolder_3); - listHolder_3->mList[0] = 257ULL; - listHolder_0->mList[1].subjects.Value() = chip::app::DataModel::List(listHolder_3->mList, 1); - } - listHolder_0->mList[1].targets.SetNull(); - listHolder_0->mList[1].fabricIndex = 1; + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override + { + bool shouldContinue = false; - aclArgument = chip::app::DataModel::List( - listHolder_0->mList, 2); + switch (mTestIndex - 1) + { + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); } - ReturnErrorOnFailure(cluster.WriteAttribute( - aclArgument, this, OnSuccessCallback_4, OnFailureCallback_4)); - return CHIP_NO_ERROR; + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } } - void OnFailureResponse_4(CHIP_ERROR error) + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); + using namespace chip::app::Clusters; + switch (testIndex) + { + } + return CHIP_NO_ERROR; } - - void OnSuccessResponse_4() { NextTest(); } }; -class Test_TC_BDX_1_1Suite : public TestCommand +class Test_TC_DD_3_11Suite : public TestCommand { public: - Test_TC_BDX_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_BDX_1_1", credsIssuerConfig), mTestIndex(0) + Test_TC_DD_3_11Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_DD_3_11", 0, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -117299,41 +49072,7 @@ class Test_TC_BDX_1_1Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_BDX_1_1Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_BDX_1_1\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_BDX_1_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } + ~Test_TC_DD_3_11Suite() {} chip::System::Clock::Timeout GetWaitDuration() const override { @@ -117341,14 +49080,17 @@ class Test_TC_BDX_1_1Suite : public TestCommand } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -117365,16 +49107,20 @@ class Test_TC_BDX_1_1Suite : public TestCommand } } - // - // Tests methods - // + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + } + return CHIP_NO_ERROR; + } }; -class Test_TC_BDX_1_2Suite : public TestCommand +class Test_TC_DD_3_12Suite : public TestCommand { public: - Test_TC_BDX_1_2Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_BDX_1_2", credsIssuerConfig), mTestIndex(0) + Test_TC_DD_3_12Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_DD_3_12", 0, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -117382,41 +49128,7 @@ class Test_TC_BDX_1_2Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_BDX_1_2Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_BDX_1_2\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_BDX_1_2\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } + ~Test_TC_DD_3_12Suite() {} chip::System::Clock::Timeout GetWaitDuration() const override { @@ -117424,14 +49136,17 @@ class Test_TC_BDX_1_2Suite : public TestCommand } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -117448,16 +49163,20 @@ class Test_TC_BDX_1_2Suite : public TestCommand } } - // - // Tests methods - // + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + } + return CHIP_NO_ERROR; + } }; -class Test_TC_BDX_1_3Suite : public TestCommand +class Test_TC_DD_3_13Suite : public TestCommand { public: - Test_TC_BDX_1_3Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_BDX_1_3", credsIssuerConfig), mTestIndex(0) + Test_TC_DD_3_13Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_DD_3_13", 0, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -117465,41 +49184,7 @@ class Test_TC_BDX_1_3Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_BDX_1_3Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_BDX_1_3\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_BDX_1_3\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } + ~Test_TC_DD_3_13Suite() {} chip::System::Clock::Timeout GetWaitDuration() const override { @@ -117507,14 +49192,17 @@ class Test_TC_BDX_1_3Suite : public TestCommand } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -117531,16 +49219,20 @@ class Test_TC_BDX_1_3Suite : public TestCommand } } - // - // Tests methods - // + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + } + return CHIP_NO_ERROR; + } }; -class Test_TC_BDX_1_5Suite : public TestCommand +class Test_TC_DD_3_14Suite : public TestCommand { public: - Test_TC_BDX_1_5Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_BDX_1_5", credsIssuerConfig), mTestIndex(0) + Test_TC_DD_3_14Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_DD_3_14", 0, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -117548,56 +49240,81 @@ class Test_TC_BDX_1_5Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_BDX_1_5Suite() {} + ~Test_TC_DD_3_14Suite() {} - /////////// TestCommand Interface ///////// - void NextTest() override + chip::System::Clock::Timeout GetWaitDuration() const override { - CHIP_ERROR err = CHIP_NO_ERROR; + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_BDX_1_5\n"); - } +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // - if (mTestCount == mTestIndex) + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override + { + bool shouldContinue = false; + + switch (mTestIndex - 1) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_BDX_1_5\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); } - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) + if (shouldContinue) { + ContinueOnChipMainThread(CHIP_NO_ERROR); } + } - if (CHIP_NO_ERROR != err) + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); } + return CHIP_NO_ERROR; + } +}; + +class Test_TC_DD_4_1Suite : public TestCommand +{ +public: + Test_TC_DD_4_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_DD_4_1", 0, credsIssuerConfig) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } + ~Test_TC_DD_4_1Suite() {} + chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -117614,16 +49331,21 @@ class Test_TC_BDX_1_5Suite : public TestCommand } } - // - // Tests methods - // + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + } + return CHIP_NO_ERROR; + } }; -class Test_TC_BDX_1_6Suite : public TestCommand +class TestGroupDemoCommandSuite : public TestCommand { public: - Test_TC_BDX_1_6Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_BDX_1_6", credsIssuerConfig), mTestIndex(0) + TestGroupDemoCommandSuite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("TestGroupDemoCommand", 21, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -117631,62 +49353,290 @@ class Test_TC_BDX_1_6Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_BDX_1_6Suite() {} + ~TestGroupDemoCommandSuite() {} - /////////// TestCommand Interface ///////// - void NextTest() override + chip::System::Clock::Timeout GetWaitDuration() const override { - CHIP_ERROR err = CHIP_NO_ERROR; + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_BDX_1_6\n"); - } +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override + { + bool shouldContinue = false; - if (mTestCount == mTestIndex) + switch (mTestIndex - 1) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_BDX_1_6\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 8: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 9: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 10: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 11: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 12: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 13: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 14: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 15: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 16: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 17: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 18: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 19: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 20: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); } - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) + if (shouldContinue) { + ContinueOnChipMainThread(CHIP_NO_ERROR); } + } - if (CHIP_NO_ERROR != err) + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "Turn On the light to see attribute change"); + chip::app::Clusters::OnOff::Commands::On::Type value; + return SendGroupCommand(kIdentityAlpha, 257, OnOff::Id, OnOff::Commands::On::Id, value); + } + case 2: { + LogStep(2, "Wait 100ms"); + SetIdentity(kIdentityAlpha); + return WaitForMs(1000); + } + case 3: { + LogStep(3, "Turn Off the light to see attribute change"); + chip::app::Clusters::OnOff::Commands::Off::Type value; + return SendGroupCommand(kIdentityAlpha, 257, OnOff::Id, OnOff::Commands::Off::Id, value); + } + case 4: { + LogStep(4, "Wait 100ms"); + SetIdentity(kIdentityAlpha); + return WaitForMs(1000); + } + case 5: { + LogStep(5, "Turn On the light to see attribute change"); + chip::app::Clusters::OnOff::Commands::On::Type value; + return SendGroupCommand(kIdentityAlpha, 257, OnOff::Id, OnOff::Commands::On::Id, value); + } + case 6: { + LogStep(6, "Wait 100ms"); + SetIdentity(kIdentityAlpha); + return WaitForMs(1000); + } + case 7: { + LogStep(7, "Turn Off the light to see attribute change"); + chip::app::Clusters::OnOff::Commands::Off::Type value; + return SendGroupCommand(kIdentityAlpha, 257, OnOff::Id, OnOff::Commands::Off::Id, value); + } + case 8: { + LogStep(8, "Wait 100ms"); + SetIdentity(kIdentityAlpha); + return WaitForMs(1000); + } + case 9: { + LogStep(9, "Turn On the light to see attribute change"); + chip::app::Clusters::OnOff::Commands::On::Type value; + return SendGroupCommand(kIdentityAlpha, 257, OnOff::Id, OnOff::Commands::On::Id, value); + } + case 10: { + LogStep(10, "Wait 100ms"); + SetIdentity(kIdentityAlpha); + return WaitForMs(1000); + } + case 11: { + LogStep(11, "Turn Off the light to see attribute change"); + chip::app::Clusters::OnOff::Commands::Off::Type value; + return SendGroupCommand(kIdentityAlpha, 257, OnOff::Id, OnOff::Commands::Off::Id, value); + } + case 12: { + LogStep(12, "Wait 100ms"); + SetIdentity(kIdentityAlpha); + return WaitForMs(1000); + } + case 13: { + LogStep(13, "Turn On the light to see attribute change"); + chip::app::Clusters::OnOff::Commands::On::Type value; + return SendGroupCommand(kIdentityAlpha, 257, OnOff::Id, OnOff::Commands::On::Id, value); + } + case 14: { + LogStep(14, "Wait 100ms"); + SetIdentity(kIdentityAlpha); + return WaitForMs(1000); } + case 15: { + LogStep(15, "Turn Off the light to see attribute change"); + chip::app::Clusters::OnOff::Commands::Off::Type value; + return SendGroupCommand(kIdentityAlpha, 257, OnOff::Id, OnOff::Commands::Off::Id, value); + } + case 16: { + LogStep(16, "Wait 100ms"); + SetIdentity(kIdentityAlpha); + return WaitForMs(1000); + } + case 17: { + LogStep(17, "Turn On the light to see attribute change"); + chip::app::Clusters::OnOff::Commands::On::Type value; + return SendGroupCommand(kIdentityAlpha, 257, OnOff::Id, OnOff::Commands::On::Id, value); + } + case 18: { + LogStep(18, "Wait 100ms"); + SetIdentity(kIdentityAlpha); + return WaitForMs(1000); + } + case 19: { + LogStep(19, "Turn Off the light to see attribute change"); + chip::app::Clusters::OnOff::Commands::Off::Type value; + return SendGroupCommand(kIdentityAlpha, 257, OnOff::Id, OnOff::Commands::Off::Id, value); + } + case 20: { + LogStep(20, "Wait 100ms"); + SetIdentity(kIdentityAlpha); + return WaitForMs(1000); + } + } + return CHIP_NO_ERROR; + } +}; + +class TestGroupDemoConfigSuite : public TestCommand +{ +public: + TestGroupDemoConfigSuite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("TestGroupDemoConfig", 5, credsIssuerConfig) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } + ~TestGroupDemoConfigSuite() {} + chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; switch (mTestIndex - 1) { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::Groups::Commands::AddGroupResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("status", value.status, 0)); + + VerifyOrReturn(CheckValue("groupId", value.groupId, 257U)); + } + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; default: LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); } @@ -117697,16 +49647,116 @@ class Test_TC_BDX_1_6Suite : public TestCommand } } - // - // Tests methods - // + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 1: { + LogStep(1, "Add Group 1 - endpoint 1"); + chip::app::Clusters::Groups::Commands::AddGroup::Type value; + value.groupId = 257U; + value.groupName = chip::Span("Group #1garbage: not in length on purpose", 8); + return SendCommand(kIdentityAlpha, GetEndpoint(1), Groups::Id, Groups::Commands::AddGroup::Id, value); + } + case 2: { + LogStep(2, "KeySet Write 1"); + chip::app::Clusters::GroupKeyManagement::Commands::KeySetWrite::Type value; + + value.groupKeySet.groupKeySetID = 417U; + value.groupKeySet.groupKeySecurityPolicy = + static_cast(0); + value.groupKeySet.epochKey0.SetNonNull(); + value.groupKeySet.epochKey0.Value() = chip::ByteSpan( + chip::Uint8::from_const_char( + "\240\241\242\243\244\245\246\247\250\251\252\253\254\255\256\257garbage: not in length on purpose"), + 16); + value.groupKeySet.epochStartTime0.SetNonNull(); + value.groupKeySet.epochStartTime0.Value() = 1110000ULL; + value.groupKeySet.epochKey1.SetNonNull(); + value.groupKeySet.epochKey1.Value() = chip::ByteSpan( + chip::Uint8::from_const_char( + "\260\261\262\263\264\265\266\267\270\271\272\273\274\275\276\277garbage: not in length on purpose"), + 16); + value.groupKeySet.epochStartTime1.SetNonNull(); + value.groupKeySet.epochStartTime1.Value() = 1110001ULL; + value.groupKeySet.epochKey2.SetNonNull(); + value.groupKeySet.epochKey2.Value() = chip::ByteSpan( + chip::Uint8::from_const_char( + "\300\301\302\303\304\305\306\307\310\311\312\313\314\315\316\317garbage: not in length on purpose"), + 16); + value.groupKeySet.epochStartTime2.SetNonNull(); + value.groupKeySet.epochStartTime2.Value() = 1110002ULL; + + return SendCommand(kIdentityAlpha, GetEndpoint(0), GroupKeyManagement::Id, + GroupKeyManagement::Commands::KeySetWrite::Id, value); + } + case 3: { + LogStep(3, "Map Group Key Set to group ID on a given fabric"); + ListFreer listFreer; + chip::app::DataModel::List value; + + { + auto * listHolder_0 = new ListHolder(1); + listFreer.add(listHolder_0); + + listHolder_0->mList[0].groupId = 257U; + listHolder_0->mList[0].groupKeySetID = 417U; + listHolder_0->mList[0].fabricIndex = 1; + + value = chip::app::DataModel::List( + listHolder_0->mList, 1); + } + return WriteAttribute(kIdentityAlpha, GetEndpoint(0), GroupKeyManagement::Id, + GroupKeyManagement::Attributes::GroupKeyMap::Id, value); + } + case 4: { + LogStep(4, "Install ACLs for test"); + ListFreer listFreer; + chip::app::DataModel::List value; + + { + auto * listHolder_0 = new ListHolder(2); + listFreer.add(listHolder_0); + + listHolder_0->mList[0].privilege = static_cast(5); + listHolder_0->mList[0].authMode = static_cast(2); + listHolder_0->mList[0].subjects.SetNull(); + listHolder_0->mList[0].targets.SetNull(); + listHolder_0->mList[0].fabricIndex = 1; + + listHolder_0->mList[1].privilege = static_cast(3); + listHolder_0->mList[1].authMode = static_cast(3); + listHolder_0->mList[1].subjects.SetNonNull(); + + { + auto * listHolder_3 = new ListHolder(1); + listFreer.add(listHolder_3); + listHolder_3->mList[0] = 257ULL; + listHolder_0->mList[1].subjects.Value() = chip::app::DataModel::List(listHolder_3->mList, 1); + } + listHolder_0->mList[1].targets.SetNull(); + listHolder_0->mList[1].fabricIndex = 1; + + value = chip::app::DataModel::List( + listHolder_0->mList, 2); + } + return WriteAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Acl::Id, value); + } + } + return CHIP_NO_ERROR; + } }; -class Test_TC_BDX_2_1Suite : public TestCommand +class Test_TC_BDX_1_1Suite : public TestCommand { public: - Test_TC_BDX_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_BDX_2_1", credsIssuerConfig), mTestIndex(0) + Test_TC_BDX_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_BDX_1_1", 0, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -117714,41 +49764,7 @@ class Test_TC_BDX_2_1Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_BDX_2_1Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_BDX_2_1\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_BDX_2_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } + ~Test_TC_BDX_1_1Suite() {} chip::System::Clock::Timeout GetWaitDuration() const override { @@ -117756,14 +49772,17 @@ class Test_TC_BDX_2_1Suite : public TestCommand } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -117780,16 +49799,20 @@ class Test_TC_BDX_2_1Suite : public TestCommand } } - // - // Tests methods - // + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + } + return CHIP_NO_ERROR; + } }; -class Test_TC_BDX_2_2Suite : public TestCommand +class Test_TC_BDX_1_2Suite : public TestCommand { public: - Test_TC_BDX_2_2Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_BDX_2_2", credsIssuerConfig), mTestIndex(0) + Test_TC_BDX_1_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_BDX_1_2", 0, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -117797,41 +49820,7 @@ class Test_TC_BDX_2_2Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_BDX_2_2Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_BDX_2_2\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_BDX_2_2\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } + ~Test_TC_BDX_1_2Suite() {} chip::System::Clock::Timeout GetWaitDuration() const override { @@ -117839,14 +49828,17 @@ class Test_TC_BDX_2_2Suite : public TestCommand } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -117863,16 +49855,20 @@ class Test_TC_BDX_2_2Suite : public TestCommand } } - // - // Tests methods - // + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + } + return CHIP_NO_ERROR; + } }; -class Test_TC_BDX_2_3Suite : public TestCommand +class Test_TC_BDX_1_3Suite : public TestCommand { public: - Test_TC_BDX_2_3Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_BDX_2_3", credsIssuerConfig), mTestIndex(0) + Test_TC_BDX_1_3Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_BDX_1_3", 0, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -117880,41 +49876,7 @@ class Test_TC_BDX_2_3Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_BDX_2_3Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_BDX_2_3\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_BDX_2_3\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } + ~Test_TC_BDX_1_3Suite() {} chip::System::Clock::Timeout GetWaitDuration() const override { @@ -117922,14 +49884,17 @@ class Test_TC_BDX_2_3Suite : public TestCommand } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -117946,16 +49911,20 @@ class Test_TC_BDX_2_3Suite : public TestCommand } } - // - // Tests methods - // + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + } + return CHIP_NO_ERROR; + } }; -class Test_TC_BDX_2_4Suite : public TestCommand +class Test_TC_BDX_1_5Suite : public TestCommand { public: - Test_TC_BDX_2_4Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_BDX_2_4", credsIssuerConfig), mTestIndex(0) + Test_TC_BDX_1_5Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_BDX_1_5", 0, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -117963,41 +49932,7 @@ class Test_TC_BDX_2_4Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_BDX_2_4Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_BDX_2_4\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_BDX_2_4\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } + ~Test_TC_BDX_1_5Suite() {} chip::System::Clock::Timeout GetWaitDuration() const override { @@ -118005,14 +49940,17 @@ class Test_TC_BDX_2_4Suite : public TestCommand } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -118029,16 +49967,20 @@ class Test_TC_BDX_2_4Suite : public TestCommand } } - // - // Tests methods - // + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + } + return CHIP_NO_ERROR; + } }; -class Test_TC_BDX_2_5Suite : public TestCommand +class Test_TC_BDX_1_6Suite : public TestCommand { public: - Test_TC_BDX_2_5Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_BDX_2_5", credsIssuerConfig), mTestIndex(0) + Test_TC_BDX_1_6Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_BDX_1_6", 0, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -118046,41 +49988,7 @@ class Test_TC_BDX_2_5Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_BDX_2_5Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_BDX_2_5\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_BDX_2_5\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } + ~Test_TC_BDX_1_6Suite() {} chip::System::Clock::Timeout GetWaitDuration() const override { @@ -118088,14 +49996,17 @@ class Test_TC_BDX_2_5Suite : public TestCommand } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -118112,15 +50023,20 @@ class Test_TC_BDX_2_5Suite : public TestCommand } } - // - // Tests methods - // + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + } + return CHIP_NO_ERROR; + } }; -class Test_TC_BR_1Suite : public TestCommand +class Test_TC_BDX_2_1Suite : public TestCommand { public: - Test_TC_BR_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_BR_1", credsIssuerConfig), mTestIndex(0) + Test_TC_BDX_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_BDX_2_1", 0, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -118128,41 +50044,7 @@ class Test_TC_BR_1Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_BR_1Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_BR_1\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_BR_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } + ~Test_TC_BDX_2_1Suite() {} chip::System::Clock::Timeout GetWaitDuration() const override { @@ -118170,14 +50052,17 @@ class Test_TC_BR_1Suite : public TestCommand } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -118194,15 +50079,20 @@ class Test_TC_BR_1Suite : public TestCommand } } - // - // Tests methods - // + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + } + return CHIP_NO_ERROR; + } }; -class Test_TC_BR_2Suite : public TestCommand +class Test_TC_BDX_2_2Suite : public TestCommand { public: - Test_TC_BR_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_BR_2", credsIssuerConfig), mTestIndex(0) + Test_TC_BDX_2_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_BDX_2_2", 0, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -118210,41 +50100,7 @@ class Test_TC_BR_2Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_BR_2Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_BR_2\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_BR_2\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } + ~Test_TC_BDX_2_2Suite() {} chip::System::Clock::Timeout GetWaitDuration() const override { @@ -118252,14 +50108,17 @@ class Test_TC_BR_2Suite : public TestCommand } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -118276,15 +50135,20 @@ class Test_TC_BR_2Suite : public TestCommand } } - // - // Tests methods - // + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + } + return CHIP_NO_ERROR; + } }; -class Test_TC_BR_3Suite : public TestCommand +class Test_TC_BDX_2_3Suite : public TestCommand { public: - Test_TC_BR_3Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_BR_3", credsIssuerConfig), mTestIndex(0) + Test_TC_BDX_2_3Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_BDX_2_3", 0, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -118292,41 +50156,7 @@ class Test_TC_BR_3Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_BR_3Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_BR_3\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_BR_3\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } + ~Test_TC_BDX_2_3Suite() {} chip::System::Clock::Timeout GetWaitDuration() const override { @@ -118334,14 +50164,17 @@ class Test_TC_BR_3Suite : public TestCommand } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -118358,16 +50191,20 @@ class Test_TC_BR_3Suite : public TestCommand } } - // - // Tests methods - // + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + } + return CHIP_NO_ERROR; + } }; -class Test_TC_BRAC_2_1Suite : public TestCommand +class Test_TC_BDX_2_4Suite : public TestCommand { public: - Test_TC_BRAC_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_BRAC_2_1", credsIssuerConfig), mTestIndex(0) + Test_TC_BDX_2_4Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_BDX_2_4", 0, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -118375,41 +50212,7 @@ class Test_TC_BRAC_2_1Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_BRAC_2_1Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_BRAC_2_1\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_BRAC_2_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } + ~Test_TC_BDX_2_4Suite() {} chip::System::Clock::Timeout GetWaitDuration() const override { @@ -118417,14 +50220,17 @@ class Test_TC_BRAC_2_1Suite : public TestCommand } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -118441,16 +50247,20 @@ class Test_TC_BRAC_2_1Suite : public TestCommand } } - // - // Tests methods - // + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + } + return CHIP_NO_ERROR; + } }; -class Test_TC_BRAC_2_2Suite : public TestCommand +class Test_TC_BDX_2_5Suite : public TestCommand { public: - Test_TC_BRAC_2_2Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_BRAC_2_2", credsIssuerConfig), mTestIndex(0) + Test_TC_BDX_2_5Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_BDX_2_5", 0, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -118458,41 +50268,7 @@ class Test_TC_BRAC_2_2Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_BRAC_2_2Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_BRAC_2_2\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_BRAC_2_2\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } + ~Test_TC_BDX_2_5Suite() {} chip::System::Clock::Timeout GetWaitDuration() const override { @@ -118500,14 +50276,17 @@ class Test_TC_BRAC_2_2Suite : public TestCommand } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -118524,16 +50303,20 @@ class Test_TC_BRAC_2_2Suite : public TestCommand } } - // - // Tests methods - // + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + } + return CHIP_NO_ERROR; + } }; -class Test_TC_DM_1_2Suite : public TestCommand +class Test_TC_BR_1Suite : public TestCommand { public: - Test_TC_DM_1_2Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_DM_1_2", credsIssuerConfig), mTestIndex(0) + Test_TC_BR_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_BR_1", 0, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -118541,41 +50324,7 @@ class Test_TC_DM_1_2Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_DM_1_2Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_DM_1_2\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_DM_1_2\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } + ~Test_TC_BR_1Suite() {} chip::System::Clock::Timeout GetWaitDuration() const override { @@ -118583,14 +50332,17 @@ class Test_TC_DM_1_2Suite : public TestCommand } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -118607,16 +50359,20 @@ class Test_TC_DM_1_2Suite : public TestCommand } } - // - // Tests methods - // + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + } + return CHIP_NO_ERROR; + } }; -class Test_TC_DM_1_4Suite : public TestCommand +class Test_TC_BR_2Suite : public TestCommand { public: - Test_TC_DM_1_4Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_DM_1_4", credsIssuerConfig), mTestIndex(0) + Test_TC_BR_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_BR_2", 0, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -118624,41 +50380,7 @@ class Test_TC_DM_1_4Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_DM_1_4Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_DM_1_4\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_DM_1_4\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } + ~Test_TC_BR_2Suite() {} chip::System::Clock::Timeout GetWaitDuration() const override { @@ -118666,14 +50388,17 @@ class Test_TC_DM_1_4Suite : public TestCommand } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -118690,16 +50415,20 @@ class Test_TC_DM_1_4Suite : public TestCommand } } - // - // Tests methods - // + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + } + return CHIP_NO_ERROR; + } }; -class Test_TC_DM_2_3Suite : public TestCommand +class Test_TC_BR_3Suite : public TestCommand { public: - Test_TC_DM_2_3Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_DM_2_3", credsIssuerConfig), mTestIndex(0) + Test_TC_BR_3Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_BR_3", 0, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -118707,41 +50436,7 @@ class Test_TC_DM_2_3Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_DM_2_3Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_DM_2_3\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_DM_2_3\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } + ~Test_TC_BR_3Suite() {} chip::System::Clock::Timeout GetWaitDuration() const override { @@ -118749,14 +50444,17 @@ class Test_TC_DM_2_3Suite : public TestCommand } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -118773,16 +50471,20 @@ class Test_TC_DM_2_3Suite : public TestCommand } } - // - // Tests methods - // + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + } + return CHIP_NO_ERROR; + } }; -class Test_TC_DM_2_4Suite : public TestCommand +class Test_TC_BRAC_2_1Suite : public TestCommand { public: - Test_TC_DM_2_4Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_DM_2_4", credsIssuerConfig), mTestIndex(0) + Test_TC_BRAC_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_BRAC_2_1", 0, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -118790,41 +50492,7 @@ class Test_TC_DM_2_4Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_DM_2_4Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_DM_2_4\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_DM_2_4\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } + ~Test_TC_BRAC_2_1Suite() {} chip::System::Clock::Timeout GetWaitDuration() const override { @@ -118832,14 +50500,17 @@ class Test_TC_DM_2_4Suite : public TestCommand } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -118856,16 +50527,20 @@ class Test_TC_DM_2_4Suite : public TestCommand } } - // - // Tests methods - // + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + } + return CHIP_NO_ERROR; + } }; -class Test_TC_DM_3_2Suite : public TestCommand +class Test_TC_BRAC_2_2Suite : public TestCommand { public: - Test_TC_DM_3_2Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_DM_3_2", credsIssuerConfig), mTestIndex(0) + Test_TC_BRAC_2_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_BRAC_2_2", 0, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -118873,41 +50548,7 @@ class Test_TC_DM_3_2Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_DM_3_2Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_DM_3_2\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_DM_3_2\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } + ~Test_TC_BRAC_2_2Suite() {} chip::System::Clock::Timeout GetWaitDuration() const override { @@ -118915,14 +50556,17 @@ class Test_TC_DM_3_2Suite : public TestCommand } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -118939,16 +50583,20 @@ class Test_TC_DM_3_2Suite : public TestCommand } } - // - // Tests methods - // + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + } + return CHIP_NO_ERROR; + } }; -class Test_TC_DM_3_4Suite : public TestCommand +class Test_TC_DM_1_2Suite : public TestCommand { public: - Test_TC_DM_3_4Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_DM_3_4", credsIssuerConfig), mTestIndex(0) + Test_TC_DM_1_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_DM_1_2", 0, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -118956,41 +50604,7 @@ class Test_TC_DM_3_4Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_DM_3_4Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_DM_3_4\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_DM_3_4\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } + ~Test_TC_DM_1_2Suite() {} chip::System::Clock::Timeout GetWaitDuration() const override { @@ -118998,14 +50612,17 @@ class Test_TC_DM_3_4Suite : public TestCommand } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -119022,16 +50639,20 @@ class Test_TC_DM_3_4Suite : public TestCommand } } - // - // Tests methods - // + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + } + return CHIP_NO_ERROR; + } }; -class Test_TC_DIAG_LOG_1_1Suite : public TestCommand +class Test_TC_DM_1_4Suite : public TestCommand { public: - Test_TC_DIAG_LOG_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_DIAG_LOG_1_1", credsIssuerConfig), mTestIndex(0) + Test_TC_DM_1_4Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_DM_1_4", 0, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -119039,41 +50660,7 @@ class Test_TC_DIAG_LOG_1_1Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_DIAG_LOG_1_1Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_DIAG_LOG_1_1\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_DIAG_LOG_1_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } + ~Test_TC_DM_1_4Suite() {} chip::System::Clock::Timeout GetWaitDuration() const override { @@ -119081,14 +50668,17 @@ class Test_TC_DIAG_LOG_1_1Suite : public TestCommand } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -119105,16 +50695,20 @@ class Test_TC_DIAG_LOG_1_1Suite : public TestCommand } } - // - // Tests methods - // + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + } + return CHIP_NO_ERROR; + } }; -class Test_TC_DIAG_LOG_1_2Suite : public TestCommand +class Test_TC_DM_2_3Suite : public TestCommand { public: - Test_TC_DIAG_LOG_1_2Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_DIAG_LOG_1_2", credsIssuerConfig), mTestIndex(0) + Test_TC_DM_2_3Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_DM_2_3", 0, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -119122,41 +50716,7 @@ class Test_TC_DIAG_LOG_1_2Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_DIAG_LOG_1_2Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_DIAG_LOG_1_2\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_DIAG_LOG_1_2\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } + ~Test_TC_DM_2_3Suite() {} chip::System::Clock::Timeout GetWaitDuration() const override { @@ -119164,14 +50724,17 @@ class Test_TC_DIAG_LOG_1_2Suite : public TestCommand } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -119188,16 +50751,20 @@ class Test_TC_DIAG_LOG_1_2Suite : public TestCommand } } - // - // Tests methods - // + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + } + return CHIP_NO_ERROR; + } }; -class Test_TC_DIAG_LOG_1_3Suite : public TestCommand +class Test_TC_DM_2_4Suite : public TestCommand { public: - Test_TC_DIAG_LOG_1_3Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_DIAG_LOG_1_3", credsIssuerConfig), mTestIndex(0) + Test_TC_DM_2_4Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_DM_2_4", 0, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -119205,41 +50772,7 @@ class Test_TC_DIAG_LOG_1_3Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_DIAG_LOG_1_3Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_DIAG_LOG_1_3\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_DIAG_LOG_1_3\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } + ~Test_TC_DM_2_4Suite() {} chip::System::Clock::Timeout GetWaitDuration() const override { @@ -119247,14 +50780,17 @@ class Test_TC_DIAG_LOG_1_3Suite : public TestCommand } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -119271,16 +50807,20 @@ class Test_TC_DIAG_LOG_1_3Suite : public TestCommand } } - // - // Tests methods - // + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + } + return CHIP_NO_ERROR; + } }; -class Test_TC_DESC_1_1Suite : public TestCommand +class Test_TC_DM_3_2Suite : public TestCommand { public: - Test_TC_DESC_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_DESC_1_1", credsIssuerConfig), mTestIndex(0) + Test_TC_DM_3_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_DM_3_2", 0, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -119288,41 +50828,7 @@ class Test_TC_DESC_1_1Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_DESC_1_1Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_DESC_1_1\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_DESC_1_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } + ~Test_TC_DM_3_2Suite() {} chip::System::Clock::Timeout GetWaitDuration() const override { @@ -119330,14 +50836,17 @@ class Test_TC_DESC_1_1Suite : public TestCommand } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -119354,16 +50863,20 @@ class Test_TC_DESC_1_1Suite : public TestCommand } } - // - // Tests methods - // + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + } + return CHIP_NO_ERROR; + } }; -class Test_TC_ETHDIAG_1_2Suite : public TestCommand +class Test_TC_DM_3_4Suite : public TestCommand { public: - Test_TC_ETHDIAG_1_2Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_ETHDIAG_1_2", credsIssuerConfig), mTestIndex(0) + Test_TC_DM_3_4Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_DM_3_4", 0, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -119371,41 +50884,7 @@ class Test_TC_ETHDIAG_1_2Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_ETHDIAG_1_2Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_ETHDIAG_1_2\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_ETHDIAG_1_2\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } + ~Test_TC_DM_3_4Suite() {} chip::System::Clock::Timeout GetWaitDuration() const override { @@ -119413,14 +50892,17 @@ class Test_TC_ETHDIAG_1_2Suite : public TestCommand } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -119437,16 +50919,21 @@ class Test_TC_ETHDIAG_1_2Suite : public TestCommand } } - // - // Tests methods - // + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + } + return CHIP_NO_ERROR; + } }; -class Test_TC_GC_1_2Suite : public TestCommand +class Test_TC_DIAG_LOG_1_1Suite : public TestCommand { public: - Test_TC_GC_1_2Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_GC_1_2", credsIssuerConfig), mTestIndex(0) + Test_TC_DIAG_LOG_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("Test_TC_DIAG_LOG_1_1", 0, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -119454,41 +50941,7 @@ class Test_TC_GC_1_2Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_GC_1_2Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_GC_1_2\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_GC_1_2\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } + ~Test_TC_DIAG_LOG_1_1Suite() {} chip::System::Clock::Timeout GetWaitDuration() const override { @@ -119496,14 +50949,17 @@ class Test_TC_GC_1_2Suite : public TestCommand } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -119520,16 +50976,21 @@ class Test_TC_GC_1_2Suite : public TestCommand } } - // - // Tests methods - // + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + } + return CHIP_NO_ERROR; + } }; -class Test_TC_GC_1_3Suite : public TestCommand +class Test_TC_DIAG_LOG_1_2Suite : public TestCommand { public: - Test_TC_GC_1_3Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_GC_1_3", credsIssuerConfig), mTestIndex(0) + Test_TC_DIAG_LOG_1_2Suite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("Test_TC_DIAG_LOG_1_2", 0, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -119537,41 +50998,7 @@ class Test_TC_GC_1_3Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_GC_1_3Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_GC_1_3\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_GC_1_3\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } + ~Test_TC_DIAG_LOG_1_2Suite() {} chip::System::Clock::Timeout GetWaitDuration() const override { @@ -119579,14 +51006,17 @@ class Test_TC_GC_1_3Suite : public TestCommand } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -119603,16 +51033,21 @@ class Test_TC_GC_1_3Suite : public TestCommand } } - // - // Tests methods - // + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + } + return CHIP_NO_ERROR; + } }; -class Test_TC_GENDIAG_1_1Suite : public TestCommand +class Test_TC_DIAG_LOG_1_3Suite : public TestCommand { public: - Test_TC_GENDIAG_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_GENDIAG_1_1", credsIssuerConfig), mTestIndex(0) + Test_TC_DIAG_LOG_1_3Suite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("Test_TC_DIAG_LOG_1_3", 0, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -119620,41 +51055,7 @@ class Test_TC_GENDIAG_1_1Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_GENDIAG_1_1Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_GENDIAG_1_1\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_GENDIAG_1_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } + ~Test_TC_DIAG_LOG_1_3Suite() {} chip::System::Clock::Timeout GetWaitDuration() const override { @@ -119662,14 +51063,17 @@ class Test_TC_GENDIAG_1_1Suite : public TestCommand } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -119686,16 +51090,20 @@ class Test_TC_GENDIAG_1_1Suite : public TestCommand } } - // - // Tests methods - // + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + } + return CHIP_NO_ERROR; + } }; -class Test_TC_GENDIAG_1_2Suite : public TestCommand +class Test_TC_DESC_1_1Suite : public TestCommand { public: - Test_TC_GENDIAG_1_2Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_GENDIAG_1_2", credsIssuerConfig), mTestIndex(0) + Test_TC_DESC_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_DESC_1_1", 0, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -119703,41 +51111,7 @@ class Test_TC_GENDIAG_1_2Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_GENDIAG_1_2Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_GENDIAG_1_2\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_GENDIAG_1_2\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } + ~Test_TC_DESC_1_1Suite() {} chip::System::Clock::Timeout GetWaitDuration() const override { @@ -119745,14 +51119,17 @@ class Test_TC_GENDIAG_1_2Suite : public TestCommand } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -119769,16 +51146,21 @@ class Test_TC_GENDIAG_1_2Suite : public TestCommand } } - // - // Tests methods - // + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + } + return CHIP_NO_ERROR; + } }; -class Test_TC_GENDIAG_2_1Suite : public TestCommand +class Test_TC_ETHDIAG_1_2Suite : public TestCommand { public: - Test_TC_GENDIAG_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_GENDIAG_2_1", credsIssuerConfig), mTestIndex(0) + Test_TC_ETHDIAG_1_2Suite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("Test_TC_ETHDIAG_1_2", 0, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -119786,41 +51168,7 @@ class Test_TC_GENDIAG_2_1Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_GENDIAG_2_1Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_GENDIAG_2_1\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_GENDIAG_2_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } + ~Test_TC_ETHDIAG_1_2Suite() {} chip::System::Clock::Timeout GetWaitDuration() const override { @@ -119828,14 +51176,17 @@ class Test_TC_GENDIAG_2_1Suite : public TestCommand } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -119852,16 +51203,20 @@ class Test_TC_GENDIAG_2_1Suite : public TestCommand } } - // - // Tests methods - // + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + } + return CHIP_NO_ERROR; + } }; -class Test_TC_I_2_2Suite : public TestCommand +class Test_TC_GC_1_2Suite : public TestCommand { public: - Test_TC_I_2_2Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_I_2_2", credsIssuerConfig), mTestIndex(0) + Test_TC_GC_1_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_GC_1_2", 0, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -119869,41 +51224,7 @@ class Test_TC_I_2_2Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_I_2_2Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_I_2_2\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_I_2_2\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } + ~Test_TC_GC_1_2Suite() {} chip::System::Clock::Timeout GetWaitDuration() const override { @@ -119911,14 +51232,17 @@ class Test_TC_I_2_2Suite : public TestCommand } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -119935,16 +51259,20 @@ class Test_TC_I_2_2Suite : public TestCommand } } - // - // Tests methods - // + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + } + return CHIP_NO_ERROR; + } }; -class Test_TC_ILL_2_2Suite : public TestCommand +class Test_TC_GC_1_3Suite : public TestCommand { public: - Test_TC_ILL_2_2Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_ILL_2_2", credsIssuerConfig), mTestIndex(0) + Test_TC_GC_1_3Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_GC_1_3", 0, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -119952,41 +51280,7 @@ class Test_TC_ILL_2_2Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_ILL_2_2Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_ILL_2_2\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_ILL_2_2\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } + ~Test_TC_GC_1_3Suite() {} chip::System::Clock::Timeout GetWaitDuration() const override { @@ -119994,14 +51288,17 @@ class Test_TC_ILL_2_2Suite : public TestCommand } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -120018,16 +51315,21 @@ class Test_TC_ILL_2_2Suite : public TestCommand } } - // - // Tests methods - // + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + } + return CHIP_NO_ERROR; + } }; -class Test_TC_IDM_1_1Suite : public TestCommand +class Test_TC_GENDIAG_1_1Suite : public TestCommand { public: - Test_TC_IDM_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_IDM_1_1", credsIssuerConfig), mTestIndex(0) + Test_TC_GENDIAG_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("Test_TC_GENDIAG_1_1", 0, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -120035,41 +51337,7 @@ class Test_TC_IDM_1_1Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_IDM_1_1Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_IDM_1_1\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_IDM_1_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } + ~Test_TC_GENDIAG_1_1Suite() {} chip::System::Clock::Timeout GetWaitDuration() const override { @@ -120077,14 +51345,17 @@ class Test_TC_IDM_1_1Suite : public TestCommand } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -120101,16 +51372,21 @@ class Test_TC_IDM_1_1Suite : public TestCommand } } - // - // Tests methods - // + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + } + return CHIP_NO_ERROR; + } }; -class Test_TC_IDM_1_2Suite : public TestCommand +class Test_TC_GENDIAG_1_2Suite : public TestCommand { public: - Test_TC_IDM_1_2Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_IDM_1_2", credsIssuerConfig), mTestIndex(0) + Test_TC_GENDIAG_1_2Suite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("Test_TC_GENDIAG_1_2", 0, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -120118,41 +51394,7 @@ class Test_TC_IDM_1_2Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_IDM_1_2Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_IDM_1_2\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_IDM_1_2\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } + ~Test_TC_GENDIAG_1_2Suite() {} chip::System::Clock::Timeout GetWaitDuration() const override { @@ -120160,14 +51402,17 @@ class Test_TC_IDM_1_2Suite : public TestCommand } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -120184,16 +51429,21 @@ class Test_TC_IDM_1_2Suite : public TestCommand } } - // - // Tests methods - // + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + } + return CHIP_NO_ERROR; + } }; -class Test_TC_IDM_2_1Suite : public TestCommand +class Test_TC_GENDIAG_2_1Suite : public TestCommand { public: - Test_TC_IDM_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_IDM_2_1", credsIssuerConfig), mTestIndex(0) + Test_TC_GENDIAG_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("Test_TC_GENDIAG_2_1", 0, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -120201,41 +51451,7 @@ class Test_TC_IDM_2_1Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_IDM_2_1Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_IDM_2_1\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_IDM_2_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } + ~Test_TC_GENDIAG_2_1Suite() {} chip::System::Clock::Timeout GetWaitDuration() const override { @@ -120243,14 +51459,17 @@ class Test_TC_IDM_2_1Suite : public TestCommand } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -120267,16 +51486,20 @@ class Test_TC_IDM_2_1Suite : public TestCommand } } - // - // Tests methods - // + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + } + return CHIP_NO_ERROR; + } }; -class Test_TC_IDM_2_2Suite : public TestCommand +class Test_TC_I_2_2Suite : public TestCommand { public: - Test_TC_IDM_2_2Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_IDM_2_2", credsIssuerConfig), mTestIndex(0) + Test_TC_I_2_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_I_2_2", 0, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -120284,41 +51507,7 @@ class Test_TC_IDM_2_2Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_IDM_2_2Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_IDM_2_2\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_IDM_2_2\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } + ~Test_TC_I_2_2Suite() {} chip::System::Clock::Timeout GetWaitDuration() const override { @@ -120326,14 +51515,17 @@ class Test_TC_IDM_2_2Suite : public TestCommand } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -120350,16 +51542,20 @@ class Test_TC_IDM_2_2Suite : public TestCommand } } - // - // Tests methods - // + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + } + return CHIP_NO_ERROR; + } }; -class Test_TC_IDM_3_1Suite : public TestCommand +class Test_TC_ILL_2_2Suite : public TestCommand { public: - Test_TC_IDM_3_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_IDM_3_1", credsIssuerConfig), mTestIndex(0) + Test_TC_ILL_2_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_ILL_2_2", 0, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -120367,41 +51563,7 @@ class Test_TC_IDM_3_1Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_IDM_3_1Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_IDM_3_1\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_IDM_3_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } + ~Test_TC_ILL_2_2Suite() {} chip::System::Clock::Timeout GetWaitDuration() const override { @@ -120409,14 +51571,17 @@ class Test_TC_IDM_3_1Suite : public TestCommand } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -120433,16 +51598,20 @@ class Test_TC_IDM_3_1Suite : public TestCommand } } - // - // Tests methods - // + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + } + return CHIP_NO_ERROR; + } }; -class Test_TC_IDM_3_2Suite : public TestCommand +class Test_TC_IDM_1_1Suite : public TestCommand { public: - Test_TC_IDM_3_2Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_IDM_3_2", credsIssuerConfig), mTestIndex(0) + Test_TC_IDM_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_IDM_1_1", 0, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -120450,41 +51619,7 @@ class Test_TC_IDM_3_2Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_IDM_3_2Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_IDM_3_2\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_IDM_3_2\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } + ~Test_TC_IDM_1_1Suite() {} chip::System::Clock::Timeout GetWaitDuration() const override { @@ -120492,14 +51627,17 @@ class Test_TC_IDM_3_2Suite : public TestCommand } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -120516,16 +51654,20 @@ class Test_TC_IDM_3_2Suite : public TestCommand } } - // - // Tests methods - // + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + } + return CHIP_NO_ERROR; + } }; -class Test_TC_IDM_4_1Suite : public TestCommand +class Test_TC_IDM_1_2Suite : public TestCommand { public: - Test_TC_IDM_4_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_IDM_4_1", credsIssuerConfig), mTestIndex(0) + Test_TC_IDM_1_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_IDM_1_2", 0, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -120533,41 +51675,7 @@ class Test_TC_IDM_4_1Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_IDM_4_1Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_IDM_4_1\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_IDM_4_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } + ~Test_TC_IDM_1_2Suite() {} chip::System::Clock::Timeout GetWaitDuration() const override { @@ -120575,14 +51683,17 @@ class Test_TC_IDM_4_1Suite : public TestCommand } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -120599,16 +51710,20 @@ class Test_TC_IDM_4_1Suite : public TestCommand } } - // - // Tests methods - // + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + } + return CHIP_NO_ERROR; + } }; -class Test_TC_IDM_4_2Suite : public TestCommand +class Test_TC_IDM_2_1Suite : public TestCommand { public: - Test_TC_IDM_4_2Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_IDM_4_2", credsIssuerConfig), mTestIndex(0) + Test_TC_IDM_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_IDM_2_1", 0, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -120616,41 +51731,7 @@ class Test_TC_IDM_4_2Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_IDM_4_2Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_IDM_4_2\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_IDM_4_2\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } + ~Test_TC_IDM_2_1Suite() {} chip::System::Clock::Timeout GetWaitDuration() const override { @@ -120658,14 +51739,17 @@ class Test_TC_IDM_4_2Suite : public TestCommand } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -120682,16 +51766,20 @@ class Test_TC_IDM_4_2Suite : public TestCommand } } - // - // Tests methods - // + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + } + return CHIP_NO_ERROR; + } }; -class Test_TC_IDM_5_1Suite : public TestCommand +class Test_TC_IDM_2_2Suite : public TestCommand { public: - Test_TC_IDM_5_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_IDM_5_1", credsIssuerConfig), mTestIndex(0) + Test_TC_IDM_2_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_IDM_2_2", 0, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -120699,41 +51787,7 @@ class Test_TC_IDM_5_1Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_IDM_5_1Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_IDM_5_1\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_IDM_5_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } + ~Test_TC_IDM_2_2Suite() {} chip::System::Clock::Timeout GetWaitDuration() const override { @@ -120741,14 +51795,17 @@ class Test_TC_IDM_5_1Suite : public TestCommand } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -120765,16 +51822,20 @@ class Test_TC_IDM_5_1Suite : public TestCommand } } - // - // Tests methods - // + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + } + return CHIP_NO_ERROR; + } }; -class Test_TC_IDM_5_2Suite : public TestCommand +class Test_TC_IDM_3_1Suite : public TestCommand { public: - Test_TC_IDM_5_2Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_IDM_5_2", credsIssuerConfig), mTestIndex(0) + Test_TC_IDM_3_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_IDM_3_1", 0, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -120782,41 +51843,7 @@ class Test_TC_IDM_5_2Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_IDM_5_2Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_IDM_5_2\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_IDM_5_2\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } + ~Test_TC_IDM_3_1Suite() {} chip::System::Clock::Timeout GetWaitDuration() const override { @@ -120824,14 +51851,17 @@ class Test_TC_IDM_5_2Suite : public TestCommand } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -120848,16 +51878,20 @@ class Test_TC_IDM_5_2Suite : public TestCommand } } - // - // Tests methods - // + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + } + return CHIP_NO_ERROR; + } }; -class Test_TC_IDM_6_1Suite : public TestCommand +class Test_TC_IDM_3_2Suite : public TestCommand { public: - Test_TC_IDM_6_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_IDM_6_1", credsIssuerConfig), mTestIndex(0) + Test_TC_IDM_3_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_IDM_3_2", 0, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -120865,41 +51899,7 @@ class Test_TC_IDM_6_1Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_IDM_6_1Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_IDM_6_1\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_IDM_6_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } + ~Test_TC_IDM_3_2Suite() {} chip::System::Clock::Timeout GetWaitDuration() const override { @@ -120907,14 +51907,17 @@ class Test_TC_IDM_6_1Suite : public TestCommand } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -120931,16 +51934,20 @@ class Test_TC_IDM_6_1Suite : public TestCommand } } - // - // Tests methods - // + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + } + return CHIP_NO_ERROR; + } }; -class Test_TC_IDM_6_2Suite : public TestCommand +class Test_TC_IDM_4_1Suite : public TestCommand { public: - Test_TC_IDM_6_2Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_IDM_6_2", credsIssuerConfig), mTestIndex(0) + Test_TC_IDM_4_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_IDM_4_1", 0, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -120948,41 +51955,7 @@ class Test_TC_IDM_6_2Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_IDM_6_2Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_IDM_6_2\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_IDM_6_2\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } + ~Test_TC_IDM_4_1Suite() {} chip::System::Clock::Timeout GetWaitDuration() const override { @@ -120990,14 +51963,17 @@ class Test_TC_IDM_6_2Suite : public TestCommand } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -121014,16 +51990,20 @@ class Test_TC_IDM_6_2Suite : public TestCommand } } - // - // Tests methods - // + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + } + return CHIP_NO_ERROR; + } }; -class Test_TC_IDM_6_3Suite : public TestCommand +class Test_TC_IDM_4_2Suite : public TestCommand { public: - Test_TC_IDM_6_3Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_IDM_6_3", credsIssuerConfig), mTestIndex(0) + Test_TC_IDM_4_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_IDM_4_2", 0, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -121031,41 +52011,7 @@ class Test_TC_IDM_6_3Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_IDM_6_3Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_IDM_6_3\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_IDM_6_3\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } + ~Test_TC_IDM_4_2Suite() {} chip::System::Clock::Timeout GetWaitDuration() const override { @@ -121073,14 +52019,17 @@ class Test_TC_IDM_6_3Suite : public TestCommand } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -121097,16 +52046,20 @@ class Test_TC_IDM_6_3Suite : public TestCommand } } - // - // Tests methods - // + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + } + return CHIP_NO_ERROR; + } }; -class Test_TC_IDM_6_4Suite : public TestCommand +class Test_TC_IDM_5_1Suite : public TestCommand { public: - Test_TC_IDM_6_4Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_IDM_6_4", credsIssuerConfig), mTestIndex(0) + Test_TC_IDM_5_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_IDM_5_1", 0, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -121114,41 +52067,7 @@ class Test_TC_IDM_6_4Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_IDM_6_4Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_IDM_6_4\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_IDM_6_4\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } + ~Test_TC_IDM_5_1Suite() {} chip::System::Clock::Timeout GetWaitDuration() const override { @@ -121156,14 +52075,17 @@ class Test_TC_IDM_6_4Suite : public TestCommand } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -121180,16 +52102,20 @@ class Test_TC_IDM_6_4Suite : public TestCommand } } - // - // Tests methods - // + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + } + return CHIP_NO_ERROR; + } }; -class Test_TC_MC_3_12Suite : public TestCommand +class Test_TC_IDM_5_2Suite : public TestCommand { public: - Test_TC_MC_3_12Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_MC_3_12", credsIssuerConfig), mTestIndex(0) + Test_TC_IDM_5_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_IDM_5_2", 0, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -121197,41 +52123,7 @@ class Test_TC_MC_3_12Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_MC_3_12Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_3_12\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_3_12\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } + ~Test_TC_IDM_5_2Suite() {} chip::System::Clock::Timeout GetWaitDuration() const override { @@ -121239,14 +52131,17 @@ class Test_TC_MC_3_12Suite : public TestCommand } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -121263,16 +52158,20 @@ class Test_TC_MC_3_12Suite : public TestCommand } } - // - // Tests methods - // + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + } + return CHIP_NO_ERROR; + } }; -class Test_TC_MC_3_13Suite : public TestCommand +class Test_TC_IDM_6_1Suite : public TestCommand { public: - Test_TC_MC_3_13Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_MC_3_13", credsIssuerConfig), mTestIndex(0) + Test_TC_IDM_6_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_IDM_6_1", 0, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -121280,41 +52179,7 @@ class Test_TC_MC_3_13Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_MC_3_13Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_3_13\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_3_13\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } + ~Test_TC_IDM_6_1Suite() {} chip::System::Clock::Timeout GetWaitDuration() const override { @@ -121322,14 +52187,17 @@ class Test_TC_MC_3_13Suite : public TestCommand } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -121346,73 +52214,46 @@ class Test_TC_MC_3_13Suite : public TestCommand } } - // - // Tests methods - // + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + } + return CHIP_NO_ERROR; + } }; -class Test_TC_MC_4_1Suite : public TestCommand +class Test_TC_IDM_6_2Suite : public TestCommand { public: - Test_TC_MC_4_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_MC_4_1", credsIssuerConfig), mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_MC_4_1Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override + Test_TC_IDM_6_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_IDM_6_2", 0, credsIssuerConfig) { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_4_1\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_4_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } + ~Test_TC_IDM_6_2Suite() {} + chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -121429,16 +52270,20 @@ class Test_TC_MC_4_1Suite : public TestCommand } } - // - // Tests methods - // + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + } + return CHIP_NO_ERROR; + } }; -class Test_TC_MC_8_2Suite : public TestCommand +class Test_TC_IDM_6_3Suite : public TestCommand { public: - Test_TC_MC_8_2Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_MC_8_2", credsIssuerConfig), mTestIndex(0) + Test_TC_IDM_6_3Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_IDM_6_3", 0, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -121446,41 +52291,7 @@ class Test_TC_MC_8_2Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_MC_8_2Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_8_2\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_8_2\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } + ~Test_TC_IDM_6_3Suite() {} chip::System::Clock::Timeout GetWaitDuration() const override { @@ -121488,14 +52299,17 @@ class Test_TC_MC_8_2Suite : public TestCommand } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -121512,16 +52326,20 @@ class Test_TC_MC_8_2Suite : public TestCommand } } - // - // Tests methods - // + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + } + return CHIP_NO_ERROR; + } }; -class Test_TC_MC_9_2Suite : public TestCommand +class Test_TC_IDM_6_4Suite : public TestCommand { public: - Test_TC_MC_9_2Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_MC_9_2", credsIssuerConfig), mTestIndex(0) + Test_TC_IDM_6_4Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_IDM_6_4", 0, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -121529,41 +52347,7 @@ class Test_TC_MC_9_2Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_MC_9_2Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_9_2\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_9_2\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } + ~Test_TC_IDM_6_4Suite() {} chip::System::Clock::Timeout GetWaitDuration() const override { @@ -121571,14 +52355,17 @@ class Test_TC_MC_9_2Suite : public TestCommand } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -121595,16 +52382,20 @@ class Test_TC_MC_9_2Suite : public TestCommand } } - // - // Tests methods - // + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + } + return CHIP_NO_ERROR; + } }; -class Test_TC_MC_10_2Suite : public TestCommand +class Test_TC_MC_3_12Suite : public TestCommand { public: - Test_TC_MC_10_2Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_MC_10_2", credsIssuerConfig), mTestIndex(0) + Test_TC_MC_3_12Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_MC_3_12", 0, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -121612,41 +52403,7 @@ class Test_TC_MC_10_2Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_MC_10_2Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_10_2\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_10_2\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } + ~Test_TC_MC_3_12Suite() {} chip::System::Clock::Timeout GetWaitDuration() const override { @@ -121654,14 +52411,17 @@ class Test_TC_MC_10_2Suite : public TestCommand } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -121678,16 +52438,20 @@ class Test_TC_MC_10_2Suite : public TestCommand } } - // - // Tests methods - // + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + } + return CHIP_NO_ERROR; + } }; -class Test_TC_MC_10_3Suite : public TestCommand +class Test_TC_MC_3_13Suite : public TestCommand { public: - Test_TC_MC_10_3Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_MC_10_3", credsIssuerConfig), mTestIndex(0) + Test_TC_MC_3_13Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_MC_3_13", 0, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -121695,41 +52459,7 @@ class Test_TC_MC_10_3Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_MC_10_3Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_10_3\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_10_3\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } + ~Test_TC_MC_3_13Suite() {} chip::System::Clock::Timeout GetWaitDuration() const override { @@ -121737,14 +52467,17 @@ class Test_TC_MC_10_3Suite : public TestCommand } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -121761,16 +52494,20 @@ class Test_TC_MC_10_3Suite : public TestCommand } } - // - // Tests methods - // + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + } + return CHIP_NO_ERROR; + } }; -class Test_TC_MC_10_4Suite : public TestCommand +class Test_TC_MC_4_1Suite : public TestCommand { public: - Test_TC_MC_10_4Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_MC_10_4", credsIssuerConfig), mTestIndex(0) + Test_TC_MC_4_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_MC_4_1", 0, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -121778,41 +52515,7 @@ class Test_TC_MC_10_4Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_MC_10_4Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_10_4\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_10_4\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } + ~Test_TC_MC_4_1Suite() {} chip::System::Clock::Timeout GetWaitDuration() const override { @@ -121820,14 +52523,17 @@ class Test_TC_MC_10_4Suite : public TestCommand } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -121844,16 +52550,20 @@ class Test_TC_MC_10_4Suite : public TestCommand } } - // - // Tests methods - // + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + } + return CHIP_NO_ERROR; + } }; -class Test_TC_MC_10_5Suite : public TestCommand +class Test_TC_MC_8_2Suite : public TestCommand { public: - Test_TC_MC_10_5Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_MC_10_5", credsIssuerConfig), mTestIndex(0) + Test_TC_MC_8_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_MC_8_2", 0, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -121861,41 +52571,7 @@ class Test_TC_MC_10_5Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_MC_10_5Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_10_5\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_10_5\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } + ~Test_TC_MC_8_2Suite() {} chip::System::Clock::Timeout GetWaitDuration() const override { @@ -121903,14 +52579,17 @@ class Test_TC_MC_10_5Suite : public TestCommand } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -121927,16 +52606,20 @@ class Test_TC_MC_10_5Suite : public TestCommand } } - // - // Tests methods - // + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + } + return CHIP_NO_ERROR; + } }; -class Test_TC_MC_10_6Suite : public TestCommand +class Test_TC_MC_9_2Suite : public TestCommand { public: - Test_TC_MC_10_6Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_MC_10_6", credsIssuerConfig), mTestIndex(0) + Test_TC_MC_9_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_MC_9_2", 0, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -121944,41 +52627,7 @@ class Test_TC_MC_10_6Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_MC_10_6Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_10_6\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_10_6\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } + ~Test_TC_MC_9_2Suite() {} chip::System::Clock::Timeout GetWaitDuration() const override { @@ -121986,14 +52635,17 @@ class Test_TC_MC_10_6Suite : public TestCommand } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -122010,16 +52662,20 @@ class Test_TC_MC_10_6Suite : public TestCommand } } - // - // Tests methods - // + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + } + return CHIP_NO_ERROR; + } }; -class Test_TC_MF_1_1Suite : public TestCommand +class Test_TC_MC_10_2Suite : public TestCommand { public: - Test_TC_MF_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_MF_1_1", credsIssuerConfig), mTestIndex(0) + Test_TC_MC_10_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_MC_10_2", 0, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -122027,41 +52683,7 @@ class Test_TC_MF_1_1Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_MF_1_1Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MF_1_1\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MF_1_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } + ~Test_TC_MC_10_2Suite() {} chip::System::Clock::Timeout GetWaitDuration() const override { @@ -122069,14 +52691,17 @@ class Test_TC_MF_1_1Suite : public TestCommand } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -122093,16 +52718,20 @@ class Test_TC_MF_1_1Suite : public TestCommand } } - // - // Tests methods - // + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + } + return CHIP_NO_ERROR; + } }; -class Test_TC_MF_1_2Suite : public TestCommand +class Test_TC_MC_10_3Suite : public TestCommand { public: - Test_TC_MF_1_2Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_MF_1_2", credsIssuerConfig), mTestIndex(0) + Test_TC_MC_10_3Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_MC_10_3", 0, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -122110,41 +52739,7 @@ class Test_TC_MF_1_2Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_MF_1_2Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MF_1_2\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MF_1_2\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } + ~Test_TC_MC_10_3Suite() {} chip::System::Clock::Timeout GetWaitDuration() const override { @@ -122152,14 +52747,17 @@ class Test_TC_MF_1_2Suite : public TestCommand } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -122176,132 +52774,28 @@ class Test_TC_MF_1_2Suite : public TestCommand } } - // - // Tests methods - // + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + } + return CHIP_NO_ERROR; + } }; -class Test_TC_MF_1_3Suite : public TestCommand +class Test_TC_MC_10_4Suite : public TestCommand { public: - Test_TC_MF_1_3Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_MF_1_3", credsIssuerConfig), mTestIndex(0) + Test_TC_MC_10_4Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_MC_10_4", 0, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("nodeId2", 0, UINT64_MAX, &mNodeId2); + AddArgument("cluster", &mCluster); AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("discriminator", 0, UINT16_MAX, &mDiscriminator); - AddArgument("payload", &mPayload); AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_MF_1_3Suite() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MF_1_3\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MF_1_3\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Reboot target device\n"); - err = TestRebootTargetDevice_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : TH_CR1 starts a commissioning process with DUT_CE\n"); - err = TestThCr1StartsACommissioningProcessWithDutCe_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Open Commissioning Window with too-short timeout\n"); - err = TestOpenCommissioningWindowWithTooShortTimeout_2(); - break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Open Commissioning Window with too-long timeout\n"); - err = TestOpenCommissioningWindowWithTooLongTimeout_3(); - break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Open Commissioning Window\n"); - err = TestOpenCommissioningWindow_4(); - break; - case 5: - ChipLogProgress( - chipTool, - " ***** Test Step 5 : TH_CR1 writes the Basic Information Clusters NodeLabel mandatory attribute of DUT_CE\n"); - err = TestThCr1WritesTheBasicInformationClustersNodeLabelMandatoryAttributeOfDutCe_5(); - break; - case 6: - ChipLogProgress( - chipTool, - " ***** Test Step 6 : TH_CR1 reads the Basic Information Clusters NodeLabel mandatory attribute of DUT_CE\n"); - err = TestThCr1ReadsTheBasicInformationClustersNodeLabelMandatoryAttributeOfDutCe_6(); - break; - case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : Commission from beta\n"); - err = TestCommissionFromBeta_7(); - break; - case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : TH_CR2 starts a commissioning process with DUT_CE\n"); - err = TestThCr2StartsACommissioningProcessWithDutCe_8(); - break; - case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : Query fabrics list\n"); - err = TestQueryFabricsList_9(); - break; - case 10: - ChipLogProgress(chipTool, " ***** Test Step 10 : Query fabrics list\n"); - err = TestQueryFabricsList_10(); - break; - case 11: - ChipLogProgress( - chipTool, - " ***** Test Step 11 : TH_CR1 writes the Basic Information Clusters NodeLabel mandatory attribute of DUT_CE\n"); - err = TestThCr1WritesTheBasicInformationClustersNodeLabelMandatoryAttributeOfDutCe_11(); - break; - case 12: - ChipLogProgress( - chipTool, - " ***** Test Step 12 : TH_CR1 reads the Basic Information Clusters NodeLabel mandatory attribute of DUT_CE\n"); - err = TestThCr1ReadsTheBasicInformationClustersNodeLabelMandatoryAttributeOfDutCe_12(); - break; - case 13: - ChipLogProgress( - chipTool, - " ***** Test Step 13 : TH_CR2 writes the Basic Information Clusters NodeLabel mandatory attribute of DUT_CE\n"); - err = TestThCr2WritesTheBasicInformationClustersNodeLabelMandatoryAttributeOfDutCe_13(); - break; - case 14: - ChipLogProgress( - chipTool, - " ***** Test Step 14 : TH_CR2 reads the Basic Information Clusters NodeLabel mandatory attribute of DUT_CE\n"); - err = TestThCr2ReadsTheBasicInformationClustersNodeLabelMandatoryAttributeOfDutCe_14(); - break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } + ~Test_TC_MC_10_4Suite() {} chip::System::Clock::Timeout GetWaitDuration() const override { @@ -122309,38 +52803,23 @@ class Test_TC_MF_1_3Suite : public TestCommand } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 15; - chip::Optional mNodeId; - chip::Optional mNodeId2; + chip::Optional mCluster; chip::Optional mEndpoint; - chip::Optional mDiscriminator; - chip::Optional mPayload; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; switch (mTestIndex - 1) { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 1: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 7: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 8: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; default: LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); } @@ -122351,436 +52830,514 @@ class Test_TC_MF_1_3Suite : public TestCommand } } - static void OnFailureCallback_5(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_5(error); - } - - static void OnSuccessCallback_5(void * context) { (static_cast(context))->OnSuccessResponse_5(); } - - static void OnFailureCallback_6(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_6(error); - } - - static void OnSuccessCallback_6(void * context, chip::CharSpan nodeLabel) - { - (static_cast(context))->OnSuccessResponse_6(nodeLabel); - } - - static void OnFailureCallback_9(void * context, CHIP_ERROR error) + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - (static_cast(context))->OnFailureResponse_9(error); - } - - static void - OnSuccessCallback_9(void * context, - const chip::app::DataModel::DecodableList< - chip::app::Clusters::OperationalCredentials::Structs::FabricDescriptor::DecodableType> & fabrics) - { - (static_cast(context))->OnSuccessResponse_9(fabrics); - } - - static void OnFailureCallback_10(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_10(error); - } - - static void - OnSuccessCallback_10(void * context, - const chip::app::DataModel::DecodableList< - chip::app::Clusters::OperationalCredentials::Structs::FabricDescriptor::DecodableType> & fabrics) - { - (static_cast(context))->OnSuccessResponse_10(fabrics); - } - - static void OnFailureCallback_11(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_11(error); + using namespace chip::app::Clusters; + switch (testIndex) + { + } + return CHIP_NO_ERROR; } +}; - static void OnSuccessCallback_11(void * context) { (static_cast(context))->OnSuccessResponse_11(); } - - static void OnFailureCallback_12(void * context, CHIP_ERROR error) +class Test_TC_MC_10_5Suite : public TestCommand +{ +public: + Test_TC_MC_10_5Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_MC_10_5", 0, credsIssuerConfig) { - (static_cast(context))->OnFailureResponse_12(error); + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - static void OnSuccessCallback_12(void * context, chip::CharSpan nodeLabel) - { - (static_cast(context))->OnSuccessResponse_12(nodeLabel); - } + ~Test_TC_MC_10_5Suite() {} - static void OnFailureCallback_13(void * context, CHIP_ERROR error) + chip::System::Clock::Timeout GetWaitDuration() const override { - (static_cast(context))->OnFailureResponse_13(error); + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } - static void OnSuccessCallback_13(void * context) { (static_cast(context))->OnSuccessResponse_13(); } - - static void OnFailureCallback_14(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_14(error); - } +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; - static void OnSuccessCallback_14(void * context, chip::CharSpan nodeLabel) - { - (static_cast(context))->OnSuccessResponse_14(nodeLabel); - } + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } // // Tests methods // - CHIP_ERROR TestRebootTargetDevice_0() - { - SetIdentity(kIdentityAlpha); - return Reboot(mDiscriminator.HasValue() ? mDiscriminator.Value() : 3840U); - } - - CHIP_ERROR TestThCr1StartsACommissioningProcessWithDutCe_1() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(1); - } - - CHIP_ERROR TestOpenCommissioningWindowWithTooShortTimeout_2() + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - using RequestType = chip::app::Clusters::AdministratorCommissioning::Commands::OpenCommissioningWindow::Type; - - RequestType request; - request.commissioningTimeout = 120U; - request.PAKEVerifier = chip::ByteSpan( - chip::Uint8::from_const_char("\006\307V\337\374\327\042e4R\241-\315\224]\214T\332+\017<\275\033M\303\361\255\262#" - "\256\262k\004|\322L\226\206o\227\233\035\203\354P\342\264\2560\315\362\375\263+" - "\330\242\021\2707\334\224\355\315V\364\321Cw\031\020v\277\305\235\231\267\3350S\357\326" - "\360,D4\362\275\322z\244\371\316\247\015s\216Lgarbage: not in length on purpose"), - 97); - request.discriminator = 3840U; - request.iterations = 1000UL; - request.salt = chip::ByteSpan(chip::Uint8::from_const_char("SPAKE2P Key Saltgarbage: not in length on purpose"), 16); - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_2(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_2(error); - }; + bool shouldContinue = false; - ReturnErrorOnFailure( - chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request, 10000)); - return CHIP_NO_ERROR; - } + switch (mTestIndex - 1) + { + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } - void OnFailureResponse_2(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_COMMAND)); - NextTest(); + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } } - void OnSuccessResponse_2() { ThrowSuccessResponse(); } - - CHIP_ERROR TestOpenCommissioningWindowWithTooLongTimeout_3() + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - using RequestType = chip::app::Clusters::AdministratorCommissioning::Commands::OpenCommissioningWindow::Type; - - RequestType request; - request.commissioningTimeout = 1000U; - request.PAKEVerifier = chip::ByteSpan( - chip::Uint8::from_const_char("\006\307V\337\374\327\042e4R\241-\315\224]\214T\332+\017<\275\033M\303\361\255\262#" - "\256\262k\004|\322L\226\206o\227\233\035\203\354P\342\264\2560\315\362\375\263+" - "\330\242\021\2707\334\224\355\315V\364\321Cw\031\020v\277\305\235\231\267\3350S\357\326" - "\360,D4\362\275\322z\244\371\316\247\015s\216Lgarbage: not in length on purpose"), - 97); - request.discriminator = 3840U; - request.iterations = 1000UL; - request.salt = chip::ByteSpan(chip::Uint8::from_const_char("SPAKE2P Key Saltgarbage: not in length on purpose"), 16); - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_3(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_3(error); - }; - - ReturnErrorOnFailure( - chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request, 10000)); + using namespace chip::app::Clusters; + switch (testIndex) + { + } return CHIP_NO_ERROR; } +}; - void OnFailureResponse_3(CHIP_ERROR error) +class Test_TC_MC_10_6Suite : public TestCommand +{ +public: + Test_TC_MC_10_6Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_MC_10_6", 0, credsIssuerConfig) { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_COMMAND)); - NextTest(); + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - void OnSuccessResponse_3() { ThrowSuccessResponse(); } + ~Test_TC_MC_10_6Suite() {} - CHIP_ERROR TestOpenCommissioningWindow_4() + chip::System::Clock::Timeout GetWaitDuration() const override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - using RequestType = chip::app::Clusters::AdministratorCommissioning::Commands::OpenCommissioningWindow::Type; - - RequestType request; - request.commissioningTimeout = 180U; - request.PAKEVerifier = chip::ByteSpan( - chip::Uint8::from_const_char("\006\307V\337\374\327\042e4R\241-\315\224]\214T\332+\017<\275\033M\303\361\255\262#" - "\256\262k\004|\322L\226\206o\227\233\035\203\354P\342\264\2560\315\362\375\263+" - "\330\242\021\2707\334\224\355\315V\364\321Cw\031\020v\277\305\235\231\267\3350S\357\326" - "\360,D4\362\275\322z\244\371\316\247\015s\216Lgarbage: not in length on purpose"), - 97); - request.discriminator = 3840U; - request.iterations = 1000UL; - request.salt = chip::ByteSpan(chip::Uint8::from_const_char("SPAKE2P Key Saltgarbage: not in length on purpose"), 16); - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_4(); - }; - - auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_4(error); - }; - - ReturnErrorOnFailure( - chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request, 10000)); - return CHIP_NO_ERROR; + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } - void OnFailureResponse_4(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; - void OnSuccessResponse_4() { NextTest(); } + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // - CHIP_ERROR TestThCr1WritesTheBasicInformationClustersNodeLabelMandatoryAttributeOfDutCe_5() + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::BasicClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::CharSpan nodeLabelArgument; - nodeLabelArgument = chip::Span("chiptestgarbage: not in length on purpose", 8); + bool shouldContinue = false; - ReturnErrorOnFailure(cluster.WriteAttribute( - nodeLabelArgument, this, OnSuccessCallback_5, OnFailureCallback_5)); - return CHIP_NO_ERROR; - } + switch (mTestIndex - 1) + { + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } - void OnFailureResponse_5(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } } - void OnSuccessResponse_5() { NextTest(); } - - CHIP_ERROR TestThCr1ReadsTheBasicInformationClustersNodeLabelMandatoryAttributeOfDutCe_6() + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::BasicClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_6, OnFailureCallback_6, true)); + using namespace chip::app::Clusters; + switch (testIndex) + { + } return CHIP_NO_ERROR; } +}; - void OnFailureResponse_6(CHIP_ERROR error) +class Test_TC_MF_1_1Suite : public TestCommand +{ +public: + Test_TC_MF_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_MF_1_1", 0, credsIssuerConfig) { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - void OnSuccessResponse_6(chip::CharSpan nodeLabel) - { - VerifyOrReturn(CheckValueAsString("nodeLabel", nodeLabel, chip::CharSpan("chiptest", 8))); - VerifyOrReturn(CheckConstraintType("nodeLabel", "", "string")); - VerifyOrReturn(CheckConstraintMaxLength("nodeLabel", nodeLabel.size(), 32)); - NextTest(); - } + ~Test_TC_MF_1_1Suite() {} - CHIP_ERROR TestCommissionFromBeta_7() + chip::System::Clock::Timeout GetWaitDuration() const override { - SetIdentity(kIdentityBeta); - return PairWithQRCode(1, mPayload.HasValue() ? mPayload.Value() : chip::CharSpan::fromCharString("MT:0000000000I31506010")); + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } - CHIP_ERROR TestThCr2StartsACommissioningProcessWithDutCe_8() - { - SetIdentity(kIdentityBeta); - return WaitForCommissionee(1); - } +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; - CHIP_ERROR TestQueryFabricsList_9() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::OperationalCredentialsClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_9, OnFailureCallback_9, true)); - return CHIP_NO_ERROR; - } + // + // Tests methods + // - void OnFailureResponse_9(CHIP_ERROR error) + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } + bool shouldContinue = false; - void OnSuccessResponse_9(const chip::app::DataModel::DecodableList< - chip::app::Clusters::OperationalCredentials::Structs::FabricDescriptor::DecodableType> & fabrics) - { + switch (mTestIndex - 1) + { + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } + + if (shouldContinue) { - auto iter_0 = fabrics.begin(); - VerifyOrReturn(CheckNextListItemDecodes("fabrics", iter_0, 0)); - VerifyOrReturn(CheckValueAsString("fabrics[0].label", iter_0.GetValue().label, chip::CharSpan("", 0))); - VerifyOrReturn(CheckNoMoreListItems("fabrics", iter_0, 1)); + ContinueOnChipMainThread(CHIP_NO_ERROR); } - VerifyOrReturn(CheckConstraintType("fabrics", "", "list")); - NextTest(); } - CHIP_ERROR TestQueryFabricsList_10() + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::OperationalCredentialsClusterTest cluster; - cluster.Associate(mDevices[kIdentityBeta], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_10, OnFailureCallback_10, false)); + using namespace chip::app::Clusters; + switch (testIndex) + { + } return CHIP_NO_ERROR; } +}; - void OnFailureResponse_10(CHIP_ERROR error) +class Test_TC_MF_1_2Suite : public TestCommand +{ +public: + Test_TC_MF_1_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_MF_1_2", 0, credsIssuerConfig) { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - void OnSuccessResponse_10(const chip::app::DataModel::DecodableList< - chip::app::Clusters::OperationalCredentials::Structs::FabricDescriptor::DecodableType> & fabrics) + ~Test_TC_MF_1_2Suite() {} + + chip::System::Clock::Timeout GetWaitDuration() const override { - { - auto iter_0 = fabrics.begin(); - VerifyOrReturn(CheckNextListItemDecodes("fabrics", iter_0, 0)); - VerifyOrReturn(CheckValueAsString("fabrics[0].label", iter_0.GetValue().label, chip::CharSpan("", 0))); - VerifyOrReturn(CheckNextListItemDecodes("fabrics", iter_0, 1)); - VerifyOrReturn(CheckValueAsString("fabrics[1].label", iter_0.GetValue().label, chip::CharSpan("", 0))); - VerifyOrReturn(CheckNoMoreListItems("fabrics", iter_0, 2)); - } - VerifyOrReturn(CheckConstraintType("fabrics", "", "list")); - NextTest(); + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } - CHIP_ERROR TestThCr1WritesTheBasicInformationClustersNodeLabelMandatoryAttributeOfDutCe_11() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::BasicClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; - chip::CharSpan nodeLabelArgument; - nodeLabelArgument = chip::Span("chiptest1garbage: not in length on purpose", 9); + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } - ReturnErrorOnFailure(cluster.WriteAttribute( - nodeLabelArgument, this, OnSuccessCallback_11, OnFailureCallback_11)); - return CHIP_NO_ERROR; - } + // + // Tests methods + // - void OnFailureResponse_11(CHIP_ERROR error) + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } - - void OnSuccessResponse_11() { NextTest(); } + bool shouldContinue = false; - CHIP_ERROR TestThCr1ReadsTheBasicInformationClustersNodeLabelMandatoryAttributeOfDutCe_12() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::BasicClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); + switch (mTestIndex - 1) + { + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_12, OnFailureCallback_12, true)); - return CHIP_NO_ERROR; + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } } - void OnFailureResponse_12(CHIP_ERROR error) + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); + using namespace chip::app::Clusters; + switch (testIndex) + { + } + return CHIP_NO_ERROR; } +}; - void OnSuccessResponse_12(chip::CharSpan nodeLabel) +class Test_TC_MF_1_3Suite : public TestCommand +{ +public: + Test_TC_MF_1_3Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_MF_1_3", 15, credsIssuerConfig) { - VerifyOrReturn(CheckValueAsString("nodeLabel", nodeLabel, chip::CharSpan("chiptest1", 9))); - VerifyOrReturn(CheckConstraintType("nodeLabel", "", "string")); - VerifyOrReturn(CheckConstraintMaxLength("nodeLabel", nodeLabel.size(), 32)); - NextTest(); + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("nodeId2", 0, UINT64_MAX, &mNodeId2); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("discriminator", 0, UINT16_MAX, &mDiscriminator); + AddArgument("payload", &mPayload); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - CHIP_ERROR TestThCr2WritesTheBasicInformationClustersNodeLabelMandatoryAttributeOfDutCe_13() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::BasicClusterTest cluster; - cluster.Associate(mDevices[kIdentityBeta], endpoint); - - chip::CharSpan nodeLabelArgument; - nodeLabelArgument = chip::Span("chiptest2garbage: not in length on purpose", 9); - - ReturnErrorOnFailure(cluster.WriteAttribute( - nodeLabelArgument, this, OnSuccessCallback_13, OnFailureCallback_13)); - return CHIP_NO_ERROR; - } + ~Test_TC_MF_1_3Suite() {} - void OnFailureResponse_13(CHIP_ERROR error) + chip::System::Clock::Timeout GetWaitDuration() const override { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } - void OnSuccessResponse_13() { NextTest(); } +private: + chip::Optional mNodeId; + chip::Optional mNodeId2; + chip::Optional mEndpoint; + chip::Optional mDiscriminator; + chip::Optional mPayload; + chip::Optional mTimeout; - CHIP_ERROR TestThCr2ReadsTheBasicInformationClustersNodeLabelMandatoryAttributeOfDutCe_14() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - chip::Controller::BasicClusterTest cluster; - cluster.Associate(mDevices[kIdentityBeta], endpoint); + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_14, OnFailureCallback_14, true)); - return CHIP_NO_ERROR; - } + // + // Tests methods + // - void OnFailureResponse_14(CHIP_ERROR error) + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { - chip::app::StatusIB status(error); - ThrowFailureResponse(error); - } + bool shouldContinue = false; - void OnSuccessResponse_14(chip::CharSpan nodeLabel) - { - VerifyOrReturn(CheckValueAsString("nodeLabel", nodeLabel, chip::CharSpan("chiptest2", 9))); - VerifyOrReturn(CheckConstraintType("nodeLabel", "", "string")); - VerifyOrReturn(CheckConstraintMaxLength("nodeLabel", nodeLabel.size(), 32)); - NextTest(); + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_COMMAND)); + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_COMMAND)); + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::CharSpan value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueAsString("nodeLabel", value, chip::CharSpan("chiptest", 8))); + VerifyOrReturn(CheckConstraintType("value", "", "string")); + VerifyOrReturn(CheckConstraintMaxLength("value", value.size(), 32)); + } + break; + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 8: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 9: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList< + chip::app::Clusters::OperationalCredentials::Structs::FabricDescriptor::DecodableType> + value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + { + auto iter_0 = value.begin(); + VerifyOrReturn(CheckNextListItemDecodes("fabrics", iter_0, 0)); + VerifyOrReturn(CheckValueAsString("fabrics[0].label", iter_0.GetValue().label, chip::CharSpan("", 0))); + VerifyOrReturn(CheckNoMoreListItems("fabrics", iter_0, 1)); + } + VerifyOrReturn(CheckConstraintType("value", "", "list")); + } + break; + case 10: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList< + chip::app::Clusters::OperationalCredentials::Structs::FabricDescriptor::DecodableType> + value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + { + auto iter_0 = value.begin(); + VerifyOrReturn(CheckNextListItemDecodes("fabrics", iter_0, 0)); + VerifyOrReturn(CheckValueAsString("fabrics[0].label", iter_0.GetValue().label, chip::CharSpan("", 0))); + VerifyOrReturn(CheckNextListItemDecodes("fabrics", iter_0, 1)); + VerifyOrReturn(CheckValueAsString("fabrics[1].label", iter_0.GetValue().label, chip::CharSpan("", 0))); + VerifyOrReturn(CheckNoMoreListItems("fabrics", iter_0, 2)); + } + VerifyOrReturn(CheckConstraintType("value", "", "list")); + } + break; + case 11: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 12: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::CharSpan value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueAsString("nodeLabel", value, chip::CharSpan("chiptest1", 9))); + VerifyOrReturn(CheckConstraintType("value", "", "string")); + VerifyOrReturn(CheckConstraintMaxLength("value", value.size(), 32)); + } + break; + case 13: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 14: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::CharSpan value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueAsString("nodeLabel", value, chip::CharSpan("chiptest2", 9))); + VerifyOrReturn(CheckConstraintType("value", "", "string")); + VerifyOrReturn(CheckConstraintMaxLength("value", value.size(), 32)); + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } + + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } + } + + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Reboot target device"); + SetIdentity(kIdentityAlpha); + return Reboot(mDiscriminator.HasValue() ? mDiscriminator.Value() : 3840U); + } + case 1: { + LogStep(1, "TH_CR1 starts a commissioning process with DUT_CE"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(1); + } + case 2: { + LogStep(2, "Open Commissioning Window with too-short timeout"); + chip::app::Clusters::AdministratorCommissioning::Commands::OpenCommissioningWindow::Type value; + value.commissioningTimeout = 120U; + value.PAKEVerifier = chip::ByteSpan( + chip::Uint8::from_const_char("\006\307V\337\374\327\042e4R\241-\315\224]\214T\332+\017<\275\033M\303\361\255\262#" + "\256\262k\004|\322L\226\206o\227\233\035\203\354P\342\264\2560\315\362\375\263+" + "\330\242\021\2707\334\224\355\315V\364\321Cw\031\020v\277\305\235\231\267\3350S\357" + "\326\360,D4\362\275\322z\244\371\316\247\015s\216Lgarbage: not in length on purpose"), + 97); + value.discriminator = 3840U; + value.iterations = 1000UL; + value.salt = chip::ByteSpan(chip::Uint8::from_const_char("SPAKE2P Key Saltgarbage: not in length on purpose"), 16); + return SendCommand(kIdentityAlpha, GetEndpoint(0), AdministratorCommissioning::Id, + AdministratorCommissioning::Commands::OpenCommissioningWindow::Id, value, + chip::Optional(10000)); + } + case 3: { + LogStep(3, "Open Commissioning Window with too-long timeout"); + chip::app::Clusters::AdministratorCommissioning::Commands::OpenCommissioningWindow::Type value; + value.commissioningTimeout = 1000U; + value.PAKEVerifier = chip::ByteSpan( + chip::Uint8::from_const_char("\006\307V\337\374\327\042e4R\241-\315\224]\214T\332+\017<\275\033M\303\361\255\262#" + "\256\262k\004|\322L\226\206o\227\233\035\203\354P\342\264\2560\315\362\375\263+" + "\330\242\021\2707\334\224\355\315V\364\321Cw\031\020v\277\305\235\231\267\3350S\357" + "\326\360,D4\362\275\322z\244\371\316\247\015s\216Lgarbage: not in length on purpose"), + 97); + value.discriminator = 3840U; + value.iterations = 1000UL; + value.salt = chip::ByteSpan(chip::Uint8::from_const_char("SPAKE2P Key Saltgarbage: not in length on purpose"), 16); + return SendCommand(kIdentityAlpha, GetEndpoint(0), AdministratorCommissioning::Id, + AdministratorCommissioning::Commands::OpenCommissioningWindow::Id, value, + chip::Optional(10000)); + } + case 4: { + LogStep(4, "Open Commissioning Window"); + chip::app::Clusters::AdministratorCommissioning::Commands::OpenCommissioningWindow::Type value; + value.commissioningTimeout = 180U; + value.PAKEVerifier = chip::ByteSpan( + chip::Uint8::from_const_char("\006\307V\337\374\327\042e4R\241-\315\224]\214T\332+\017<\275\033M\303\361\255\262#" + "\256\262k\004|\322L\226\206o\227\233\035\203\354P\342\264\2560\315\362\375\263+" + "\330\242\021\2707\334\224\355\315V\364\321Cw\031\020v\277\305\235\231\267\3350S\357" + "\326\360,D4\362\275\322z\244\371\316\247\015s\216Lgarbage: not in length on purpose"), + 97); + value.discriminator = 3840U; + value.iterations = 1000UL; + value.salt = chip::ByteSpan(chip::Uint8::from_const_char("SPAKE2P Key Saltgarbage: not in length on purpose"), 16); + return SendCommand(kIdentityAlpha, GetEndpoint(0), AdministratorCommissioning::Id, + AdministratorCommissioning::Commands::OpenCommissioningWindow::Id, value, + chip::Optional(10000)); + } + case 5: { + LogStep(5, "TH_CR1 writes the Basic Information Clusters NodeLabel mandatory attribute of DUT_CE"); + chip::CharSpan value; + value = chip::Span("chiptestgarbage: not in length on purpose", 8); + return WriteAttribute(kIdentityAlpha, GetEndpoint(0), Basic::Id, Basic::Attributes::NodeLabel::Id, value); + } + case 6: { + LogStep(6, "TH_CR1 reads the Basic Information Clusters NodeLabel mandatory attribute of DUT_CE"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), Basic::Id, Basic::Attributes::NodeLabel::Id); + } + case 7: { + LogStep(7, "Commission from beta"); + SetIdentity(kIdentityBeta); + return PairWithQRCode( + 1, mPayload.HasValue() ? mPayload.Value() : chip::CharSpan::fromCharString("MT:0000000000I31506010")); + } + case 8: { + LogStep(8, "TH_CR2 starts a commissioning process with DUT_CE"); + SetIdentity(kIdentityBeta); + return WaitForCommissionee(1); + } + case 9: { + LogStep(9, "Query fabrics list"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), OperationalCredentials::Id, + OperationalCredentials::Attributes::Fabrics::Id); + } + case 10: { + LogStep(10, "Query fabrics list"); + return ReadAttribute(kIdentityBeta, GetEndpoint(0), OperationalCredentials::Id, + OperationalCredentials::Attributes::Fabrics::Id, false); + } + case 11: { + LogStep(11, "TH_CR1 writes the Basic Information Clusters NodeLabel mandatory attribute of DUT_CE"); + chip::CharSpan value; + value = chip::Span("chiptest1garbage: not in length on purpose", 9); + return WriteAttribute(kIdentityAlpha, GetEndpoint(0), Basic::Id, Basic::Attributes::NodeLabel::Id, value); + } + case 12: { + LogStep(12, "TH_CR1 reads the Basic Information Clusters NodeLabel mandatory attribute of DUT_CE"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), Basic::Id, Basic::Attributes::NodeLabel::Id); + } + case 13: { + LogStep(13, "TH_CR2 writes the Basic Information Clusters NodeLabel mandatory attribute of DUT_CE"); + chip::CharSpan value; + value = chip::Span("chiptest2garbage: not in length on purpose", 9); + return WriteAttribute(kIdentityBeta, GetEndpoint(0), Basic::Id, Basic::Attributes::NodeLabel::Id, value); + } + case 14: { + LogStep(14, "TH_CR2 reads the Basic Information Clusters NodeLabel mandatory attribute of DUT_CE"); + return ReadAttribute(kIdentityBeta, GetEndpoint(0), Basic::Id, Basic::Attributes::NodeLabel::Id); + } + } + return CHIP_NO_ERROR; } }; class Test_TC_MF_1_5Suite : public TestCommand { public: - Test_TC_MF_1_5Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_MF_1_5", credsIssuerConfig), mTestIndex(0) + Test_TC_MF_1_5Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_MF_1_5", 0, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -122790,54 +53347,23 @@ class Test_TC_MF_1_5Suite : public TestCommand ~Test_TC_MF_1_5Suite() {} - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MF_1_5\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MF_1_5\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -122854,16 +53380,20 @@ class Test_TC_MF_1_5Suite : public TestCommand } } - // - // Tests methods - // + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + } + return CHIP_NO_ERROR; + } }; class Test_TC_MF_1_7Suite : public TestCommand { public: - Test_TC_MF_1_7Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_MF_1_7", credsIssuerConfig), mTestIndex(0) + Test_TC_MF_1_7Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_MF_1_7", 0, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -122873,54 +53403,23 @@ class Test_TC_MF_1_7Suite : public TestCommand ~Test_TC_MF_1_7Suite() {} - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MF_1_7\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MF_1_7\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -122937,16 +53436,20 @@ class Test_TC_MF_1_7Suite : public TestCommand } } - // - // Tests methods - // + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + } + return CHIP_NO_ERROR; + } }; class Test_TC_MF_1_8Suite : public TestCommand { public: - Test_TC_MF_1_8Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_MF_1_8", credsIssuerConfig), mTestIndex(0) + Test_TC_MF_1_8Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_MF_1_8", 0, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -122956,54 +53459,23 @@ class Test_TC_MF_1_8Suite : public TestCommand ~Test_TC_MF_1_8Suite() {} - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MF_1_8\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MF_1_8\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -123020,16 +53492,20 @@ class Test_TC_MF_1_8Suite : public TestCommand } } - // - // Tests methods - // + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + } + return CHIP_NO_ERROR; + } }; class Test_TC_MF_1_9Suite : public TestCommand { public: - Test_TC_MF_1_9Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_MF_1_9", credsIssuerConfig), mTestIndex(0) + Test_TC_MF_1_9Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_MF_1_9", 0, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -123039,54 +53515,23 @@ class Test_TC_MF_1_9Suite : public TestCommand ~Test_TC_MF_1_9Suite() {} - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MF_1_9\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MF_1_9\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -123103,16 +53548,20 @@ class Test_TC_MF_1_9Suite : public TestCommand } } - // - // Tests methods - // + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + } + return CHIP_NO_ERROR; + } }; class Test_TC_MF_1_10Suite : public TestCommand { public: - Test_TC_MF_1_10Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_MF_1_10", credsIssuerConfig), mTestIndex(0) + Test_TC_MF_1_10Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_MF_1_10", 0, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -123122,54 +53571,23 @@ class Test_TC_MF_1_10Suite : public TestCommand ~Test_TC_MF_1_10Suite() {} - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MF_1_10\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MF_1_10\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -123186,16 +53604,20 @@ class Test_TC_MF_1_10Suite : public TestCommand } } - // - // Tests methods - // + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + } + return CHIP_NO_ERROR; + } }; class Test_TC_MF_1_11Suite : public TestCommand { public: - Test_TC_MF_1_11Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_MF_1_11", credsIssuerConfig), mTestIndex(0) + Test_TC_MF_1_11Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_MF_1_11", 0, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -123205,54 +53627,23 @@ class Test_TC_MF_1_11Suite : public TestCommand ~Test_TC_MF_1_11Suite() {} - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MF_1_11\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MF_1_11\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -123269,16 +53660,20 @@ class Test_TC_MF_1_11Suite : public TestCommand } } - // - // Tests methods - // + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + } + return CHIP_NO_ERROR; + } }; class Test_TC_MF_1_12Suite : public TestCommand { public: - Test_TC_MF_1_12Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_MF_1_12", credsIssuerConfig), mTestIndex(0) + Test_TC_MF_1_12Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_MF_1_12", 0, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -123288,54 +53683,23 @@ class Test_TC_MF_1_12Suite : public TestCommand ~Test_TC_MF_1_12Suite() {} - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MF_1_12\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MF_1_12\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -123352,16 +53716,20 @@ class Test_TC_MF_1_12Suite : public TestCommand } } - // - // Tests methods - // + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + } + return CHIP_NO_ERROR; + } }; class Test_TC_MF_1_13Suite : public TestCommand { public: - Test_TC_MF_1_13Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_MF_1_13", credsIssuerConfig), mTestIndex(0) + Test_TC_MF_1_13Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_MF_1_13", 0, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -123371,54 +53739,23 @@ class Test_TC_MF_1_13Suite : public TestCommand ~Test_TC_MF_1_13Suite() {} - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MF_1_13\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MF_1_13\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -123435,16 +53772,20 @@ class Test_TC_MF_1_13Suite : public TestCommand } } - // - // Tests methods - // + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + } + return CHIP_NO_ERROR; + } }; class Test_TC_MF_1_14Suite : public TestCommand { public: - Test_TC_MF_1_14Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_MF_1_14", credsIssuerConfig), mTestIndex(0) + Test_TC_MF_1_14Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_MF_1_14", 0, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -123454,54 +53795,23 @@ class Test_TC_MF_1_14Suite : public TestCommand ~Test_TC_MF_1_14Suite() {} - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MF_1_14\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MF_1_14\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -123518,16 +53828,20 @@ class Test_TC_MF_1_14Suite : public TestCommand } } - // - // Tests methods - // + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + } + return CHIP_NO_ERROR; + } }; class Test_TC_MF_1_15Suite : public TestCommand { public: - Test_TC_MF_1_15Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_MF_1_15", credsIssuerConfig), mTestIndex(0) + Test_TC_MF_1_15Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_MF_1_15", 0, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -123537,54 +53851,23 @@ class Test_TC_MF_1_15Suite : public TestCommand ~Test_TC_MF_1_15Suite() {} - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MF_1_15\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MF_1_15\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -123600,17 +53883,21 @@ class Test_TC_MF_1_15Suite : public TestCommand ContinueOnChipMainThread(CHIP_NO_ERROR); } } - - // - // Tests methods - // + + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + } + return CHIP_NO_ERROR; + } }; class Test_TC_MF_1_16Suite : public TestCommand { public: - Test_TC_MF_1_16Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_MF_1_16", credsIssuerConfig), mTestIndex(0) + Test_TC_MF_1_16Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_MF_1_16", 0, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -123620,54 +53907,23 @@ class Test_TC_MF_1_16Suite : public TestCommand ~Test_TC_MF_1_16Suite() {} - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MF_1_16\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MF_1_16\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -123684,16 +53940,20 @@ class Test_TC_MF_1_16Suite : public TestCommand } } - // - // Tests methods - // + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + } + return CHIP_NO_ERROR; + } }; class Test_TC_MF_1_17Suite : public TestCommand { public: - Test_TC_MF_1_17Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_MF_1_17", credsIssuerConfig), mTestIndex(0) + Test_TC_MF_1_17Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_MF_1_17", 0, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -123703,54 +53963,23 @@ class Test_TC_MF_1_17Suite : public TestCommand ~Test_TC_MF_1_17Suite() {} - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MF_1_17\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MF_1_17\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -123767,16 +53996,20 @@ class Test_TC_MF_1_17Suite : public TestCommand } } - // - // Tests methods - // + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + } + return CHIP_NO_ERROR; + } }; class Test_TC_MF_1_18Suite : public TestCommand { public: - Test_TC_MF_1_18Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_MF_1_18", credsIssuerConfig), mTestIndex(0) + Test_TC_MF_1_18Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_MF_1_18", 0, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -123786,54 +54019,23 @@ class Test_TC_MF_1_18Suite : public TestCommand ~Test_TC_MF_1_18Suite() {} - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MF_1_18\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MF_1_18\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -123850,16 +54052,20 @@ class Test_TC_MF_1_18Suite : public TestCommand } } - // - // Tests methods - // + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + } + return CHIP_NO_ERROR; + } }; class Test_TC_MF_1_19Suite : public TestCommand { public: - Test_TC_MF_1_19Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_MF_1_19", credsIssuerConfig), mTestIndex(0) + Test_TC_MF_1_19Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_MF_1_19", 0, credsIssuerConfig) { AddArgument("cluster", &mCluster); AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); @@ -123869,54 +54075,23 @@ class Test_TC_MF_1_19Suite : public TestCommand ~Test_TC_MF_1_19Suite() {} - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MF_1_19\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MF_1_19\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; - chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mNodeId; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -123933,16 +54108,20 @@ class Test_TC_MF_1_19Suite : public TestCommand } } - // - // Tests methods - // + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + } + return CHIP_NO_ERROR; + } }; class Test_TC_MF_1_20Suite : public TestCommand { public: - Test_TC_MF_1_20Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_MF_1_20", credsIssuerConfig), mTestIndex(0) + Test_TC_MF_1_20Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_MF_1_20", 0, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -123952,54 +54131,23 @@ class Test_TC_MF_1_20Suite : public TestCommand ~Test_TC_MF_1_20Suite() {} - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MF_1_20\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MF_1_20\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -124016,16 +54164,20 @@ class Test_TC_MF_1_20Suite : public TestCommand } } - // - // Tests methods - // + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + } + return CHIP_NO_ERROR; + } }; class Test_TC_MF_1_21Suite : public TestCommand { public: - Test_TC_MF_1_21Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_MF_1_21", credsIssuerConfig), mTestIndex(0) + Test_TC_MF_1_21Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_MF_1_21", 0, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -124035,54 +54187,23 @@ class Test_TC_MF_1_21Suite : public TestCommand ~Test_TC_MF_1_21Suite() {} - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MF_1_21\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MF_1_21\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -124099,16 +54220,20 @@ class Test_TC_MF_1_21Suite : public TestCommand } } - // - // Tests methods - // + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + } + return CHIP_NO_ERROR; + } }; class Test_TC_MF_1_22Suite : public TestCommand { public: - Test_TC_MF_1_22Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_MF_1_22", credsIssuerConfig), mTestIndex(0) + Test_TC_MF_1_22Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_MF_1_22", 0, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -124118,54 +54243,23 @@ class Test_TC_MF_1_22Suite : public TestCommand ~Test_TC_MF_1_22Suite() {} - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MF_1_22\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MF_1_22\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -124182,16 +54276,20 @@ class Test_TC_MF_1_22Suite : public TestCommand } } - // - // Tests methods - // + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + } + return CHIP_NO_ERROR; + } }; class Test_TC_MF_1_23Suite : public TestCommand { public: - Test_TC_MF_1_23Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_MF_1_23", credsIssuerConfig), mTestIndex(0) + Test_TC_MF_1_23Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_MF_1_23", 0, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -124201,54 +54299,23 @@ class Test_TC_MF_1_23Suite : public TestCommand ~Test_TC_MF_1_23Suite() {} - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MF_1_23\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MF_1_23\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -124265,16 +54332,20 @@ class Test_TC_MF_1_23Suite : public TestCommand } } - // - // Tests methods - // + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + } + return CHIP_NO_ERROR; + } }; class Test_TC_MF_1_24Suite : public TestCommand { public: - Test_TC_MF_1_24Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_MF_1_24", credsIssuerConfig), mTestIndex(0) + Test_TC_MF_1_24Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_MF_1_24", 0, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -124284,54 +54355,23 @@ class Test_TC_MF_1_24Suite : public TestCommand ~Test_TC_MF_1_24Suite() {} - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MF_1_24\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MF_1_24\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -124348,16 +54388,20 @@ class Test_TC_MF_1_24Suite : public TestCommand } } - // - // Tests methods - // + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + } + return CHIP_NO_ERROR; + } }; class Test_TC_MF_1_25Suite : public TestCommand { public: - Test_TC_MF_1_25Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_MF_1_25", credsIssuerConfig), mTestIndex(0) + Test_TC_MF_1_25Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_MF_1_25", 0, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -124367,54 +54411,23 @@ class Test_TC_MF_1_25Suite : public TestCommand ~Test_TC_MF_1_25Suite() {} - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MF_1_25\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MF_1_25\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -124431,16 +54444,20 @@ class Test_TC_MF_1_25Suite : public TestCommand } } - // - // Tests methods - // + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + } + return CHIP_NO_ERROR; + } }; class Test_TC_MF_1_26Suite : public TestCommand { public: - Test_TC_MF_1_26Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_MF_1_26", credsIssuerConfig), mTestIndex(0) + Test_TC_MF_1_26Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_MF_1_26", 0, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -124450,54 +54467,23 @@ class Test_TC_MF_1_26Suite : public TestCommand ~Test_TC_MF_1_26Suite() {} - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MF_1_26\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MF_1_26\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -124514,16 +54500,20 @@ class Test_TC_MF_1_26Suite : public TestCommand } } - // - // Tests methods - // + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + } + return CHIP_NO_ERROR; + } }; class Test_TC_MF_1_27Suite : public TestCommand { public: - Test_TC_MF_1_27Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_MF_1_27", credsIssuerConfig), mTestIndex(0) + Test_TC_MF_1_27Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_MF_1_27", 0, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -124533,54 +54523,23 @@ class Test_TC_MF_1_27Suite : public TestCommand ~Test_TC_MF_1_27Suite() {} - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MF_1_27\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MF_1_27\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -124597,16 +54556,20 @@ class Test_TC_MF_1_27Suite : public TestCommand } } - // - // Tests methods - // + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + } + return CHIP_NO_ERROR; + } }; class Test_TC_MF_1_28Suite : public TestCommand { public: - Test_TC_MF_1_28Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_MF_1_28", credsIssuerConfig), mTestIndex(0) + Test_TC_MF_1_28Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_MF_1_28", 0, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -124616,54 +54579,23 @@ class Test_TC_MF_1_28Suite : public TestCommand ~Test_TC_MF_1_28Suite() {} - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MF_1_28\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MF_1_28\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -124680,16 +54612,20 @@ class Test_TC_MF_1_28Suite : public TestCommand } } - // - // Tests methods - // + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + } + return CHIP_NO_ERROR; + } }; class Test_TC_MOD_1_2Suite : public TestCommand { public: - Test_TC_MOD_1_2Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_MOD_1_2", credsIssuerConfig), mTestIndex(0) + Test_TC_MOD_1_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_MOD_1_2", 0, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -124699,54 +54635,23 @@ class Test_TC_MOD_1_2Suite : public TestCommand ~Test_TC_MOD_1_2Suite() {} - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MOD_1_2\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MOD_1_2\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -124763,16 +54668,20 @@ class Test_TC_MOD_1_2Suite : public TestCommand } } - // - // Tests methods - // + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + } + return CHIP_NO_ERROR; + } }; class Test_TC_MOD_2_1Suite : public TestCommand { public: - Test_TC_MOD_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_MOD_2_1", credsIssuerConfig), mTestIndex(0) + Test_TC_MOD_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_MOD_2_1", 0, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -124782,54 +54691,23 @@ class Test_TC_MOD_2_1Suite : public TestCommand ~Test_TC_MOD_2_1Suite() {} - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MOD_2_1\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MOD_2_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -124846,16 +54724,20 @@ class Test_TC_MOD_2_1Suite : public TestCommand } } - // - // Tests methods - // + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + } + return CHIP_NO_ERROR; + } }; class Test_TC_MOD_2_2Suite : public TestCommand { public: - Test_TC_MOD_2_2Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_MOD_2_2", credsIssuerConfig), mTestIndex(0) + Test_TC_MOD_2_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_MOD_2_2", 0, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -124865,54 +54747,23 @@ class Test_TC_MOD_2_2Suite : public TestCommand ~Test_TC_MOD_2_2Suite() {} - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MOD_2_2\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MOD_2_2\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -124929,16 +54780,20 @@ class Test_TC_MOD_2_2Suite : public TestCommand } } - // - // Tests methods - // + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + } + return CHIP_NO_ERROR; + } }; class Test_TC_MOD_3_1Suite : public TestCommand { public: - Test_TC_MOD_3_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_MOD_3_1", credsIssuerConfig), mTestIndex(0) + Test_TC_MOD_3_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_MOD_3_1", 0, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -124948,54 +54803,23 @@ class Test_TC_MOD_3_1Suite : public TestCommand ~Test_TC_MOD_3_1Suite() {} - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MOD_3_1\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MOD_3_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -125011,17 +54835,21 @@ class Test_TC_MOD_3_1Suite : public TestCommand ContinueOnChipMainThread(CHIP_NO_ERROR); } } - - // - // Tests methods - // + + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + } + return CHIP_NO_ERROR; + } }; class Test_TC_MOD_3_2Suite : public TestCommand { public: - Test_TC_MOD_3_2Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_MOD_3_2", credsIssuerConfig), mTestIndex(0) + Test_TC_MOD_3_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_MOD_3_2", 0, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -125031,54 +54859,23 @@ class Test_TC_MOD_3_2Suite : public TestCommand ~Test_TC_MOD_3_2Suite() {} - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MOD_3_2\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MOD_3_2\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -125095,16 +54892,20 @@ class Test_TC_MOD_3_2Suite : public TestCommand } } - // - // Tests methods - // + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + } + return CHIP_NO_ERROR; + } }; class Test_TC_MOD_3_3Suite : public TestCommand { public: - Test_TC_MOD_3_3Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_MOD_3_3", credsIssuerConfig), mTestIndex(0) + Test_TC_MOD_3_3Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_MOD_3_3", 0, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -125114,54 +54915,23 @@ class Test_TC_MOD_3_3Suite : public TestCommand ~Test_TC_MOD_3_3Suite() {} - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MOD_3_3\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MOD_3_3\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -125178,16 +54948,20 @@ class Test_TC_MOD_3_3Suite : public TestCommand } } - // - // Tests methods - // + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + } + return CHIP_NO_ERROR; + } }; class Test_TC_SU_1_1Suite : public TestCommand { public: - Test_TC_SU_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_SU_1_1", credsIssuerConfig), mTestIndex(0) + Test_TC_SU_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_SU_1_1", 0, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -125197,54 +54971,23 @@ class Test_TC_SU_1_1Suite : public TestCommand ~Test_TC_SU_1_1Suite() {} - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_SU_1_1\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_SU_1_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -125261,16 +55004,20 @@ class Test_TC_SU_1_1Suite : public TestCommand } } - // - // Tests methods - // + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + } + return CHIP_NO_ERROR; + } }; class Test_TC_SU_2_1Suite : public TestCommand { public: - Test_TC_SU_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_SU_2_1", credsIssuerConfig), mTestIndex(0) + Test_TC_SU_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_SU_2_1", 0, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -125280,54 +55027,23 @@ class Test_TC_SU_2_1Suite : public TestCommand ~Test_TC_SU_2_1Suite() {} - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_SU_2_1\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_SU_2_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -125344,16 +55060,20 @@ class Test_TC_SU_2_1Suite : public TestCommand } } - // - // Tests methods - // + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + } + return CHIP_NO_ERROR; + } }; class Test_TC_SU_2_2Suite : public TestCommand { public: - Test_TC_SU_2_2Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_SU_2_2", credsIssuerConfig), mTestIndex(0) + Test_TC_SU_2_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_SU_2_2", 0, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -125363,54 +55083,23 @@ class Test_TC_SU_2_2Suite : public TestCommand ~Test_TC_SU_2_2Suite() {} - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_SU_2_2\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_SU_2_2\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -125427,16 +55116,20 @@ class Test_TC_SU_2_2Suite : public TestCommand } } - // - // Tests methods - // + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + } + return CHIP_NO_ERROR; + } }; class Test_TC_SU_2_3Suite : public TestCommand { public: - Test_TC_SU_2_3Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_SU_2_3", credsIssuerConfig), mTestIndex(0) + Test_TC_SU_2_3Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_SU_2_3", 0, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -125446,54 +55139,23 @@ class Test_TC_SU_2_3Suite : public TestCommand ~Test_TC_SU_2_3Suite() {} - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_SU_2_3\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_SU_2_3\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -125510,16 +55172,20 @@ class Test_TC_SU_2_3Suite : public TestCommand } } - // - // Tests methods - // + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + } + return CHIP_NO_ERROR; + } }; class Test_TC_SU_2_4Suite : public TestCommand { public: - Test_TC_SU_2_4Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_SU_2_4", credsIssuerConfig), mTestIndex(0) + Test_TC_SU_2_4Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_SU_2_4", 0, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -125529,54 +55195,23 @@ class Test_TC_SU_2_4Suite : public TestCommand ~Test_TC_SU_2_4Suite() {} - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_SU_2_4\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_SU_2_4\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -125593,16 +55228,20 @@ class Test_TC_SU_2_4Suite : public TestCommand } } - // - // Tests methods - // + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + } + return CHIP_NO_ERROR; + } }; class Test_TC_SU_2_5Suite : public TestCommand { public: - Test_TC_SU_2_5Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_SU_2_5", credsIssuerConfig), mTestIndex(0) + Test_TC_SU_2_5Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_SU_2_5", 0, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -125612,54 +55251,23 @@ class Test_TC_SU_2_5Suite : public TestCommand ~Test_TC_SU_2_5Suite() {} - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_SU_2_5\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_SU_2_5\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -125676,16 +55284,20 @@ class Test_TC_SU_2_5Suite : public TestCommand } } - // - // Tests methods - // + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + } + return CHIP_NO_ERROR; + } }; class Test_TC_SU_2_6Suite : public TestCommand { public: - Test_TC_SU_2_6Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_SU_2_6", credsIssuerConfig), mTestIndex(0) + Test_TC_SU_2_6Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_SU_2_6", 0, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -125695,54 +55307,23 @@ class Test_TC_SU_2_6Suite : public TestCommand ~Test_TC_SU_2_6Suite() {} - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_SU_2_6\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_SU_2_6\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -125759,16 +55340,20 @@ class Test_TC_SU_2_6Suite : public TestCommand } } - // - // Tests methods - // + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + } + return CHIP_NO_ERROR; + } }; class Test_TC_SU_2_7Suite : public TestCommand { public: - Test_TC_SU_2_7Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_SU_2_7", credsIssuerConfig), mTestIndex(0) + Test_TC_SU_2_7Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_SU_2_7", 0, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -125778,54 +55363,23 @@ class Test_TC_SU_2_7Suite : public TestCommand ~Test_TC_SU_2_7Suite() {} - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_SU_2_7\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_SU_2_7\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -125842,16 +55396,20 @@ class Test_TC_SU_2_7Suite : public TestCommand } } - // - // Tests methods - // + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + } + return CHIP_NO_ERROR; + } }; class Test_TC_SU_3_1Suite : public TestCommand { public: - Test_TC_SU_3_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_SU_3_1", credsIssuerConfig), mTestIndex(0) + Test_TC_SU_3_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_SU_3_1", 0, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -125861,54 +55419,23 @@ class Test_TC_SU_3_1Suite : public TestCommand ~Test_TC_SU_3_1Suite() {} - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_SU_3_1\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_SU_3_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -125925,16 +55452,20 @@ class Test_TC_SU_3_1Suite : public TestCommand } } - // - // Tests methods - // + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + } + return CHIP_NO_ERROR; + } }; class Test_TC_SU_3_2Suite : public TestCommand { public: - Test_TC_SU_3_2Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_SU_3_2", credsIssuerConfig), mTestIndex(0) + Test_TC_SU_3_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_SU_3_2", 0, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -125944,54 +55475,23 @@ class Test_TC_SU_3_2Suite : public TestCommand ~Test_TC_SU_3_2Suite() {} - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_SU_3_2\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_SU_3_2\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -126008,16 +55508,20 @@ class Test_TC_SU_3_2Suite : public TestCommand } } - // - // Tests methods - // + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + } + return CHIP_NO_ERROR; + } }; class Test_TC_SU_3_3Suite : public TestCommand { public: - Test_TC_SU_3_3Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_SU_3_3", credsIssuerConfig), mTestIndex(0) + Test_TC_SU_3_3Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_SU_3_3", 0, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -126027,54 +55531,23 @@ class Test_TC_SU_3_3Suite : public TestCommand ~Test_TC_SU_3_3Suite() {} - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_SU_3_3\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_SU_3_3\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -126091,16 +55564,20 @@ class Test_TC_SU_3_3Suite : public TestCommand } } - // - // Tests methods - // + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + } + return CHIP_NO_ERROR; + } }; class Test_TC_SU_3_4Suite : public TestCommand { public: - Test_TC_SU_3_4Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_SU_3_4", credsIssuerConfig), mTestIndex(0) + Test_TC_SU_3_4Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_SU_3_4", 0, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -126110,54 +55587,23 @@ class Test_TC_SU_3_4Suite : public TestCommand ~Test_TC_SU_3_4Suite() {} - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_SU_3_4\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_SU_3_4\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -126174,16 +55620,20 @@ class Test_TC_SU_3_4Suite : public TestCommand } } - // - // Tests methods - // + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + } + return CHIP_NO_ERROR; + } }; class Test_TC_SU_4_1Suite : public TestCommand { public: - Test_TC_SU_4_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_SU_4_1", credsIssuerConfig), mTestIndex(0) + Test_TC_SU_4_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_SU_4_1", 0, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -126193,54 +55643,23 @@ class Test_TC_SU_4_1Suite : public TestCommand ~Test_TC_SU_4_1Suite() {} - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_SU_4_1\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_SU_4_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -126257,16 +55676,20 @@ class Test_TC_SU_4_1Suite : public TestCommand } } - // - // Tests methods - // + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + } + return CHIP_NO_ERROR; + } }; class Test_TC_SU_4_2Suite : public TestCommand { public: - Test_TC_SU_4_2Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_SU_4_2", credsIssuerConfig), mTestIndex(0) + Test_TC_SU_4_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_SU_4_2", 0, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -126276,54 +55699,23 @@ class Test_TC_SU_4_2Suite : public TestCommand ~Test_TC_SU_4_2Suite() {} - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_SU_4_2\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_SU_4_2\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -126340,16 +55732,20 @@ class Test_TC_SU_4_2Suite : public TestCommand } } - // - // Tests methods - // + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + } + return CHIP_NO_ERROR; + } }; class Test_TC_PSCFG_2_1Suite : public TestCommand { public: - Test_TC_PSCFG_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_PSCFG_2_1", credsIssuerConfig), mTestIndex(0) + Test_TC_PSCFG_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_PSCFG_2_1", 0, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -126359,54 +55755,23 @@ class Test_TC_PSCFG_2_1Suite : public TestCommand ~Test_TC_PSCFG_2_1Suite() {} - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_PSCFG_2_1\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_PSCFG_2_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -126423,16 +55788,20 @@ class Test_TC_PSCFG_2_1Suite : public TestCommand } } - // - // Tests methods - // + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + } + return CHIP_NO_ERROR; + } }; class Test_TC_PSCFG_3_1Suite : public TestCommand { public: - Test_TC_PSCFG_3_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_PSCFG_3_1", credsIssuerConfig), mTestIndex(0) + Test_TC_PSCFG_3_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_PSCFG_3_1", 0, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -126442,54 +55811,23 @@ class Test_TC_PSCFG_3_1Suite : public TestCommand ~Test_TC_PSCFG_3_1Suite() {} - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_PSCFG_3_1\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_PSCFG_3_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -126506,16 +55844,20 @@ class Test_TC_PSCFG_3_1Suite : public TestCommand } } - // - // Tests methods - // + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + } + return CHIP_NO_ERROR; + } }; class Test_TC_SC_4_5Suite : public TestCommand { public: - Test_TC_SC_4_5Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_SC_4_5", credsIssuerConfig), mTestIndex(0) + Test_TC_SC_4_5Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_SC_4_5", 0, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -126525,54 +55867,23 @@ class Test_TC_SC_4_5Suite : public TestCommand ~Test_TC_SC_4_5Suite() {} - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_SC_4_5\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_SC_4_5\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -126589,16 +55900,20 @@ class Test_TC_SC_4_5Suite : public TestCommand } } - // - // Tests methods - // + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + } + return CHIP_NO_ERROR; + } }; class Test_TC_SC_4_6Suite : public TestCommand { public: - Test_TC_SC_4_6Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_SC_4_6", credsIssuerConfig), mTestIndex(0) + Test_TC_SC_4_6Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_SC_4_6", 0, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -126608,54 +55923,23 @@ class Test_TC_SC_4_6Suite : public TestCommand ~Test_TC_SC_4_6Suite() {} - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_SC_4_6\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_SC_4_6\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -126672,16 +55956,20 @@ class Test_TC_SC_4_6Suite : public TestCommand } } - // - // Tests methods - // + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + } + return CHIP_NO_ERROR; + } }; class Test_TC_SC_4_7Suite : public TestCommand { public: - Test_TC_SC_4_7Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_SC_4_7", credsIssuerConfig), mTestIndex(0) + Test_TC_SC_4_7Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_SC_4_7", 0, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -126691,54 +55979,23 @@ class Test_TC_SC_4_7Suite : public TestCommand ~Test_TC_SC_4_7Suite() {} - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_SC_4_7\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_SC_4_7\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -126755,16 +56012,20 @@ class Test_TC_SC_4_7Suite : public TestCommand } } - // - // Tests methods - // + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + } + return CHIP_NO_ERROR; + } }; class Test_TC_SC_4_8Suite : public TestCommand { public: - Test_TC_SC_4_8Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_SC_4_8", credsIssuerConfig), mTestIndex(0) + Test_TC_SC_4_8Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_SC_4_8", 0, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -126774,54 +56035,23 @@ class Test_TC_SC_4_8Suite : public TestCommand ~Test_TC_SC_4_8Suite() {} - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_SC_4_8\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_SC_4_8\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -126838,16 +56068,20 @@ class Test_TC_SC_4_8Suite : public TestCommand } } - // - // Tests methods - // + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + } + return CHIP_NO_ERROR; + } }; class Test_TC_SC_4_9Suite : public TestCommand { public: - Test_TC_SC_4_9Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_SC_4_9", credsIssuerConfig), mTestIndex(0) + Test_TC_SC_4_9Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_SC_4_9", 0, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -126857,54 +56091,23 @@ class Test_TC_SC_4_9Suite : public TestCommand ~Test_TC_SC_4_9Suite() {} - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_SC_4_9\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_SC_4_9\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -126921,16 +56124,20 @@ class Test_TC_SC_4_9Suite : public TestCommand } } - // - // Tests methods - // + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + } + return CHIP_NO_ERROR; + } }; class Test_TC_SWDIAG_1_2Suite : public TestCommand { public: - Test_TC_SWDIAG_1_2Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_SWDIAG_1_2", credsIssuerConfig), mTestIndex(0) + Test_TC_SWDIAG_1_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_SWDIAG_1_2", 0, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -126940,54 +56147,23 @@ class Test_TC_SWDIAG_1_2Suite : public TestCommand ~Test_TC_SWDIAG_1_2Suite() {} - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_SWDIAG_1_2\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_SWDIAG_1_2\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -127004,16 +56180,21 @@ class Test_TC_SWDIAG_1_2Suite : public TestCommand } } - // - // Tests methods - // + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + } + return CHIP_NO_ERROR; + } }; class Test_TC_WIFIDIAG_1_2Suite : public TestCommand { public: Test_TC_WIFIDIAG_1_2Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_WIFIDIAG_1_2", credsIssuerConfig), mTestIndex(0) + TestCommand("Test_TC_WIFIDIAG_1_2", 0, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -127023,54 +56204,23 @@ class Test_TC_WIFIDIAG_1_2Suite : public TestCommand ~Test_TC_WIFIDIAG_1_2Suite() {} - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_WIFIDIAG_1_2\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_WIFIDIAG_1_2\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -127087,16 +56237,21 @@ class Test_TC_WIFIDIAG_1_2Suite : public TestCommand } } - // - // Tests methods - // + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + } + return CHIP_NO_ERROR; + } }; class Test_TC_WIFIDIAG_2_1Suite : public TestCommand { public: Test_TC_WIFIDIAG_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_WIFIDIAG_2_1", credsIssuerConfig), mTestIndex(0) + TestCommand("Test_TC_WIFIDIAG_2_1", 0, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -127106,54 +56261,23 @@ class Test_TC_WIFIDIAG_2_1Suite : public TestCommand ~Test_TC_WIFIDIAG_2_1Suite() {} - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_WIFIDIAG_2_1\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_WIFIDIAG_2_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -127170,16 +56294,20 @@ class Test_TC_WIFIDIAG_2_1Suite : public TestCommand } } - // - // Tests methods - // + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + } + return CHIP_NO_ERROR; + } }; class Test_TC_WNCV_6_1Suite : public TestCommand { public: - Test_TC_WNCV_6_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_WNCV_6_1", credsIssuerConfig), mTestIndex(0) + Test_TC_WNCV_6_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_WNCV_6_1", 0, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -127189,54 +56317,23 @@ class Test_TC_WNCV_6_1Suite : public TestCommand ~Test_TC_WNCV_6_1Suite() {} - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_WNCV_6_1\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_WNCV_6_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -127253,16 +56350,20 @@ class Test_TC_WNCV_6_1Suite : public TestCommand } } - // - // Tests methods - // + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + } + return CHIP_NO_ERROR; + } }; class Test_TC_FLW_3_1Suite : public TestCommand { public: - Test_TC_FLW_3_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_FLW_3_1", credsIssuerConfig), mTestIndex(0) + Test_TC_FLW_3_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_FLW_3_1", 0, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -127272,54 +56373,23 @@ class Test_TC_FLW_3_1Suite : public TestCommand ~Test_TC_FLW_3_1Suite() {} - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_FLW_3_1\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_FLW_3_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -127336,16 +56406,20 @@ class Test_TC_FLW_3_1Suite : public TestCommand } } - // - // Tests methods - // + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + } + return CHIP_NO_ERROR; + } }; class Test_TC_OCC_2_3Suite : public TestCommand { public: - Test_TC_OCC_2_3Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_OCC_2_3", credsIssuerConfig), mTestIndex(0) + Test_TC_OCC_2_3Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_OCC_2_3", 0, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -127355,54 +56429,23 @@ class Test_TC_OCC_2_3Suite : public TestCommand ~Test_TC_OCC_2_3Suite() {} - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_OCC_2_3\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_OCC_2_3\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -127419,16 +56462,20 @@ class Test_TC_OCC_2_3Suite : public TestCommand } } - // - // Tests methods - // + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + } + return CHIP_NO_ERROR; + } }; class Test_TC_OCC_2_4Suite : public TestCommand { public: - Test_TC_OCC_2_4Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_OCC_2_4", credsIssuerConfig), mTestIndex(0) + Test_TC_OCC_2_4Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_OCC_2_4", 0, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -127438,54 +56485,23 @@ class Test_TC_OCC_2_4Suite : public TestCommand ~Test_TC_OCC_2_4Suite() {} - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_OCC_2_4\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_OCC_2_4\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -127502,16 +56518,20 @@ class Test_TC_OCC_2_4Suite : public TestCommand } } - // - // Tests methods - // + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + } + return CHIP_NO_ERROR; + } }; class Test_TC_OCC_3_1Suite : public TestCommand { public: - Test_TC_OCC_3_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_OCC_3_1", credsIssuerConfig), mTestIndex(0) + Test_TC_OCC_3_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_OCC_3_1", 0, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -127521,54 +56541,23 @@ class Test_TC_OCC_3_1Suite : public TestCommand ~Test_TC_OCC_3_1Suite() {} - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_OCC_3_1\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_OCC_3_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -127585,16 +56574,20 @@ class Test_TC_OCC_3_1Suite : public TestCommand } } - // - // Tests methods - // + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + } + return CHIP_NO_ERROR; + } }; class Test_TC_PRS_2_2Suite : public TestCommand { public: - Test_TC_PRS_2_2Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_PRS_2_2", credsIssuerConfig), mTestIndex(0) + Test_TC_PRS_2_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_PRS_2_2", 0, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -127604,54 +56597,23 @@ class Test_TC_PRS_2_2Suite : public TestCommand ~Test_TC_PRS_2_2Suite() {} - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_PRS_2_2\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_PRS_2_2\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -127668,16 +56630,20 @@ class Test_TC_PRS_2_2Suite : public TestCommand } } - // - // Tests methods - // + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + } + return CHIP_NO_ERROR; + } }; class Test_TC_PRS_2_3Suite : public TestCommand { public: - Test_TC_PRS_2_3Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_PRS_2_3", credsIssuerConfig), mTestIndex(0) + Test_TC_PRS_2_3Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_PRS_2_3", 0, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -127687,54 +56653,23 @@ class Test_TC_PRS_2_3Suite : public TestCommand ~Test_TC_PRS_2_3Suite() {} - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_PRS_2_3\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_PRS_2_3\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -127751,16 +56686,20 @@ class Test_TC_PRS_2_3Suite : public TestCommand } } - // - // Tests methods - // + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + } + return CHIP_NO_ERROR; + } }; class Test_TC_PS_2_2Suite : public TestCommand { public: - Test_TC_PS_2_2Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_PS_2_2", credsIssuerConfig), mTestIndex(0) + Test_TC_PS_2_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_PS_2_2", 0, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -127770,54 +56709,23 @@ class Test_TC_PS_2_2Suite : public TestCommand ~Test_TC_PS_2_2Suite() {} - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_PS_2_2\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_PS_2_2\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -127834,9 +56742,14 @@ class Test_TC_PS_2_2Suite : public TestCommand } } - // - // Tests methods - // + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + } + return CHIP_NO_ERROR; + } }; #endif // CONFIG_ENABLE_YAML_TESTS diff --git a/zzz_generated/placeholder/app1/zap-generated/test/Commands.h b/zzz_generated/placeholder/app1/zap-generated/test/Commands.h index 88f428d15118de..2b77262870c0b1 100644 --- a/zzz_generated/placeholder/app1/zap-generated/test/Commands.h +++ b/zzz_generated/placeholder/app1/zap-generated/test/Commands.h @@ -24,7 +24,7 @@ class Test_TC_DM_1_3_SimulatedSuite : public TestCommand { public: - Test_TC_DM_1_3_SimulatedSuite() : TestCommand("Test_TC_DM_1_3_Simulated"), mTestIndex(0) + Test_TC_DM_1_3_SimulatedSuite() : TestCommand("Test_TC_DM_1_3_Simulated", 21) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -34,133 +34,18 @@ class Test_TC_DM_1_3_SimulatedSuite : public TestCommand ~Test_TC_DM_1_3_SimulatedSuite() {} - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_DM_1_3_Simulated\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_DM_1_3_Simulated\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the device to be commissioned\n"); - err = TestWaitForTheDeviceToBeCommissioned_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Log OnOff Test Startup\n"); - err = TestLogOnOffTestStartup_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Query Data Model Revision\n"); - err = TestQueryDataModelRevision_2(); - break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Query Vendor Name\n"); - err = TestQueryVendorName_3(); - break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Query VendorID\n"); - err = TestQueryVendorID_4(); - break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Query Product Name\n"); - err = TestQueryProductName_5(); - break; - case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : Query ProductID\n"); - err = TestQueryProductID_6(); - break; - case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : Query Node Label\n"); - err = TestQueryNodeLabel_7(); - break; - case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : Query User Location\n"); - err = TestQueryUserLocation_8(); - break; - case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : Query HardwareVersion\n"); - err = TestQueryHardwareVersion_9(); - break; - case 10: - ChipLogProgress(chipTool, " ***** Test Step 10 : Query HardwareVersionString\n"); - err = TestQueryHardwareVersionString_10(); - break; - case 11: - ChipLogProgress(chipTool, " ***** Test Step 11 : Query SoftwareVersion\n"); - err = TestQuerySoftwareVersion_11(); - break; - case 12: - ChipLogProgress(chipTool, " ***** Test Step 12 : Query SoftwareVersionString\n"); - err = TestQuerySoftwareVersionString_12(); - break; - case 13: - ChipLogProgress(chipTool, " ***** Test Step 13 : Query ManufacturingDate\n"); - err = TestQueryManufacturingDate_13(); - break; - case 14: - ChipLogProgress(chipTool, " ***** Test Step 14 : Query PartNumber\n"); - err = TestQueryPartNumber_14(); - break; - case 15: - ChipLogProgress(chipTool, " ***** Test Step 15 : Query ProductURL\n"); - err = TestQueryProductURL_15(); - break; - case 16: - ChipLogProgress(chipTool, " ***** Test Step 16 : Query ProductLabel\n"); - err = TestQueryProductLabel_16(); - break; - case 17: - ChipLogProgress(chipTool, " ***** Test Step 17 : Query SerialNumber\n"); - err = TestQuerySerialNumber_17(); - break; - case 18: - ChipLogProgress(chipTool, " ***** Test Step 18 : Query LocalConfigDisabled\n"); - err = TestQueryLocalConfigDisabled_18(); - break; - case 19: - ChipLogProgress(chipTool, " ***** Test Step 19 : Query Reachable\n"); - err = TestQueryReachable_19(); - break; - case 20: - ChipLogProgress(chipTool, " ***** Test Step 20 : Query UniqueID\n"); - err = TestQueryUniqueID_20(); - break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 21; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -185,232 +70,98 @@ class Test_TC_DM_1_3_SimulatedSuite : public TestCommand } } - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheDeviceToBeCommissioned_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissioning(); - } - - CHIP_ERROR TestLogOnOffTestStartup_1() - { - SetIdentity(kIdentityAlpha); - return Log("*** Basic Cluster Tests Ready"); - } - - CHIP_ERROR TestQueryDataModelRevision_2() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - ChipLogError(chipTool, "[Endpoint: 0x%08x Cluster: Basic Attribute: DataModelRevision] Query Data Model Revision", - endpoint); - - ClearAttributeAndCommandPaths(); - mAttributePath = chip::app::ConcreteAttributePath(endpoint, chip::app::Clusters::Basic::Id, - chip::app::Clusters::Basic::Attributes::DataModelRevision::Id); - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestQueryVendorName_3() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - ChipLogError(chipTool, "[Endpoint: 0x%08x Cluster: Basic Attribute: VendorName] Query Vendor Name", endpoint); - - ClearAttributeAndCommandPaths(); - mAttributePath = chip::app::ConcreteAttributePath(endpoint, chip::app::Clusters::Basic::Id, - chip::app::Clusters::Basic::Attributes::VendorName::Id); - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestQueryVendorID_4() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - ChipLogError(chipTool, "[Endpoint: 0x%08x Cluster: Basic Attribute: VendorID] Query VendorID", endpoint); - - ClearAttributeAndCommandPaths(); - mAttributePath = chip::app::ConcreteAttributePath(endpoint, chip::app::Clusters::Basic::Id, - chip::app::Clusters::Basic::Attributes::VendorID::Id); - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestQueryProductName_5() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - ChipLogError(chipTool, "[Endpoint: 0x%08x Cluster: Basic Attribute: ProductName] Query Product Name", endpoint); - - ClearAttributeAndCommandPaths(); - mAttributePath = chip::app::ConcreteAttributePath(endpoint, chip::app::Clusters::Basic::Id, - chip::app::Clusters::Basic::Attributes::ProductName::Id); - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestQueryProductID_6() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - ChipLogError(chipTool, "[Endpoint: 0x%08x Cluster: Basic Attribute: ProductID] Query ProductID", endpoint); - - ClearAttributeAndCommandPaths(); - mAttributePath = chip::app::ConcreteAttributePath(endpoint, chip::app::Clusters::Basic::Id, - chip::app::Clusters::Basic::Attributes::ProductID::Id); - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestQueryNodeLabel_7() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - ChipLogError(chipTool, "[Endpoint: 0x%08x Cluster: Basic Attribute: NodeLabel] Query Node Label", endpoint); - - ClearAttributeAndCommandPaths(); - mAttributePath = chip::app::ConcreteAttributePath(endpoint, chip::app::Clusters::Basic::Id, - chip::app::Clusters::Basic::Attributes::NodeLabel::Id); - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestQueryUserLocation_8() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - ChipLogError(chipTool, "[Endpoint: 0x%08x Cluster: Basic Attribute: Location] Query User Location", endpoint); - - ClearAttributeAndCommandPaths(); - mAttributePath = chip::app::ConcreteAttributePath(endpoint, chip::app::Clusters::Basic::Id, - chip::app::Clusters::Basic::Attributes::Location::Id); - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestQueryHardwareVersion_9() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - ChipLogError(chipTool, "[Endpoint: 0x%08x Cluster: Basic Attribute: HardwareVersion] Query HardwareVersion", endpoint); - - ClearAttributeAndCommandPaths(); - mAttributePath = chip::app::ConcreteAttributePath(endpoint, chip::app::Clusters::Basic::Id, - chip::app::Clusters::Basic::Attributes::HardwareVersion::Id); - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestQueryHardwareVersionString_10() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - ChipLogError(chipTool, "[Endpoint: 0x%08x Cluster: Basic Attribute: HardwareVersionString] Query HardwareVersionString", - endpoint); - - ClearAttributeAndCommandPaths(); - mAttributePath = chip::app::ConcreteAttributePath(endpoint, chip::app::Clusters::Basic::Id, - chip::app::Clusters::Basic::Attributes::HardwareVersionString::Id); - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestQuerySoftwareVersion_11() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - ChipLogError(chipTool, "[Endpoint: 0x%08x Cluster: Basic Attribute: SoftwareVersion] Query SoftwareVersion", endpoint); - - ClearAttributeAndCommandPaths(); - mAttributePath = chip::app::ConcreteAttributePath(endpoint, chip::app::Clusters::Basic::Id, - chip::app::Clusters::Basic::Attributes::SoftwareVersion::Id); - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestQuerySoftwareVersionString_12() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - ChipLogError(chipTool, "[Endpoint: 0x%08x Cluster: Basic Attribute: SoftwareVersionString] Query SoftwareVersionString", - endpoint); - - ClearAttributeAndCommandPaths(); - mAttributePath = chip::app::ConcreteAttributePath(endpoint, chip::app::Clusters::Basic::Id, - chip::app::Clusters::Basic::Attributes::SoftwareVersionString::Id); - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestQueryManufacturingDate_13() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - ChipLogError(chipTool, "[Endpoint: 0x%08x Cluster: Basic Attribute: ManufacturingDate] Query ManufacturingDate", endpoint); - - ClearAttributeAndCommandPaths(); - mAttributePath = chip::app::ConcreteAttributePath(endpoint, chip::app::Clusters::Basic::Id, - chip::app::Clusters::Basic::Attributes::ManufacturingDate::Id); - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestQueryPartNumber_14() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - ChipLogError(chipTool, "[Endpoint: 0x%08x Cluster: Basic Attribute: PartNumber] Query PartNumber", endpoint); - - ClearAttributeAndCommandPaths(); - mAttributePath = chip::app::ConcreteAttributePath(endpoint, chip::app::Clusters::Basic::Id, - chip::app::Clusters::Basic::Attributes::PartNumber::Id); - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestQueryProductURL_15() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - ChipLogError(chipTool, "[Endpoint: 0x%08x Cluster: Basic Attribute: ProductURL] Query ProductURL", endpoint); - - ClearAttributeAndCommandPaths(); - mAttributePath = chip::app::ConcreteAttributePath(endpoint, chip::app::Clusters::Basic::Id, - chip::app::Clusters::Basic::Attributes::ProductURL::Id); - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestQueryProductLabel_16() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - ChipLogError(chipTool, "[Endpoint: 0x%08x Cluster: Basic Attribute: ProductLabel] Query ProductLabel", endpoint); - - ClearAttributeAndCommandPaths(); - mAttributePath = chip::app::ConcreteAttributePath(endpoint, chip::app::Clusters::Basic::Id, - chip::app::Clusters::Basic::Attributes::ProductLabel::Id); - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestQuerySerialNumber_17() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - ChipLogError(chipTool, "[Endpoint: 0x%08x Cluster: Basic Attribute: SerialNumber] Query SerialNumber", endpoint); - - ClearAttributeAndCommandPaths(); - mAttributePath = chip::app::ConcreteAttributePath(endpoint, chip::app::Clusters::Basic::Id, - chip::app::Clusters::Basic::Attributes::SerialNumber::Id); - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestQueryLocalConfigDisabled_18() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - ChipLogError(chipTool, "[Endpoint: 0x%08x Cluster: Basic Attribute: LocalConfigDisabled] Query LocalConfigDisabled", - endpoint); - - ClearAttributeAndCommandPaths(); - mAttributePath = chip::app::ConcreteAttributePath(endpoint, chip::app::Clusters::Basic::Id, - chip::app::Clusters::Basic::Attributes::LocalConfigDisabled::Id); - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestQueryReachable_19() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - ChipLogError(chipTool, "[Endpoint: 0x%08x Cluster: Basic Attribute: Reachable] Query Reachable", endpoint); - - ClearAttributeAndCommandPaths(); - mAttributePath = chip::app::ConcreteAttributePath(endpoint, chip::app::Clusters::Basic::Id, - chip::app::Clusters::Basic::Attributes::Reachable::Id); - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestQueryUniqueID_20() + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - ChipLogError(chipTool, "[Endpoint: 0x%08x Cluster: Basic Attribute: UniqueID] Query UniqueID", endpoint); - - ClearAttributeAndCommandPaths(); - mAttributePath = chip::app::ConcreteAttributePath(endpoint, chip::app::Clusters::Basic::Id, - chip::app::Clusters::Basic::Attributes::UniqueID::Id); + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the device to be commissioned"); + SetIdentity(kIdentityAlpha); + return WaitForCommissioning(); + } + case 1: { + LogStep(1, "Log OnOff Test Startup"); + SetIdentity(kIdentityAlpha); + return Log("*** Basic Cluster Tests Ready"); + } + case 2: { + LogStep(2, "Query Data Model Revision"); + return WaitAttribute(GetEndpoint(0), Basic::Id, Basic::Attributes::DataModelRevision::Id); + } + case 3: { + LogStep(3, "Query Vendor Name"); + return WaitAttribute(GetEndpoint(0), Basic::Id, Basic::Attributes::VendorName::Id); + } + case 4: { + LogStep(4, "Query VendorID"); + return WaitAttribute(GetEndpoint(0), Basic::Id, Basic::Attributes::VendorID::Id); + } + case 5: { + LogStep(5, "Query Product Name"); + return WaitAttribute(GetEndpoint(0), Basic::Id, Basic::Attributes::ProductName::Id); + } + case 6: { + LogStep(6, "Query ProductID"); + return WaitAttribute(GetEndpoint(0), Basic::Id, Basic::Attributes::ProductID::Id); + } + case 7: { + LogStep(7, "Query Node Label"); + return WaitAttribute(GetEndpoint(0), Basic::Id, Basic::Attributes::NodeLabel::Id); + } + case 8: { + LogStep(8, "Query User Location"); + return WaitAttribute(GetEndpoint(0), Basic::Id, Basic::Attributes::Location::Id); + } + case 9: { + LogStep(9, "Query HardwareVersion"); + return WaitAttribute(GetEndpoint(0), Basic::Id, Basic::Attributes::HardwareVersion::Id); + } + case 10: { + LogStep(10, "Query HardwareVersionString"); + return WaitAttribute(GetEndpoint(0), Basic::Id, Basic::Attributes::HardwareVersionString::Id); + } + case 11: { + LogStep(11, "Query SoftwareVersion"); + return WaitAttribute(GetEndpoint(0), Basic::Id, Basic::Attributes::SoftwareVersion::Id); + } + case 12: { + LogStep(12, "Query SoftwareVersionString"); + return WaitAttribute(GetEndpoint(0), Basic::Id, Basic::Attributes::SoftwareVersionString::Id); + } + case 13: { + LogStep(13, "Query ManufacturingDate"); + return WaitAttribute(GetEndpoint(0), Basic::Id, Basic::Attributes::ManufacturingDate::Id); + } + case 14: { + LogStep(14, "Query PartNumber"); + return WaitAttribute(GetEndpoint(0), Basic::Id, Basic::Attributes::PartNumber::Id); + } + case 15: { + LogStep(15, "Query ProductURL"); + return WaitAttribute(GetEndpoint(0), Basic::Id, Basic::Attributes::ProductURL::Id); + } + case 16: { + LogStep(16, "Query ProductLabel"); + return WaitAttribute(GetEndpoint(0), Basic::Id, Basic::Attributes::ProductLabel::Id); + } + case 17: { + LogStep(17, "Query SerialNumber"); + return WaitAttribute(GetEndpoint(0), Basic::Id, Basic::Attributes::SerialNumber::Id); + } + case 18: { + LogStep(18, "Query LocalConfigDisabled"); + return WaitAttribute(GetEndpoint(0), Basic::Id, Basic::Attributes::LocalConfigDisabled::Id); + } + case 19: { + LogStep(19, "Query Reachable"); + return WaitAttribute(GetEndpoint(0), Basic::Id, Basic::Attributes::Reachable::Id); + } + case 20: { + LogStep(20, "Query UniqueID"); + return WaitAttribute(GetEndpoint(0), Basic::Id, Basic::Attributes::UniqueID::Id); + } + } return CHIP_NO_ERROR; } }; @@ -418,7 +169,7 @@ class Test_TC_DM_1_3_SimulatedSuite : public TestCommand class Test_TC_DM_3_3_SimulatedSuite : public TestCommand { public: - Test_TC_DM_3_3_SimulatedSuite() : TestCommand("Test_TC_DM_3_3_Simulated"), mTestIndex(0) + Test_TC_DM_3_3_SimulatedSuite() : TestCommand("Test_TC_DM_3_3_Simulated", 6) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -428,88 +179,18 @@ class Test_TC_DM_3_3_SimulatedSuite : public TestCommand ~Test_TC_DM_3_3_SimulatedSuite() {} - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_DM_3_3_Simulated\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_DM_3_3_Simulated\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the device to be commissioned\n"); - err = TestWaitForTheDeviceToBeCommissioned_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Wait for Scan Network Command\n"); - err = TestWaitForScanNetworkCommand_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Wait for Add Wifi Network Command\n"); - if (ShouldSkip("WIFI")) - { - NextTest(); - return; - } - err = TestWaitForAddWifiNetworkCommand_2(); - break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Wait for Update Thread Network Command\n"); - if (ShouldSkip("THREAD")) - { - NextTest(); - return; - } - err = TestWaitForUpdateThreadNetworkCommand_3(); - break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Wait for Enable Network Command\n"); - err = TestWaitForEnableNetworkCommand_4(); - break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Wait for Remove Network Command\n"); - if (ShouldSkip("WIFI | THREAD")) - { - NextTest(); - return; - } - err = TestWaitForRemoveNetworkCommand_5(); - break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 6; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -530,82 +211,42 @@ class Test_TC_DM_3_3_SimulatedSuite : public TestCommand } } - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheDeviceToBeCommissioned_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissioning(); - } - - CHIP_ERROR TestWaitForScanNetworkCommand_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - ChipLogError(chipTool, - "[Endpoint: 0x%08x Cluster: Network Commissioning Command: ScanNetworks] Wait for Scan Network Command", - endpoint); - - ClearAttributeAndCommandPaths(); - mCommandPath = chip::app::ConcreteCommandPath(endpoint, chip::app::Clusters::NetworkCommissioning::Id, - chip::app::Clusters::NetworkCommissioning::Commands::ScanNetworks::Id); - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestWaitForAddWifiNetworkCommand_2() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - ChipLogError( - chipTool, - "[Endpoint: 0x%08x Cluster: Network Commissioning Command: AddOrUpdateWiFiNetwork] Wait for Add Wifi Network Command", - endpoint); - - ClearAttributeAndCommandPaths(); - mCommandPath = - chip::app::ConcreteCommandPath(endpoint, chip::app::Clusters::NetworkCommissioning::Id, - chip::app::Clusters::NetworkCommissioning::Commands::AddOrUpdateWiFiNetwork::Id); - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestWaitForUpdateThreadNetworkCommand_3() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - ChipLogError(chipTool, - "[Endpoint: 0x%08x Cluster: Network Commissioning Command: AddOrUpdateThreadNetwork] Wait for Update Thread " - "Network Command", - endpoint); - - ClearAttributeAndCommandPaths(); - mCommandPath = - chip::app::ConcreteCommandPath(endpoint, chip::app::Clusters::NetworkCommissioning::Id, - chip::app::Clusters::NetworkCommissioning::Commands::AddOrUpdateThreadNetwork::Id); - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestWaitForEnableNetworkCommand_4() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - ChipLogError(chipTool, - "[Endpoint: 0x%08x Cluster: Network Commissioning Command: ConnectNetwork] Wait for Enable Network Command", - endpoint); - - ClearAttributeAndCommandPaths(); - mCommandPath = chip::app::ConcreteCommandPath(endpoint, chip::app::Clusters::NetworkCommissioning::Id, - chip::app::Clusters::NetworkCommissioning::Commands::ConnectNetwork::Id); - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestWaitForRemoveNetworkCommand_5() + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - ChipLogError(chipTool, - "[Endpoint: 0x%08x Cluster: Network Commissioning Command: RemoveNetwork] Wait for Remove Network Command", - endpoint); - - ClearAttributeAndCommandPaths(); - mCommandPath = chip::app::ConcreteCommandPath(endpoint, chip::app::Clusters::NetworkCommissioning::Id, - chip::app::Clusters::NetworkCommissioning::Commands::RemoveNetwork::Id); + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the device to be commissioned"); + SetIdentity(kIdentityAlpha); + return WaitForCommissioning(); + } + case 1: { + LogStep(1, "Wait for Scan Network Command"); + return WaitCommand(GetEndpoint(0), NetworkCommissioning::Id, NetworkCommissioning::Commands::ScanNetworks::Id); + } + case 2: { + LogStep(2, "Wait for Add Wifi Network Command"); + VerifyOrdo(!ShouldSkip("WIFI"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return WaitCommand(GetEndpoint(0), NetworkCommissioning::Id, + NetworkCommissioning::Commands::AddOrUpdateWiFiNetwork::Id); + } + case 3: { + LogStep(3, "Wait for Update Thread Network Command"); + VerifyOrdo(!ShouldSkip("THREAD"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return WaitCommand(GetEndpoint(0), NetworkCommissioning::Id, + NetworkCommissioning::Commands::AddOrUpdateThreadNetwork::Id); + } + case 4: { + LogStep(4, "Wait for Enable Network Command"); + return WaitCommand(GetEndpoint(0), NetworkCommissioning::Id, NetworkCommissioning::Commands::ConnectNetwork::Id); + } + case 5: { + LogStep(5, "Wait for Remove Network Command"); + VerifyOrdo(!ShouldSkip("WIFI | THREAD"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return WaitCommand(GetEndpoint(0), NetworkCommissioning::Id, NetworkCommissioning::Commands::RemoveNetwork::Id); + } + } return CHIP_NO_ERROR; } }; @@ -613,7 +254,7 @@ class Test_TC_DM_3_3_SimulatedSuite : public TestCommand class Test_TC_DM_2_3_SimulatedSuite : public TestCommand { public: - Test_TC_DM_2_3_SimulatedSuite() : TestCommand("Test_TC_DM_2_3_Simulated"), mTestIndex(0) + Test_TC_DM_2_3_SimulatedSuite() : TestCommand("Test_TC_DM_2_3_Simulated", 10) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -623,89 +264,18 @@ class Test_TC_DM_2_3_SimulatedSuite : public TestCommand ~Test_TC_DM_2_3_SimulatedSuite() {} - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_DM_2_3_Simulated\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_DM_2_3_Simulated\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for Arm Fail Safe\n"); - err = TestWaitForArmFailSafe_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Wait for Set Regulatory Config\n"); - err = TestWaitForSetRegulatoryConfig_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Wait for Attestation Certificate Chain Request\n"); - err = TestWaitForAttestationCertificateChainRequest_2(); - break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Wait for Attestation Certificate Chain Request\n"); - err = TestWaitForAttestationCertificateChainRequest_3(); - break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Wait for Attestation Request\n"); - err = TestWaitForAttestationRequest_4(); - break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Wait for CSR Request\n"); - err = TestWaitForCsrRequest_5(); - break; - case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : Wait for Add Trusted Root Certificate Request\n"); - err = TestWaitForAddTrustedRootCertificateRequest_6(); - break; - case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : Wait for Add Op NOC\n"); - err = TestWaitForAddOpNoc_7(); - break; - case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : Wait for Commissioning Complete\n"); - err = TestWaitForCommissioningComplete_8(); - break; - case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : Wait 3000ms\n"); - err = TestWait3000ms_9(); - break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 10; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -726,138 +296,59 @@ class Test_TC_DM_2_3_SimulatedSuite : public TestCommand } } - // - // Tests methods - // - - CHIP_ERROR TestWaitForArmFailSafe_0() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - ChipLogError(chipTool, "[Endpoint: 0x%08x Cluster: General Commissioning Command: ArmFailSafe] Wait for Arm Fail Safe", - endpoint); - - ClearAttributeAndCommandPaths(); - mCommandPath = chip::app::ConcreteCommandPath(endpoint, chip::app::Clusters::GeneralCommissioning::Id, - chip::app::Clusters::GeneralCommissioning::Commands::ArmFailSafe::Id); - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestWaitForSetRegulatoryConfig_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - ChipLogError( - chipTool, - "[Endpoint: 0x%08x Cluster: General Commissioning Command: SetRegulatoryConfig] Wait for Set Regulatory Config", - endpoint); - - ClearAttributeAndCommandPaths(); - mCommandPath = chip::app::ConcreteCommandPath(endpoint, chip::app::Clusters::GeneralCommissioning::Id, - chip::app::Clusters::GeneralCommissioning::Commands::SetRegulatoryConfig::Id); - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestWaitForAttestationCertificateChainRequest_2() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - ChipLogError(chipTool, - "[Endpoint: 0x%08x Cluster: Operational Credentials Command: CertificateChainRequest] Wait for Attestation " - "Certificate Chain Request", - endpoint); - - ClearAttributeAndCommandPaths(); - mCommandPath = - chip::app::ConcreteCommandPath(endpoint, chip::app::Clusters::OperationalCredentials::Id, - chip::app::Clusters::OperationalCredentials::Commands::CertificateChainRequest::Id); - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestWaitForAttestationCertificateChainRequest_3() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - ChipLogError(chipTool, - "[Endpoint: 0x%08x Cluster: Operational Credentials Command: CertificateChainRequest] Wait for Attestation " - "Certificate Chain Request", - endpoint); - - ClearAttributeAndCommandPaths(); - mCommandPath = - chip::app::ConcreteCommandPath(endpoint, chip::app::Clusters::OperationalCredentials::Id, - chip::app::Clusters::OperationalCredentials::Commands::CertificateChainRequest::Id); - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestWaitForAttestationRequest_4() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - ChipLogError(chipTool, - "[Endpoint: 0x%08x Cluster: Operational Credentials Command: AttestationRequest] Wait for Attestation Request", - endpoint); - - ClearAttributeAndCommandPaths(); - mCommandPath = - chip::app::ConcreteCommandPath(endpoint, chip::app::Clusters::OperationalCredentials::Id, - chip::app::Clusters::OperationalCredentials::Commands::AttestationRequest::Id); - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestWaitForCsrRequest_5() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - ChipLogError(chipTool, "[Endpoint: 0x%08x Cluster: Operational Credentials Command: CSRRequest] Wait for CSR Request", - endpoint); - - ClearAttributeAndCommandPaths(); - mCommandPath = chip::app::ConcreteCommandPath(endpoint, chip::app::Clusters::OperationalCredentials::Id, - chip::app::Clusters::OperationalCredentials::Commands::CSRRequest::Id); - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestWaitForAddTrustedRootCertificateRequest_6() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - ChipLogError(chipTool, - "[Endpoint: 0x%08x Cluster: Operational Credentials Command: AddTrustedRootCertificate] Wait for Add Trusted " - "Root Certificate Request", - endpoint); - - ClearAttributeAndCommandPaths(); - mCommandPath = - chip::app::ConcreteCommandPath(endpoint, chip::app::Clusters::OperationalCredentials::Id, - chip::app::Clusters::OperationalCredentials::Commands::AddTrustedRootCertificate::Id); - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestWaitForAddOpNoc_7() + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - ChipLogError(chipTool, "[Endpoint: 0x%08x Cluster: Operational Credentials Command: AddNOC] Wait for Add Op NOC", endpoint); - - ClearAttributeAndCommandPaths(); - mCommandPath = chip::app::ConcreteCommandPath(endpoint, chip::app::Clusters::OperationalCredentials::Id, - chip::app::Clusters::OperationalCredentials::Commands::AddNOC::Id); - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestWaitForCommissioningComplete_8() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - ChipLogError( - chipTool, - "[Endpoint: 0x%08x Cluster: General Commissioning Command: CommissioningComplete] Wait for Commissioning Complete", - endpoint); - - ClearAttributeAndCommandPaths(); - mCommandPath = - chip::app::ConcreteCommandPath(endpoint, chip::app::Clusters::GeneralCommissioning::Id, - chip::app::Clusters::GeneralCommissioning::Commands::CommissioningComplete::Id); + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for Arm Fail Safe"); + return WaitCommand(GetEndpoint(0), GeneralCommissioning::Id, GeneralCommissioning::Commands::ArmFailSafe::Id); + } + case 1: { + LogStep(1, "Wait for Set Regulatory Config"); + return WaitCommand(GetEndpoint(0), GeneralCommissioning::Id, GeneralCommissioning::Commands::SetRegulatoryConfig::Id); + } + case 2: { + LogStep(2, "Wait for Attestation Certificate Chain Request"); + return WaitCommand(GetEndpoint(0), OperationalCredentials::Id, + OperationalCredentials::Commands::CertificateChainRequest::Id); + } + case 3: { + LogStep(3, "Wait for Attestation Certificate Chain Request"); + return WaitCommand(GetEndpoint(0), OperationalCredentials::Id, + OperationalCredentials::Commands::CertificateChainRequest::Id); + } + case 4: { + LogStep(4, "Wait for Attestation Request"); + return WaitCommand(GetEndpoint(0), OperationalCredentials::Id, + OperationalCredentials::Commands::AttestationRequest::Id); + } + case 5: { + LogStep(5, "Wait for CSR Request"); + return WaitCommand(GetEndpoint(0), OperationalCredentials::Id, OperationalCredentials::Commands::CSRRequest::Id); + } + case 6: { + LogStep(6, "Wait for Add Trusted Root Certificate Request"); + return WaitCommand(GetEndpoint(0), OperationalCredentials::Id, + OperationalCredentials::Commands::AddTrustedRootCertificate::Id); + } + case 7: { + LogStep(7, "Wait for Add Op NOC"); + return WaitCommand(GetEndpoint(0), OperationalCredentials::Id, OperationalCredentials::Commands::AddNOC::Id); + } + case 8: { + LogStep(8, "Wait for Commissioning Complete"); + return WaitCommand(GetEndpoint(0), GeneralCommissioning::Id, GeneralCommissioning::Commands::CommissioningComplete::Id); + } + case 9: { + LogStep(9, "Wait 3000ms"); + SetIdentity(kIdentityAlpha); + return WaitForMs(3000); + } + } return CHIP_NO_ERROR; } - - CHIP_ERROR TestWait3000ms_9() - { - SetIdentity(kIdentityAlpha); - return WaitForMs(3000); - } }; std::unique_ptr GetTestCommand(std::string testName) diff --git a/zzz_generated/placeholder/app2/zap-generated/test/Commands.h b/zzz_generated/placeholder/app2/zap-generated/test/Commands.h index 88f428d15118de..2b77262870c0b1 100644 --- a/zzz_generated/placeholder/app2/zap-generated/test/Commands.h +++ b/zzz_generated/placeholder/app2/zap-generated/test/Commands.h @@ -24,7 +24,7 @@ class Test_TC_DM_1_3_SimulatedSuite : public TestCommand { public: - Test_TC_DM_1_3_SimulatedSuite() : TestCommand("Test_TC_DM_1_3_Simulated"), mTestIndex(0) + Test_TC_DM_1_3_SimulatedSuite() : TestCommand("Test_TC_DM_1_3_Simulated", 21) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -34,133 +34,18 @@ class Test_TC_DM_1_3_SimulatedSuite : public TestCommand ~Test_TC_DM_1_3_SimulatedSuite() {} - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_DM_1_3_Simulated\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_DM_1_3_Simulated\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the device to be commissioned\n"); - err = TestWaitForTheDeviceToBeCommissioned_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Log OnOff Test Startup\n"); - err = TestLogOnOffTestStartup_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Query Data Model Revision\n"); - err = TestQueryDataModelRevision_2(); - break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Query Vendor Name\n"); - err = TestQueryVendorName_3(); - break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Query VendorID\n"); - err = TestQueryVendorID_4(); - break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Query Product Name\n"); - err = TestQueryProductName_5(); - break; - case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : Query ProductID\n"); - err = TestQueryProductID_6(); - break; - case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : Query Node Label\n"); - err = TestQueryNodeLabel_7(); - break; - case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : Query User Location\n"); - err = TestQueryUserLocation_8(); - break; - case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : Query HardwareVersion\n"); - err = TestQueryHardwareVersion_9(); - break; - case 10: - ChipLogProgress(chipTool, " ***** Test Step 10 : Query HardwareVersionString\n"); - err = TestQueryHardwareVersionString_10(); - break; - case 11: - ChipLogProgress(chipTool, " ***** Test Step 11 : Query SoftwareVersion\n"); - err = TestQuerySoftwareVersion_11(); - break; - case 12: - ChipLogProgress(chipTool, " ***** Test Step 12 : Query SoftwareVersionString\n"); - err = TestQuerySoftwareVersionString_12(); - break; - case 13: - ChipLogProgress(chipTool, " ***** Test Step 13 : Query ManufacturingDate\n"); - err = TestQueryManufacturingDate_13(); - break; - case 14: - ChipLogProgress(chipTool, " ***** Test Step 14 : Query PartNumber\n"); - err = TestQueryPartNumber_14(); - break; - case 15: - ChipLogProgress(chipTool, " ***** Test Step 15 : Query ProductURL\n"); - err = TestQueryProductURL_15(); - break; - case 16: - ChipLogProgress(chipTool, " ***** Test Step 16 : Query ProductLabel\n"); - err = TestQueryProductLabel_16(); - break; - case 17: - ChipLogProgress(chipTool, " ***** Test Step 17 : Query SerialNumber\n"); - err = TestQuerySerialNumber_17(); - break; - case 18: - ChipLogProgress(chipTool, " ***** Test Step 18 : Query LocalConfigDisabled\n"); - err = TestQueryLocalConfigDisabled_18(); - break; - case 19: - ChipLogProgress(chipTool, " ***** Test Step 19 : Query Reachable\n"); - err = TestQueryReachable_19(); - break; - case 20: - ChipLogProgress(chipTool, " ***** Test Step 20 : Query UniqueID\n"); - err = TestQueryUniqueID_20(); - break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 21; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -185,232 +70,98 @@ class Test_TC_DM_1_3_SimulatedSuite : public TestCommand } } - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheDeviceToBeCommissioned_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissioning(); - } - - CHIP_ERROR TestLogOnOffTestStartup_1() - { - SetIdentity(kIdentityAlpha); - return Log("*** Basic Cluster Tests Ready"); - } - - CHIP_ERROR TestQueryDataModelRevision_2() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - ChipLogError(chipTool, "[Endpoint: 0x%08x Cluster: Basic Attribute: DataModelRevision] Query Data Model Revision", - endpoint); - - ClearAttributeAndCommandPaths(); - mAttributePath = chip::app::ConcreteAttributePath(endpoint, chip::app::Clusters::Basic::Id, - chip::app::Clusters::Basic::Attributes::DataModelRevision::Id); - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestQueryVendorName_3() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - ChipLogError(chipTool, "[Endpoint: 0x%08x Cluster: Basic Attribute: VendorName] Query Vendor Name", endpoint); - - ClearAttributeAndCommandPaths(); - mAttributePath = chip::app::ConcreteAttributePath(endpoint, chip::app::Clusters::Basic::Id, - chip::app::Clusters::Basic::Attributes::VendorName::Id); - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestQueryVendorID_4() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - ChipLogError(chipTool, "[Endpoint: 0x%08x Cluster: Basic Attribute: VendorID] Query VendorID", endpoint); - - ClearAttributeAndCommandPaths(); - mAttributePath = chip::app::ConcreteAttributePath(endpoint, chip::app::Clusters::Basic::Id, - chip::app::Clusters::Basic::Attributes::VendorID::Id); - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestQueryProductName_5() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - ChipLogError(chipTool, "[Endpoint: 0x%08x Cluster: Basic Attribute: ProductName] Query Product Name", endpoint); - - ClearAttributeAndCommandPaths(); - mAttributePath = chip::app::ConcreteAttributePath(endpoint, chip::app::Clusters::Basic::Id, - chip::app::Clusters::Basic::Attributes::ProductName::Id); - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestQueryProductID_6() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - ChipLogError(chipTool, "[Endpoint: 0x%08x Cluster: Basic Attribute: ProductID] Query ProductID", endpoint); - - ClearAttributeAndCommandPaths(); - mAttributePath = chip::app::ConcreteAttributePath(endpoint, chip::app::Clusters::Basic::Id, - chip::app::Clusters::Basic::Attributes::ProductID::Id); - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestQueryNodeLabel_7() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - ChipLogError(chipTool, "[Endpoint: 0x%08x Cluster: Basic Attribute: NodeLabel] Query Node Label", endpoint); - - ClearAttributeAndCommandPaths(); - mAttributePath = chip::app::ConcreteAttributePath(endpoint, chip::app::Clusters::Basic::Id, - chip::app::Clusters::Basic::Attributes::NodeLabel::Id); - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestQueryUserLocation_8() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - ChipLogError(chipTool, "[Endpoint: 0x%08x Cluster: Basic Attribute: Location] Query User Location", endpoint); - - ClearAttributeAndCommandPaths(); - mAttributePath = chip::app::ConcreteAttributePath(endpoint, chip::app::Clusters::Basic::Id, - chip::app::Clusters::Basic::Attributes::Location::Id); - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestQueryHardwareVersion_9() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - ChipLogError(chipTool, "[Endpoint: 0x%08x Cluster: Basic Attribute: HardwareVersion] Query HardwareVersion", endpoint); - - ClearAttributeAndCommandPaths(); - mAttributePath = chip::app::ConcreteAttributePath(endpoint, chip::app::Clusters::Basic::Id, - chip::app::Clusters::Basic::Attributes::HardwareVersion::Id); - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestQueryHardwareVersionString_10() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - ChipLogError(chipTool, "[Endpoint: 0x%08x Cluster: Basic Attribute: HardwareVersionString] Query HardwareVersionString", - endpoint); - - ClearAttributeAndCommandPaths(); - mAttributePath = chip::app::ConcreteAttributePath(endpoint, chip::app::Clusters::Basic::Id, - chip::app::Clusters::Basic::Attributes::HardwareVersionString::Id); - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestQuerySoftwareVersion_11() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - ChipLogError(chipTool, "[Endpoint: 0x%08x Cluster: Basic Attribute: SoftwareVersion] Query SoftwareVersion", endpoint); - - ClearAttributeAndCommandPaths(); - mAttributePath = chip::app::ConcreteAttributePath(endpoint, chip::app::Clusters::Basic::Id, - chip::app::Clusters::Basic::Attributes::SoftwareVersion::Id); - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestQuerySoftwareVersionString_12() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - ChipLogError(chipTool, "[Endpoint: 0x%08x Cluster: Basic Attribute: SoftwareVersionString] Query SoftwareVersionString", - endpoint); - - ClearAttributeAndCommandPaths(); - mAttributePath = chip::app::ConcreteAttributePath(endpoint, chip::app::Clusters::Basic::Id, - chip::app::Clusters::Basic::Attributes::SoftwareVersionString::Id); - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestQueryManufacturingDate_13() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - ChipLogError(chipTool, "[Endpoint: 0x%08x Cluster: Basic Attribute: ManufacturingDate] Query ManufacturingDate", endpoint); - - ClearAttributeAndCommandPaths(); - mAttributePath = chip::app::ConcreteAttributePath(endpoint, chip::app::Clusters::Basic::Id, - chip::app::Clusters::Basic::Attributes::ManufacturingDate::Id); - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestQueryPartNumber_14() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - ChipLogError(chipTool, "[Endpoint: 0x%08x Cluster: Basic Attribute: PartNumber] Query PartNumber", endpoint); - - ClearAttributeAndCommandPaths(); - mAttributePath = chip::app::ConcreteAttributePath(endpoint, chip::app::Clusters::Basic::Id, - chip::app::Clusters::Basic::Attributes::PartNumber::Id); - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestQueryProductURL_15() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - ChipLogError(chipTool, "[Endpoint: 0x%08x Cluster: Basic Attribute: ProductURL] Query ProductURL", endpoint); - - ClearAttributeAndCommandPaths(); - mAttributePath = chip::app::ConcreteAttributePath(endpoint, chip::app::Clusters::Basic::Id, - chip::app::Clusters::Basic::Attributes::ProductURL::Id); - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestQueryProductLabel_16() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - ChipLogError(chipTool, "[Endpoint: 0x%08x Cluster: Basic Attribute: ProductLabel] Query ProductLabel", endpoint); - - ClearAttributeAndCommandPaths(); - mAttributePath = chip::app::ConcreteAttributePath(endpoint, chip::app::Clusters::Basic::Id, - chip::app::Clusters::Basic::Attributes::ProductLabel::Id); - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestQuerySerialNumber_17() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - ChipLogError(chipTool, "[Endpoint: 0x%08x Cluster: Basic Attribute: SerialNumber] Query SerialNumber", endpoint); - - ClearAttributeAndCommandPaths(); - mAttributePath = chip::app::ConcreteAttributePath(endpoint, chip::app::Clusters::Basic::Id, - chip::app::Clusters::Basic::Attributes::SerialNumber::Id); - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestQueryLocalConfigDisabled_18() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - ChipLogError(chipTool, "[Endpoint: 0x%08x Cluster: Basic Attribute: LocalConfigDisabled] Query LocalConfigDisabled", - endpoint); - - ClearAttributeAndCommandPaths(); - mAttributePath = chip::app::ConcreteAttributePath(endpoint, chip::app::Clusters::Basic::Id, - chip::app::Clusters::Basic::Attributes::LocalConfigDisabled::Id); - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestQueryReachable_19() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - ChipLogError(chipTool, "[Endpoint: 0x%08x Cluster: Basic Attribute: Reachable] Query Reachable", endpoint); - - ClearAttributeAndCommandPaths(); - mAttributePath = chip::app::ConcreteAttributePath(endpoint, chip::app::Clusters::Basic::Id, - chip::app::Clusters::Basic::Attributes::Reachable::Id); - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestQueryUniqueID_20() + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - ChipLogError(chipTool, "[Endpoint: 0x%08x Cluster: Basic Attribute: UniqueID] Query UniqueID", endpoint); - - ClearAttributeAndCommandPaths(); - mAttributePath = chip::app::ConcreteAttributePath(endpoint, chip::app::Clusters::Basic::Id, - chip::app::Clusters::Basic::Attributes::UniqueID::Id); + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the device to be commissioned"); + SetIdentity(kIdentityAlpha); + return WaitForCommissioning(); + } + case 1: { + LogStep(1, "Log OnOff Test Startup"); + SetIdentity(kIdentityAlpha); + return Log("*** Basic Cluster Tests Ready"); + } + case 2: { + LogStep(2, "Query Data Model Revision"); + return WaitAttribute(GetEndpoint(0), Basic::Id, Basic::Attributes::DataModelRevision::Id); + } + case 3: { + LogStep(3, "Query Vendor Name"); + return WaitAttribute(GetEndpoint(0), Basic::Id, Basic::Attributes::VendorName::Id); + } + case 4: { + LogStep(4, "Query VendorID"); + return WaitAttribute(GetEndpoint(0), Basic::Id, Basic::Attributes::VendorID::Id); + } + case 5: { + LogStep(5, "Query Product Name"); + return WaitAttribute(GetEndpoint(0), Basic::Id, Basic::Attributes::ProductName::Id); + } + case 6: { + LogStep(6, "Query ProductID"); + return WaitAttribute(GetEndpoint(0), Basic::Id, Basic::Attributes::ProductID::Id); + } + case 7: { + LogStep(7, "Query Node Label"); + return WaitAttribute(GetEndpoint(0), Basic::Id, Basic::Attributes::NodeLabel::Id); + } + case 8: { + LogStep(8, "Query User Location"); + return WaitAttribute(GetEndpoint(0), Basic::Id, Basic::Attributes::Location::Id); + } + case 9: { + LogStep(9, "Query HardwareVersion"); + return WaitAttribute(GetEndpoint(0), Basic::Id, Basic::Attributes::HardwareVersion::Id); + } + case 10: { + LogStep(10, "Query HardwareVersionString"); + return WaitAttribute(GetEndpoint(0), Basic::Id, Basic::Attributes::HardwareVersionString::Id); + } + case 11: { + LogStep(11, "Query SoftwareVersion"); + return WaitAttribute(GetEndpoint(0), Basic::Id, Basic::Attributes::SoftwareVersion::Id); + } + case 12: { + LogStep(12, "Query SoftwareVersionString"); + return WaitAttribute(GetEndpoint(0), Basic::Id, Basic::Attributes::SoftwareVersionString::Id); + } + case 13: { + LogStep(13, "Query ManufacturingDate"); + return WaitAttribute(GetEndpoint(0), Basic::Id, Basic::Attributes::ManufacturingDate::Id); + } + case 14: { + LogStep(14, "Query PartNumber"); + return WaitAttribute(GetEndpoint(0), Basic::Id, Basic::Attributes::PartNumber::Id); + } + case 15: { + LogStep(15, "Query ProductURL"); + return WaitAttribute(GetEndpoint(0), Basic::Id, Basic::Attributes::ProductURL::Id); + } + case 16: { + LogStep(16, "Query ProductLabel"); + return WaitAttribute(GetEndpoint(0), Basic::Id, Basic::Attributes::ProductLabel::Id); + } + case 17: { + LogStep(17, "Query SerialNumber"); + return WaitAttribute(GetEndpoint(0), Basic::Id, Basic::Attributes::SerialNumber::Id); + } + case 18: { + LogStep(18, "Query LocalConfigDisabled"); + return WaitAttribute(GetEndpoint(0), Basic::Id, Basic::Attributes::LocalConfigDisabled::Id); + } + case 19: { + LogStep(19, "Query Reachable"); + return WaitAttribute(GetEndpoint(0), Basic::Id, Basic::Attributes::Reachable::Id); + } + case 20: { + LogStep(20, "Query UniqueID"); + return WaitAttribute(GetEndpoint(0), Basic::Id, Basic::Attributes::UniqueID::Id); + } + } return CHIP_NO_ERROR; } }; @@ -418,7 +169,7 @@ class Test_TC_DM_1_3_SimulatedSuite : public TestCommand class Test_TC_DM_3_3_SimulatedSuite : public TestCommand { public: - Test_TC_DM_3_3_SimulatedSuite() : TestCommand("Test_TC_DM_3_3_Simulated"), mTestIndex(0) + Test_TC_DM_3_3_SimulatedSuite() : TestCommand("Test_TC_DM_3_3_Simulated", 6) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -428,88 +179,18 @@ class Test_TC_DM_3_3_SimulatedSuite : public TestCommand ~Test_TC_DM_3_3_SimulatedSuite() {} - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_DM_3_3_Simulated\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_DM_3_3_Simulated\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the device to be commissioned\n"); - err = TestWaitForTheDeviceToBeCommissioned_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Wait for Scan Network Command\n"); - err = TestWaitForScanNetworkCommand_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Wait for Add Wifi Network Command\n"); - if (ShouldSkip("WIFI")) - { - NextTest(); - return; - } - err = TestWaitForAddWifiNetworkCommand_2(); - break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Wait for Update Thread Network Command\n"); - if (ShouldSkip("THREAD")) - { - NextTest(); - return; - } - err = TestWaitForUpdateThreadNetworkCommand_3(); - break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Wait for Enable Network Command\n"); - err = TestWaitForEnableNetworkCommand_4(); - break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Wait for Remove Network Command\n"); - if (ShouldSkip("WIFI | THREAD")) - { - NextTest(); - return; - } - err = TestWaitForRemoveNetworkCommand_5(); - break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 6; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -530,82 +211,42 @@ class Test_TC_DM_3_3_SimulatedSuite : public TestCommand } } - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheDeviceToBeCommissioned_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissioning(); - } - - CHIP_ERROR TestWaitForScanNetworkCommand_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - ChipLogError(chipTool, - "[Endpoint: 0x%08x Cluster: Network Commissioning Command: ScanNetworks] Wait for Scan Network Command", - endpoint); - - ClearAttributeAndCommandPaths(); - mCommandPath = chip::app::ConcreteCommandPath(endpoint, chip::app::Clusters::NetworkCommissioning::Id, - chip::app::Clusters::NetworkCommissioning::Commands::ScanNetworks::Id); - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestWaitForAddWifiNetworkCommand_2() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - ChipLogError( - chipTool, - "[Endpoint: 0x%08x Cluster: Network Commissioning Command: AddOrUpdateWiFiNetwork] Wait for Add Wifi Network Command", - endpoint); - - ClearAttributeAndCommandPaths(); - mCommandPath = - chip::app::ConcreteCommandPath(endpoint, chip::app::Clusters::NetworkCommissioning::Id, - chip::app::Clusters::NetworkCommissioning::Commands::AddOrUpdateWiFiNetwork::Id); - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestWaitForUpdateThreadNetworkCommand_3() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - ChipLogError(chipTool, - "[Endpoint: 0x%08x Cluster: Network Commissioning Command: AddOrUpdateThreadNetwork] Wait for Update Thread " - "Network Command", - endpoint); - - ClearAttributeAndCommandPaths(); - mCommandPath = - chip::app::ConcreteCommandPath(endpoint, chip::app::Clusters::NetworkCommissioning::Id, - chip::app::Clusters::NetworkCommissioning::Commands::AddOrUpdateThreadNetwork::Id); - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestWaitForEnableNetworkCommand_4() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - ChipLogError(chipTool, - "[Endpoint: 0x%08x Cluster: Network Commissioning Command: ConnectNetwork] Wait for Enable Network Command", - endpoint); - - ClearAttributeAndCommandPaths(); - mCommandPath = chip::app::ConcreteCommandPath(endpoint, chip::app::Clusters::NetworkCommissioning::Id, - chip::app::Clusters::NetworkCommissioning::Commands::ConnectNetwork::Id); - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestWaitForRemoveNetworkCommand_5() + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - ChipLogError(chipTool, - "[Endpoint: 0x%08x Cluster: Network Commissioning Command: RemoveNetwork] Wait for Remove Network Command", - endpoint); - - ClearAttributeAndCommandPaths(); - mCommandPath = chip::app::ConcreteCommandPath(endpoint, chip::app::Clusters::NetworkCommissioning::Id, - chip::app::Clusters::NetworkCommissioning::Commands::RemoveNetwork::Id); + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the device to be commissioned"); + SetIdentity(kIdentityAlpha); + return WaitForCommissioning(); + } + case 1: { + LogStep(1, "Wait for Scan Network Command"); + return WaitCommand(GetEndpoint(0), NetworkCommissioning::Id, NetworkCommissioning::Commands::ScanNetworks::Id); + } + case 2: { + LogStep(2, "Wait for Add Wifi Network Command"); + VerifyOrdo(!ShouldSkip("WIFI"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return WaitCommand(GetEndpoint(0), NetworkCommissioning::Id, + NetworkCommissioning::Commands::AddOrUpdateWiFiNetwork::Id); + } + case 3: { + LogStep(3, "Wait for Update Thread Network Command"); + VerifyOrdo(!ShouldSkip("THREAD"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return WaitCommand(GetEndpoint(0), NetworkCommissioning::Id, + NetworkCommissioning::Commands::AddOrUpdateThreadNetwork::Id); + } + case 4: { + LogStep(4, "Wait for Enable Network Command"); + return WaitCommand(GetEndpoint(0), NetworkCommissioning::Id, NetworkCommissioning::Commands::ConnectNetwork::Id); + } + case 5: { + LogStep(5, "Wait for Remove Network Command"); + VerifyOrdo(!ShouldSkip("WIFI | THREAD"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return WaitCommand(GetEndpoint(0), NetworkCommissioning::Id, NetworkCommissioning::Commands::RemoveNetwork::Id); + } + } return CHIP_NO_ERROR; } }; @@ -613,7 +254,7 @@ class Test_TC_DM_3_3_SimulatedSuite : public TestCommand class Test_TC_DM_2_3_SimulatedSuite : public TestCommand { public: - Test_TC_DM_2_3_SimulatedSuite() : TestCommand("Test_TC_DM_2_3_Simulated"), mTestIndex(0) + Test_TC_DM_2_3_SimulatedSuite() : TestCommand("Test_TC_DM_2_3_Simulated", 10) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -623,89 +264,18 @@ class Test_TC_DM_2_3_SimulatedSuite : public TestCommand ~Test_TC_DM_2_3_SimulatedSuite() {} - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_DM_2_3_Simulated\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_DM_2_3_Simulated\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for Arm Fail Safe\n"); - err = TestWaitForArmFailSafe_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Wait for Set Regulatory Config\n"); - err = TestWaitForSetRegulatoryConfig_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Wait for Attestation Certificate Chain Request\n"); - err = TestWaitForAttestationCertificateChainRequest_2(); - break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Wait for Attestation Certificate Chain Request\n"); - err = TestWaitForAttestationCertificateChainRequest_3(); - break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Wait for Attestation Request\n"); - err = TestWaitForAttestationRequest_4(); - break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Wait for CSR Request\n"); - err = TestWaitForCsrRequest_5(); - break; - case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : Wait for Add Trusted Root Certificate Request\n"); - err = TestWaitForAddTrustedRootCertificateRequest_6(); - break; - case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : Wait for Add Op NOC\n"); - err = TestWaitForAddOpNoc_7(); - break; - case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : Wait for Commissioning Complete\n"); - err = TestWaitForCommissioningComplete_8(); - break; - case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : Wait 3000ms\n"); - err = TestWait3000ms_9(); - break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 10; - chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override { bool shouldContinue = false; @@ -726,138 +296,59 @@ class Test_TC_DM_2_3_SimulatedSuite : public TestCommand } } - // - // Tests methods - // - - CHIP_ERROR TestWaitForArmFailSafe_0() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - ChipLogError(chipTool, "[Endpoint: 0x%08x Cluster: General Commissioning Command: ArmFailSafe] Wait for Arm Fail Safe", - endpoint); - - ClearAttributeAndCommandPaths(); - mCommandPath = chip::app::ConcreteCommandPath(endpoint, chip::app::Clusters::GeneralCommissioning::Id, - chip::app::Clusters::GeneralCommissioning::Commands::ArmFailSafe::Id); - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestWaitForSetRegulatoryConfig_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - ChipLogError( - chipTool, - "[Endpoint: 0x%08x Cluster: General Commissioning Command: SetRegulatoryConfig] Wait for Set Regulatory Config", - endpoint); - - ClearAttributeAndCommandPaths(); - mCommandPath = chip::app::ConcreteCommandPath(endpoint, chip::app::Clusters::GeneralCommissioning::Id, - chip::app::Clusters::GeneralCommissioning::Commands::SetRegulatoryConfig::Id); - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestWaitForAttestationCertificateChainRequest_2() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - ChipLogError(chipTool, - "[Endpoint: 0x%08x Cluster: Operational Credentials Command: CertificateChainRequest] Wait for Attestation " - "Certificate Chain Request", - endpoint); - - ClearAttributeAndCommandPaths(); - mCommandPath = - chip::app::ConcreteCommandPath(endpoint, chip::app::Clusters::OperationalCredentials::Id, - chip::app::Clusters::OperationalCredentials::Commands::CertificateChainRequest::Id); - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestWaitForAttestationCertificateChainRequest_3() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - ChipLogError(chipTool, - "[Endpoint: 0x%08x Cluster: Operational Credentials Command: CertificateChainRequest] Wait for Attestation " - "Certificate Chain Request", - endpoint); - - ClearAttributeAndCommandPaths(); - mCommandPath = - chip::app::ConcreteCommandPath(endpoint, chip::app::Clusters::OperationalCredentials::Id, - chip::app::Clusters::OperationalCredentials::Commands::CertificateChainRequest::Id); - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestWaitForAttestationRequest_4() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - ChipLogError(chipTool, - "[Endpoint: 0x%08x Cluster: Operational Credentials Command: AttestationRequest] Wait for Attestation Request", - endpoint); - - ClearAttributeAndCommandPaths(); - mCommandPath = - chip::app::ConcreteCommandPath(endpoint, chip::app::Clusters::OperationalCredentials::Id, - chip::app::Clusters::OperationalCredentials::Commands::AttestationRequest::Id); - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestWaitForCsrRequest_5() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - ChipLogError(chipTool, "[Endpoint: 0x%08x Cluster: Operational Credentials Command: CSRRequest] Wait for CSR Request", - endpoint); - - ClearAttributeAndCommandPaths(); - mCommandPath = chip::app::ConcreteCommandPath(endpoint, chip::app::Clusters::OperationalCredentials::Id, - chip::app::Clusters::OperationalCredentials::Commands::CSRRequest::Id); - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestWaitForAddTrustedRootCertificateRequest_6() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - ChipLogError(chipTool, - "[Endpoint: 0x%08x Cluster: Operational Credentials Command: AddTrustedRootCertificate] Wait for Add Trusted " - "Root Certificate Request", - endpoint); - - ClearAttributeAndCommandPaths(); - mCommandPath = - chip::app::ConcreteCommandPath(endpoint, chip::app::Clusters::OperationalCredentials::Id, - chip::app::Clusters::OperationalCredentials::Commands::AddTrustedRootCertificate::Id); - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestWaitForAddOpNoc_7() + CHIP_ERROR DoTestStep(uint16_t testIndex) override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - ChipLogError(chipTool, "[Endpoint: 0x%08x Cluster: Operational Credentials Command: AddNOC] Wait for Add Op NOC", endpoint); - - ClearAttributeAndCommandPaths(); - mCommandPath = chip::app::ConcreteCommandPath(endpoint, chip::app::Clusters::OperationalCredentials::Id, - chip::app::Clusters::OperationalCredentials::Commands::AddNOC::Id); - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestWaitForCommissioningComplete_8() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; - ChipLogError( - chipTool, - "[Endpoint: 0x%08x Cluster: General Commissioning Command: CommissioningComplete] Wait for Commissioning Complete", - endpoint); - - ClearAttributeAndCommandPaths(); - mCommandPath = - chip::app::ConcreteCommandPath(endpoint, chip::app::Clusters::GeneralCommissioning::Id, - chip::app::Clusters::GeneralCommissioning::Commands::CommissioningComplete::Id); + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for Arm Fail Safe"); + return WaitCommand(GetEndpoint(0), GeneralCommissioning::Id, GeneralCommissioning::Commands::ArmFailSafe::Id); + } + case 1: { + LogStep(1, "Wait for Set Regulatory Config"); + return WaitCommand(GetEndpoint(0), GeneralCommissioning::Id, GeneralCommissioning::Commands::SetRegulatoryConfig::Id); + } + case 2: { + LogStep(2, "Wait for Attestation Certificate Chain Request"); + return WaitCommand(GetEndpoint(0), OperationalCredentials::Id, + OperationalCredentials::Commands::CertificateChainRequest::Id); + } + case 3: { + LogStep(3, "Wait for Attestation Certificate Chain Request"); + return WaitCommand(GetEndpoint(0), OperationalCredentials::Id, + OperationalCredentials::Commands::CertificateChainRequest::Id); + } + case 4: { + LogStep(4, "Wait for Attestation Request"); + return WaitCommand(GetEndpoint(0), OperationalCredentials::Id, + OperationalCredentials::Commands::AttestationRequest::Id); + } + case 5: { + LogStep(5, "Wait for CSR Request"); + return WaitCommand(GetEndpoint(0), OperationalCredentials::Id, OperationalCredentials::Commands::CSRRequest::Id); + } + case 6: { + LogStep(6, "Wait for Add Trusted Root Certificate Request"); + return WaitCommand(GetEndpoint(0), OperationalCredentials::Id, + OperationalCredentials::Commands::AddTrustedRootCertificate::Id); + } + case 7: { + LogStep(7, "Wait for Add Op NOC"); + return WaitCommand(GetEndpoint(0), OperationalCredentials::Id, OperationalCredentials::Commands::AddNOC::Id); + } + case 8: { + LogStep(8, "Wait for Commissioning Complete"); + return WaitCommand(GetEndpoint(0), GeneralCommissioning::Id, GeneralCommissioning::Commands::CommissioningComplete::Id); + } + case 9: { + LogStep(9, "Wait 3000ms"); + SetIdentity(kIdentityAlpha); + return WaitForMs(3000); + } + } return CHIP_NO_ERROR; } - - CHIP_ERROR TestWait3000ms_9() - { - SetIdentity(kIdentityAlpha); - return WaitForMs(3000); - } }; std::unique_ptr GetTestCommand(std::string testName)